芝麻web文件管理V1.00
编辑当前文件:/home/asmplong/www/ancien-site-2019/site/plugins/editors-xtd/readmore/readmore.php
loadLanguage(); } /** * readmore button * @return array A two element array of (imageName, textToInsert) */ public function onDisplay($name) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $template = $app->getTemplate(); // button is not active in specific content components $getContent = $this->_subject->getContent($name); $present = JText::_('PLG_READMORE_ALREADY_EXISTS', true) ; $js = " function insertReadmore(editor) { var content = $getContent if (content.match(/
/i)) { alert('$present'); return false; } else { jInsertEditorText('
', editor); } } "; $doc->addScriptDeclaration($js); $button = new JObject; $button->set('modal', false); $button->set('onclick', 'insertReadmore(\''.$name.'\');return false;'); $button->set('text', JText::_('PLG_READMORE_BUTTON_READMORE')); $button->set('name', 'readmore'); // TODO: The button writer needs to take into account the javascript directive //$button->set('link', 'javascript:void(0)'); $button->set('link', '#'); return $button; } }