function wikiplugin_vimeo($data, $params) { if (isset($params['url'])) { $params['vimeo'] = $params['url']; unset($params['url']); } return wikiplugin_flash($data, $params); }
function wikiplugin_bliptv($data, $params) { if (isset($params['url'])) { $params['bliptv'] = $params['url']; unset($params['movie']); } return wikiplugin_flash($data, $params); }
function wikiplugin_video($data, $params) { global $artlib, $tikilib; $list_articles = $artlib->list_articles(0, 1, 'publishDate_desc', '', 0, $tikilib->now, false, 'video', '', 'y', '', '', '', '', '', '', '', false, 'y'); $article = $list_articles['data'][0]; $plugins = array(); $tikilib->plugin_match($article['body'], $plugins); $pluginName = strtolower($plugins[1]); if ($pluginName !== 'vimeo' && $pluginName !== 'youtube') { return "ERRO: não foi possível encontrar o plugin com o vídeo do Vimeo ou Youtube. Isso significa que ele não está presente ou que ele não é o primeiro plugin no corpo do objeto."; } $params = $plugins['arguments']; if (isset($params['movie']) && !isset($params['url'])) { $params['url'] = $params['movie']; } if (!$params['url']) { return "ERRO: não foi possível encontrar o parâmetro obrigatório 'url' no plugin com o vídeo."; } $params['height'] = 200; $params['width'] = 284; if ($pluginName == 'vimeo') { $params['vimeo'] = $params['url']; } if ($pluginName == 'youtube') { $params['youtube'] = $params['url']; } return '<div class="box_video box_home"><a href="video"><img border="0" src="styles/pe/video.gif"></a>' . wikiplugin_flash($data, $params) . '</div>'; }
function wikiplugin_vimeo($data, $params) { global $prefs; static $instance = 0; $instance++; if (isset($params['url'])) { $params['vimeo'] = $params['url']; unset($params['url']); return wikiplugin_flash($data, $params); } elseif (isset($params['fileId'])) { $fileIds = preg_split('/\\D+/', $params['fileId'], -1, PREG_SPLIT_NO_EMPTY); unset($params['fileId']); $out = ''; foreach ($fileIds as $fileId) { $attributelib = TikiLib::lib('attribute'); $attributes = $attributelib->get_attributes('file', $fileId); if (!empty($attributes['tiki.content.url'])) { $params['vimeo'] = $attributes['tiki.content.url']; $out .= wikiplugin_flash($data, $params); } else { TikiLib::lib('errorreport')->report(tr('Vimeo video not found for file #%0', $fileId)); } } return $out; } else { global $page; $smarty = TikiLib::lib('smarty'); if ($prefs['vimeo_upload'] !== 'y') { $smarty->loadPlugin('smarty_block_remarksbox'); $repeat = false; return smarty_block_remarksbox(array('type' => 'error', 'title' => tra('Feature required')), tra('Feature "vimeo_upload" is required to be able to add videos here.'), $smarty, $repeat); } // old perms access to get "special" gallery perms to handle user gals etc $perms = TikiLib::lib('tiki')->get_perm_object(!empty($params['galleryId']) ? $params['galleryId'] : $prefs['vimeo_default_gallery'], 'file gallery', TikiLib::lib('filegal')->get_file_gallery_info($prefs['vimeo_default_gallery']), false); if ($perms['tiki_p_upload_files'] !== 'y') { return ''; //$permMessage = tra('You do not have permsission to add files here.'); } else { if (!empty($params['fromFieldId'])) { $fieldInfo = TikiLib::lib('trk')->get_tracker_field($params['fromFieldId']); if (empty($params['fromItemId'])) { $item = Tracker_Item::newItem($fieldInfo['trackerId']); } else { $item = Tracker_Item::fromId($params['fromItemId']); } if (!$item->canModify()) { return ''; //$permMessage = tra('You do not have permsission modify this tracker item.'); } } else { if ($page) { $pagePerms = Perms::get(array('type' => 'wiki page', 'object' => $page))->edit; if (!$pagePerms) { return ''; //$permMessage = tra('You do not have permsission modify this page.'); } } } } // set up for an upload $smarty->loadPlugin('smarty_function_button'); $smarty->loadPlugin('smarty_function_service'); $html = smarty_function_button(array('_keepall' => 'y', '_class' => 'vimeo dialog', 'href' => smarty_function_service(array('controller' => 'vimeo', 'action' => 'upload'), $smarty), '_text' => tra('Upload Video')), $smarty); $js = ' $(".vimeo.dialog").click(function () { var link = this; $(this).serviceDialog({ title: tr("Upload Video"), data: { controller: "vimeo", action: "upload"' . (!empty($params['galleryId']) ? ',galleryId:' . $params['galleryId'] : '') . (!empty($params['fromFieldId']) ? ',fieldId:' . $params['fromFieldId'] : '') . (!empty($params['fromItemId']) ? ',itemId:' . $params['fromItemId'] : '') . ' }, load: function(data) { var $dialog = $(".vimeo_upload").parents(".ui-dialog-content"); // odd its the content, not the outer div $(".vimeo_upload").on("vimeo_uploaded", function(event, data) {'; if (!empty($page) && empty($params['fromFieldId'])) { $js .= ' var params = { page: ' . json_encode($page) . ', content: "", index: ' . $instance . ', type: "vimeo", params: { url: data.url } }; $.post("tiki-wikiplugin_edit.php", params, function() { $("input[type=file]", $dialog).val(""); // webkit reloads the dialog as it destroys it for some reason $dialog.dialog("destroy").remove(); $.get($.service("wiki", "get_page", {page:' . json_encode($page) . '}), function (data) { if (data) { $("#page-data").html(data); } }); });'; } else { $js .= ' $dialog.dialog("destroy").remove(); handleVimeoFile(link, data); '; } $js .= ' }); } }); return false; });'; TikiLib::lib('header')->add_jq_onready($js); return $html; } }