function getInput() { JHtml::_('behavior.modal'); //$this->_loadAssets(); $this->_setOptions(); if ($this->container->hasParameter('roksprocket.current_provider')) { /** @var RokSprocket_IProvider $provider */ $provider = $this->container->getParameter('roksprocket.current_provider'); $provider->filterPerItemTypes($this->type, $this->fieldname, $this->options); } if (preg_match("/^-([a-z]{1,})-\$/", $this->value)) { if ($this->value == '-article-' && preg_match("/_title\$/", $this->id)) { $this->value = '-title-'; } $this->isCustom = false; } $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . ' peritempicker' . (count($this->options) == 1 ? ' single' : '') . '"' : ' class="peritempicker"'; $placeholder = $this->element['placeholder'] ? ' placeholder="' . (string) $this->element['placeholder'] . '"' : ''; $html = array(); $cleaned_value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'); $html[] = '<div class="peritempicker-wrapper' . (!$this->isCustom ? ' peritempicker-noncustom' : '') . '" data-peritempicker="true" data-peritempicker-id="' . $this->id . '" data-peritempicker-name="' . $this->name . '">'; $html[] = ' <input data-peritempicker-display="true" data-original-title="' . $cleaned_value . '" type="text" value="' . $cleaned_value . '" ' . $class . $placeholder . ' />'; $html[] = ' <input type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $cleaned_value . '" />'; $html[] = $this->_getDropdown(); $html[] = '</div>'; return implode("\n", $html); }
/** * Finds the path to the file where the class is defined. * * @param string $class The name of the class * * @return bool|null|string The path, if found */ public function find($class) { $classpath = get_object_vars($this->container->getParameter($this->classpath_key)); krsort($classpath); $current_md5 = md5(RokCommon_Utils_ArrayHelper::toString($classpath)); if ($this->last_md5 != $current_md5) { $this->last_md5 = $current_md5; $found_maps = array(); foreach ($classpath as $priority => $priority_paths) { foreach ($priority_paths as $path) { if (!in_array($path, $this->checked_paths)) { $this->checked_paths[] = $path; if (is_dir($path)) { $path = $path . DIRECTORY_SEPARATOR . self::MAP_FILE_DEFAULT_NAME; } if (!in_array($path, $this->checked_paths) && is_file($path)) { if (($path_map = @(include $path)) && is_array($path_map)) { $found_maps[] = $path_map; } else { if (defined('ROKCOMMON_CORE_DEBUG') && ROKCOMMON_CORE_DEBUG) { error_log(sprintf('%s: Unable to load map file %s as a valid class map', get_class($this), $path)); } } } } } if (isset($this->maps[$priority]) && !empty($found_maps)) { $this->maps[$priority] = array_merge($this->maps[$priority], (array) $found_maps); } elseif (!empty($found_maps)) { $this->maps[$priority] = (array) $found_maps; } } krsort($this->maps); } if ('\\' === $class[0]) { $class = substr($class, 1); } foreach ($this->maps as $priority_maps) { foreach ($priority_maps as $map) { if (isset($map[$class])) { return $map[$class]; } } } return false; }
/** * @param RokSprocket_ItemCollection $items * @param RokCommon_Registry $parameters */ public function initialize(RokSprocket_ItemCollection $items, RokCommon_Registry $parameters) { $this->setItems($items); $this->setParameters($parameters); $this->layoutPackage = sprintf('roksprocket_layout_%s', $this->name); // setup the theme packages and content and info $this->theme = $this->parameters->get($this->name . '_themes', 'default'); $this->themePackage = sprintf('%s_%s', $this->layoutPackage, $this->theme); $paths = $this->container[sprintf('roksprocket.layouts.%s.paths', $this->name)]; $paths[] = $this->container->platforminfo->getPathForTemplate($this->container->roksprocket_platformhelper->getCurrentTemplate()) . '/' . $this->container->getParameter('roksprocket.template.subdir') . '/layouts/' . $this->name; foreach ($paths as $order => $path) { RokCommon_Composite::addPackagePath($this->layoutPackage, $path, $order); RokCommon_Composite::addPackagePath($this->themePackage, $path . '/themes/' . $this->theme, $order); } $this->theme_context = RokCommon_Composite::get($this->themePackage); $this->cleanItemParams(); }
function getInput() { JHtml::_('behavior.modal'); //$this->_loadAssets(); $this->_setOptions(); if ($this->container->hasParameter('roksprocket.current_provider')) { /** @var RokSprocket_IProvider $provider */ $provider = $this->container->getParameter('roksprocket.current_provider'); $provider->filterPerItemTypes($this->type, $this->fieldname, $this->options); } if (preg_match("/^-([a-z]{1,})-\$/", $this->value)) { if ($this->value == '-article-' && preg_match("/_title\$/", $this->id)) { $this->value = '-title-'; } $this->isCustom = false; } if (!$this->value) { $this->value = array(); } if (!is_array($this->value)) { if (strpos($this->value, ',') === false) { $this->value = array($this->value); } else { $this->value = explode(",", preg_replace("/\\s/", "", $this->value)); } } $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . ' peritempickertags' . (count($this->options) == 1 ? ' single' : '') . '"' : ' class="peritempickertags"'; $placeholder = $this->element['placeholder'] ? ' placeholder="' . (string) $this->element['placeholder'] . '"' : ''; $html = array(); //$cleaned_value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'); $html[] = '<div class="peritempickertags-wrapper' . (!$this->isCustom ? ' peritempickertags-noncustom' : '') . '" data-peritempickertags="true" data-peritempickertags-id="' . $this->id . '" data-peritempickertags-name="' . $this->name . '">'; $html[] = '<div class="tags" data-tags>'; $html[] = ' <ul class="tags-holder" data-tags-holder>'; $html[] = $this->_createTags(); $html[] = ' <li class="tags-input main-input"><input type="text" data-tags-maininput style="width: 15px;" /></li>'; $html[] = ' </ul>'; $html[] = ' <input type="hidden" id="' . $this->id . '" name="' . $this->name . '" ' . $class . ' value="' . implode(", ", $this->value) . '" data-tags-input data-peritempickertags-display="true" />'; //$html[] = ' <input data-peritempickertags-display="true" data-original-title="'.$cleaned_value.'" type="text" value="'.$cleaned_value.'" '.$class.$placeholder.' />'; $html[] = '</div>'; //$html[] = ' <input type="hidden" id="'.$this->id.'" name="'.$this->name.'" value="'.$cleaned_value.'" />'; $html[] = $this->_getDropdown(); $html[] = '</div>'; return implode("\n", $html); }
/** * @param string $class * * @return bool|string */ public function find($class) { $paths = get_object_vars($this->container->getParameter($this->classpath_key)); ksort($paths); if ('\\' == $class[0]) { $class = substr($class, 1); } if (false !== ($pos = strrpos($class, '\\'))) { // namespaced class name $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; $className = substr($class, $pos + 1); } else { // PEAR-like class name $classPath = null; $className = $class; } $classPathParts = array(); if (!empty($classPath)) { $classPathParts = explode(DIRECTORY_SEPARATOR, $classPath); } $nameStartPosition = count($classPathParts); $classNameParts = explode('_', $className); $classPathParts = array_merge($classPathParts, $classNameParts); $partsCount = count($classPathParts); if (count($classPathParts) > 0) { // check for compiled first foreach ($paths as $priority_paths) { foreach ($priority_paths as $dir) { $pos = $partsCount - 1; do { $path = $dir . DIRECTORY_SEPARATOR . $classPath . implode(DIRECTORY_SEPARATOR, array_slice($classPathParts, 0, $pos)); $path .= $pos != $nameStartPosition ? DIRECTORY_SEPARATOR : null; $path .= implode('_', array_slice($classPathParts, $pos)) . '.php'; if (($path = $this->fileExists($path, false)) !== false) { return $path; } } while (--$pos >= $nameStartPosition); } } } return false; }
/** * @param $class * * @return bool|string */ protected function findFileForClass($class) { $prefixes = $this->container->getParameter('classloader.allowed_prefixes'); $findit = false; foreach ($prefixes as $allowed_prefix) { if (stripos($class, $allowed_prefix) === 0) { $findit = true; break; } } if ($findit) { foreach ($this->finders as $finder) { /** @var $finder RokCommon_ClassLoader_IFinder */ if ($file = $finder->find($class)) { return $file; } } } return false; }
/** * @param null $ajax_path */ public function renderGlobalHeaders($ajax_path = null) { if (!self::$globalHeadersRendered) { if (defined('_JEXEC')) { JHtml::_('behavior.framework'); } RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('mootools-mobile.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('rokmediaqueries.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('roksprocket.js')); /** @var $platforminfo RokCommon_IPlatformInfo */ $platforminfo = $this->container->getService('platforminfo'); $ns = array(); $ns[] = "if (typeof RokSprocket == 'undefined') RokSprocket = {};"; $ns[] = "Object.merge(RokSprocket, {"; $ns[] = "\tSiteURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl(), true)) . "',"; $ns[] = "\tCurrentURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl(), true)) . "',"; $ns[] = "\tAjaxURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl() . $ajax_path)) . "'"; $ns[] = "});"; RokCommon_Header::addInlineScript(implode("\n", $ns) . "\n"); self::$globalHeadersRendered = true; } }
/** * @throws \RokCommon_Config_Exception */ protected function process() { /** @var $ret array */ $ret = array(); if ($this->context) { if ($this->mode == self::MODE_BASEDIR) { $ret = $this->context->getAll($this->filename); } elseif ($this->mode == self::MODE_CHILDDIR) { $ret = $this->context->getAllSubFiles($this->filename); } else { throw new RokCommon_Config_Exception(rc__('Unknown mode of %s on config', $this->mode)); } ksort($ret, SORT_NUMERIC); $parameters = new RokCommon_Registry(); foreach ($ret as $priority => $files) { foreach ($files as $file) { $file_xml = RokCommon_Utils_XMLHelper::getXML($file, true); if (!isset($file_xml['name'])) { throw new RokCommon_Config_Exception(rc__('No "name" attribute defined on config %s', $file)); } // add the infomation to the container $param_path = explode('_', $this->identifier); $param_path[] = (string) $file_xml['name']; self::$parameters->set(implode('.', $param_path) . '.name', (string) $file_xml['name']); self::$parameters->set(implode('.', $param_path) . '.display_name', isset($file_xml['displayName']) ? (string) $file_xml['displayName'] : $file_xml['name']); self::$parameters->set(implode('.', $param_path) . '.config_file', $file); $this->container->addParameters(self::$parameters->toArray()); self::mergeNodes($this->joined_xml, $file_xml); } } foreach ($this->subentries as $subentry) { if ($this->jointype == self::JOINTYPE_MERGE) { self::mergeNodes($this->joined_xml, $subentry->get()); } else { throw new RokCommon_Config_Exception(rc__('Unknown Join Type of %s on config', $this->jointype)); } } } //self::reorderNodes($this->joined_xml); }
public function __construct() { $this->container = RokCommon_Service::getContainer(); $this->assets_content = $this->container->getParameter('form.validator.assets.context'); }
/** * @return mixed */ public function onBeforeCompileHead() { /** @var $header RokCommon_Header_Joomla */ $header = $this->contaier->getService('header'); $header->populate(); }
/** * Method to get the id used for the field input tag. * * @param string $fieldId The field element id. * @param string $fieldName The field element name. * * @return string The id to be used for the field input tag. * @since 1.6 */ public function getId($fieldId, $fieldName) { /** @var $namehandler RokCommon_Form_IItemNameHandler */ $namehandler = $this->container->getService('form.namehandler'); return $namehandler->getId($fieldName, $fieldId, $this->group, $this->formControl, false); }