[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/plugins/editors/tinymce/ -> tinymce.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  defined('_JEXEC') or die;
   8  
   9  /**
  10   * TinyMCE Editor Plugin
  11   *
  12   * @package        Joomla.Plugin
  13   * @subpackage    Editors.tinymce
  14   * @since        1.5
  15   */
  16  class plgEditorTinymce extends JPlugin
  17  {
  18      /**
  19       * Base path for editor files
  20       */
  21      protected $_basePath = 'media/editors/tinymce/jscripts/tiny_mce';
  22  
  23      /**
  24       * Constructor
  25       *
  26       * @param  object  $subject  The object to observe
  27       * @param  array   $config   An array that holds the plugin configuration
  28       *
  29       * @since       1.5
  30       */
  31  	public function __construct(&$subject, $config)
  32      {
  33          parent::__construct($subject, $config);
  34          $this->loadLanguage();
  35      }
  36  
  37      /**
  38       * Initialises the Editor.
  39       *
  40       * @return  string  JavaScript Initialization string
  41       *
  42       * @since 1.5
  43       */
  44  	public function onInit()
  45      {
  46          $app        = JFactory::getApplication();
  47          $language    = JFactory::getLanguage();
  48  
  49          $mode    = (int) $this->params->get('mode', 1);
  50          $theme    = array('simple', 'advanced', 'advanced');
  51          $skin    = $this->params->get('skin', '0');
  52  
  53          switch ($skin)
  54            {
  55              case '3':
  56                  $skin = 'skin : "o2k7", skin_variant : "black",';
  57                  break;
  58  
  59              case '2':
  60                  $skin = 'skin : "o2k7", skin_variant : "silver",';
  61                  break;
  62  
  63              case '1':
  64                  $skin = 'skin : "o2k7",';
  65                  break;
  66              case '0':
  67              default:
  68                  $skin = 'skin : "default",';
  69          }
  70  
  71          $entity_encoding    = $this->params->def('entity_encoding', 'raw');
  72  
  73          $langMode            = $this->params->def('lang_mode', 0);
  74          $langPrefix            = $this->params->def('lang_code', 'en');
  75  
  76          if ($langMode)
  77          {
  78              $langPrefix = substr($language->getTag(), 0, strpos($language->getTag(), '-'));
  79          }
  80  
  81          $text_direction = 'ltr';
  82          if ($language->isRTL())
  83          {
  84              $text_direction = 'rtl';
  85          }
  86  
  87          $use_content_css    = $this->params->def('content_css', 1);
  88          $content_css_custom    = $this->params->def('content_css_custom', '');
  89  
  90          /*
  91           * Lets get the default template for the site application
  92           */
  93          $db        = JFactory::getDBO();
  94          $query    = $db->getQuery(true);
  95  
  96          $query->select('template');
  97          $query->from('#__template_styles');
  98          $query->where('client_id=0 AND home=1');
  99  
 100          $db->setQuery( $query );
 101          $template = $db->loadResult();
 102  
 103          $content_css = '';
 104  
 105          $templates_path = JPATH_SITE . '/templates';
 106          // loading of css file for 'styles' dropdown
 107          if ( $content_css_custom )
 108          {
 109              // If URL, just pass it to $content_css
 110              if (strpos( $content_css_custom, 'http' ) !==false)
 111              {
 112                  $content_css = 'content_css : "'. $content_css_custom .'",';
 113              }
 114              // If it is not a URL, assume it is a file name in the current template folder
 115              else
 116              {
 117                  $content_css = 'content_css : "'. JURI::root() .'templates/'. $template . '/css/'. $content_css_custom .'",';
 118  
 119                  // Issue warning notice if the file is not found (but pass name to $content_css anyway to avoid TinyMCE error
 120                  if (!file_exists($templates_path . '/' . $template . '/css/' . $content_css_custom)) {
 121                      $msg = sprintf (JText::_('PLG_TINY_ERR_CUSTOMCSSFILENOTPRESENT'), $content_css_custom);
 122                      JError::raiseNotice('SOME_ERROR_CODE', $msg);
 123                  }
 124              }
 125          }
 126          else
 127          {
 128              // process when use_content_css is Yes and no custom file given
 129              if ($use_content_css)
 130              {
 131                  // first check templates folder for default template
 132                  // if no editor.css file in templates folder, check system template folder
 133                  if (!file_exists($templates_path . '/' . $template . '/css/editor.css'))
 134                  {
 135                      $template = 'system';
 136  
 137                      // if no editor.css file in system folder, show alert
 138                      if (!file_exists($templates_path . '/system/css/editor.css'))
 139                      {
 140                          JError::raiseNotice('SOME_ERROR_CODE', JText::_('PLG_TINY_ERR_EDITORCSSFILENOTPRESENT'));
 141                      }
 142                      else
 143                      {
 144                          $content_css = 'content_css : "' . JURI::root() .'templates/system/css/editor.css",';
 145                      }
 146                  }
 147                  else
 148                  {
 149                      $content_css = 'content_css : "' . JURI::root() .'templates/'. $template . '/css/editor.css",';
 150                  }
 151              }
 152          }
 153  
 154          $relative_urls        = $this->params->def('relative_urls', '1');
 155  
 156          if ($relative_urls)
 157          {
 158              // relative
 159              $relative_urls = "true";
 160          }
 161          else
 162          {
 163              // absolute
 164              $relative_urls = "false";
 165          }
 166  
 167          $newlines            = $this->params->def('newlines', 0);
 168  
 169          if ($newlines)
 170          {
 171              // br
 172              $forcenewline = "force_br_newlines : true, force_p_newlines : false, forced_root_block : '',";
 173          }
 174          else
 175          {
 176              // p
 177              $forcenewline = "force_br_newlines : false, force_p_newlines : true, forced_root_block : 'p',";
 178          }
 179  
 180          $invalid_elements    = $this->params->def('invalid_elements', 'script,applet,iframe');
 181          $extended_elements    = $this->params->def('extended_elements', '');
 182  
 183          // theme_advanced_* settings
 184          $toolbar            = $this->params->def('toolbar', 'top');
 185          $toolbar_align        = $this->params->def('toolbar_align', 'left');
 186          $html_height        = $this->params->def('html_height', '550');
 187          $html_width            = $this->params->def('html_width', '750');
 188          $resizing            = $this->params->def('resizing', 'true');
 189          $resize_horizontal    = $this->params->def('resize_horizontal', 'false');
 190          $element_path = '';
 191  
 192          if ($this->params->get('element_path', 1))
 193          {
 194              $element_path = 'theme_advanced_statusbar_location : "bottom", theme_advanced_path : true';
 195          }
 196          else
 197          {
 198              $element_path = 'theme_advanced_statusbar_location : "none", theme_advanced_path : false';
 199          }
 200  
 201          $buttons1_add_before = $buttons1_add = array();
 202          $buttons2_add_before = $buttons2_add = array();
 203          $buttons3_add_before = $buttons3_add = array();
 204          $buttons4 = array();
 205          $plugins  = array();
 206  
 207          if ($extended_elements != "")
 208          {
 209              $elements    = explode(',', $extended_elements);
 210          }
 211  
 212          // Initial values for buttons
 213          array_push($buttons4, 'cut', 'copy', 'paste');
 214          // array_push($buttons4,'|');
 215  
 216          // Plugins
 217  
 218          // fonts
 219          $fonts =  $this->params->def( 'fonts', 1 );
 220  
 221          if ($fonts)
 222          {
 223              $buttons1_add[]    = 'fontselect,fontsizeselect';
 224          }
 225  
 226          // paste
 227          $paste =  $this->params->def('paste', 1);
 228  
 229          if ($paste)
 230          {
 231              $plugins[]    = 'paste';
 232              $buttons4[]    = 'pastetext';
 233              $buttons4[]    = 'pasteword';
 234              $buttons4[]    = 'selectall,|';
 235          }
 236  
 237          // search & replace
 238          $searchreplace        =  $this->params->def('searchreplace', 1);
 239  
 240          if ($searchreplace)
 241          {
 242              $plugins[]    = 'searchreplace';
 243              $buttons2_add_before[]    = 'search,replace,|';
 244          }
 245  
 246          // insert date and/or time plugin
 247          $insertdate            = $this->params->def('insertdate', 1);
 248          $format_date        = $this->params->def('format_date', '%Y-%m-%d');
 249          $inserttime            = $this->params->def('inserttime', 1);
 250          $format_time        = $this->params->def('format_time', '%H:%M:%S');
 251  
 252          if ($insertdate or $inserttime)
 253          {
 254              $plugins[]    = 'insertdatetime';
 255              if ($insertdate)
 256              {
 257                  $buttons2_add[]    = 'insertdate';
 258              }
 259  
 260              if ($inserttime)
 261              {
 262                  $buttons2_add[]    = 'inserttime';
 263              }
 264          }
 265  
 266          // colors
 267          $colors =  $this->params->def('colors', 1);
 268  
 269          if ($colors)
 270          {
 271              $buttons2_add[]    = 'forecolor,backcolor';
 272          }
 273  
 274          // table
 275          $table = $this->params->def('table', 1);
 276  
 277          if ($table)
 278          {
 279              $plugins[]    = 'table';
 280              $buttons3_add_before[]    = 'tablecontrols';
 281          }
 282  
 283          // emotions
 284          $smilies = $this->params->def('smilies', 1);
 285  
 286          if ($smilies)
 287          {
 288              $plugins[]    = 'emotions';
 289              $buttons3_add[]    = 'emotions';
 290          }
 291  
 292          //media plugin
 293          $media = $this->params->def('media', 1);
 294  
 295          if ($media)
 296          {
 297              $plugins[] = 'media';
 298              $buttons3_add[] = 'media';
 299          }
 300  
 301          // horizontal line
 302          $hr = $this->params->def('hr', 1);
 303  
 304          if ($hr)
 305          {
 306              $plugins[]    = 'advhr';
 307              $elements[] = 'hr[id|title|alt|class|width|size|noshade|style]';
 308              $buttons3_add[]    = 'advhr';
 309          }
 310          else
 311          {
 312              $elements[] = 'hr[id|class|title|alt]';
 313          }
 314  
 315          // rtl/ltr buttons
 316          $directionality    = $this->params->def('directionality', 1);
 317  
 318          if ($directionality)
 319          {
 320              $plugins[] = 'directionality';
 321              $buttons3_add[] = 'ltr,rtl';
 322          }
 323  
 324          // fullscreen
 325          $fullscreen    = $this->params->def('fullscreen', 1);
 326  
 327          if ($fullscreen)
 328          {
 329              $plugins[]    = 'fullscreen';
 330              $buttons2_add[]    = 'fullscreen';
 331          }
 332  
 333          // layer
 334          $layer = $this->params->def('layer', 1);
 335  
 336          if ($layer)
 337          {
 338              $plugins[]    = 'layer';
 339              $buttons4[]    = 'insertlayer';
 340              $buttons4[]    = 'moveforward';
 341              $buttons4[]    = 'movebackward';
 342              $buttons4[]    = 'absolute';
 343          }
 344  
 345          // style
 346          $style = $this->params->def('style', 1);
 347  
 348          if ($style) 
 349          {
 350              $plugins[]    = 'style';
 351              $buttons4[]    = 'styleprops';
 352          }
 353  
 354          // XHTMLxtras
 355          $xhtmlxtras    = $this->params->def('xhtmlxtras', 1);
 356  
 357          if ($xhtmlxtras)
 358          {
 359              $plugins[]    = 'xhtmlxtras';
 360              $buttons4[]    = 'cite,abbr,acronym,ins,del,attribs';
 361          }
 362  
 363          // visualchars
 364          $visualchars = $this->params->def('visualchars', 1);
 365  
 366          if ($visualchars)
 367          {
 368              $plugins[]    = 'visualchars';
 369              $buttons4[]    = 'visualchars';
 370          }
 371  
 372          // non-breaking
 373          $nonbreaking = $this->params->def('nonbreaking', 1);
 374  
 375          if ($nonbreaking)
 376          {
 377              $plugins[]    = 'nonbreaking';
 378              $buttons4[]    = 'nonbreaking';
 379          }
 380  
 381          // blockquote
 382          $blockquote    = $this->params->def( 'blockquote', 1 );
 383  
 384          if ($blockquote)
 385          {
 386              $buttons4[] = 'blockquote';
 387          }
 388  
 389          // wordcount
 390          $wordcount    = $this->params->def( 'wordcount', 1 );
 391  
 392          if ($wordcount)
 393          {
 394              $plugins[] = 'wordcount';
 395          }
 396  
 397          // template
 398          $template = $this->params->def('template', 1);
 399  
 400          if ($template)
 401          {
 402              $plugins[]    = 'template';
 403              $buttons4[]    = 'template';
 404          }
 405  
 406          // advimage
 407          $advimage = $this->params->def('advimage', 1);
 408  
 409          if ($advimage)
 410          {
 411              $plugins[]    = 'advimage';
 412              $elements[]    = 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]';
 413          }
 414  
 415          // advlink
 416          $advlink    = $this->params->def('advlink', 1);
 417  
 418          if ($advlink)
 419          {
 420              $plugins[]    = 'advlink';
 421              $elements[]    = 'a[id|class|name|href|hreflang|target|title|onclick|rel|style]';
 422          }
 423  
 424          //advlist
 425          $advlist    = $this->params->def('advlist', 1);
 426  
 427          if ($advlist)
 428          {
 429              $plugins[]    = 'advlist';
 430          }
 431  
 432          // autosave
 433          $autosave = $this->params->def('autosave', 1);
 434  
 435          if ($autosave)
 436          {
 437              $plugins[]    = 'autosave';
 438          }
 439  
 440          // context menu
 441          $contextmenu = $this->params->def('contextmenu', 1);
 442  
 443          if ($contextmenu)
 444          {
 445              $plugins[]    = 'contextmenu';
 446          }
 447  
 448          // inline popups
 449          $inlinepopups            = $this->params->def('inlinepopups', 1);
 450  
 451          if ($inlinepopups)
 452          {
 453              $plugins[]    = 'inlinepopups';
 454              $dialog_type = 'dialog_type : "modal",';
 455          }
 456          else
 457          {
 458              $dialog_type = "";
 459          }
 460  
 461          $custom_plugin = $this->params->def('custom_plugin', '');
 462  
 463          if ($custom_plugin != "")
 464          {
 465              $plugins[] = $custom_plugin;
 466          }
 467  
 468          $custom_button = $this->params->def('custom_button', '');
 469  
 470          if ($custom_button != "")
 471          {
 472              $buttons4[] = $custom_button;
 473          }
 474  
 475          // Prepare config variables
 476          $buttons1_add_before = implode(',', $buttons1_add_before);
 477          $buttons2_add_before = implode(',', $buttons2_add_before);
 478          $buttons3_add_before = implode(',', $buttons3_add_before);
 479          $buttons1_add = implode(',', $buttons1_add);
 480          $buttons2_add = implode(',', $buttons2_add);
 481          $buttons3_add = implode(',', $buttons3_add);
 482          $buttons4 = implode(',', $buttons4);
 483          $plugins = implode(',', $plugins);
 484          $elements = implode(',', $elements);
 485  
 486          switch ($mode)
 487          {
 488              case 0: /* Simple mode*/
 489                  $load = "\t<script type=\"text/javascript\" src=\"".
 490                          JURI::root().$this->_basePath.
 491                          "/tiny_mce.js\"></script>\n";
 492  
 493                  $return = $load .
 494                  "\t<script type=\"text/javascript\">
 495                  tinyMCE.init({
 496                      // General
 497                      directionality: \"$text_direction\",
 498                      editor_selector : \"mce_editable\",
 499                      language : \"". $langPrefix . "\",
 500                      mode : \"specific_textareas\",
 501                      $skin
 502                      theme : \"$theme[$mode]\",
 503                      // Cleanup/Output
 504                      inline_styles : true,
 505                      gecko_spellcheck : true,
 506                      entity_encoding : \"$entity_encoding\",
 507                      $forcenewline
 508                      // URL
 509                      relative_urls : $relative_urls,
 510                      remove_script_host : false,
 511                      // Layout
 512                      $content_css
 513                      document_base_url : \"". JURI::root() ."\"
 514                  });
 515                  </script>";
 516                  break;
 517  
 518              case 1: /* Advanced mode*/
 519                  $load = "\t<script type=\"text/javascript\" src=\"".
 520                          JURI::root().$this->_basePath.
 521                          "/tiny_mce.js\"></script>\n";
 522  
 523                  $return = $load .
 524                  "\t<script type=\"text/javascript\">
 525                  tinyMCE.init({
 526                      // General
 527                      directionality: \"$text_direction\",
 528                      editor_selector : \"mce_editable\",
 529                      language : \"". $langPrefix . "\",
 530                      mode : \"specific_textareas\",
 531                      $skin
 532                      theme : \"$theme[$mode]\",
 533                      // Cleanup/Output
 534                      inline_styles : true,
 535                      gecko_spellcheck : true,
 536                      entity_encoding : \"$entity_encoding\",
 537                      extended_valid_elements : \"$elements\",
 538                      $forcenewline
 539                      invalid_elements : \"$invalid_elements\",
 540                      // URL
 541                      relative_urls : $relative_urls,
 542                      remove_script_host : false,
 543                      document_base_url : \"". JURI::root() ."\",
 544                      // Layout
 545                      $content_css
 546                      // Advanced theme
 547                      theme_advanced_toolbar_location : \"$toolbar\",
 548                      theme_advanced_toolbar_align : \"$toolbar_align\",
 549                      theme_advanced_source_editor_height : \"$html_height\",
 550                      theme_advanced_source_editor_width : \"$html_width\",
 551                      theme_advanced_resizing : $resizing,
 552                      theme_advanced_resize_horizontal : $resize_horizontal,
 553                      $element_path
 554                  });
 555                  </script>";
 556                  break;
 557  
 558              case 2: /* Extended mode*/
 559                  $load = "\t<script type=\"text/javascript\" src=\"".
 560                          JURI::root().$this->_basePath.
 561                          "/tiny_mce.js\"></script>\n";
 562  
 563                  $return = $load .
 564                  "\t<script type=\"text/javascript\">
 565                  tinyMCE.init({
 566                      // General
 567                      $dialog_type
 568                      directionality: \"$text_direction\",
 569                      editor_selector : \"mce_editable\",
 570                      language : \"". $langPrefix . "\",
 571                      mode : \"specific_textareas\",
 572                      plugins : \"$plugins\",
 573                      $skin
 574                      theme : \"$theme[$mode]\",
 575                      // Cleanup/Output
 576                      inline_styles : true,
 577                      gecko_spellcheck : true,
 578                      entity_encoding : \"$entity_encoding\",
 579                      extended_valid_elements : \"$elements\",
 580                      $forcenewline
 581                      invalid_elements : \"$invalid_elements\",
 582                      // URL
 583                      relative_urls : $relative_urls,
 584                      remove_script_host : false,
 585                      document_base_url : \"". JURI::root() ."\",
 586                      //Templates
 587                      template_external_list_url :  \"". JURI::root() ."media/editors/tinymce/templates/template_list.js\",
 588                      // Layout
 589                      $content_css
 590                      // Advanced theme
 591                      theme_advanced_toolbar_location : \"$toolbar\",
 592                      theme_advanced_toolbar_align : \"$toolbar_align\",
 593                      theme_advanced_source_editor_height : \"$html_height\",
 594                      theme_advanced_source_editor_width : \"$html_width\",
 595                      theme_advanced_resizing : $resizing,
 596                      theme_advanced_resize_horizontal : $resize_horizontal,
 597                      $element_path,
 598                      theme_advanced_buttons1_add_before : \"$buttons1_add_before\",
 599                      theme_advanced_buttons2_add_before : \"$buttons2_add_before\",
 600                      theme_advanced_buttons3_add_before : \"$buttons3_add_before\",
 601                      theme_advanced_buttons1_add : \"$buttons1_add\",
 602                      theme_advanced_buttons2_add : \"$buttons2_add\",
 603                      theme_advanced_buttons3_add : \"$buttons3_add\",
 604                      theme_advanced_buttons4 : \"$buttons4\",
 605                      plugin_insertdate_dateFormat : \"$format_date\",
 606                      plugin_insertdate_timeFormat : \"$format_time\",
 607                      fullscreen_settings : {
 608                          theme_advanced_path_location : \"top\"
 609                      }
 610                  });
 611                  </script>";
 612                  break;
 613          }
 614  
 615          return $return;
 616      }
 617  
 618      /**
 619       * TinyMCE WYSIWYG Editor - get the editor content
 620       *
 621       * @param  string  The name of the editor
 622       *
 623       * @return string
 624       */
 625  	public function onGetContent($editor)
 626      {
 627          return 'tinyMCE.get(\''.$editor.'\').getContent();';
 628      }
 629  
 630      /**
 631       * TinyMCE WYSIWYG Editor - set the editor content
 632       *
 633       * @param   string  The name of the editor
 634       *
 635       * @return  string
 636       */
 637  	public function onSetContent($editor, $html)
 638      {
 639          return 'tinyMCE.get(\''.$editor.'\').setContent('.$html.');';
 640      }
 641  
 642      /**
 643       * TinyMCE WYSIWYG Editor - copy editor content to form field
 644       *
 645       * @param   string  The name of the editor
 646       *
 647       * @return  string
 648       */
 649  	public function onSave($editor)
 650      {
 651          return 'if (tinyMCE.get("'.$editor.'").isHidden()) {tinyMCE.get("'.$editor.'").show()}; tinyMCE.get("'.$editor.'").save();';
 652      }
 653  
 654      /**
 655       *
 656       * @return  boolean
 657       */
 658  	public function onGetInsertMethod($name)
 659      {
 660          $doc = JFactory::getDocument();
 661  
 662          $js= "
 663  			function isBrowserIE() {
 664                  return navigator.appName==\"Microsoft Internet Explorer\";
 665              }
 666  
 667  			function jInsertEditorText( text, editor ) {
 668                  if (isBrowserIE()) {
 669                      if (window.parent.tinyMCE) {
 670                          window.parent.tinyMCE.selectedInstance.selection.moveToBookmark(window.parent.global_ie_bookmark);
 671                      }
 672                  }
 673                  tinyMCE.execInstanceCommand(editor, 'mceInsertContent',false,text);
 674              }
 675  
 676              var global_ie_bookmark = false;
 677  
 678  			function IeCursorFix() {
 679                  if (isBrowserIE()) {
 680                      tinyMCE.execCommand('mceInsertContent', false, '');
 681                      global_ie_bookmark = tinyMCE.activeEditor.selection.getBookmark(false);
 682                  }
 683                  return true;
 684              }";
 685  
 686          $doc->addScriptDeclaration($js);
 687  
 688          return true;
 689      }
 690  
 691      /**
 692       * Display the editor area.
 693       *
 694       * @param   string   The name of the editor area.
 695       * @param   string   The content of the field.
 696       * @param   string   The width of the editor area.
 697       * @param   string   The height of the editor area.
 698       * @param   int      The number of columns for the editor area.
 699       * @param   int      The number of rows for the editor area.
 700       * @param   boolean  True and the editor buttons will be displayed.
 701       * @param   string   An optional ID for the textarea. If not supplied the name is used.
 702       *
 703       * @return  string
 704       */
 705  	public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null)
 706      {
 707          if (empty($id))
 708          {
 709              $id = $name;
 710          }
 711  
 712          // Only add "px" to width and height if they are not given as a percentage
 713          if (is_numeric($width))
 714          {
 715              $width .= 'px';
 716          }
 717  
 718          if (is_numeric($height))
 719          {
 720              $height .= 'px';
 721          }
 722  
 723          $editor  = '<textarea name="' . $name . '" id="' . $id .'" cols="' . $col .'" rows="' . $row . '" style="width: ' . $width . '; height:' . $height . ';" class="mce_editable">' . $content . "</textarea>\n" .
 724          $this->_displayButtons($id, $buttons, $asset, $author) .
 725          $this->_toogleButton($id);
 726  
 727          return $editor;
 728      }
 729  
 730      /**
 731       *
 732       * @return  string
 733       */
 734  	private function _displayButtons($name, $buttons, $asset, $author)
 735      {
 736          // Load modal popup behavior
 737          JHtml::_('behavior.modal', 'a.modal-button');
 738  
 739          $args['name'] = $name;
 740          $args['event'] = 'onGetInsertMethod';
 741  
 742          $return = '';
 743          $results[] = $this->update($args);
 744  
 745          foreach ($results as $result)
 746          {
 747              if (is_string($result) && trim($result))
 748              {
 749                  $return .= $result;
 750              }
 751          }
 752  
 753          if (is_array($buttons) || (is_bool($buttons) && $buttons))
 754          {
 755              $results = $this->_subject->getButtons($name, $buttons, $asset, $author);
 756  
 757              /*
 758               * This will allow plugins to attach buttons or change the behavior on the fly using AJAX
 759               */
 760              $return .= "\n<div id=\"editor-xtd-buttons\">\n";
 761  
 762              foreach ($results as $button)
 763              {
 764                  /*
 765                   * Results should be an object
 766                   */
 767                  if ( $button->get('name') ) {
 768                      $modal        = ($button->get('modal')) ? ' class="modal-button"' : null;
 769                      $href        = ($button->get('link')) ? ' href="'.JURI::base().$button->get('link').'"' : null;
 770                      $onclick    = ($button->get('onclick')) ? ' onclick="'.$button->get('onclick').'"' : 'onclick="IeCursorFix(); return false;"';
 771                      $title      = ($button->get('title')) ? $button->get('title') : $button->get('text');
 772                      $return .= '<div class="button2-left"><div class="' . $button->get('name')
 773                          . '"><a' . $modal . ' title="' . $title . '"' . $href . $onclick . ' rel="' . $button->get('options')
 774                          . '">' . $button->get('text') . "</a></div></div>\n";
 775                  }
 776              }
 777  
 778              $return .= "</div>\n";
 779          }
 780  
 781          return $return;
 782      }
 783  
 784      /**
 785       *
 786       * @return  string
 787       */
 788  	private function _toogleButton($name)
 789      {
 790          $return  = '';
 791          $return .= "\n<div class=\"toggle-editor\">\n";
 792          $return .= "<div class=\"button2-left\"><div class=\"blank\"><a href=\"#\" onclick=\"tinyMCE.execCommand('mceToggleEditor', false, '" . $name . "');return false;\" title=\"".JText::_('PLG_TINY_BUTTON_TOGGLE_EDITOR').'">'.JText::_('PLG_TINY_BUTTON_TOGGLE_EDITOR')."</a></div></div>";
 793          $return .= "</div>\n";
 794  
 795          return $return;
 796      }
 797  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1