| [ Indice ] |
Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4Servizio fornito da VMItalia |
[Vedi sommario] [Stampa] [Vedi testo]
1 <?php 2 /** 3 * @version $Id: readmore.php 10709 2008-08-21 09:58:52Z eddieajau $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. 6 * @license GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_JEXEC' ) or die( 'Restricted access' ); 16 17 jimport( 'joomla.plugin.plugin' ); 18 19 /** 20 * Editor Readmore buton 21 * 22 * @package Editors-xtd 23 * @since 1.5 24 */ 25 class plgButtonReadmore extends JPlugin 26 { 27 /** 28 * Constructor 29 * 30 * For php4 compatability we must not use the __constructor as a constructor for plugins 31 * because func_get_args ( void ) returns a copy of all passed arguments NOT references. 32 * This causes problems with cross-referencing necessary for the observer design pattern. 33 * 34 * @param object $subject The object to observe 35 * @param array $config An array that holds the plugin configuration 36 * @since 1.5 37 */ 38 function plgButtonReadmore(& $subject, $config) 39 { 40 parent::__construct($subject, $config); 41 } 42 43 /** 44 * readmore button 45 * @return array A two element array of ( imageName, textToInsert ) 46 */ 47 function onDisplay($name) 48 { 49 global $mainframe; 50 51 $doc =& JFactory::getDocument(); 52 $template = $mainframe->getTemplate(); 53 54 // button is not active in specific content components 55 56 $getContent = $this->_subject->getContent($name); 57 $present = JText::_('ALREADY EXISTS', true) ; 58 $js = " 59 function insertReadmore(editor) { 60 var content = $getContent 61 if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) { 62 alert('$present'); 63 return false; 64 } else { 65 jInsertEditorText('<hr id=\"system-readmore\" />', editor); 66 } 67 } 68 "; 69 70 $doc->addScriptDeclaration($js); 71 72 $button = new JObject(); 73 $button->set('modal', false); 74 $button->set('onclick', 'insertReadmore(\''.$name.'\');return false;'); 75 $button->set('text', JText::_('Readmore')); 76 $button->set('name', 'readmore'); 77 // TODO: The button writer needs to take into account the javascript directive 78 //$button->set('link', 'javascript:void(0)'); 79 $button->set('link', '#'); 80 81 return $button; 82 } 83 }
titolo
Descrizione
Corpo
titolo
Descrizione
Corpo
titolo
Descrizione
Corpo
titolo
Corpo
| Generato il: Mon Oct 19 20:29:27 2009 | Generato con PHPXref 0.7 |