Example #1
1
function entry(&$argv)
{
    if (is_file($argv[0])) {
        if (0 === substr_compare($argv[0], '.class.php', -10)) {
            $uri = realpath($argv[0]);
            if (null === ($cl = \lang\ClassLoader::getDefault()->findUri($uri))) {
                throw new \Exception('Cannot load ' . $uri . ' - not in class path');
            }
            return $cl->loadUri($uri)->literal();
        } else {
            if (0 === substr_compare($argv[0], '.xar', -4)) {
                $cl = \lang\ClassLoader::registerPath($argv[0]);
                if (!$cl->providesResource('META-INF/manifest.ini')) {
                    throw new \Exception($cl->toString() . ' does not provide a manifest');
                }
                $manifest = parse_ini_string($cl->getResource('META-INF/manifest.ini'));
                return strtr($manifest['main-class'], '.', '\\');
            } else {
                array_unshift($argv, 'eval');
                return 'xp\\runtime\\Evaluate';
            }
        }
    } else {
        return strtr($argv[0], '.', '\\');
    }
}
 protected function getInput()
 {
     $html = '';
     $db = JFactory::getDbo();
     $options = JUDownloadHelper::getFieldGroupOptions();
     if ($this->element['usenone'] == 'true') {
         array_unshift($options, array('value' => '0', 'text' => JText::_('COM_JUDOWNLOAD_NONE')));
     }
     if ($this->element['useinherit'] == 'true') {
         $appendInherit = "";
         if ($this->form->getValue("id")) {
             $appendInherit = " ( " . JText::_('COM_JUDOWNLOAD_NONE') . " )";
             if ($this->form->getValue("id") > 0) {
                 $catObj = JUDownloadHelper::getCategoryById($this->form->getValue("parent_id"));
                 if ($catObj->fieldgroup_id > 1) {
                     $query = "SELECT name, published FROM #__judownload_fields_groups WHERE id = " . (int) $catObj->fieldgroup_id . " AND id != 1";
                     $db->setQuery($query);
                     $fieldgroup = $db->loadObject();
                     $groupName = $fieldgroup->published != 1 ? "[" . $fieldgroup->name . "]" : $fieldgroup->name;
                     $appendInherit = "( " . $groupName . " )";
                 }
             }
         }
         array_unshift($options, array('value' => '-1', 'text' => JText::_('COM_JUDOWNLOAD_INHERIT') . $appendInherit));
     } else {
         array_unshift($options, array('value' => '', 'text' => JText::_('COM_JUDOWNLOAD_SELECT_FIELD_GROUP')));
     }
     $required_class = $this->element['required'] == 'true' ? 'required' : '';
     $attributes = "class=\"inputbox {$required_class}\"";
     $html .= JHtml::_('select.genericlist', $options, $this->name, $attributes, 'value', 'text', $this->value, $this->id);
     return $html;
 }
Example #3
1
 function display($tmpl_file, $app_id = null)
 {
     array_unshift($this->_files, $tmpl_file);
     $this->_vars = $this->pagedata;
     if ($p = strpos($tmpl_file, ':')) {
         $object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
         if ($object) {
             $tmpl_file_path = substr($tmpl_file, $p + 1);
             $last_modified = $object->last_modified($tmpl_file_path);
         }
     } else {
         $tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
         $last_modified = filemtime($tmpl_file);
     }
     if (!$last_modified) {
         //无文件
     }
     $compile_id = $this->compile_id($tmpl_file);
     if ($object) {
         $compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
     } else {
         $compile_code = $this->_compiler()->compile_file($tmpl_file);
     }
     eval('?>' . $compile_code);
     array_shift($this->_files);
 }
Example #4
1
 /**
  * Get an HTML select list of the available languages.
  *
  * @return	string
  */
 public static function getLanguageList()
 {
     $languages = array();
     $languages = JLanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true);
     array_unshift($languages, JHtml::_('select.option', '', JText::_('JDEFAULT')));
     return JHtml::_('select.genericlist', $languages, 'lang', ' class="inputbox"', 'value', 'text', null);
 }
Example #5
0
 public function register($path, $namespace = 'default')
 {
     if (!isset($this->_paths[$namespace])) {
         $this->_paths[$namespace] = array();
     }
     array_unshift($this->_paths[$namespace], $path);
 }
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     // path to images directory
     $path = JPATH_ROOT . DS . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $recursive = $node->attributes('recursive') == 1 ? true : false;
     $folders = JFolder::folders($path, $filter, $recursive);
     $folders = $this->recursive_listdir($path, $node);
     $options = array();
     foreach ($folders as $key => $folder) {
         if ($exclude) {
             if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                 continue;
             }
         }
         $options[] = JHTML::_('select.option', $key, $folder);
     }
     if (!$node->attributes('hide_none')) {
         array_unshift($options, JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -'));
     }
     if (!$node->attributes('hide_default')) {
         array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Use default') . ' -'));
     }
     $fullName = ElementHelper::getFullName($this, $control_name, $name);
     return JHTML::_('select.genericlist', $options, $fullName, 'class="inputbox"', 'value', 'text', $value, "params{$name}");
 }
 function __construct(&$lines, $level)
 {
     $res = array();
     $body = array();
     while (count($lines)) {
         $line = array_shift($lines);
         // Blank lines just get a carriage return added (for markdown) and otherwise ignored
         if (!trim($line)) {
             $body[] = "\n";
             continue;
         }
         // Get the indent
         preg_match('/^(\\s*)/', $line, $match);
         $indent = $match[1];
         // Check to make sure we're still indented
         if (strlen($indent) <= $level) {
             array_unshift($lines, $line);
             break;
         }
         // Check for tag
         if (preg_match('/^@([^\\s]+)(.*)$/', trim($line), $match)) {
             $tag = $match[1];
             $sub = new RESTDocblockParser($lines, strlen($indent));
             $sub['details'] = trim($match[2]);
             if (!isset($res[$tag])) {
                 $res[$tag] = new RESTDocblockParser_Sequence();
             }
             $res[$tag][] = $sub;
         } else {
             $body[] = substr($line, $level > 0 ? $level : 0);
         }
     }
     $res['body'] = Markdown(implode("", $body));
     $this->res = $res;
 }
Example #8
0
 public function action_index($options = array("max" => 10, "current" => 1, "count" => 5))
 {
     $model = array();
     $pages = array();
     $max_page = $options["max"];
     // Максимальное количество страниц
     $current_page = $options["current"];
     // Текущая страница
     $pages_length = $options["count"];
     // Количество номеров страниц (нечётное число)
     $next_prev_pages = floor($pages_length / 2);
     // Количество доп. страниц
     $pages[] = array("href" => "#", "active" => "active", "num" => $current_page);
     // Создание доп. страниц
     for ($i = 1; $i <= $next_prev_pages; $i++) {
         if ($current_page - $i > 1) {
             array_unshift($pages, array("href" => URL::query(array("page" => $current_page - $i)), "num" => $current_page - $i));
         }
         if ($current_page + $i < $max_page) {
             array_push($pages, array("href" => URL::query(array("page" => $current_page + $i)), "num" => $current_page + $i));
         }
     }
     if ($current_page > 1) {
         $model["min_page"] = array("num" => 1, "href" => URL::query(array("page" => 1)));
         $model["prev_href"] = URL::query(array("page" => $current_page - 1));
     }
     if ($current_page < $max_page) {
         $model["max_page"] = array("num" => $max_page, "href" => URL::query(array("page" => $max_page)));
         $model["next_href"] = URL::query(array("page" => $current_page + 1));
     }
     $model["pages"] = $pages;
     $this->set_template("/widgets/twig_pagination.php", "twig")->render($model)->body();
 }
Example #9
0
 /**
  * Filter
  *
  * @return void
  */
 public function filter()
 {
     /*
      * Variable qui contient la chaine de recherche
      */
     if (is_array($this->terms)) {
         $stringSearch = implode(' ', $this->terms);
     } else {
         $stringSearch = $this->terms;
     }
     /*
      * On divise en mots (séparé par des espace)
      */
     $words = preg_split('`\\s+`', $stringSearch, -1, PREG_SPLIT_NO_EMPTY);
     if (count($words) > 1) {
         array_unshift($words, $stringSearch);
     }
     $words = array_unique($words);
     $conds = [];
     foreach ($words as $index => $word) {
         foreach ($this->columns as $colName) {
             $cond = $this->queryBuilder->expr()->like($colName, ':word_' . ($index + 1));
             $this->queryBuilder->setParameter('word_' . ($index + 1), '%' . $word . '%');
             $conds[] = $cond;
         }
     }
     $this->queryBuilder->andWhere(implode(' OR ', $conds));
 }
Example #10
0
 /**
  * Customises the backup progress bar
  *
  * @global moodle_page $PAGE
  * @return array
  */
 public function get_progress_bar()
 {
     global $PAGE;
     $stage = self::STAGE_COMPLETE;
     $currentstage = $this->stage->get_stage();
     $items = array();
     while ($stage > 0) {
         $classes = array('backup_stage');
         if (floor($stage / 2) == $currentstage) {
             $classes[] = 'backup_stage_next';
         } else {
             if ($stage == $currentstage) {
                 $classes[] = 'backup_stage_current';
             } else {
                 if ($stage < $currentstage) {
                     $classes[] = 'backup_stage_complete';
                 }
             }
         }
         $item = array('text' => strlen(decbin($stage * 2)) . '. ' . get_string('importcurrentstage' . $stage, 'backup'), 'class' => join(' ', $classes));
         if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && (!self::$skipcurrentstage || $stage * 2 != $currentstage)) {
             $item['link'] = new moodle_url($PAGE->url, $this->stage->get_params() + array('backup' => $this->get_backupid(), 'stage' => $stage));
         }
         array_unshift($items, $item);
         $stage = floor($stage / 2);
     }
     $selectorlink = new moodle_url($PAGE->url, $this->stage->get_params());
     $selectorlink->remove_params('importid');
     array_unshift($items, array('text' => '1. ' . get_string('importcurrentstage0', 'backup'), 'class' => join(' ', $classes), 'link' => $selectorlink));
     return $items;
 }
 public function on_start()
 {
     $this->error = Loader::helper('validation/error');
     if (USER_REGISTRATION_WITH_EMAIL_ADDRESS == true) {
         $this->set('uNameLabel', t('Email Address'));
     } else {
         $this->set('uNameLabel', t('Username'));
     }
     $txt = Loader::helper('text');
     if (strlen($_GET['uName'])) {
         // pre-populate the username if supplied, if its an email address with special characters the email needs to be urlencoded first,
         $this->set("uName", trim($txt->email($_GET['uName'])));
     }
     $languages = array();
     $locales = array();
     if (Config::get('LANGUAGE_CHOOSE_ON_LOGIN')) {
         Loader::library('3rdparty/Zend/Locale');
         Loader::library('3rdparty/Zend/Locale/Data');
         $languages = Localization::getAvailableInterfaceLanguages();
         if (count($languages) > 0) {
             array_unshift($languages, 'en_US');
         }
         $locales = array('' => t('** Default'));
         Zend_Locale_Data::setCache(Cache::getLibrary());
         foreach ($languages as $lang) {
             $loc = new Zend_Locale($lang);
             $locales[$lang] = Zend_Locale::getTranslation($loc->getLanguage(), 'language', ACTIVE_LOCALE);
         }
     }
     $this->locales = $locales;
     $this->set('locales', $locales);
     $this->openIDReturnTo = BASE_URL . View::url("/login", "complete_openid");
 }
Example #12
0
 public function __()
 {
     $args = func_get_args();
     $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), 'Mage_GoogleCheckout');
     array_unshift($args, $expr);
     return Mage::app()->getTranslator()->translate($args);
 }
 function hook_menu(&$items)
 {
     // Change the item to a tab.
     $this->plugin['menu']['items']['list']['type'] = MENU_LOCAL_TASK;
     $this->plugin['menu']['items']['list']['weight'] = -6;
     $this->plugin['menu']['items']['list']['title'] = 'List defaults';
     // menu local actions are weird.
     $this->plugin['menu']['items']['add']['path'] = 'list/add';
     $this->plugin['menu']['items']['import']['path'] = 'list/import';
     // Edit is being handled elsewhere.
     unset($this->plugin['menu']['items']['edit callback']);
     unset($this->plugin['menu']['items']['access']);
     foreach (panelizer_operations() as $path => $operation) {
         $location = isset($operation['ui path']) ? $operation['ui path'] : $path;
         if (isset($this->plugin['menu']['items'][$location])) {
             unset($this->plugin['menu']['items'][$location]);
         }
     }
     // Change the callbacks for everything.
     foreach ($this->plugin['menu']['items'] as $key => $item) {
         // The item has already been set; continue to next item to avoid shifting
         // items onto the page arguments array more than once.
         if ($this->plugin['menu']['items'][$key]['access callback'] == 'panelizer_has_choice_callback') {
             continue;
         }
         $this->plugin['menu']['items'][$key]['access callback'] = 'panelizer_has_choice_callback';
         $this->plugin['menu']['items'][$key]['access arguments'] = array(3, 4, '');
         $this->plugin['menu']['items'][$key]['page callback'] = 'panelizer_export_ui_switcher_page';
         array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 4);
         array_unshift($this->plugin['menu']['items'][$key]['page arguments'], 3);
     }
     parent::hook_menu($items);
 }
Example #14
0
function act_plugin_action_links($links)
{
    $settings_link = '<a href="admin.php?page=act_admin#act_date">' . __('Settings') . '</a>';
    $uninstall_link = '<a href="admin.php?page=act_admin#act_reset">' . __('Uninstall') . '</a>';
    array_unshift($links, $settings_link, $uninstall_link);
    return $links;
}
Example #15
0
 /**
  * Formats a message as a block of text.
  *
  * @param string|array $messages The message to write in the block
  * @param string|null $type The block type (added in [] on first line)
  * @param string|null $style The style to apply to the whole block
  * @param string $prefix The prefix for the block
  * @param bool $padding Whether to add vertical padding
  */
 public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
 {
     $this->autoPrependBlock();
     $messages = is_array($messages) ? array_values($messages) : array($messages);
     $lines = array();
     // add type
     if (null !== $type) {
         $messages[0] = sprintf('[%s] %s', $type, $messages[0]);
     }
     // wrap and add newlines for each element
     foreach ($messages as $key => $message) {
         $message = OutputFormatter::escape($message);
         $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
         if (count($messages) > 1 && $key < count($messages) - 1) {
             $lines[] = '';
         }
     }
     if ($padding && $this->isDecorated()) {
         array_unshift($lines, '');
         $lines[] = '';
     }
     foreach ($lines as &$line) {
         $line = sprintf('%s%s', $prefix, $line);
         $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
         if ($style) {
             $line = sprintf('<%s>%s</>', $style, $line);
         }
     }
     $this->writeln($lines);
     $this->newLine();
 }
Example #16
0
 private function _request($request)
 {
     $request = array_map('Comet_encode', $request);
     array_unshift($request, $this->ORIGIN);
     $ctx = stream_context_create(array('http' => array('timeout' => 200)));
     return json_decode(file_get_contents_curl(implode('/', $request)), true);
 }
Example #17
0
 public function select($name, $options = array())
 {
     $options += array('name' => $name, 'options' => array(), 'value' => null, 'empty' => false);
     $select_options = array_unset($options, 'options');
     $select_value = array_unset($options, 'value');
     if (($empty = array_unset($options, 'empty')) !== false) {
         $keys = array_keys($select_options);
         if (is_array($empty)) {
             $empty_keys = array_keys($empty);
             $key = $empty_keys[0];
             $values = array_merge($empty, $select_options);
         } else {
             $key = $empty;
             $values = array_merge(array($empty), $select_options);
         }
         array_unshift($keys, $key);
         $select_options = array_combine($keys, $values);
     }
     $content = '';
     foreach ($select_options as $key => $value) {
         $option = array('value' => $key);
         if ((string) $key === (string) $select_value) {
             $option['selected'] = true;
         }
         $content .= $this->html->tag('option', $value, $option);
     }
     return $this->html->tag('select', $content, $options);
 }
Example #18
0
 /**
  * Return the Add Form as HTML
  * @return 
  */
 public function AddForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     // Would like to get the regions width / height
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING);
     $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING);
     Theme::Set('form_id', 'ModuleForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=AddMedia');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" id="iRegionId" name="regionid" value="' . $regionid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" />');
     // Source list
     Theme::Set('source_field_list', array(array('sourceid' => '1', 'source' => 'Feed'), array('sourceid' => '2', 'source' => 'DataSet')));
     // Data set list
     $datasets = $user->DataSetList();
     array_unshift($datasets, array('datasetid' => '0', 'dataset' => 'None'));
     Theme::Set('dataset_field_list', $datasets);
     // Return
     $this->response->html = Theme::RenderReturn('media_form_ticker_add');
     $this->response->dialogTitle = __('Add New Ticker');
     if ($this->showRegionOptions) {
         $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
     } else {
         $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
     return $this->response;
 }
Example #19
0
 public function __construct($kirbytext, $name, $tag)
 {
     if (is_null($kirbytext)) {
         $kirbytext = new Kirbytext('');
     }
     $this->page = $kirbytext->field->page;
     $this->kirbytext = $kirbytext;
     $this->name = $name;
     $this->html = kirbytext::$tags[$name]['html'];
     // get a list with all attributes
     $attributes = isset(kirbytext::$tags[$name]['attr']) ? (array) kirbytext::$tags[$name]['attr'] : array();
     // add the name as first attribute
     array_unshift($attributes, $name);
     if (is_array($tag)) {
         foreach ($attributes as $key) {
             if (isset($tag[$key])) {
                 $this->attr[$key] = $tag[$key];
             }
         }
     } else {
         // extract all attributes
         $search = preg_split('!(' . implode('|', $attributes) . '):!i', $tag, false, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
         $num = 0;
         foreach ($search as $key) {
             if (!isset($search[$num + 1])) {
                 break;
             }
             $key = trim($search[$num]);
             $value = trim($search[$num + 1]);
             $this->attr[$key] = $value;
             $num = $num + 2;
         }
     }
 }
 /**
  * Call external Method
  *
  * @param \Smarty_Internal_Data $data
  * @param string                $name external method names
  * @param array                 $args argument array
  *
  * @return mixed
  * @throws SmartyException
  */
 public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
 {
     /* @var Smarty $data ->smarty */
     $smarty = isset($data->smarty) ? $data->smarty : $data;
     if (!isset($smarty->ext->{$name})) {
         $class = 'Smarty_Internal_Method_' . ucfirst($name);
         if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
             if (!isset($this->_property_info[$prop = $match[2]])) {
                 // convert camel case to underscored name
                 $this->resolvedProperties[$prop] = $pn = strtolower(join('_', preg_split('/([A-Z][^A-Z]*)/', $prop, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
                 $this->_property_info[$prop] = property_exists($data, $pn) ? 1 : ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
             }
             if ($this->_property_info[$prop]) {
                 $pn = $this->resolvedProperties[$prop];
                 if ($match[1] == 'get') {
                     return $this->_property_info[$prop] == 1 ? $data->{$pn} : $data->smarty->{$pn};
                 } else {
                     return $this->_property_info[$prop] == 1 ? $data->{$pn} = $args[0] : ($data->smarty->{$pn} = $args[0]);
                 }
             } elseif (!class_exists($class)) {
                 throw new SmartyException("property '{$pn}' does not exist.");
             }
         }
         if (class_exists($class)) {
             $callback = array($smarty->ext->{$name} = new $class(), $name);
         }
     } else {
         $callback = array($smarty->ext->{$name}, $name);
     }
     array_unshift($args, $data);
     if (isset($callback) && $callback[0]->objMap | $data->_objType) {
         return call_user_func_array($callback, $args);
     }
     return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
 }
Example #21
0
 /**
  * @param string $interface
  */
 public function addInterface($interface)
 {
     if ($this->hasInterface($interface)) {
         return;
     }
     array_unshift($this->interfaces, $interface);
 }
Example #22
0
 function render()
 {
     array_unshift($this->output, $this->initial);
     $this->output[] = '}';
     $output = implode($this->glue, $this->output);
     return $output;
 }
Example #23
0
 /**
  * Translate a phrase
  *
  * @return string
  */
 public function __()
 {
     $args = func_get_args();
     $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getRealModuleName());
     array_unshift($args, $expr);
     return AO::app()->getTranslator()->translate($args);
 }
Example #24
0
 protected function _renderCellTemplate($columnName)
 {
     $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
     if ($columnName == "template") {
         $collection = Mage::getResourceModel('core/email_template_collection')->load();
         $arr_select = $collection->toOptionArray();
         array_unshift($arr_select, array('label' => Mage::helper('rewardpoints')->__('Default'), 'value' => ''));
         return $this->_getTemplateRenderer()->setName($inputName)->setTitle($columnName)->setExtraParams('style="width:260px"')->setOptions($arr_select)->toHtml();
     } else {
         if ($columnName == "sender") {
             $arr_select = array();
             $config = Mage::getSingleton('adminhtml/config')->getSection('trans_email')->groups->children();
             foreach ($config as $node) {
                 $nodeName = $node->getName();
                 $label = (string) $node->label;
                 $sortOrder = (int) $node->sort_order;
                 $arr_select[$sortOrder] = array('value' => preg_replace('#^ident_(.*)$#', '$1', $nodeName), 'label' => Mage::helper('adminhtml')->__($label));
             }
             ksort($arr_select);
             /*array_unshift(
                   $arr_select,
                   array(
                       'label' => Mage::helper('rewardpoints')->__('Default'),
                       'value' => ''
                   )
               );*/
             return $this->_getSenderRenderer()->setName($inputName)->setTitle($columnName)->setExtraParams('style="width:260px"')->setOptions($arr_select)->toHtml();
         }
     }
     return parent::_renderCellTemplate($columnName);
 }
 /**
  * Return JS configuration of the htmlArea plugins registered by the extension
  *
  * @return string JS configuration for registered plugins
  */
 public function buildJavascriptConfiguration()
 {
     $schema = array('types' => array(), 'properties' => array());
     // Parse configured schemas
     if (is_array($this->configuration['thisConfig']['schema.']) && is_array($this->configuration['thisConfig']['schema.']['sources.'])) {
         foreach ($this->configuration['thisConfig']['schema.']['sources.'] as $source) {
             $fileName = trim($source);
             $absolutePath = GeneralUtility::getFileAbsFileName($fileName);
             // Fallback to default schema file if configured file does not exists or is of zero size
             if (!$fileName || !file_exists($absolutePath) || !filesize($absolutePath)) {
                 $fileName = 'EXT:' . $this->extensionKey . '/Resources/Public/Rdf/MicrodataSchema/SchemaOrgAll.rdf';
             }
             $fileName = $this->getFullFileName($fileName);
             $rdf = file_get_contents($fileName);
             if ($rdf) {
                 $this->parseSchema($rdf, $schema);
             }
         }
     }
     uasort($schema['types'], array($this, 'compareLabels'));
     uasort($schema['properties'], array($this, 'compareLabels'));
     // Insert no type and no property entries
     $languageService = $this->getLanguageService();
     $noSchema = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/MicrodataSchema/locallang.xlf:No type');
     $noProperty = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/MicrodataSchema/locallang.xlf:No property');
     array_unshift($schema['types'], array('name' => 'none', 'label' => $noSchema));
     array_unshift($schema['properties'], array('name' => 'none', 'label' => $noProperty));
     // Store json encoded array in temporary file
     return 'RTEarea[editornumber].schemaUrl = "' . $this->writeTemporaryFile('schema_' . $this->configuration['language'], 'js', json_encode($schema)) . '";';
 }
 protected function _beforeToHtml()
 {
     $account = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
     $magentoOrdersSettings = $account->getData('magento_orders_settings');
     $magentoOrdersSettings = !empty($magentoOrdersSettings) ? json_decode($magentoOrdersSettings, true) : array();
     // ---------------------------------------
     $temp = Mage::getModel('core/website')->getCollection()->setOrder('sort_order', 'ASC')->toArray();
     $this->websites = $temp['items'];
     // ---------------------------------------
     // ---------------------------------------
     $temp = Mage::getModel('customer/group')->getCollection()->toArray();
     $this->groups = $temp['items'];
     // ---------------------------------------
     // ---------------------------------------
     $selectedStore = !empty($magentoOrdersSettings['listing']['store_id']) ? $magentoOrdersSettings['listing']['store_id'] : '';
     $blockStoreSwitcher = $this->getLayout()->createBlock('M2ePro/adminhtml_storeSwitcher', '', array('id' => 'magento_orders_listings_store_id', 'name' => 'magento_orders_settings[listing][store_id]', 'selected' => $selectedStore));
     $blockStoreSwitcher->hasDefaultOption(false);
     $this->setChild('magento_orders_listings_store_id', $blockStoreSwitcher);
     // ---------------------------------------
     // ---------------------------------------
     $selectedStore = !empty($magentoOrdersSettings['listing_other']['store_id']) ? $magentoOrdersSettings['listing_other']['store_id'] : '';
     $blockStoreSwitcher = $this->getLayout()->createBlock('M2ePro/adminhtml_storeSwitcher', '', array('id' => 'magento_orders_listings_other_store_id', 'name' => 'magento_orders_settings[listing_other][store_id]', 'selected' => $selectedStore));
     $blockStoreSwitcher->hasDefaultOption(false);
     $this->setChild('magento_orders_listings_other_store_id', $blockStoreSwitcher);
     // ---------------------------------------
     // ---------------------------------------
     $productTaxClasses = Mage::getModel('tax/class')->getCollection()->addFieldToFilter('class_type', Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->toOptionArray();
     $none = array('value' => Ess_M2ePro_Model_Magento_Product::TAX_CLASS_ID_NONE, 'label' => 'None');
     array_unshift($productTaxClasses, $none);
     $this->productTaxClasses = $productTaxClasses;
     // ---------------------------------------
     return parent::_beforeToHtml();
 }
Example #27
0
 protected function execute($report, $query, $parameters)
 {
     $report->DB()->SetFetchMode(ADODB_FETCH_ASSOC);
     $rs = $report->DB()->Execute($query, $parameters);
     if (!$rs) {
         error_log($report->DB()->ErrorMsg());
         return array("ERROR", "Error generating report");
     }
     $reportNamesFilled = false;
     $columnNames = array();
     $reportData = array();
     foreach ($rs as $rowId => $row) {
         $reportData[] = array();
         if (!$reportNamesFilled) {
             $countIt = 0;
             foreach ($row as $name => $value) {
                 $countIt++;
                 $columnNames[$countIt] = $name;
                 $reportData[count($reportData) - 1][] = $value;
             }
             $reportNamesFilled = true;
         } else {
             foreach ($row as $name => $value) {
                 $reportData[count($reportData) - 1][] = $value;
             }
         }
     }
     array_unshift($reportData, $columnNames);
     return $reportData;
 }
function bctt_options_link($links)
{
    $settingsText = sprintf(__('Settings', 'better-click-to-tweet'));
    $settings_link = '<a href="options-general.php?page=better-click-to-tweet">' . $settingsText . '</a>';
    array_unshift($links, $settings_link);
    return $links;
}
Example #29
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.language.help');
     $helpsites = JHelp::createSiteList(JPATH_ADMINISTRATOR . DS . 'help' . DS . 'helpsites-15.xml', $value);
     array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local')));
     return JHTML::_('select.genericlist', $helpsites, '' . $control_name . '[' . $name . ']', ' class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Example #30
0
 public function getOptionText($value)
 {
     if (!$value) {
         $value = '0';
     }
     $isMultiple = false;
     if (strpos($value, ',')) {
         $isMultiple = true;
         $value = explode(',', $value);
     }
     if (!$this->_options) {
         $collection = Mage::getResourceModel('core/store_collection');
         if ('store_id' == $this->getAttribute()->getAttributeCode()) {
             $collection->setWithoutDefaultFilter();
         }
         $this->_options = $collection->load()->toOptionArray();
         if ('created_in' == $this->getAttribute()->getAttributeCode()) {
             array_unshift($this->_options, array('value' => '0', 'label' => Mage::helper('customer')->__('Admin')));
         }
     }
     if ($isMultiple) {
         $values = array();
         foreach ($value as $val) {
             $values[] = $this->_options[$val];
         }
         return $values;
     } else {
         return $this->_options[$value];
     }
     return false;
 }