public function display() { $document = WFDocument::getInstance(); $view = $this->getView(); $view->addTemplatePath(WF_EDITOR_PLUGIN . '/tmpl'); $document->setTitle(WFText::_('WF_' . strtoupper($this->getName() . '_TITLE'))); $theme = $this->getParam('source.theme', 'textmate'); //$editor = 'codemirror'; $document->addScript(array('tiny_mce_popup'), 'tiny_mce'); $document->addScript(array('editor', 'format'), 'plugins'); $document->addStyleSheet(array('editor'), 'plugins'); $document->addScript(array('codemirror-compressed'), 'jce.tiny_mce.plugins.source.js.codemirror'); $document->addStyleSheet(array('codemirror', 'theme/' . $theme), 'jce.tiny_mce.plugins.source.css.codemirror'); /*switch ($editor) { case 'ace': $document->addScript(array('ace', 'mode-html'), 'jce.tiny_mce.plugins.source.js.ace'); if ($theme != 'textmate') { $document->addScript(array('theme-' . $theme), 'jce.tiny_mce.plugins.source.js.ace'); } break; case 'codemirror': $document->addScript(array('codemirror-compressed'), 'jce.tiny_mce.plugins.source.js.codemirror'); $document->addStyleSheet(array('codemirror', 'theme/' . $theme), 'jce.tiny_mce.plugins.source.css.codemirror'); break; }*/ }
function com_install() { $mainframe = JFactory::getApplication(); jimport('joomla.filesystem.folder'); // Initialize variables jimport('joomla.client.helper'); $FTPOptions = JClientHelper::getCredentials('ftp'); $language = JFactory::getLanguage(); $language->load('com_jce_imgmanager_ext', JPATH_SITE); $cache = $mainframe->getCfg('tmp_path'); // Check for tmp folder if (!JFolder::exists($cache)) { // Create if does not exist if (!JFolder::create($cache)) { $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error'); } } // Check if folder exists and is writable or the FTP layer is enabled if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) { $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_CACHE_DESC')); } else { $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error'); } // Check for GD if (!function_exists('gd_info')) { $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_GD_DESC'), 'error'); } else { $info = gd_info(); $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_GD_DESC') . ' - ' . $info['GD Version']); } // remove wideimage folder if (JFolder::exists(dirname(__FILE) . '/classes/wideimage')) { @JFolder::delete(dirname(__FILE) . '/classes/wideimage'); } }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = $node->attributes('class') ? $node->attributes('class') . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $options = array('width' => 765, 'height' => 480, 'modal' => true, 'id' => $attributes['id'] . '_browser'); $model = JModel::getInstance('WFModel'); $html .= '<a href="' . $model->getBrowserLink($attributes['id'], $filter) . '" class="dialog browser" target="_blank" data-options=\'' . json_encode($options) . '\' title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
public function fetchElement($name, $value, &$node, $control_name) { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $language = JFactory::getLanguage(); // create a unique id $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name); $attribs = array('class="parameter-nested-parent"'); // path to directory $path = WF_EDITOR_EXTENSIONS . '/filesystem'; $filter = '\\.xml$'; $files = JFolder::files($path, $filter, false, true, array('build.xml')); $options = array(); if ((bool) $node->attributes()->exclude_default === false) { $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET')); } if (is_array($files)) { foreach ($files as $file) { // load language file $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE); $xml = WFXMLHelper::parseInstallManifest($file); $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name'])); } } // if a group is specified, setup to be an object if ((string) $node->attributes()->group) { $name = $control_name . '[filesystem][' . $name . ']'; } else { $name = $control_name . '[filesystem]'; } return JHTML::_('select.genericlist', $options, $name, implode(' ', $attribs), 'value', 'text', $value, $id); }
public function save() { // Check for request forgeries JRequest::checkToken() or die('RESTRICTED'); $db = JFactory::getDBO(); $post = JRequest::getVar('params', '', 'POST', 'ARRAY'); $registry = new JRegistry(); $registry->loadArray($post); // get params $component = WFExtensionHelper::getComponent(); // set preferences object $preferences = $registry->toObject(); if (isset($preferences->rules)) { $preferences->access = $preferences->rules; unset($preferences->rules); } // set params as JSON string $component->params = json_encode($preferences); if (!$component->check()) { JError::raiseError(500, $row->getError()); } if (!$component->store()) { JError::raiseError(500, $row->getError()); } $component->checkin(); $close = 0; if ($this->getTask() == 'save') { $close = 1; } $this->setRedirect('index.php?option=com_jce&view=preferences&tmpl=component&close=' . $close, WFText::_('WF_PREFERENCES_SAVED')); }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $installer = WFInstaller::getInstance(); $version = $model->getVersion(); // Check Groups DB if (!$installer->profiles) { $link = JHTML::link('index.php?option=com_jce&task=repair&table=profiles', WFText::_('WF_DB_CREATE_RESTORE')); $mainframe->enqueueMessage(WFText::_('WF_DB_PROFILES_ERROR') . ' - ' . $link, 'error'); } $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate(); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); $this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});'); WFToolbarHelper::preferences(); WFToolbarHelper::updates($canUpdate); WFToolbarHelper::help('cpanel.about'); $this->assignRef('icons', $icons); $this->assignRef('model', $model); $this->assignRef('installer', $installer); $this->assignRef('params', $params); $this->assignRef('version', $version); parent::display($tpl); }
function getList() { $wf = WFEditorPlugin::getInstance(); if ($wf->checkAccess('links.joomlalinks.weblinks', 1)) { return '<li id="index.php?option=com_weblinks&view=categories"><div class="tree-row"><div class="tree-image"></div><span class="folder weblink nolink"><a href="javascript:;">' . WFText::_('WF_LINKS_JOOMLALINKS_WEBLINKS') . '</a></span></div></li>'; } }
public function fetchElement($name, $value, &$node, $control_name) { $default = self::$fonts; if (empty($value)) { $data = self::$fonts; } else { $data = json_decode($value, true); } $output = array(); $output[] = '<div class="fontlist">'; $output[] = '<ul>'; foreach ($data as $title => $fonts) { if (in_array($title, array_keys(self::$fonts))) { $output[] = '<li><input type="checkbox" value="' . $title . '=' . $fonts . '" checked="checked" /><span style="font-family:' . $fonts . '">' . $title . '</span></li>'; unset($default[$title]); } else { $output[] = '<li class="font-item"><input type="text" value="' . $title . '" placeholder="' . WFText::_('WF_LABEL_NAME') . '"><input type="text" value="' . $fonts . '" placeholder="' . WFText::_('WF_LABEL_FONTS') . ', eg: arial,helvetica,sans-serif" /><a href="#" class="close">×</a></li>'; } } foreach ($default as $title => $fonts) { $output[] = '<li><input type="checkbox" value="' . $title . '=' . $fonts . '" /><span style="font-family:' . $fonts . '">' . $title . '</span></li>'; } $output[] = '<li class="font-item hide"><input type="text" value="" placeholder="' . WFText::_('WF_LABEL_NAME') . '"><input type="text" value="" placeholder="' . WFText::_('WF_LABEL_FONTS') . ', eg: arial,helvetica,sans-serif" /><a href="#" class="close">×</a></li>'; $output[] = '</ul>'; $output[] = '<a href="#" class="close plus"><span>' . WFText::_('WF_PARAM_FONTS_NEW') . '</span><span>+</span></a>'; $output[] = '<input type="hidden" name="' . $control_name . '[' . $name . ']" value="" />'; $output[] = '</div>'; return implode("\n", $output); }
function fetchElement($name, $value, &$node, $control_name) { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $language = JFactory::getLanguage(); // create a unique id $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name); // add javascript if element has parameters if ($node->attributes('parameters')) { $document = JFactory::getDocument(); $document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");'); } // path to directory $path = WF_EDITOR_EXTENSIONS . DS . 'filesystem'; $filter = '\\.xml$'; $files = JFolder::files($path, $filter, false, true); $options = array(); if (!$node->attributes('exclude_default')) { $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET')); } if (is_array($files)) { foreach ($files as $file) { // load language file $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE); $xml = JApplicationHelper::parseXMLInstallFile($file); $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name'])); } } return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id); }
function display($tpl = null) { $db = JFactory::getDBO(); $client = JRequest::getWord('client', 'admin'); $model = $this->getModel(); $this->document->setTitle(WFText::_('WF_PREFERENCES_TITLE')); $this->document->addStyleSheet('templates/system/css/system.css'); $component = WFExtensionHelper::getComponent(); $xml = JPATH_COMPONENT . '/models/preferences.xml'; // get params definitions $params = new WFParameter($component->params, $xml, 'preferences'); $params->addElementPath(JPATH_COMPONENT . '/elements'); if (WFModel::authorize('admin')) { $form = $model->getForm('permissions'); } else { $form = null; } $this->assign('params', $params); $this->assign('permissons', $form); $this->addStyleSheet('components/com_jce/media/css/preferences.css'); $this->addScript('components/com_jce/media/js/preferences.js'); if (JRequest::getInt('close') == 1) { $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.close();});'); } else { $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.init();});'); } parent::display($tpl); }
public function fetchElement($name, $value, &$node, $control_name) { jimport('joomla.filesystem.folder'); // path to images directory $path = WF_EDITOR . '/extensions/mediaplayer'; $files = JFolder::files($path, '\\.xml', false, true); $language = JFactory::getLanguage(); // create unique id $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'mediaplayer' . $name); // add javascript if element has parameters if ((string) $node->attributes()->parameters) { $document = JFactory::getDocument(); $document->addCustomTag('<script type="text/javascript">$jce.Parameter.add("#' . $id . '", "mediaplayer");</script>'); } $options = array(); $options[] = JHTML::_('select.option', 'none', WFText::_('WF_OPTION_NONE')); if (is_array($files)) { foreach ($files as $file) { // load language file $language->load('com_jce_' . $name . '_' . basename($file, '.xml'), JPATH_SITE); $xml = WFXMLHelper::parseInstallManifest($file); $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name'])); } } return JHTML::_('select.genericlist', $options, '' . $control_name . '[mediaplayer][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id); }
public function getList() { $wf = WFEditorPlugin::getInstance(); if ($wf->checkAccess('links.joomlalinks.menu', 1)) { return '<li id="index.php?option=com_menu"><div class="tree-row"><div class="tree-image"></div><span class="folder menu nolink"><a href="javascript:;">' . WFText::_('WF_LINKS_JOOMLALINKS_MENU') . '</a></span></div></li>'; } }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $version = $model->getVersion(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate() && $model->authorize('installer'); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); $this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});'); if ($model->authorize('preferences')) { WFToolbarHelper::preferences(); } if ($model->authorize('installer')) { WFToolbarHelper::updates($canUpdate); } WFToolbarHelper::help('cpanel.about'); $this->assignRef('icons', $icons); $this->assignRef('model', $model); $this->assignRef('installer', $installer); $this->assignRef('params', $params); $this->assignRef('version', $version); parent::display($tpl); }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $version = $model->getVersion(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate() && WFModel::authorize('installer'); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); JHtml::_('behavior.modal'); $this->addScript('components/com_jce/media/js/cpanel.js'); $this->addScriptDeclaration('jQuery.jce.Cpanel.options = ' . json_encode($options) . ';'); // load styles $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/cpanel.css'); if (WFModel::authorize('preferences')) { WFToolbarHelper::preferences(); } if (WFModel::authorize('installer')) { WFToolbarHelper::updates($canUpdate); } WFToolbarHelper::help('cpanel.about'); $views = array('config', 'profiles', 'installer', 'browser', 'mediabox'); $icons = array(); foreach ($views as $view) { // check if its allowed... if (WFModel::authorize($view) === false) { continue; } $attribs = array('target="_self"'); $title = 'WF_' . strtoupper($view); $description = 'WF_' . strtoupper($view) . '_DESC'; $link = 'index.php?option=com_jce&view=' . $view; if ($view == 'browser') { $link = WFModel::getBrowserLink(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $width = (int) $params->get('browser_width', 790); $height = (int) $params->get('browser_height', 560); if (empty($link)) { continue; } $attribs = array('target="_blank"', 'class="browser"', 'onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;"'); $title = 'WF_' . strtoupper($view) . '_TITLE'; $description = 'WF_CPANEL_' . strtoupper($view); } // if its mediabox, check the plugin is installed and enabled if ($view == 'mediabox' && !JPluginHelper::isEnabled('system', 'jcemediabox')) { continue; } $icons[] = '<li class="cpanel-icon wf-tooltip" title="' . WFText::_($title) . '::' . WFText::_($description) . '"><a id="wf-browser-link" href="' . $link . '"' . implode(' ', $attribs) . '><span class="' . $view . '"></span>' . WFText::_($title) . '</a></li>'; } $this->assign('icons', $icons); $this->assign('model', $model); $this->assign('params', $params); $this->assign('version', $version); parent::display($tpl); }
public function getList() { //Reference to JConentEditor (JCE) instance $wf = WFEditorPlugin::getInstance(); if ($wf->checkAccess('links.joomlalinks.contacts', 1)) { return '<li id="index.php?option=com_contact"><div class="tree-row"><div class="tree-image"></div><span class="folder contact nolink"><a href="javascript:;">' . WFText::_('WF_LINKS_JOOMLALINKS_CONTACTS') . '</a></span></div></li>'; } }
public function getForm($group = null) { jimport('joomla.form.form'); if (class_exists('JForm')) { JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_jce'); $form = JForm::getInstance('com_jce.component', 'config', array('control' => 'params'), false, '/config'); if ($group) { return $form->getFieldset($group); } return $form; } else { $component = WFExtensionHelper::getComponent(); // get params definitions $params = json_decode($component->params); $rules = isset($params->access) ? $params->access : null; // Build the form control. $curLevel = 0; $actions = $this->getActions(); $groups = $this->getUserGroups(); $tabs = array('<ul class="nav nav-tabs">'); $content = array('<div class="tabs-content">'); foreach ($groups as $group) { $difLevel = $group->level - $curLevel; $html = array(); $item = new StdClass(); $id = $curLevel; $tabs[] = '<li><a href="#permission-' . $id . '">' . str_repeat('<span> › </span> ', $curLevel = $group->level) . $group->text . '</a></li>'; $content[] = '<div id="permission-' . $id . '" class="tab-pane">'; $content[] = '<table border="0" cellspacing="1" class="table table-striped">'; $content[] = '<thead>'; $content[] = '<tr>'; $content[] = '<th><span>' . WFText::_('WF_RULES_ACTION') . '</span></th>'; $content[] = '<th><span>' . WFText::_('WF_RULES_SELECT_SETTING') . '</span></th>'; $content[] = '</tr>'; $content[] = '</thead>'; $content[] = '<tbody>'; foreach ($actions as $action) { $content[] = '<tr>'; $content[] = '<td><label class="tooltip" for="' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(WFText::_($action->title) . '::' . WFText::_($action->description), ENT_COMPAT, 'UTF-8') . '">' . WFText::_($action->title) . '</label></td>'; $content[] = '<td>'; $content[] = '<select name="params[rules][' . $action->name . '][' . $group->value . ']" id="' . $action->name . '_' . $group->value . '" title="' . WFText::sprintf('WF_RULES_SELECT_ALLOW_DENY_GROUP', WFText::_($action->title), trim($group->text)) . '">'; $assetRule = $this->checkRule($rules, $action->name, $group->value); $content[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_ALLOWED') . '</option>'; $content[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_DENIED') . '</option>'; $content[] = '</select>  '; $content[] = '</td>'; $content[] = '</tr>'; } $content[] = '</tbody>'; $content[] = '</table>'; $content[] = '</div>'; } $tabs[] = '</ul>'; $content[] = '</div>'; return implode('', array_merge($tabs, $content)); } return null; }
function display($tpl = null) { $model = $this->getModel(); $this->document->addScript('components/com_jce/media/js/update.js?version=' . $model->getVersion()); $options = array('language' => array('check' => WFText::_('WF_UPDATES_CHECK'), 'install' => WFText::_('WF_UPDATES_INSTALL'), 'installed' => WFText::_('WF_UPDATES_INSTALLED'), 'no_updates' => WFText::_('WF_UPDATES_NONE'), 'high' => WFText::_('WF_UPDATES_HIGH'), 'medium' => WFText::_('WF_UPDATES_MEDIUM'), 'low' => WFText::_('WF_UPDATES_LOW'), 'full' => WFText::_('WF_UPDATES_FULL'), 'patch' => WFText::_('WF_UPDATES_PATCH'), 'auth_failed' => WFText::_('WF_UPDATES_AUTH_FAIL'), 'update_info' => WFText::_('WF_UPDATES_INFO'), 'install_info' => WFText::_('WF_UPDATES_INSTALL_INFO'), 'check_updates' => WFText::_('WF_UPDATES_CHECKING'))); $options = json_encode($options); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Update.init(' . $options . ');});'); parent::display($tpl); }
public function save() { // Check for request forgeries JRequest::checkToken() or die('RESTRICTED'); $db = JFactory::getDBO(); $post = JRequest::getVar('params', '', 'POST', 'ARRAY'); $registry = new JRegistry(); $registry->loadArray($post); // get params $component = WFExtensionHelper::getComponent(); // create params object from json string $params = json_decode($component->params); // set preferences object $preferences = $registry->toObject(); if (isset($preferences->rules)) { jimport('joomla.access.rules'); if (class_exists('JRules')) { $data = $this->filter($post); $rules = new JRules($data['rules']); $asset = JTable::getInstance('asset'); $option = JRequest::getCmd('option'); if (!$asset->loadByName($option)) { $root = JTable::getInstance('asset'); $root->loadByName('root.1'); $asset->name = $option; $asset->title = $option; $asset->setLocation($root->id, 'last-child'); } $asset->rules = (string) $rules; if (!$asset->check() || !$asset->store()) { JError::raiseError(500, $asset->getError()); return false; } // Joomla! 1.5 } else { $params->access = $preferences->rules; } } if (isset($preferences->preferences)) { $params->preferences = $preferences->preferences; // set params as JSON string $component->params = json_encode($params); if (!$component->check()) { JError::raiseError(500, $row->getError()); } if (!$component->store()) { JError::raiseError(500, $row->getError()); } $component->checkin(); } $close = 0; if ($this->getTask() == 'save') { $close = 1; } $this->setRedirect('index.php?option=com_jce&view=preferences&tmpl=component&close=' . $close, WFText::_('WF_PREFERENCES_SAVED')); }
public function display() { $document = WFDocument::getInstance(); $view = $this->getView(); $view->addTemplatePath(WF_EDITOR_PLUGIN . DS . 'tmpl'); $document->setTitle(WFText::_('WF_' . strtoupper($this->getName() . '_TITLE'))); $document->addScript(array('codemirror'), 'jce.tiny_mce.plugins.source.js.codemirror'); $document->addScript(array('editor'), 'plugins'); $document->addStyleSheet(array('codemirror'), 'jce.tiny_mce.plugins.source.css.codemirror'); $document->addStyleSheet(array('editor'), 'plugins'); }
function display($tpl = null) { $model = $this->getModel(); $this->addScript('components/com_jce/media/js/update.js'); $options = array('language' => array('check' => WFText::_('WF_UPDATES_CHECK'), 'install' => WFText::_('WF_UPDATES_INSTALL'), 'installed' => WFText::_('WF_UPDATES_INSTALLED'), 'no_updates' => WFText::_('WF_UPDATES_NONE'), 'high' => WFText::_('WF_UPDATES_HIGH'), 'medium' => WFText::_('WF_UPDATES_MEDIUM'), 'low' => WFText::_('WF_UPDATES_LOW'), 'full' => WFText::_('WF_UPDATES_FULL'), 'patch' => WFText::_('WF_UPDATES_PATCH'), 'auth_failed' => WFText::_('WF_UPDATES_AUTH_FAIL'), 'update_info' => WFText::_('WF_UPDATES_INFO'), 'install_info' => WFText::_('WF_UPDATES_INSTALL_INFO'), 'check_updates' => WFText::_('WF_UPDATES_CHECKING'), 'read_more' => WFText::_('WF_UPDATES_READMORE'), 'read_less' => WFText::_('WF_UPDATES_READLESS'))); $options = json_encode($options); $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Update.init(' . $options . ');});'); // load styles $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/updates.css'); parent::display($tpl); }
public function display() { parent::display(); $document = WFDocument::getInstance(); // get command, eg: mcePaste, mcePasteText $cmd = JRequest::getCmd('cmd', 'paste'); // remove mce prefix $cmd = str_replace('mce', '', $cmd); // set title $document->setTitle(WFText::_('WF_' . strtoupper($cmd) . '_TITLE')); $document->addScript(array('clipboard'), 'plugins'); $document->addStyleSheet(array('clipboard'), 'plugins'); }
function checkVersion() { $file = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml'; if (!is_file($file)) { $file = JPATH_PLUGINS . DS . 'system' . 'jcemediabox' . DS . 'jcemediabox.xml'; } $required = $this->get('_requires'); if ($xml = JApplicationHelper::parseXMLInstallFile($file)) { if (version_compare($xml['version'], (int) $required, '<')) { echo '<p class="required">' . WFText::sprintf('WF_POPUPS_JCEMEDIABOX_VERSION_ERROR', $required) . '</p>'; } } }
/** * Execute the theme item * @access public */ public function execute() { WFToken::checkToken() or die('RESTRICTED ACCESS'); $document = WFDocument::getInstance(array('title' => WFText::_('WF_' . strtoupper($this->get('dialog')) . '_TITLE'), 'version' => $this->getVersion(), 'name' => $this->get('dialog'))); $this->display(); // pack assets if required $document->pack(true, $this->getParam('editor.compress_gzip', 0)); // get view $view = $this->getView(); // set body output $document->setBody($view->loadTemplate()); $document->render(); }
/** * Display the plugin */ function display() { parent::display(); $document = WFDocument::getInstance(); $document->setTitle(WFText::_('WF_' . strtoupper($this->getElementName()) . '_TITLE')); $document->addScript(array('xhtmlxtras'), 'plugins'); $document->addStyleSheet(array('xhtmlxtras'), 'plugins'); $document->addScriptDeclaration('XHTMLXtrasDialog.settings=' . json_encode($this->getSettings()) . ';'); $tabs = WFTabs::getInstance(array('base_path' => WF_EDITOR_PLUGIN)); $tabs->addTab('standard'); if ($this->getElementName() == 'attributes') { $tabs->addTab('events'); } }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = (string) $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); // pattern data attribute for editable select input box if ((string) $node->attributes()->parent) { $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name); $items = array(); foreach (explode(';', (string) $node->attributes()->parent) as $item) { $items[] = $prefix . $item; } $attributes['data-parent'] = implode(';', $items); } $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $width = (int) $params->get('browser_width', 780); $height = (int) $params->get('browser_height', 560); wfimport('admin.models.model'); $model = new WFModel(); $link = $model->getBrowserLink($attributes['id'], $filter); $html .= '<a href="' . $link . '" id="' . $attributes['id'] . '_browser' . '" class="browser" target="_blank" onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
/** * Fetches update information from the server using cURL or fopen * @param string $url The URL to check * @param string $data Data to send via POST * * @return mixed Result string on success, false on failure */ public function check($url, $data) { $result = false; if (self::hasCURL()) { $ch = curl_init($url); self::applyCACert($ch); curl_setopt($ch, CURLOPT_HEADER, 0); // Pretend we are Firefox, so that webservers play nice with us curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110105 Firefox/3.6.14'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // needed to display errors curl_setopt($ch, CURLOPT_FAILONERROR, true); // The @ sign allows the next line to fail if open_basedir is set or if safe mode is enabled @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); @curl_setopt($ch, CURLOPT_MAXREDIRS, 20); // add post data if ($data) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } $result = curl_exec($ch); // file download if ($result === false) { $error = curl_error($ch); $num = (int) curl_errno($ch); if (!$error && $num === 7) { $error = 'Failed to connect() to host or proxy'; } curl_close($ch); return array('error' => 'CURL ERROR : ' . $num . ' - ' . $error); } curl_close($ch); } else { if (self::hasFOPEN()) { $options = array('http' => array('method' => 'POST', 'timeout' => 10, 'content' => $data)); $context = stream_context_create($options); $result = @file_get_contents($url, false, $context); if ($result === false) { return array('error' => WFText::_('Update check failed : Invalid response from update server')); } } } return $result; }
/** * Writes a configuration button and invokes a cancel operation (eg a checkin) * @param string The name of the component, eg, com_content * @param int The height of the popup * @param int The width of the popup * @param string The name of the button * @param string An alternative path for the configuation xml relative to JPATH_SITE * @since 1.0 */ public static function updates($enabled = false) { $bar = JToolBar::getInstance('toolbar'); // Add a configuration button $options = array('size' => array('x' => 780, 'y' => 560), 'handler' => 'iframe'); $link = 'index.php?option=com_jce&view=updates&tmpl=component'; if ($enabled) { JHtml::_('behavior.modal'); if (class_exists('JHtmlSidebar')) { $html = '<button onclick="Joomla.modal(this, \'' . $link . '\', 780, 560);return false;" class="btn btn-small" title="' . WFText::_('WF_UPDATES') . '"><i class="icon-upload"></i> ' . WFText::_('WF_UPDATES') . '</button>'; } else { $html = '<a href="' . $link . '" target="_blank" rel="' . str_replace('"', "'", json_encode($options)) . '" class="modal help" title="' . WFText::_('WF_UPDATES') . '">'; $html .= '<span class="icon-32-default icon-32-update" title="' . WFText::_('WF_HELP') . '"></span>' . WFText::_('WF_UPDATES') . '</a>'; } } $bar->appendButton('Custom', $html, 'updates'); }
/** * Writes a configuration button and invokes a cancel operation (eg a checkin) * @param string The name of the component, eg, com_content * @param int The height of the popup * @param int The width of the popup * @param string The name of the button * @param string An alternative path for the configuation xml relative to JPATH_SITE * @since 1.0 */ public static function updates($enabled = false) { $bar = JToolBar::getInstance('toolbar'); // Add a configuration button $w = 780; $h = 560; $link = 'index.php?option=com_jce&view=updates&tmpl=component'; if ($enabled) { JHtml::_('behavior.modal'); if (class_exists('JHtmlSidebar')) { $html = '<button onclick="' . self::createClick($link, $w, $h) . '" class="btn btn-small" title="' . WFText::_('WF_UPDATES') . '"><i class="icon-upload"></i> ' . WFText::_('WF_UPDATES') . '</button>'; } else { $html = '<a href="' . $link . '" target="_blank" onclick="' . self::createClick($link, $w, $h) . '" class="updates" title="' . WFText::_('WF_UPDATES') . '">'; $html .= '<span class="icon-32-default icon-32-update" title="' . WFText::_('WF_HELP') . '"></span>' . WFText::_('WF_UPDATES') . '</a>'; } } $bar->appendButton('Custom', $html, 'updates'); }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = (string) $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); // pattern data attribute for editable select input box if ((string) $node->attributes()->parent) { $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name); $items = array(); foreach (explode(';', (string) $node->attributes()->parent) as $item) { $items[] = $prefix . $item; } $attributes['data-parent'] = implode(';', $items); } $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $options = array('width' => 780, 'height' => 560, 'modal' => true, 'id' => $attributes['id'] . '_browser'); wfimport('admin.models.model'); $model = new WFModel(); $html .= '<a href="' . $model->getBrowserLink($attributes['id'], $filter) . '" class="dialog browser" target="_blank" data-options="' . str_replace('"', "'", json_encode($options)) . '" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
function display($tpl = null) { $db = JFactory::getDBO(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jcemediabox'); $client = JRequest::getWord('client', 'site'); $model = $this->getModel(); $plugin = JPluginHelper::getPlugin('system', 'jcemediabox'); $params = $this->getParams($plugin->params); $this->assign('params', $params); $this->assign('client', $client); wfimport('admin.models.editor'); $options = array('stylesheets' => (array) WFModelEditor::getStyleSheets(), 'labels' => array('picker' => WFText::_('WF_COLORPICKER_PICKER'), 'palette' => WFText::_('WF_COLORPICKER_PALETTE'), 'named' => WFText::_('WF_COLORPICKER_NAMED'), 'template' => WFText::_('WF_COLORPICKER_TEMPLATE'), 'color' => WFText::_('WF_COLORPICKER_COLOR'), 'apply' => WFText::_('WF_COLORPICKER_APPLY'), 'name' => WFText::_('WF_COLORPICKER_NAME')), 'parent' => '#jce'); $this->addScriptDeclaration('jQuery(document).ready(function($){$("input.color").colorpicker(' . json_encode($options) . ');});'); WFToolbarHelper::apply(); WFToolbarHelper::save(); WFToolbarHelper::help('mediabox.config'); parent::display($tpl); }