/** * Method to get an array of data items. * * @return array An array of data items * * @since 12.2 */ public function getItems() { jimport('joomla.filesystem.folder'); $items = array(); $files = JFolder::files(JDeveloperArchive::getArchiveDir()); $store = $this->getStoreId('getItems'); foreach ($files as $file) { if (preg_match('/(^pkg_).*(.zip$)/', $file)) { $item = new JObject(); $item->set('id', $file); $item->set('name', $file); $item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file))); $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0")); $content = array(); if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) { throw new Exception("Failed to open {$file}"); } while ($zip_entry = zip_read($zip)) { if (preg_match('/.zip$/', zip_entry_name($zip_entry))) { $content[] = zip_entry_name($zip_entry); } } $item->set('content', implode('<br>', $content)); $items[] = $item; } } // Add the items to the internal cache. $this->cache['packages'] = $items; return $this->cache['packages']; }
/** * Display the button * * @return array A four element array of (article_id, article_title, category_id, object) */ function onDisplay($name) { /* * Javascript to insert the link * View element calls arsSelectItem when an item is clicked * arsSelectItem creates the link tag, sends it to the editor, * and closes the select frame. */ $js = "\n\n\n;// This comment is intentionally put here to prevent badly written plugins from causing a Javascript error\n// due to missing trailing semicolon and/or newline in their code.\n\t\tfunction arsSelectItem(id, title) {\n\t\t\tvar tag = '<a href='+'\"index.php?option=com_ars&view=Item&id='+id+'\">'+title+'</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); $app = JFactory::getApplication(); $tmpl = $app->getTemplate(); $doc->addStyleDeclaration(".button2-left .arsitem {background: url(templates/{$tmpl}/images/j_button2_readmore.png) 100% 0 no-repeat;}"); JHtml::_('behavior.core'); JHtml::_('behavior.modal'); /* * Use the built-in element view to select the article. * Currently uses blank class. */ $link = 'index.php?option=com_ars&view=Items&layout=modal&tmpl=component'; $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('PLG_ARSITEM_BUTTON_ITEM')); $button->set('name', 'arsitem'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); return $button; }
/** * Fired whenever a Joomla WYSIWYG Editor is displayed * @param $name * @return unknown_type */ function onDisplay($name) { $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/tienda/css/stylesheet.css'); $js = "\r\n\t\tfunction jSelectProducts(id, title, object) {\r\n\t\t\tvar layout = \$('product_layout').value;\r\n\t\t\tjInsertEditorText('{tiendaproduct id='+id+' layout='+layout+'}', '" . $name . "');\r\n\t\t\tdocument.getElementById('sbox-window').close();\r\n\t\t}"; $doc->addScriptDeclaration($js); $form_id = JRequest::getVar('id'); $getContent = $this->_subject->getContent($name); $link = 'index.php?option=com_tienda&task=elementproduct&tmpl=component&e_name=' . $name; JHTML::_('behavior.modal'); $layout_html = '</a><select name="product_layout" id="product_layout">'; $layouts = array('View' => 'view', 'Add to Cart' => 'product_buy'); foreach ($layouts as $k => $l) { $layout_html .= '<option value="' . $l . '">' . $k . '</option>'; } $layout_html .= '</select>'; // Trick for showing extra html $extrahtml = '{handler: \'iframe\', size: {x: 800, y: 500}}">' . JText::_('Tienda Product') . $layout_html . '<a style="display:none;'; $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Tienda Product')); $button->set('name', 'tiendaproduct'); $button->set('options', $extrahtml); return $button; }
/** * Display the button * * @return array A four element array of (article_id, article_title, category_id, object) */ function onDisplay($name) { $app = JFactory::getApplication(); if (!$app->isAdmin()) { return false; } $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root() . 'plugins/editors-xtd/123rfbutton/assets/css/style.css'); $base_url = JURI::base(); if ($app->isAdmin()) { $base_url = dirname($base_url); } // $current_url = 'index.php?'.$_SERVER['QUERY_STRING']; $option = JRequest::getVar('option'); $view = JRequest::getVar('view', 'form'); $layout = JRequest::getVar('layout', 'edit', ''); if ($app->isAdmin()) { $view = 'article'; } else { if ($option != 'com_content') { $view = 'form'; $layout = 'edit'; } } $url = '?option=com_ajax&plugin=123rf&format=html'; JHtml::_('behavior.modal'); $button = new JObject(); $button->class = 'btn'; $button->set('text', '123rf'); $button->set('link', $url); $button->set('name', 'picture'); $button->set('modal', true); $button->set('options', "{handler: 'iframe', size: {x: 1000, y: 600}, classWindow: 'ja123rf-window'}"); return $button; }
function addTag() { $mainframe =& JFactory::getApplication(); $tag = JRequest::getString('tag'); $tag = str_replace('-', '', $tag); $response = new JObject(); $response->set('name', $tag); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'JSON.php'; $json = new Services_JSON(); if (empty($tag)) { $response->set('msg', JText::_('You need to enter a tag!', true)); echo $json->encode($response); $mainframe->close(); } $db =& JFactory::getDBO(); $query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=" . $db->Quote($tag); $db->setQuery($query); $result = $db->loadResult(); if ($result > 0) { $response->set('msg', JText::_('Tag already exists!', true)); echo $json->encode($response); $mainframe->close(); } $row =& JTable::getInstance('K2Tag', 'Table'); $row->name = $tag; $row->published = 1; $row->store(); $cache =& JFactory::getCache('com_k2'); $cache->clean(); $response->set('id', $row->id); $response->set('status', 'success'); $response->set('msg', JText::_('Tag added to available tags list!', true)); echo $json->encode($response); $mainframe->close(); }
function onDisplay($name) { /* * Javascript to insert the link * View element calls jSelectArticle when an article is clicked * jSelectArticle creates the link tag, sends it to the editor, * and closes the select frame. */ $js = "\n\t\tfunction jSelectPerson(id, title, appid, apptitle, treeid) {\n\t\t\tvar tag = '{joaktree person|' + appid + '|' + id + '|extended}';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); JHtml::_('behavior.modal'); /* * Use the built-in element view to select the article. * Currently uses blank class. */ $link = 'index.php?option=com_joaktree&view=jt_persons&layout=element&select=1&tmpl=component&' . JSession::getFormToken() . '=1'; $button = new JObject(); $button->set('modal', true); $button->class = 'btn'; $button->set('link', $link); $button->set('text', JText::_('PLG_JOAKTREE_BUTTON_PERSONLINK')); $button->set('name', 'person_link'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); return $button; }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function render($name) { $mainframe =& JFactory::getApplication(); $button = new JObject(); if ($mainframe->isSite()) { $enable_frontend = $this->params->enable_frontend; if (!$enable_frontend) { return $button; } } JHTML::_('behavior.modal'); $document =& JFactory::getDocument(); $button_style = 'modulesanywhere'; if (!$this->params->button_icon) { $button_style = 'blank blank_modulesanywhere'; } $document->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/modulesanywhere/css/style.css'); $link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.modulesanywhere' . '&file=modulesanywhere.inc.php' . '&name=' . $name; $text = JText::_(str_replace(' ', '_', $this->params->button_text)); if ($text == str_replace(' ', '_', $this->params->button_text)) { $text = JText::_($this->params->button_text); } $button->set('modal', true); $button->set('link', $link); $button->set('text', $text); $button->set('name', $button_style); $button->set('options', "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}"); return $button; }
/** * Display the button * * @return array A four element array of (article_id, article_title, category_id, object) */ function onDisplay($name) { /* * Javascript to insert the link * View element calls jSelectArticle when an article is clicked * jSelectArticle creates the link tag, sends it to the editor, * and closes the select frame. */ $js = "\n\t\tfunction jSelectArticle(id, title, catid, object) {\n\t\t\tvar tag = '<a href='+'\"index.php?option=com_content&view=article&catid='+catid+'&id='+id+'\">'+title+'</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); JHtml::_('behavior.modal'); /* * Use the built-in element view to select the article. * Currently uses blank class. */ $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component'; $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE')); $button->set('name', 'article'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); return $button; }
function _loadData() { global $mainframe; // Lets load the content if it doesn't already exist if (empty($this->_data)) { // Lets load the content if it doesn't already exist if (empty($this->_data)) { $query = 'SELECT p.filename as filename' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id; $this->_db->setQuery($query); $filename_object = $this->_db->loadObject(); //Get Folder settings and File resize settings $path = PhocaGalleryHelper::getPathSet(); $file = new JObject(); //Create thumbnail if it doesn't exists but originalfile must exist $orig_path = $path['orig_abs_ds']; $refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&cid[]=' . $this->_id; //Creata thumbnails if not exist PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $filename_object->filename, $refresh_url, 1, 1, 1); jimport('joomla.filesystem.file'); if (!isset($filename_object->filename)) { $file->set('linkthumbnailpath', ''); } else { $thumbnail_file = PhocaGalleryHelper::getThumbnailName($filename_object->filename, 'large'); $file->set('linkthumbnailpath', $thumbnail_file['rel']); } } if (isset($file)) { $this->_data = $file; } else { $this->_data = ''; } return (bool) $this->_data; } return true; }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function onDisplay($name) { global $mainframe; $params =& JComponentHelper::getParams('com_admirorgallery'); $doc =& JFactory::getDocument(); $doc->addStyleSheet(JURI::root() . 'administrator/components/com_admirorgallery/templates/default/css/add-trigger.css'); $doc->addScript(JURI::root() . 'plugins/content/AdmirorGallery/AG_jQuery.js'); $doc->addScriptDeclaration(" \n\t\tfunction buttonTestClick(txt) {\n\t\t if(!txt) return;\n\t\t jInsertEditorText(txt, '" . $name . "');\n\t\t}\n\t\t"); $template = $mainframe->getTemplate(); $app =& JFactory::getApplication(); $link = 'index.php?option=com_admirorgallery&view=button&tmpl=component&e_name=' . $name; JHTML::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); // modal dialog $button->set('link', $link); //link to open on click $button->set('text', JText::_('Admiror Gallery')); //button text $button->set('name', 'admirorgallery'); //div class $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); //need to work return $button; }
function onDisplay($name) { $document = JFactory::getDocument(); if (version_compare(JVERSION, '3.0', 'lt')) { $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js'); } else { JHtml::_('jquery.framework'); } $document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/fancybox/jquery.fancybox.pack.js?v=3.0.5'); $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_sigpro/js/fancybox/jquery.fancybox.css?v=3.0.5'); $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_sigpro/css/editor.css?v=3.0.5'); if (version_compare(JVERSION, '3.0', 'lt')) { $option = JRequest::getCmd('option'); if ($option == 'com_virtuemart' || $option == 'com_tienda' || $option == 'com_k2') { $document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/jquery.noconflict.restore.js?v=3.0.5'); } else { $document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/jquery.noconflict.js?v=3.0.5'); } } $document->addScript(JURI::root(true) . '/administrator/components/com_sigpro/js/editor.js?v=3.0.5'); $button = new JObject(); $link = 'index.php?option=com_sigpro&tmpl=component&type=site&editorName=' . $name; $application = JFactory::getApplication(); if ($application->isSite()) { $link .= '&template=system'; } $button->set('link', $link); $button->set('text', JText::_('PLG_EDITORS-XTD_JW_SIGPRO_IMAGE_GALLERIES')); $button->set('name', 'sigProEditorButton'); $button->set('onclick', 'SigProModal(this); return false;'); if (version_compare(JVERSION, '3.0', 'ge')) { $button->class = 'btn'; } return $button; }
/** * Display the button * * @return array A two element array of (imageName, textToInsert) */ function onDisplay($name) { $app =& JFactory::getApplication(); $params =& JComponentHelper::getParams('com_media'); $ranks = array('publisher', 'editor', 'author', 'registered'); $acl =& JFactory::getACL(); // TODO: Fix this ACL call //for($i = 0; $i < $params->get('allowed_media_usergroup', 3); $i++) //{ // $acl->addACL('com_media', 'popup', 'users', $ranks[$i]); //} // TODO: Fix this ACL call //Make sure the user is authorized to view this page $user =& JFactory::getUser(); if (!$user->authorize('com_media.popup')) { //return; } $doc =& JFactory::getDocument(); $template = $app->getTemplate(); $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name; JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Image')); $button->set('name', 'image'); $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}"); return $button; }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function render($name) { $mainframe =& JFactory::getApplication(); $button = new JObject(); if ($mainframe->isSite()) { $enable_frontend = $this->params->enable_frontend; if (!$enable_frontend) { return $button; } } $this->params->tag_open = preg_replace('#[^a-z0-9-_]#s', '', $this->params->tag_open); $this->params->tag_close = preg_replace('#[^a-z0-9-_]#s', '', $this->params->tag_close); $this->params->tag_delimiter = $this->params->tag_delimiter == 'space' ? ' ' : '='; $text = '{' . $this->params->tag_open . $this->params->tag_delimiter . JText::_('TBR_TITLE') . ' 1}\\n' . '<p>' . JText::_('TBR_TEXT') . '</p>\\n' . '<p>{' . $this->params->tag_open . $this->params->tag_delimiter . JText::_('TBR_TITLE') . ' 2}</p>\\n' . '<p>' . JText::_('TBR_TEXT') . '</p>\\n' . '<p>{/' . $this->params->tag_close . '}</p>'; $text = str_replace('\\\\n', '\\n', addslashes($text)); $text = str_replace('{', '{\'+\'', $text); $document =& JFactory::getDocument(); $js = "\n\t\t\tfunction insertTabber(editor) {\n\t\t\t\tjInsertEditorText('" . $text . "', editor);\n\t\t\t}\n\t\t"; $document->addScriptDeclaration($js); $button_style = 'tabber'; if (!$this->params->button_icon) { $button_style = 'blank blank_tabber'; } $document->addStyleSheet(JURI::root(true) . '/plugins/editors-xtd/tabber/css/style.css'); $text = JText::_(str_replace(' ', '_', $this->params->button_text)); if ($text == str_replace(' ', '_', $this->params->button_text)) { $text = JText::_($this->params->button_text); } $button->set('modal', false); $button->set('link', '#'); $button->set('onclick', 'insertTabber(\'' . $name . '\');return false;'); $button->set('text', $text); $button->set('name', $button_style); return $button; }
function onDisplay($name) { $js = "\r\n\t\tfunction oziofunction(menu_id) {\r\n\t\t\tvar tag = '{oziogallery ' + menu_id + '}';\r\n\t\t\tjInsertEditorText(tag, '" . $name . "');\r\n\t\t\tSqueezeBox.close();\r\n\t\t}"; require_once JPATH_SITE . "/components/com_oziogallery3/oziogallery.inc"; $style = ""; $postfix = ""; if (!$GLOBALS["oziogallery3"]["registered"]) { $style = ".button2-left .oziogallery a { color: #f03030; }"; $postfix = " (Unregistered)"; } $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $document->addStyleSheet(JUri::root(true) . "/plugins/" . $this->_type . "/" . $this->_name . "/css/style.css"); $document->addStyleDeclaration($style); JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->class = 'btn'; $application = JFactory::getApplication(); $prefix = 'administrator/'; if ($application->isAdmin()) { $prefix = ''; } $button->set('link', $prefix . 'index.php?option=com_oziogallery3&view=galleries&layout=modal&tmpl=component&function=oziofunction'); $button->set('text', JText::_('BTN_OZIOGALLERY_BUTTON_LABEL') . $postfix); $button->set('name', 'camera'); $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}"); return $button; }
/** * Получаем доступы для действий. * * @param int $categoryId Id категории. * @param int $messageId Id сообщения. * * @return object */ public static function getActions($categoryId = 0, $messageId = 0) { // Определяем имя ассета (ресурса). if (empty($messageId) && empty($categoryId)) { $assetName = 'com_helloworld'; $section = 'component'; } elseif (empty($messageId)) { $assetName = 'com_helloworld.category.' . (int) $categoryId; $section = 'category'; } else { $assetName = 'com_helloworld.message.' . (int) $messageId; $section = 'message'; } if (empty(self::$actions)) { // Получаем список доступных действий для компонента. $accessFile = JPATH_ADMINISTRATOR . '/components/com_helloworld/access.xml'; $actions = JAccess::getActionsFromFile($accessFile, "/access/section[@name='" . $section . "']/"); // Для сообщения и категорий добавляем действие core.admin. if ($section == 'category' || $section == 'message') { $adminAction = new stdClass(); $adminAction->name = 'core.admin'; array_push($actions, $adminAction); } self::$actions = new JObject(); foreach ($actions as $action) { // Устанавливаем доступы пользователя для действий. self::$actions->set($action->name, JFactory::getUser()->authorise($action->name, $assetName)); } } return self::$actions; }
/** * Returns a singleton with all settings * * @return JObject - loads a singleton object with all settings */ private static function _loadSettings() { $db = JFactory::getDBO(); $settings = new JObject(); $query = ' SELECT st.title, st.value' . ' FROM #__matukio_settings AS st' . ' ORDER BY st.id'; $db->setQuery($query); $data = $db->loadObjectList(); foreach ($data as $value) { $settings->set($value->title, $value->value); } // Grab the settings from the menu and merge them in the object $app = JFactory::getApplication(); $menu = $app->getMenu(); if (is_object($menu)) { if ($item = $menu->getActive()) { $menuParams = $menu->getParams($item->id); foreach ($menuParams->toArray() as $key => $value) { if ($key == 'show_page_heading') { $key = 'show_page_title'; } $settings->set($key, $value); } } } return $settings; }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function render($name) { $button = new JObject(); if (JFactory::getApplication()->isSite()) { $enable_frontend = $this->params->enable_frontend; if (!$enable_frontend) { return $button; } } JHtml::_('behavior.modal'); JHtml::stylesheet('nnframework/style.min.css', false, true); $icon = 'nonumber icon-sourcerer'; $link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.sourcerer' . '&file=sourcerer.inc.php' . '&name=' . $name; $text_ini = strtoupper(str_replace(' ', '_', $this->params->button_text)); $text = JText::_($text_ini); if ($text == $text_ini) { $text = JText::_($this->params->button_text); } $button->set('modal', true); $button->set('link', $link); $button->set('text', trim($text)); $button->set('name', $icon); $button->set('options', "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}"); return $button; }
function onDisplay($name) { $application = JFactory::getApplication(); $my_first_daughters_name = "Anna"; $user =& JFactory::getUser(); $prefix = ''; if ($application->isAdmin()) { $prefix = '../'; } // needed because of user friendly urls!! Relative urls for the css does not work then. $relative_dir = parse_url(JURI::base()); $relative_dir = $relative_dir['path']; $relative_dir = rtrim($relative_dir,"\\/.") . '/'; // we replace to get a consistent output with different php versions! $css = ".button2-left .jfuButton { background: transparent url(".$relative_dir.$prefix."plugins/editors-xtd/jfuploader_editor/jfuploader_editor.png) no-repeat 100% 0px; }"; // we need to use the right part to get the right user!! if ($application->isAdmin()) { // front and admin do not have the sames session. I have to create a secret token to check that the request is not modified $jConfig = new JConfig(); $secret = $jConfig->secret; $ts =time(); $token = md5($user->username . $my_first_daughters_name . $secret . $ts); $stub = $prefix. "index.php"; $link = $stub . '?option=com_jfuploader&tmpl=component&type=jfuploader_editor&e_name='.$name .'&ts='.$ts.'&myid=' . $user->username . '&mytoken=' . $token; } else { $stub = "index.php"; $link = $prefix.$stub . '?option=com_jfuploader&tmpl=component&type=jfuploader_editor&e_name='.$name; } $popup_width = 680; $popup_height = 520; if(@$this->params){ if(@$this->params->get('popup_width') > 0){ $popup_width = (int)@$this->params->get('popup_width'); } if(@$this->params->get('popup_height') > 0){ $popup_height = (int)@$this->params->get('popup_height'); } } $doc = & JFactory::getDocument(); if ($application->isAdmin()) { $doc->addStyleDeclaration($css); } $button = new JObject(); $button->set('modal', true); $button->set('text', JText::_('JFUploader')); $button->set('name', 'jfuButton'); $button->set('options', "{handler: 'iframe',size: {x: $popup_width, y: $popup_height}}"); $button->set('link', $link); return $button; }
/** * Display the button * * @return array A two element array of(imageName, textToInsert) */ function onDisplay($name) { $link = 'index.php?option=com_avreloaded&view=insert&tmpl=component&e_name=' . $name; JHTML::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('AVR Media')); $button->set('name', 'image'); $button->set('options', "{handler: 'iframe', size: {x: 600, y: 650}}"); return $button; }
public function onDisplay($name) { $style = ".button2-left .filelink {\n background:transparent url(" . JURI::root(true) . "/media/com_fileman/images/j_button2_filelink.png) no-repeat scroll 100% 0pt;\n }"; JFactory::getDocument()->addStyleDeclaration($style); $button = new JObject(); $button->set('modal', true); $button->set('link', 'index.php?option=com_fileman&view=filelink&e_name=' . $name . '&tmpl=component'); $button->set('text', JText::_('FILElink')); $button->set('name', 'filelink'); $button->set('options', "{handler: 'iframe', size: {x: 730, y: 450}}"); return $button; }
/** * Add Attachment button * * @return a button */ function onDisplay($name, $asset, $author) { // Avoid displaying the button for anything except content articles $option = JRequest::getVar('option'); if ($option != 'com_content') { return new JObject(); } // Get the article ID $cid = JRequest::getVar('cid', array(0), '', 'array'); $id = 0; if (count($cid) > 0) { $id = intval($cid[0]); } if ($id == 0) { $nid = JRequest::getVar('id', null); if (!is_null($nid)) { $id = intval($nid); } } JHtml::_('behavior.modal'); // Create the button object $button = new JObject(); // Figure out where we are and construct the right link and set // up the style sheet (to get the visual for the button working) $document =& JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $document->addStyleSheet(JURI::root() . '/media/com_cedtag/css/admintag.css'); if ($id == 0) { $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); $link = "index.php?option=com_cedtag&controller=tag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING"; } else { $button->set('options', "{handler: 'iframe', size: {x: 600, y: 300}}"); $link = "index.php?option=com_cedtag&controller=tag&task=add&article_id=" . $id . "&tmpl=component"; } } else { $CedTagThemes = new CedTagThemes(); $CedTagThemes->addCss(); //return $button; if ($id == 0) { $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}"); $msg = JText::_('SAVE ARTICLE BEFORE ADD TAGS'); $link = "index.php?option=com_cedtag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING"; } else { $button->set('options', "{handler: 'iframe', size: {x: 500, y: 300}}"); $link = "index.php?option=com_cedtag&tmpl=component&task=add&article_id=" . $id; } } $button->set('modal', true); $button->set('class', 'modal'); $button->set('text', JText::_('Add Tags')); $button->set('name', 'add_Tags'); $button->set('link', $link); //$button->set('image', ''); return $button; }
function display($tpl = null) { global $mainframe; $id = JRequest::getVar('id', 0, '', 'int'); $chemOptions = new JObject(); $chemOptions->set('carbonLabelVisible', JRequest::getVar('carbonLabelVisible', 0, '', 'int')); $chemOptions->set('cpkColoring', JRequest::getVar('cpkColoring', 1, '', 'int')); $chemOptions->set('implicitHydrogen', JRequest::getVar('implicitHydrogen', 'TERMINAL_AND_HETERO', '', 'string')); $chemOptions->set('displayMode', JREquest::getVar('displayMode', 'WIREFRAME', '', 'string')); $chemOptions->set('bgrcolor', JRequest::getVar('bgrcolor', '#ffffff', '', 'string')); $chemOptions->set('zoomMode', JRequest::getVar('zoomMode', 'fit', '', 'string')); $chemOptions->set('width', JRequest::getVar('width', 300, '', 'int')); $chemOptions->set('height', JRequest::getVar('height', 300, '', 'int')); $this->setLayout('jsme'); $db =& JFactory::getDBO(); $document =& JFactory::getDocument(); $pathway =& $mainframe->getPathway(); // Adds parameter handling $params = $mainframe->getParams(); //Set page title information $menus =& JSite::getMenu(); $menu = $menus->getActive(); // $params->set('page_title','Chem'); $document->setTitle($params->get('page_title')); $params->def('show_page_title', 1); //$params->def( 'page_title', 'Chem Title' ); $where = $id !== 0 ? ' where id=' . $id : ''; $query = 'SELECT * ' . ' FROM #__chem a' . $where; $db->setQuery($query); $chem = $db->loadObjectList(); $this->assignRef('request', $chem); $this->assignRef('params', $params); $this->assignRef('chemoptions', $chemOptions); parent::display($tpl); }
function onDisplay($name) { $document = JFactory::getDocument(); $document->addStyleSheet(JURI::base(true) . '/../plugins/editors-xtd/plg_spoileralertbutton/css/style.css'); $jsCode = "function insertShortCode(nameOfEditor) { jInsertEditorText('[spoiler]This is a dummy spoiler text[/spoiler]', nameOfEditor); } "; $document->addScriptDeclaration($jsCode); $button = new JObject(); $button->set('modal', false); $button->set('class', 'btn'); $button->set('text', 'Spoiler Alert'); $button->set('onclick', 'insertShortCode(\'' . $name . '\')'); $button->set('name', 'spoiler'); return $button; }
function onDisplay($name) { $getContent = $this->_subject->getContent($name); $js = "\n\t\t\t\tfunction insertJCommentsOn(editor) {\n\t\t\t\t\tvar content = {$getContent}\n\t\t\t\t\tif (content.match(/{jcomments on}/)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjInsertEditorText('{jcomments on}', editor);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); $button = new JObject(); $button->set('modal', false); $button->set('onclick', 'insertJCommentsOn(\'' . $name . '\');return false;'); $button->set('text', JText::_('PLG_EDITORS-XTD_JCOMMENTSON_BUTTON_JCOMMENTSON')); $button->set('name', 'blank'); $button->set('link', '#'); return $button; }
function onDisplay($name) { global $mainframe; $doc =& JFactory::getDocument(); $link = 'index.php?option=com_xmap&task=navigator&sitemap=' . $this->params->get('sitemap') . '&tmpl=component&e_name=' . $name; JHTML::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Link')); $button->set('name', 'blank'); $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}"); return $button; }
/** * readmore button * @return array A two element array of (imageName, textToInsert) */ public function onDisplay($name) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $js = "\n\t\t\tfunction insert##Plugin##(editor) {\n\t\t\t\tjInsertEditorText('<div>example</div>', editor);\n\t\t\t}\n\t\t\t"; $doc->addScriptDeclaration($js); $button = new JObject(); $button->set('modal', false); $button->set('onclick', 'insert##Plugin##(\'' . $name . '\');return false;'); $button->set('text', JText::_('PLG_##Plugin##_BUTTON_##Plugin##')); $button->set('name', '##plugin##'); $button->set('link', '#'); return $button; }
static function getYoutubeData($yturl) { parse_str(parse_url($yturl, PHP_URL_QUERY), $my_array_of_vars); $vidID = $my_array_of_vars['v']; $jsonurl = "http://gdata.youtube.com/feeds/api/videos/" . $vidID . "?v=2&alt=jsonc"; $json = file_get_contents($jsonurl); $json_output = json_decode($json, true); $data = $json_output['data']; $result = new JObject(); $result->set('title', $data['title']); $result->set('duration', gmdate('H:i:s', $data['duration'])); $result->set('description', $data['description']); return $result; }
function &getFormData() { if (!isset($this->_fd)) { $i = new JObject(); $s =& JFactory::getSession(); $i->set('basepath', $this->getBasePath()); $i->set('files', $this->getFiles()); $i->set('uploadURL', JURI::base() . index . '&task=file.upload&mm=1&tool=badges&' . JUtility::getToken() . '=1&' . $s->getName() . '=' . $s->getId()); $i->set('deleteURL', JURI::base() . index . '&task=file.delete&mm=1&tool=badges&' . JUtility::getToken() . '=1&' . $s->getName() . '=' . $s->getId() . '&file='); $this->_fd = $i; } $ref =& $this->_fd; return $ref; }
function onDisplay($name) { $getContent = $this->_subject->getContent($name); $js = "\n\t\t\t\tfunction insertJCommentsOff(editor) {\n\t\t\t\t\tvar content = {$getContent}\n\t\t\t\t\tif (content.match(/{jcomments off}/)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjInsertEditorText('{jcomments off}', editor);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t"; $doc =& JFactory::getDocument(); $doc->addScriptDeclaration($js); $button = new JObject(); $button->set('modal', false); $button->set('onclick', 'insertJCommentsOff(\'' . $name . '\');return false;'); $button->set('text', 'JComments OFF'); $button->set('name', 'blank'); $button->set('link', '#'); return $button; }
/** * Display the button * * @return array A two element array of (imageName, textToInsert) */ public function onDisplay($name) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $template = $app->getTemplate(); $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK')); $button->set('name', 'pagebreak'); $button->set('options', "{handler: 'iframe', size: {x: 400, y: 100}}"); return $button; }