Exemple #1
0
 /**
  * A JParameter object holding the parameters for the plugin
  *
  * @var		A JParameter object
  * @access	public
  * @since	1.5
  */
 function onSave($plugin, $pluginToolbarnames)
 {
     if (!$this->canDo->get('core.edit')) {
         $this->app->redirect(JRoute::_('index.php?option=com_arkeditor&view=list', false), JText::_('COM_ARKEDITOR_PLUGIN_PERM_NO_SAVE'), 'error');
         return false;
     }
     arkimport('helper');
     $toolbarnames = ARKHelper::getEditorToolbars();
     $config = ARKHelper::getEditorPluginConfig();
     $toolbars = $config->get('toolbars');
     if (!empty($toolbarnames)) {
         foreach ($toolbarnames as $toolbarname) {
             $toolbar = $toolbars[$toolbarname];
             if (in_array($toolbarname, $pluginToolbarnames)) {
                 if (!ARKHelper::in_array($plugin->title, $toolbar)) {
                     $toolbar[] = array($plugin->title);
                 }
             } else {
                 $key = ARKHelper::in_array($plugin->title, $toolbar);
                 if (ARKHelper::in_array($plugin->title, $toolbar)) {
                     foreach ($toolbar as $key => $elements) {
                         $found = false;
                         foreach ($elements as $k => $value) {
                             if ($value == $plugin->title) {
                                 unset($toolbar[$key][$k]);
                                 $found = true;
                                 break;
                             }
                         }
                         if ($found) {
                             break;
                         }
                     }
                 }
             }
             $toolbars[$toolbarname] = $toolbar;
         }
         $config->set('toolbars', base64_encode(json_encode($toolbars)));
         $row = JTable::getInstance('extension');
         $row->load(array('folder' => 'editors', 'element' => 'arkeditor'));
         $row->bind(array('params' => $config->toArray()));
         if (!$row->store()) {
             ARKHelper::error('Failed to save Ark Editor\'s parameters');
         }
     }
     //Publish or unpblish plugin
     $this->onPublish(array($plugin->id), (int) $plugin->published);
     //Checkin extension plugin
     $row = JTable::getInstance('extension');
     $row->load(array('custom_data' => $plugin->id));
     if ($row->extension_id) {
         if (!$row->checkin()) {
             ARKHelper::error('Failed to check in in extension');
         }
     }
 }
 protected function getOptions()
 {
     $options = array();
     $items = ARKHelper::getEditorToolbars();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             $options[] = JHtml::_('select.option', $item, $item);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 function getToolbarList()
 {
     $rows = array();
     arkimport('helper');
     $toolbars = ARKHelper::getEditorToolbars();
     if (!empty($toolbars)) {
         foreach ($toolbars as $toolbar) {
             $row = new stdclass();
             $row->text = ucfirst($toolbar);
             $row->value = $toolbar;
             $rows[] = $row;
         }
     }
     return $rows;
 }
         $colour = $type && in_array($type, array('muted', 'warning', 'error', 'info', 'success')) ? 'text-' . $type : '';
         $statistic = '<p class="' . $colour . '"><strong>' . $stat . '</strong></p>';
     }
     //end if
     if ($link && $label) {
         $base = 'index.php?option=com_arkeditor&view=';
         $label = '<a href="' . $base . $link . '">' . $label . '</a>';
         $statistic = '<a href="' . $base . $link . '" class="badge-link">' . $statistic . '</a>';
     }
     //end if
     // RENDER STAT
     echo '<td>' . $label . '</td>';
     echo '<td>' . $statistic . '</td>';
 }
 $config = ARKHelper::getEditorPluginConfig();
 $toolbars = ARKHelper::getEditorToolbars(true);
 $plugins = ARKHelper::getEditorPlugins(true);
 $toolbars_core = JArrayHelper::getColumn($toolbars, 'iscore');
 $plugins_core = JArrayHelper::getColumn($plugins, 'iscore');
 $plugins_state = JArrayHelper::getColumn($plugins, 'published');
 echo '<div id="arkstats">';
 echo '<table class="table table-striped">';
 echo '<tr>';
 addStatistic(JText::_('COM_ARKEDITOR_STATISTIC_ALLTOOLBARS_NAME'), count($toolbars), 'info');
 addStatistic(JText::_('COM_ARKEDITOR_STATISTIC_ALLPLUGINS_NAME'), count($plugins), 'info', 'list&filter_state=*&filter_iscore=*');
 echo '</tr>';
 echo '<tr>';
 addStatistic(JText::_('COM_ARKEDITOR_STATISTIC_CORETOOLBARS_NAME'), count(array_keys($toolbars_core, 1)), 'inverse');
 addStatistic(JText::_('COM_ARKEDITOR_STATISTIC_COREPLUGINS_NAME'), count(array_keys($plugins_core, 1)), 'inverse', 'list&filter_state=*&filter_iscore=1');
 echo '</tr>';
 echo '<tr>';