public static function ui($name) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . '/elements/jbetolo.css'); return ''; }
public static function ui($name) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . '/elements/clearcache.js'); $document->addScriptDeclaration("\n var _jbetoloclearcache;\n\n window.addEvent('domready', function() {\n _jbetoloclearcache = new jbetoloclearcache({\n base: '" . JURI::base() . "',\n prefix: '" . (jbetoloHelper::isJ16() ? 'jform_params_' : 'params') . "',\n j16: " . (jbetoloHelper::isJ16() ? 'true' : 'false') . ",\n PLG_SYSTEM_JBETOLO_CACHE_CLEARED: '" . JText::_('PLG_SYSTEM_JBETOLO_CACHE_CLEARED') . "',\n });\n });\n "); $ui = "\n <div class='fieldContainer'>\n <ul class='btns'>\n <li><a id='clearSiteCacheBtn' title='" . JText::_('PLG_SYSTEM_JBETOLO_CACHE_CLEAR_SITE') . "' href='#'>" . JText::_('PLG_SYSTEM_JBETOLO_CACHE_CLEAR_SITE') . "</a></li>\n <li><a id='clearAdministratorCacheBtn' title='" . JText::_('PLG_SYSTEM_JBETOLO_CACHE_CLEAR_ADMINISTRATOR') . "' href='#'>" . JText::_('PLG_SYSTEM_JBETOLO_CACHE_CLEAR_ADMINISTRATOR') . "</a></li>\n </ul>\n </div>\n "; return $ui; }
public static function ui($name) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . '/elements/htaccess.js'); $document->addScriptDeclaration("\n window.addEvent('domready', function() {\n new jbetolohtaccess({base: '" . JURI::base() . "'});\n });\n "); $ui = "\n <div class='fieldContainer'>\n <button type='button' id='htaccessBtn'>" . JText::_('PLG_SYSTEM_JBETOLO_HTACCESS_PATCH_BTN') . "</button>\n </div>\n "; return $ui; }
public static function ui($name) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . '/elements/cdnpurge.js'); $document->addScriptDeclaration("\n window.addEvent('domready', function() {\n new jbetolocdnpurge({base: '" . JURI::base() . "'});\n });\n "); $ui = "\n <div class='fieldContainer'>\n <div style='clear:both;'><label for='cdnpurgeCDN'>CDN</label><select id='cdnpurgeCDN'><option>maxcdn</option><option>cloudfront</option></select></div>\n <div style='clear:both;'><label for='cdnpurgePurge'>File to purge</label><input id='cdnpurgePurge' type='text' size='90' /></div>\n <div style='clear:both;'><label for='cdnpurgeKeys'>Keys</label><input id='cdnpurgeKeys' type='text' size='90' /><ul style='clear:both;'><li>maxcdn = APIKEY::APIID</li><li>cloudfront = ACCESSKEYID::SECRETKEYID::DISTRIBUTIONID</li></ul></div>\n <div style='clear:both;'><button type='button' id='cdnpurgeBtn'>" . JText::_('PLG_SYSTEM_JBETOLO_CDNPURGE_BTN') . "</button></div>\n </div>\n "; return $ui; }
public static function ui($name, $fileList) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . '/elements/jbetolosettings.js'); $document->addScriptDeclaration("\n var _jbetolosettings;\n\n window.addEvent('domready', function() {\n _jbetolosettings = new jbetolosettings({\n base: '" . JURI::base() . "',\n settingsSelectorID: '" . $name . "',\n prefix: '" . (jbetoloHelper::isJ16() ? 'jform_params_' : 'params') . "',\n j16: " . (jbetoloHelper::isJ16() ? 'true' : 'false') . ",\n PLG_JBETOLO_PREDEFINED_SUCCESS: '" . JText::_('PLG_JBETOLO_PREDEFINED_SUCCESS') . "',\n PLG_JBETOLO_PREDEFINED_CONFIRM: '" . JText::_('PLG_JBETOLO_PREDEFINED_CONFIRM') . "',\n PLG_JBETOLO_PREDEFINED_SAVENAME: '" . JText::_('PLG_JBETOLO_PREDEFINED_SAVENAME') . "',\n PLG_JBETOLO_PREDEFINED_SAVEAUTHOR: '" . JText::_('PLG_JBETOLO_PREDEFINED_SAVEAUTHOR') . "',\n PLG_JBETOLO_PREDEFINED_SAVEFAILURE: '" . JText::_('PLG_JBETOLO_PREDEFINED_SAVEFAILURE') . "',\n PLG_JBETOLO_PREDEFINED_SAVESUCCESS: '" . JText::_('PLG_JBETOLO_PREDEFINED_SAVESUCCESS') . "',\n PLG_JBETOLO_PREDEFINED_NAMEEXISTS: '" . JText::_('PLG_JBETOLO_PREDEFINED_NAMEEXISTS') . "'\n });\n });\n "); $ui = "\n <div class='fieldContainer'>\n <ul class='btns'>\n <li>" . $fileList . "</li>\n <li><a id='saveSettingBtn' title='" . JText::_('PLG_JBETOLO_PREDEFINED_SAVE') . "' href='#'>" . JText::_('PLG_JBETOLO_PREDEFINED_SAVE') . "</a></li>\n <li><a id='readSettingBtn' title='" . JText::_('PLG_JBETOLO_PREDEFINED_READ') . "' href='#'>" . JText::_('PLG_JBETOLO_PREDEFINED_READ') . "</a></li>\n <li><a id='pingBtn' title='" . JText::_('PLG_JBETOLO_PING') . "' href='#'>" . JText::_('PLG_JBETOLO_PING') . "</a></li>\n </ul>\n </div>\n "; JHTML::_('behavior.modal'); return $ui; }
public static function ui($name) { if (jbetoloHelper::isJ16()) { $name = str_replace('-', '_', $name); } $document = JFactory::getDocument(); $loc = JURI::root(true) . '/plugins/system/jbetolo/' . (jbetoloHelper::isJ16() ? 'jbetolo/' : '') . 'elements/'; $document->addScript($loc . 'smushit.js'); $document->addScriptDeclaration("\n var _jbetolosmushit;\n\n window.addEvent('domready', function() {\n _jbetolosmushit = new jbetolosmushit({\n base: '" . JURI::base() . "',\n smushitDir: '" . $name . "',\n j16: " . (jbetoloHelper::isJ16() ? 'true' : 'false') . ",\n PLG_JBETOLO_SMUSHIT_DIRECTORY: '" . JText::_('PLG_JBETOLO_SMUSHIT_DIRECTORY') . "'\n });\n });\n "); $ui = '<div class="fieldContainer"> <ul> <li><img id="smushitprogress" src="' . $loc . 'progress.gif" style="visibility:hidden;" /><input type="text" name="' . $name . '" id="' . $name . '" value="" size="50" /><button type="button" id="smushItBtn">' . JText::_('PLG_JBETOLO_SMUSHIT_BTN') . '</button></li> <li><input type="checkbox" name="' . $name . '_replace" id="' . $name . '_replace" />' . JText::_('PLG_JBETOLO_SMUSHIT_REPLACE') . '</li> <li><input type="checkbox" name="' . $name . '_recursive" id="' . $name . '_recursive" />' . JText::_('PLG_JBETOLO_SMUSHIT_RECURSIVE') . '</li> <li><input type="text" name="' . $name . '_fix" id="' . $name . '_fix" value="_smush" />' . JText::_('PLG_JBETOLO_SMUSHIT_FIX') . '</li> </ul> </div> '; return $ui; }
<?php //$Copyright$ defined('_JEXEC') or die('Restricted access'); if (jbetoloHelper::isJ16()) { class JFormFieldCDNJS extends JFormFieldList { public $type = 'CDNJS'; protected function getOptions() { $options = array(); require_once dirname(__FILE__) . '/../assets/cdnjs.php'; foreach ($cdnjs as $key => $option) { // Create a new option object based on the <option /> element. $tmp = JHtml::_('select.option', $option, JText::alt(trim($key), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', false); // Add the option object to the result set. $options[] = $tmp; } reset($options); return $options; } } } else { class JElementCDNJS extends JElement { public function fetchElement($name, $value, &$node, $control_name) { return 'CDNJS'; } } }
public static function getMetaData($name, $isField = true, $attr = '') { jimport('joomla.application.helper'); $xml = simplexml_load_file(JApplicationHelper::getPath('plg_xml', 'system' . DS . 'jbetolo')); if ($isField) { $path = jbetoloHelper::isJ16() ? "config/fields/fieldset/field" : "params/param"; $result = $xml->xpath($path . "[@name='" . $name . "']"); if ($attr) { $result = $result[0]; $result = $result->attributes(); $result = (string) $result[$attr]; } } else { $result = $xml->xpath($name); $result = (string) $result[0]; } return $result; }
/** * both getter and setter of plugin parameters * (de)serializes indicated params before getting resp. setting */ public static function param($name, $value = '', $dir = 'get') { static $plg, $params, $_params; if (!isset($params)) { $plg = JPluginHelper::getPlugin('system', 'jbetolo'); if (!$plg) { return; } if (version_compare(JVERSION, '2.5', 'ge')) { $params = new JRegistry($plg->params); } else { jimport('joomla.html.parameter'); $params = new JParameter($plg->params); } } if ($dir == 'set') { static $plgT, $db, $plgId, $j16; if (!isset($db)) { $j16 = jbetoloHelper::isJ16(); $db = JFactory::getDBO(); JTable::addIncludePath(JPATH_SITE . '/libraries/joomla/database/table/'); $plgT = JTable::getInstance(!$j16 ? 'plugin' : 'extension'); if ($j16) { $query = "SELECT extension_id FROM #__extensions WHERE type = 'plugin' AND folder = 'system' AND element = 'jbetolo' LIMIT 1"; } else { $query = "SELECT id FROM #__plugins WHERE folder = 'system' AND element = 'jbetolo' LIMIT 1"; } $db = JFactory::getDBO(); $db->setQuery($query); $plgId = $db->loadResult(); } $files = ''; if ($value instanceof JRegistry || $value instanceof JParameter) { $params = $value; $files = $params->get('files'); } else { if (in_array($name, self::$serializableParams)) { $value = serialize($value); } if ($name == 'files') { $files = $value; } else { $params->set($name, $value); } } if ($files) { JFile::write(JBETOLO_FILES_CACHE, $files); } $params->set('files', null); $plgT->bind(array($j16 ? 'extension_id' : 'id' => $plgId, 'params' => $params->toString($j16 ? 'JSON' : 'INI'))); if (!$plgT->store()) { return JError::raiseWarning(500, $db->getError()); } if (!empty($name)) { unset($_params[$name]); } } else { if (!isset($_params[$name]) || in_array($name, self::$serializableParams) && !is_array($_params[$name])) { if ($name == 'files') { $files = JFile::exists(JBETOLO_FILES_CACHE) ? JFile::read(JBETOLO_FILES_CACHE) : ''; $params->set('files', $files); $files = null; } $_params[$name] = $params->get($name); if (is_string($_params[$name])) { $_params[$name] = trim($_params[$name]); } if (!isset($_params[$name])) { $_params[$name] = $value; } if (in_array($name, self::$serializableParams)) { if (isset($_params[$name]) && !empty($_params[$name])) { $_params[$name] = @unserialize($_params[$name]); } if (empty($_params[$name])) { $_params[$name] = array(); } } } return $_params[$name]; } }