<?php
/**************************************************************************
* API VIMEO *
**************************************************************************/
function _msmvimeo_api_request($uri, $options = array()) {
module_load_include('php', 'msmvimeo', 'VimeoApi/src/Vimeo');
$instance = field_info_instance('node', 'field_vimeo', 'video');
$widget = $instance['widget'];
$settings = $widget['settings'];
$access_token = 'c605e81f4d865b952eb9842da0380f6b';
$vimeo = new Vimeo($settings['vimeo_consumer_key'], $settings['vimeo_consumer_secret'], $access_token);
$result = array();
try {
$result = $vimeo->request($uri, $options);
}
catch (VimeoRequestException $e) {
drupal_set_message("Encountered an API error -- code {$e->getCode()} - {$e->getMessage()}", 'error');
watchdog('msmvimeo', "Vimeo : La requête via l'api vimeo a échoué - user: {$settings["vimeo_username"]}.", array(), WATCHDOG_ERROR);
}
return $result;
}
function _msmvimeo_list_videos_with_formatted_info($settings, $reset = FALSE){
$list = _msmvimeo_list_videos($settings, $reset);
$list = _msmvimeo_unset_from_list_not_public_video($list);
$list_with_formatted_info = _msmvimeo_list_videos_add_formatted_info_list_videos($list);
return $list_with_formatted_info;
}
/**
* List videos in account associated to the current widget
*/
function _msmvimeo_list_videos($settings, $reset = FALSE) {
$cid = 'vimeo_list_'.$settings["vimeo_username"];
if ($reset === FALSE) {
// On cherche les informations en cache
$cache = cache_get($cid);
if (!empty($cache)) {
return $cache->data;
}
}
$list = array();
$videos = _msmvimeo_api_request('/users/'.$settings["vimeo_username"].'/videos', array('perpage' => 50, 'sort' => 'date', 'page' => 1));
foreach($videos['body']['data'] as $entry) {
$list[] = $entry;
}
variable_set($cid, $list);
cache_set($cid, $list, 'cache', time()+3600);
watchdog('msmvimeo', "Vimeo : La mise à jour de la liste des vidéos de {$settings["vimeo_username"]} a été effectuée avec succès.");
return $list;
}
function _msmvimeo_unset_from_list_not_public_video($list) {
$new_list = array();
foreach($list as $entry) {
if ($entry['privacy']['view'] == 'anybody') {
$new_list[] = $entry;
}
}
return $new_list;
}
function _msmvimeo_list_videos_add_formatted_info_list_videos($videos_list){
foreach($videos_list as $key => $video) {
$videos_list[$key] = _msmvimeo_video_details_add_formatted_info($video);
}
return $videos_list;
}
function _msmvimeo_video_details_add_formatted_info($video) {
$video['formatted_info']['title'] = $video['name'];
$video['formatted_info']['description'] = $video['description'];
$vimeo_id = explode('/',$video['uri']);
$vimeo_id = $vimeo_id[2];
$video['formatted_info']['vimeo_id'] = $vimeo_id;
$video['formatted_info']['date'] = date('d/m/Y H:m:i', strtotime($video['modified_time']));
$video['formatted_info']['link'] = $video['link'];
$video['formatted_info']['duration'] = $video['duration'];
$video['formatted_info']['stats_number_of_plays'] = $video['stats']['plays'];
return $video;
}
function _msmvimeo_video_details_with_formatted_info($vimeo_id){
$video = _msmvimeo_api_request('/videos/' . $vimeo_id);
$video_details_with_formatted_info = _msmvimeo_video_details_add_formatted_info($video['body']);
return $video_details_with_formatted_info;
}
/**
* Retrieve details from Vimeo about a video
**/
function _msmvimeo_video_details_with_formatted_info_and_local_thumbnail($vimeo_id, $instance) {
$data = _msmvimeo_api_request('/videos/' . $vimeo_id);
$data = _msmvimeo_video_details_add_formatted_info($data['body']);
//Download large thumbnail to our server (for use with ImageCache)
if (!empty($data['pictures']['sizes'])) {
$thumbnail_large = end($data['pictures']['sizes'])['link'];
$result = _msmvimeo_download_thumbnail($vimeo_id, $thumbnail_large, $instance['field_name']);
if ($result === TRUE) {
//Add local thumbnail to data array
$data['thumbnail_local'] = 'public://'.$instance['field_name'].'/' . $vimeo_id . '.jpg';
}
}
return $data;
}
/**
* Download thumbnail from Vimeo
**/
function _msmvimeo_download_thumbnail($id, $url, $directory) {
//Check if the containing folder exists -- if not, create it.
$dir = 'public://'.$directory;
file_prepare_directory($dir, FILE_CREATE_DIRECTORY);
file_prepare_directory($dir, FILE_MODIFY_PERMISSIONS);
//Setup local filename
$destination = $dir.'/'.$id . '.jpg';
$result = drupal_http_request($url);
$code = floor($result->code / 100) * 100;
$types = array('image/jpeg');
if ($result->data && $code != 400 && $code != 500) {
$src = file_save_data($result->data, $destination, FILE_EXISTS_REPLACE);
image_path_flush($destination);
return TRUE;
}
}
/**************************************************************************
* VIMEO CACHE *
**************************************************************************/
/**
* Implements hook_permission().
*/
function msmvimeo_permission() {
return array(
'flush vimeo cache' => array(
'title' => 'Gestion des vidéos',
'description' => 'Vider le cache de la liste des vidéos',
),
);
}
/**
* Implements hook_menu().
*/
function msmvimeo_menu() {
$items['vimeo/cache/flush/%/%/%'] = array(
'page callback' => 'msmvimeo_flush_cache',
'page arguments' => array(3,4,5),
'access arguments' => array('flush vimeo cache'),
'type' => MENU_CALLBACK,
);
return $items;
}
function msmvimeo_flush_cache($type, $name, $bundle) {
$instance = field_info_instance($type, $name, $bundle);
if (!empty($instance)) {
$widget = $instance['widget'];
$vimeo_settings = $widget['settings'];
$list = _msmvimeo_list_videos($vimeo_settings, TRUE);
drupal_set_message("La liste des vidéos a été mise à jour");
} else {
drupal_set_message("La liste des vidéos n'a pas pu être mise à jour", 'error');
}
if (!empty($_GET['destination'])) {
drupal_goto($_GET['destination']);
} elseif (!empty($list)) {
return $list;
}
}
/**************************************************************************
* VIMEO STATS *
**************************************************************************/
function msmvimeo_refresh_plays($type, $name, $bundle) {
$instance = field_info_instance($type, $name, $bundle);
if (!empty($instance)) {
$widget = $instance['widget'];
$settings = $widget['settings'];
$videos = _msmvimeo_api_request('/users/'.$settings["vimeo_username"].'/videos', array('perpage' => 1, 'sort' => 'date'));
$total = !empty($videos['body']['total']) ? $videos['body']['total'] : 0;
$pages = ceil($total/50);
for ($i=1; $i <=$pages; $i++) {
$videos = _msmvimeo_api_request('/users/'.$settings["vimeo_username"].'/videos', array('perpage' => 50, 'sort' => 'date', 'page' => $i));
$videos = _msmvimeo_unset_from_list_not_public_video($videos['body']['data']);
$videos = _msmvimeo_list_videos_add_formatted_info_list_videos($videos);
foreach($videos as $video) {
$video_id = $video['formatted_info']['vimeo_id'];
$nid = db_query('SELECT entity_id FROM {field_data_field_vimeo} WHERE field_vimeo_vimeo_id = :vid', array(':vid' => $video_id))->fetchColumn(0);
if (!empty($nid)) {
$node = node_load($nid);
$node->field_plays[LANGUAGE_NONE][0]['value'] = $video['formatted_info']['stats_number_of_plays'];
field_attach_update('node', $node);
}
}
}
}
}
/**************************************************************************
* FIELD VIMEO *
**************************************************************************/
/**
* Implements hook_field_info().
* Defines the field for admin/structure/types/manage/dummy/fields
*/
function msmvimeo_field_info() {
return array(
'msmvimeo' => array(
'label' => 'Champ Vimeo',
'description' => 'Champ de référence aux vidéos d\'un compte Vimeo',
'settings' => array('num_dimensions' => 2), // DO NOT REMOVE => Define the number of values exposed by the field...
'default_widget' => 'msmvimeo_vimeo_field',
'default_formatter' => 'msmvimeo_default'
)
);
}
/**
* Implements hook_field_is_empty().
* Defines when the result returned by the field should be regarded as empty
*/
function msmvimeo_field_is_empty($item, $field) {
if ($field['type'] == 'msmvimeo') {
if (empty($item['vimeo_id'])) {
return TRUE;
}
return FALSE;
}
}
/**
* Implements hook_field_widget_info().
* Defines the widget settings
*/
function msmvimeo_field_widget_info() {
return array(
'msmvimeo_vimeo_form' => array(
'label' => 'Vidéo associée',
'field types' => array('msmvimeo'),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_DEFAULT, // DO NOT REMOVE => Define the number of values exposed by the field...
'default value' => FIELD_BEHAVIOR_NONE,
),
),
);
}
/**
* Implements hook_field_widget_settings_form().
* Defines the form to define settings for the widget called in a content type
*/
function msmvimeo_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$settings = $widget['settings'];
$form['vimeo_username'] = array(
'#type' => 'textfield',
'#size' => 60,
'#maxlenght' => 255,
'#title' => 'Nom d\'utilisateur du compte Vimeo',
'#default_value' => isset($settings['vimeo_username']) ? $settings['vimeo_username'] : null,
'#description' => 'Merci de bien vouloir indiquer le nom d\'utilisateur du compte Vimeo',
'#required' => TRUE,
);
$form['vimeo_consumer_key'] = array(
'#type' => 'textfield',
'#size' => 60,
'#maxlenght' => 255,
'#title' => 'Clef client pour l\'API',
'#default_value' => isset($settings['vimeo_consumer_key']) ? $settings['vimeo_consumer_key'] : null,
'#description' => 'Merci de bien vouloir indiquer la clef client pour l\'API',
'#required' => TRUE,
);
$form['vimeo_consumer_secret'] = array(
'#type' => 'textfield',
'#size' => 60,
'#maxlenght' => 255,
'#title' => 'Mot de passe pour l\'API',
'#default_value' => isset($settings['vimeo_consumer_secret']) ? $settings['vimeo_consumer_secret'] : null,
'#description' => 'Merci de bien vouloir indiquer le mot de passe client pour l\'API',
'#required' => TRUE,
);
return $form;
}
/**
* Implements hook_field_formatter_info().
* Defines the formatter for the widget viewed in content
*/
function msmvimeo_field_formatter_info() {
return array(
'embed_video' => array(
'label' => 'Vidéo intégrée',
'field types' => array('msmvimeo'),
'settings' => array('vimeo_player_width' => 536, 'vimeo_player_height' => 302)
),
);
}
/**
* Implements hook_field_formatter_settings_form().
* Defines the form to to define settings for the formatter
*/
function msmvimeo_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element['vimeo_player_width'] = array(
'#type' => 'textfield',
'#size' => 3,
'#maxlenght' => 3,
'#title' => 'Largeur du player',
'#default_value' => $settings['vimeo_player_width'],
'#description' => 'Valeur en pixels',
'#required' => TRUE,
);
$element['vimeo_player_height'] = array(
'#type' => 'textfield',
'#size' => 3,
'#maxlenght' => 3,
'#title' => 'Hauteur du player',
'#default_value' => $settings['vimeo_player_height'],
'#description' => 'Valeur en pixels',
'#required' => TRUE,
);
return $element;
}
/**
* Implements hook_field_formatter_settings_summary().
* Defines the summary returned by the formatter
*/
function msmvimeo_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$summary = array();
if ($display['type'] == 'embed_video') {
if (empty($settings) || !isset($settings['vimeo_player_width']) || !isset($settings['vimeo_player_height'])) {
$summary[] = '<div style="color:red">Vous devez préciser la largeur et la hauteur du player Vimeo.</div>';
} else {
$summary[] = 'Hauteur : '.$settings['vimeo_player_height'].'px';
$summary[] = 'Largeur : '.$settings['vimeo_player_width'].'px';
}
}
return implode('<br />', $summary);
}
/**
* Implements hook_field_widget_form().
* Defines the form for the widget in entities creation form
*/
function msmvimeo_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$base = $element;
$widget = $instance['widget'];
$vimeo_settings = $widget['settings'];
// Define default value
$options = array();
if (!empty($items[$delta]['vimeo_id'])) {
$data = unserialize($items[$delta]['vimeo_data']);
$options[$items[$delta]['vimeo_id']] = $data['formatted_info']['title'];
}
// videos waiting on Vimeo
$list = _msmvimeo_list_videos_with_formatted_info($vimeo_settings);
foreach ($list as $entry) {
$entry_id = $entry['formatted_info']['vimeo_id'];
$options[$entry_id] = $entry['formatted_info']['title'];
}
// online videos
$query = new EntityFieldQuery;
$query->entityCondition('entity_type', $instance['entity_type']);
if ($instance['entity_type'] == 'node') {
$query->propertyCondition('type', $instance['bundle']);
}
if (!empty($items[$delta]['vimeo_id'])) {
$query->fieldCondition($instance['field_name'], 'vimeo_id', $items[$delta]['vimeo_id'], '<>');
}
$query->fieldOrderBy($instance['field_name'], 'vimeo_id', 'ASC');
$result = $query->execute();
if (!empty($result[$instance['entity_type']])) {
$entities = entity_load($instance['entity_type'], array_keys($result[$instance['entity_type']]));
foreach ($entities as $entity) {
foreach ($entity->{$instance['field_name']} as $lines) {
foreach ($lines as $entry) {
unset($options[$entry["vimeo_id"]]);
}
}
}
}
if (isset($_GET['vimeo_id']) && !isset($items[$delta]['vimeo_id'])) {
$items[$delta]['vimeo_id'] = (int)$_GET['vimeo_id'];
}
// Form
$element['vimeo_id']= array(
'#title' => !empty($instance['label']) ? $instance['label'] : 'Vidéo associée',
'#required' => $instance['required'],
'#type' => 'select',
'#options' => $options,
'#default_value' => isset($items[$delta]['vimeo_id']) ? $items[$delta]['vimeo_id'] : NULL,
'#description' => "Pour mettre à jour la liste des vidéos, utilisez <strong>". l('ce lien', 'vimeo/cache/flush/'.$instance['entity_type'].'/'.$instance['field_name'].'/'.$instance['bundle'], array('query' => array('destination' => current_path())))."</strong>."
);
$element['vimeo_data']= array(
'#type' => 'hidden'
);
return $element;
}
/**
* Implements hook_field_presave().
* Presave operations handled on the field => cf. Vimeo API
*/
function msmvimeo_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
if ($entity_type == 'node' && isset($entity->is_imported) && $entity->is_imported === TRUE) {
return;
}
if ($field['type'] == 'msmvimeo') {
foreach ($items as $delta => $item) {
$data = _msmvimeo_video_details_with_formatted_info_and_local_thumbnail($item['vimeo_id'], $instance);
if (!empty($data)) {
$items[$delta]['vimeo_data'] = serialize($data);
}
}
}
}
/**
* Implements hook_field_formatter_view().
* Defines the output of the formatter
*/
function msmvimeo_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
$settings = $display['settings'];
switch ($display['type']) {
case 'embed_video':
foreach ($items as $delta => $item) {
$player = '<iframe
src="https://player.vimeo.com/video/'.$item['vimeo_id'].'?title=0&byline=0&portrait=0&autoplay=0"
width="'.$settings['vimeo_player_width'].'"
height="'.$settings['vimeo_player_height'].'"
frameborder="0"></iframe>';
$element[$delta] = array(
'#markup' => $player,
);
}
break;
}
return $element;
}
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/aTt4l
function name: (null)
number of ops: 1
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
443 0 E > > RETURN 1
Function _msmvimeo_api_request:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 35
Branch analysis from position: 35
2 jumps found. (Code = 107) Position 1 = 36, Position 2 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/aTt4l
function name: _msmvimeo_api_request
number of ops: 61
compiled vars: !0 = $uri, !1 = $options, !2 = $instance, !3 = $widget, !4 = $settings, !5 = $access_token, !6 = $vimeo, !7 = $result, !8 = $e
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
7 0 E > RECV !0
1 RECV_INIT !1 <array>
8 2 INIT_FCALL_BY_NAME 'module_load_include'
3 SEND_VAL_EX 'php'
4 SEND_VAL_EX 'msmvimeo'
5 SEND_VAL_EX 'VimeoApi%2Fsrc%2FVimeo'
6 DO_FCALL 0
9 7 INIT_FCALL_BY_NAME 'field_info_instance'
8 SEND_VAL_EX 'node'
9 SEND_VAL_EX 'field_vimeo'
10 SEND_VAL_EX 'video'
11 DO_FCALL 0 $10
12 ASSIGN !2, $10
10 13 FETCH_DIM_R ~12 !2, 'widget'
14 ASSIGN !3, ~12
11 15 FETCH_DIM_R ~14 !3, 'settings'
16 ASSIGN !4, ~14
12 17 ASSIGN !5, 'c605e81f4d865b952eb9842da0380f6b'
13 18 NEW $17 'Vimeo'
19 CHECK_FUNC_ARG
20 FETCH_DIM_FUNC_ARG $18 !4, 'vimeo_consumer_key'
21 SEND_FUNC_ARG $18
22 CHECK_FUNC_ARG
23 FETCH_DIM_FUNC_ARG $19 !4, 'vimeo_consumer_secret'
24 SEND_FUNC_ARG $19
25 SEND_VAR_EX !5
26 DO_FCALL 0
27 ASSIGN !6, $17
14 28 ASSIGN !7, <array>
16 29 INIT_METHOD_CALL !6, 'request'
30 SEND_VAR_EX !0
31 SEND_VAR_EX !1
32 DO_FCALL 0 $23
33 ASSIGN !7, $23
34 > JMP ->59
18 35 E > > CATCH last 'VimeoRequestException'
19 36 > INIT_FCALL_BY_NAME 'drupal_set_message'
37 ROPE_INIT 4 ~28 'Encountered+an+API+error+--+code+'
38 INIT_METHOD_CALL !8, 'getCode'
39 DO_FCALL 0 $25
40 ROPE_ADD 1 ~28 ~28, $25
41 ROPE_ADD 2 ~28 ~28, '+-+'
42 INIT_METHOD_CALL !8, 'getMessage'
43 DO_FCALL 0 $26
44 ROPE_END 3 ~27 ~28, $26
45 SEND_VAL_EX ~27
46 SEND_VAL_EX 'error'
47 DO_FCALL 0
20 48 INIT_FCALL_BY_NAME 'watchdog'
49 SEND_VAL_EX 'msmvimeo'
50 ROPE_INIT 3 ~33 'Vimeo+%3A+La+requ%C3%AAte+via+l%27api+vimeo+a+%C3%A9chou%C3%A9+-+user%3A+'
51 FETCH_DIM_R ~31 !4, 'vimeo_username'
52 ROPE_ADD 1 ~33 ~33, ~31
53 ROPE_END 2 ~32 ~33, '.'
54 SEND_VAL_EX ~32
55 SEND_VAL_EX <array>
56 FETCH_CONSTANT ~35 'WATCHDOG_ERROR'
57 SEND_VAL_EX ~35
58 DO_FCALL 0
22 59 > > RETURN !7
23 60* > RETURN null
End of function _msmvimeo_api_request
Function _msmvimeo_list_videos_with_formatted_info:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/aTt4l
function name: _msmvimeo_list_videos_with_formatted_info
number of ops: 17
compiled vars: !0 = $settings, !1 = $reset, !2 = $list, !3 = $list_with_formatted_info
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
25 0 E > RECV !0
1 RECV_INIT !1 <false>
26 2 INIT_FCALL_BY_NAME '_msmvimeo_list_videos'
3 SEND_VAR_EX !0
4 SEND_VAR_EX !1
5 DO_FCALL 0 $4
6 ASSIGN !2, $4
27 7 INIT_FCALL_BY_NAME '_msmvimeo_unset_from_list_not_public_video'
8 SEND_VAR_EX !2
9 DO_FCALL 0 $6
10 ASSIGN !2, $6
28 11 INIT_FCALL_BY_NAME '_msmvimeo_list_videos_add_formatted_info_list_videos'
12 SEND_VAR_EX !2
13 DO_FCALL 0 $8
14 ASSIGN !3, $8
29 15 > RETURN !3
30 16* > RETURN null
End of function _msmvimeo_list_videos_with_formatted_info
Function _msmvimeo_list_videos:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 16
filename: /in/aTt4l
function name: _msmvimeo_list_videos
number of ops: 56
compiled vars: !0 = $settings, !1 = $reset, !2 = $cid, !3 = $cache, !4 = $list, !5 = $videos, !6 = $entry
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
35 0 E > RECV !0
1 RECV_INIT !1 <false>
36 2 FETCH_DIM_R ~7 !0, 'vimeo_username'
3 CONCAT ~8 'vimeo_list_', ~7
4 ASSIGN !2, ~8
37 5 TYPE_CHECK 4 !1
6 > JMPZ ~10, ->16
39 7 > INIT_FCALL_BY_NAME 'cache_get'
8 SEND_VAR_EX !2
9 DO_FCALL 0 $11
10 ASSIGN !3, $11
40 11 ISSET_ISEMPTY_CV ~13 !3
12 BOOL_NOT ~14 ~13
13 > JMPZ ~14, ->16
41 14 > FETCH_OBJ_R ~15 !3, 'data'
15 > RETURN ~15
44 16 > ASSIGN !4, <array>
45 17 INIT_FCALL '_msmvimeo_api_request'
18 FETCH_DIM_R ~17 !0, 'vimeo_username'
19 CONCAT ~18 '%2Fusers%2F', ~17
20 CONCAT ~19 ~18, '%2Fvideos'
21 SEND_VAL ~19
22 SEND_VAL <array>
23 DO_FCALL 0 $20
24 ASSIGN !5, $20
46 25 FETCH_DIM_R ~22 !5, 'body'
26 FETCH_DIM_R ~23 ~22, 'data'
27 > FE_RESET_R $24 ~23, ->32
28 > > FE_FETCH_R $24, !6, ->32
47 29 > ASSIGN_DIM !4
30 OP_DATA !6
46 31 > JMP ->28
32 > FE_FREE $24
49 33 INIT_FCALL_BY_NAME 'variable_set'
34 SEND_VAR_EX !2
35 SEND_VAR_EX !4
36 DO_FCALL 0
50 37 INIT_FCALL_BY_NAME 'cache_set'
38 SEND_VAR_EX !2
39 SEND_VAR_EX !4
40 SEND_VAL_EX 'cache'
41 INIT_FCALL 'time'
42 DO_ICALL $27
43 ADD ~28 $27, 3600
44 SEND_VAL_EX ~28
45 DO_FCALL 0
51 46 INIT_FCALL_BY_NAME 'watchdog'
47 SEND_VAL_EX 'msmvimeo'
48 ROPE_INIT 3 ~32 'Vimeo+%3A+La+mise+%C3%A0+jour+de+la+liste+des+vid%C3%A9os+de+'
49 FETCH_DIM_R ~30 !0, 'vimeo_username'
50 ROPE_ADD 1 ~32 ~32, ~30
51 ROPE_END 2 ~31 ~32, '+a+%C3%A9t%C3%A9+effectu%C3%A9e+avec+succ%C3%A8s.'
52 SEND_VAL_EX ~31
53 DO_FCALL 0
53 54 > RETURN !4
54 55* > RETURN null
End of function _msmvimeo_list_videos
Function _msmvimeo_unset_from_list_not_public_video:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename: /in/aTt4l
function name: _msmvimeo_unset_from_list_not_public_video
number of ops: 14
compiled vars: !0 = $list, !1 = $new_list, !2 = $entry
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
56 0 E > RECV !0
57 1 ASSIGN !1, <array>
58 2 > FE_RESET_R $4 !0, ->11
3 > > FE_FETCH_R $4, !2, ->11
59 4 > FETCH_DIM_R ~5 !2, 'privacy'
5 FETCH_DIM_R ~6 ~5, 'view'
6 IS_EQUAL ~6, 'anybody'
7 > JMPZ ~7, ->10
60 8 > ASSIGN_DIM !1
9 OP_DATA !2
58 10 > > JMP ->3
11 > FE_FREE $4
63 12 > RETURN !1
64 13* > RETURN null
End of function _msmvimeo_unset_from_list_not_public_video
Function _msmvimeo_list_videos_add_formatted_info_list_videos:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename: /in/aTt4l
function name: _msmvimeo_list_videos_add_formatted_info_list_videos
number of ops: 13
compiled vars: !0 = $videos_list, !1 = $video, !2 = $key
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
66 0 E > RECV !0
67 1 > FE_RESET_R $3 !0, ->10
2 > > FE_FETCH_R ~4 $3, !1, ->10
3 > ASSIGN !2, ~4
68 4 INIT_FCALL_BY_NAME '_msmvimeo_video_details_add_formatted_info'
5 SEND_VAR_EX !1
6 DO_FCALL 0 $7
7 ASSIGN_DIM !0, !2
8 OP_DATA $7
67 9 > JMP ->2
10 > FE_FREE $3
70 11 > RETURN !0
71 12* > RETURN null
End of function _msmvimeo_list_videos_add_formatted_info_list_videos
Function _msmvimeo_video_details_add_formatted_info:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/aTt4l
function name: _msmvimeo_video_details_add_formatted_info
number of ops: 46
compiled vars: !0 = $video, !1 = $vimeo_id
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
73 0 E > RECV !0
74 1 FETCH_DIM_R ~4 !0, 'name'
2 FETCH_DIM_W $2 !0, 'formatted_info'
3 ASSIGN_DIM $2, 'title'
4 OP_DATA ~4
75 5 FETCH_DIM_R ~7 !0, 'description'
6 FETCH_DIM_W $5 !0, 'formatted_info'
7 ASSIGN_DIM $5, 'description'
8 OP_DATA ~7
77 9 INIT_FCALL 'explode'
10 SEND_VAL '%2F'
11 FETCH_DIM_R ~8 !0, 'uri'
12 SEND_VAL ~8
13 DO_ICALL $9
14 ASSIGN !1, $9
78 15 FETCH_DIM_R ~11 !1, 2
16 ASSIGN !1, ~11
79 17 FETCH_DIM_W $13 !0, 'formatted_info'
18 ASSIGN_DIM $13, 'vimeo_id'
19 OP_DATA !1
81 20 INIT_FCALL 'date'
21 SEND_VAL 'd%2Fm%2FY+H%3Am%3Ai'
22 INIT_FCALL 'strtotime'
23 FETCH_DIM_R ~17 !0, 'modified_time'
24 SEND_VAL ~17
25 DO_ICALL $18
26 SEND_VAR $18
27 DO_ICALL $19
28 FETCH_DIM_W $15 !0, 'formatted_info'
29 ASSIGN_DIM $15, 'date'
30 OP_DATA $19
82 31 FETCH_DIM_R ~22 !0, 'link'
32 FETCH_DIM_W $20 !0, 'formatted_info'
33 ASSIGN_DIM $20, 'link'
34 OP_DATA ~22
83 35 FETCH_DIM_R ~25 !0, 'duration'
36 FETCH_DIM_W $23 !0, 'formatted_info'
37 ASSIGN_DIM $23, 'duration'
38 OP_DATA ~25
84 39 FETCH_DIM_R ~28 !0, 'stats'
40 FETCH_DIM_R ~29 ~28, 'plays'
41 FETCH_DIM_W $26 !0, 'formatted_info'
42 ASSIGN_DIM $26, 'stats_number_of_plays'
43 OP_DATA ~29
85 44 > RETURN !0
86 45* > RETURN null
End of function _msmvimeo_video_details_add_formatted_info
Function _msmvimeo_video_details_with_formatted_info:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/aTt4l
function name: _msmvimeo_video_details_with_formatted_info
number of ops: 13
compiled vars: !0 = $vimeo_id, !1 = $video, !2 = $video_details_with_formatted_info
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
88 0 E > RECV !0
89 1 INIT_FCALL '_msmvimeo_api_request'
2 CONCAT ~3 '%2Fvideos%2F', !0
3 SEND_VAL ~3
4 DO_FCALL 0 $4
5 ASSIGN !1, $4
90 6 INIT_FCALL '_msmvimeo_video_details_add_formatted_info'
7 FETCH_DIM_R ~6 !1, 'body'
8 SEND_VAL ~6
9 DO_FCALL 0 $7
10 ASSIGN !2, $7
91 11 > RETURN !2
92 12* > RETURN null
End of function _msmvimeo_video_details_with_formatted_info
Function _msmvimeo_video_details_with_formatted_info_and_local_thumbnail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 40
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 40
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 40
filename: /in/aTt4l
function name: _msmvimeo_video_details_with_formatted_info_and_local_thumbnail
number of ops: 42
compiled vars: !0 = $vimeo_id, !1 = $instance, !2 = $data, !3 = $thumbnail_large, !4 = $result
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
97 0 E > RECV !0
1 RECV !1
98 2 INIT_FCALL '_msmvimeo_api_request'
3 CONCAT ~5 '%2Fvideos%2F', !0
4 SEND_VAL ~5
5 DO_FCALL 0 $6
6 ASSIGN !2, $6
99 7 INIT_FCALL '_msmvimeo_video_details_add_formatted_info'
8 FETCH_DIM_R ~8 !2, 'body'
9 SEND_VAL ~8
10 DO_FCALL 0 $9
11 ASSIGN !2, $9
102 12 FETCH_DIM_IS ~11 !2, 'pictures'
13 ISSET_ISEMPTY_DIM_OBJ 1 ~12 ~11, 'sizes'
14 BOOL_NOT ~13 ~12
15 > JMPZ ~13, ->40
103 16 > INIT_FCALL 'end'
17 FETCH_DIM_W $14 !2, 'pictures'
18 FETCH_DIM_W $15 $14, 'sizes'
19 SEND_REF $15
20 DO_ICALL $16
21 FETCH_DIM_R ~17 $16, 'link'
22 ASSIGN !3, ~17
104 23 INIT_FCALL_BY_NAME '_msmvimeo_download_thumbnail'
24 SEND_VAR_EX !0
25 SEND_VAR_EX !3
26 CHECK_FUNC_ARG
27 FETCH_DIM_FUNC_ARG $19 !1, 'field_name'
28 SEND_FUNC_ARG $19
29 DO_FCALL 0 $20
30 ASSIGN !4, $20
105 31 TYPE_CHECK 8 !4
32 > JMPZ ~22, ->40
107 33 > FETCH_DIM_R ~24 !1, 'field_name'
34 CONCAT ~25 'public%3A%2F%2F', ~24
35 CONCAT ~26 ~25, '%2F'
36 CONCAT ~27 ~26, !0
37 CONCAT ~28 ~27, '.jpg'
38 ASSIGN_DIM !2, 'thumbnail_local'
39 OP_DATA ~28
110 40 > > RETURN !2
111 41* > RETURN null
End of function _msmvimeo_video_details_with_formatted_info_and_local_thumbnail
Function _msmvimeo_download_thumbnail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
2 jumps found. (Code = 46) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 52
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 35
filename: /in/aTt4l
function name: _msmvimeo_download_thumbnail
number of ops: 53
compiled vars: !0 = $id, !1 = $url, !2 = $directory, !3 = $dir, !4 = $destination, !5 = $result, !6 = $code, !7 = $types, !8 = $src
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
115 0 E > RECV !0
1 RECV !1
2 RECV !2
117 3 CONCAT ~9 'public%3A%2F%2F', !2
4 ASSIGN !3, ~9
118 5 INIT_FCALL_BY_NAME 'file_prepare_directory'
6 SEND_VAR_EX !3
7 FETCH_CONSTANT ~11 'FILE_CREATE_DIRECTORY'
8 SEND_VAL_EX ~11
9 DO_FCALL 0
119 10 INIT_FCALL_BY_NAME 'file_prepare_directory'
11 SEND_VAR_EX !3
12 FETCH_CONSTANT ~13 'FILE_MODIFY_PERMISSIONS'
13 SEND_VAL_EX ~13
14 DO_FCALL 0
121 15 CONCAT ~15 !3, '%2F'
16 CONCAT ~16 ~15, !0
17 CONCAT ~17 ~16, '.jpg'
18 ASSIGN !4, ~17
122 19 INIT_FCALL_BY_NAME 'drupal_http_request'
20 SEND_VAR_EX !1
21 DO_FCALL 0 $19
22 ASSIGN !5, $19
123 23 INIT_FCALL 'floor'
24 FETCH_OBJ_R ~21 !5, 'code'
25 DIV ~22 ~21, 100
26 SEND_VAL ~22
27 DO_ICALL
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
264.95 ms | 1431 KiB | 31 Q