/** * Return a list of icons for each JCE editor row * * @access public * @param string The number of rows * @return The row array */ private function getToolbar() { wfimport('admin.models.plugins'); $model = new WFModelPlugins(); $wf = WFEditor::getInstance(); $rows = array('theme_advanced_buttons1' => '', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => ''); // we need a profile object and some defined rows if (!is_object($this->profile) || empty($this->profile->rows)) { return $rows; } // get plugins $plugins = $model->getPlugins(); // get core commands $commands = $model->getCommands(); // merge plugins and commands $icons = array_merge($commands, $plugins); // create an array of rows $lists = explode(';', $this->profile->rows); // backwards compatability map $map = array('paste' => 'clipboard', 'spacer' => '|', 'forecolor' => 'fontcolor', 'backcolor' => 'backcolor'); $x = 0; for ($i = 1; $i <= count($lists); $i++) { $buttons = array(); $items = explode(',', $lists[$x]); foreach ($items as $item) { // set the plugin/command name $name = $item; // map legacy values etc. if (array_key_exists($item, $map)) { $item = $map[$item]; } // check if button should be in toolbar if ($item !== "|") { if (array_key_exists($item, $icons) === false) { continue; } // assign icon $item = $icons[$item]->icon; } // check for custom plugin buttons if (array_key_exists($name, $plugins)) { $custom = $wf->getParam($name . '.buttons'); if (!empty($custom)) { $custom = array_filter((array) $custom); if (empty($custom)) { $item = ""; } else { $a = array(); foreach (explode(',', $item) as $s) { if (in_array($s, $custom) || $s == "|") { $a[] = $s; } } $item = implode(',', $a); // remove leading or trailing | $item = trim($item, '|'); } } } if (!empty($item)) { // remove double | $item = preg_replace('#(\\|,)+#', '|,', $item); $buttons[] = $item; } } if (!empty($buttons)) { $rows['theme_advanced_buttons' . $i] = implode(',', $buttons); } $x++; } return $rows; }