Example #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');
         }
     }
 }
Example #2
0
 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;
 }
Example #3
0
function ARKRegisterAllEventlisetners()
{
    $files = JFolder::files(JPATH_COMPONENT . DS . 'event');
    foreach ($files as $file) {
        arkimport('event.' . str_replace('.php', '', $file));
    }
}
Example #4
0
    list($controllername, $task) = explode('.', $task);
}
if ($controllername) {
    $app->input->set('controller', $controllername);
}
//Make sure we load in system language file for component
$lang = JFactory::getLanguage();
$component = 'com_arkeditor.sys';
$lang->load($component, JPATH_ADMINISTRATOR);
require_once 'helper.php';
//$view = $app->input->get('view','cpanel' );
if (!is_dir(CKEDITOR_LIBRARY)) {
    $app->enqueueMessage(JText::_('COM_ARKEDITOR_MSG_NOEDITOR_DETECT'), 'warning');
    $app->input->set('task', '');
    $app->input->set('view', 'cpanel');
} elseif (!JPluginHelper::isEnabled('editors', 'arkeditor')) {
    $app->enqueueMessage(JText::_('COM_ARKEDITOR_MSG_EDITOR_DISABLED'), 'warning');
    if ($app->input->get('task', '') != 'cpanel.editor') {
        $app->input->set('task', '');
        $app->input->set('view', 'cpanel');
    }
}
//end if
// main helper class
arkimport('helper');
// global include classes
arkimport('parameter.parameter');
arkimport('html.html');
$controller = JControllerLegacy::getInstance('ARK');
$controller->execute($app->input->get('task'));
$controller->redirect();
Example #5
0
 function getSelectedToolbarList()
 {
     $rows = array();
     arkimport('helper');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     $db = JFactory::getDBO();
     $sql = $db->getQuery(true);
     $sql->select('title')->from('#__ark_editor_plugins')->where('id = ' . $cid[0]);
     $title = $db->setQuery($sql)->loadResult();
     if (!!$title && !is_string($title)) {
         ARKHelper::error($db->getErrorMsg());
     }
     $config = ARKHelper::getEditorPluginConfig();
     $toolbars = $config->get('toolbars');
     foreach ($toolbars as $key => $toolbar) {
         if (ARKHelper::in_array($title, $toolbar)) {
             $row = new stdclass();
             $row->text = ucfirst($key);
             $row->value = $key;
             $rows[] = $row;
         }
     }
     return $rows;
 }
Example #6
0
<?php

/*------------------------------------------------------------------------
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
# @license - GPLv2.0
# Author: WebxSolution Ltd
# Websites:  http://webx.solutions
# Terms of Use: An extension that is derived from the Ark Editor will only be allowed under the following conditions: http://arkextensions.com/terms-of-use
# ------------------------------------------------------------------------*/
defined('_JEXEC') or die;
arkimport('event.observable.editor');
class ARKController extends JControllerLegacy
{
    /**
     * Custom Constructor
     */
    private $editor_obervable;
    protected $event_args;
    protected $default_view = 'cpanel';
    public function __construct($default = array())
    {
        parent::__construct($default);
        $app = JFactory::getApplication();
        $this->_event_args = null;
        $name = $app->input->get('controller', '');
        if (!$name) {
            $name = $app->input->get('view', $this->getName());
        }
        $eventListenerFile = JPATH_COMPONENT . DS . 'event' . DS . $name . '.php';
        jimport('joomla.filesystem.file');
        if (JFile::exists($eventListenerFile)) {