function get_token_from_guids($guids) { $guids = array_unique($guids); sort($guids); $string = implode(',', $guids); return md5($string); }
/** * * get array of slide classes, between two sections. */ public function getArrClasses($startText = "", $endText = "", $explodeonspace = false) { $content = $this->cssContent; //trim from top if (!empty($startText)) { $posStart = strpos($content, $startText); if ($posStart !== false) { $content = substr($content, $posStart, strlen($content) - $posStart); } } //trim from bottom if (!empty($endText)) { $posEnd = strpos($content, $endText); if ($posEnd !== false) { $content = substr($content, 0, $posEnd); } } //get styles $lines = explode("\n", $content); $arrClasses = array(); foreach ($lines as $key => $line) { $line = trim($line); if (strpos($line, "{") === false) { continue; } //skip unnessasary links if (strpos($line, ".caption a") !== false) { continue; } if (strpos($line, ".tp-caption a") !== false) { continue; } //get style out of the line $class = str_replace("{", "", $line); $class = trim($class); //skip captions like this: .tp-caption.imageclass img if (strpos($class, " ") !== false) { if (!$explodeonspace) { continue; } else { $class = explode(',', $class); $class = $class[0]; } } //skip captions like this: .tp-caption.imageclass:hover, :before, :after if (strpos($class, ":") !== false) { continue; } $class = str_replace(".caption.", ".", $class); $class = str_replace(".tp-caption.", ".", $class); $class = str_replace(".", "", $class); $class = trim($class); $arrWords = explode(" ", $class); $class = $arrWords[count($arrWords) - 1]; $class = trim($class); $arrClasses[] = $class; } sort($arrClasses); return $arrClasses; }
/** * Image Manager Popup * * @param string $listFolder The image directory to display * @since 1.5 */ function getFolderList($base = null) { global $mainframe; // Get some paths from the request if (empty($base)) { $base = JA_WORKING_DATA_FOLDER; } // Get the list of folders jimport('joomla.filesystem.folder'); $folders = JFolder::folders($base, '.', 4, true); // Load appropriate language files $lang =& JFactory::getLanguage(); $lang->load(JRequest::getCmd('option'), JPATH_ADMINISTRATOR); $document =& JFactory::getDocument(); $document->setTitle(JText::_('Insert Image')); // Build the array of select options for the folder list $options[] = JHTML::_('select.option', "", "/"); foreach ($folders as $folder) { $folder = str_replace(JA_WORKING_DATA_FOLDER, "", $folder); $value = substr($folder, 1); $text = str_replace(DS, "/", $folder); $options[] = JHTML::_('select.option', $value, $text); } // Sort the folder list array if (is_array($options)) { sort($options); } // Create the drop-down folder select list $list = JHTML::_('select.genericlist', $options, 'folderlist', "class=\"inputbox\" size=\"1\" onchange=\"ImageManager.setFolder(this.options[this.selectedIndex].value)\" ", 'value', 'text', $base); return $list; }
private static function listCommands() { $commands = array(); $dir = __DIR__; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != "base.php") { $s1 = explode("cli_", $entry); $s2 = explode(".php", $s1[1]); if (sizeof($s2) == 2) { require_once "{$dir}/{$entry}"; $command = $s2[0]; $className = "cli_{$command}"; $class = new $className(); if (is_a($class, "cliCommand")) { $commands[] = $command; } } } } closedir($handle); } sort($commands); return implode(" ", $commands); }
/** * getTableList * * @return Array A list of tables based off the table schema that should be present in the system. */ public function getTableList() { $tables = $this->getExpectedSchema(); $tables = array_keys($tables); sort($tables); return $tables; }
/** * Execute the action. * * @param array command line parameters specific for this command */ public function run($args) { $runner = $this->getCommandRunner(); $commands = $runner->commands; if (isset($args[0])) { $name = strtolower($args[0]); } if (!isset($args[0]) || !isset($commands[$name])) { echo <<<EOD At the prompt, you may enter a PHP statement or one of the following commands: EOD; $commandNames = array_keys($commands); sort($commandNames); echo ' - ' . implode("\n - ", $commandNames); echo <<<EOD Type 'help <command-name>' for details about a command. To expand the above command list, place your command class files under 'protected/commands/shell', or a directory specified by the 'YIIC_SHELL_COMMAND_PATH' environment variable. The command class must extend from CConsoleCommand. EOD; } else { echo $runner->createCommand($name)->getHelp(); } }
/** * Gets a pipe-separated string of available languages * * @return string */ public function getAvailable() { $languagesArray = $this->languages; //Make local copy sort($languagesArray); return implode('|', array_reverse($languagesArray)); }
/** * Takes the included files and breaks up into mutli arrays for use in the debugger * @param array $files * @return Ambigous <multitype:unknown , unknown> */ public function setup_files(array $files) { sort($files); $path_third = realpath(eedt_third_party_path()); $path_ee = realpath(APPPATH); $path_first_modules = realpath(PATH_MOD); $bootstrap_file = FCPATH . SELF; $return = array(); foreach ($files as $file) { if (strpos($file, $path_third) === 0) { $return['third_party_addon'][] = $file; continue; } if (strpos($file, $path_first_modules) === 0) { $return['first_party_modules'][] = $file; continue; } if (strpos($file, $bootstrap_file) === 0) { $return['bootstrap_file'] = $file; continue; } if (strpos($file, $path_ee) === 0) { $return['expressionengine_core'][] = $file; continue; } $return['other_files'][] = $file; } return $return; }
public function beforeFilter() { parent::beforeFilter(); // Update current semester, if needed if (date('m') < 5) { // Winter semester $this->currentSemester = date('Y') . '01'; } elseif (date('m') < 9) { // Summer semester $this->currentSemester = date('Y') . '05'; } else { // Autumn semester $this->currentSemester = date('Y') . '09'; } if ($this->Session->read('Registration.semester') != '') { $this->registrationSemester = $this->Session->read('Registration.semester'); } else { $this->registrationSemester = '201501'; $this->Session->write('Registration.semester', $this->registrationSemester); } // If unregistration is still possible for current semester, add it to the registration semesters list if (!in_array($this->currentSemester, $this->registrationSemesters) && $this->deadlines[$this->currentSemester]['drop_fee'] >= date('Ymd')) { $this->registrationSemesters[] = $this->currentSemester; sort($this->registrationSemesters); } }
/** * @dataProvider dataProviderForMode */ public function testMode(array $numbers, $modes) { $computed_modes = Average::mode($numbers); sort($modes); sort($computed_modes); $this->assertEquals($modes, $computed_modes); }
function display_array_content_style($arrayname, $method, $base_url) { $a = ""; sort($arrayname); while (list($key, $value) = each($arrayname)) { if (is_array($value)) { $c = display_array_content($value, ''); $d = ltrim($c, "0"); $d = str_replace("-", "", $c); $a .= "<a id='modal_window_link' href='" . $base_url . "output/print.output.php?section=styles&view=" . $c . "&tb=true'>" . $d . "</a>"; } else { $e = ltrim($value, "0"); $e = str_replace("-", "", $value); $a .= "<a id='modal_window_link' href='" . $base_url . "output/print.output.php?section=styles&view=" . $value . "&tb=true'>" . $e . "</a>"; } if ($method == "1") { $a .= ""; } if ($method == "2") { $a .= " "; } if ($method == "3") { $a .= ", "; } } $b = rtrim($a, " "); $b = rtrim($b, " "); return $b; }
public function execute(PhutilArgumentParser $args) { $can_recover = id(new PhabricatorPeopleQuery())->setViewer($this->getViewer())->withIsAdmin(true)->execute(); if (!$can_recover) { throw new PhutilArgumentUsageException(pht('This Phabricator installation has no recoverable administrator ' . 'accounts. You can use `bin/accountadmin` to create a new ' . 'administrator account or make an existing user an administrator.')); } $can_recover = mpull($can_recover, 'getUsername'); sort($can_recover); $can_recover = implode(', ', $can_recover); $usernames = $args->getArg('username'); if (!$usernames) { throw new PhutilArgumentUsageException(pht('You must specify the username of the account to recover.')); } else { if (count($usernames) > 1) { throw new PhutilArgumentUsageException(pht('You can only recover the username for one account.')); } } $username = head($usernames); $user = id(new PhabricatorPeopleQuery())->setViewer($this->getViewer())->withUsernames(array($username))->executeOne(); if (!$user) { throw new PhutilArgumentUsageException(pht('No such user "%s". Recoverable administrator accounts are: %s.', $username, $can_recover)); } if (!$user->getIsAdmin()) { throw new PhutilArgumentUsageException(pht('You can only recover administrator accounts, but %s is not an ' . 'administrator. Recoverable administrator accounts are: %s.', $username, $can_recover)); } $engine = new PhabricatorAuthSessionEngine(); $onetime_uri = $engine->getOneTimeLoginURI($user, null, PhabricatorAuthSessionEngine::ONETIME_RECOVER); $console = PhutilConsole::getConsole(); $console->writeOut(pht('Use this link to recover access to the "%s" account from the web ' . 'interface:', $username)); $console->writeOut("\n\n"); $console->writeOut(' %s', $onetime_uri); $console->writeOut("\n\n"); $console->writeOut(pht('After logging in, you can use the "Auth" application to add or ' . 'restore authentication providers and allow normal logins to ' . 'succeed.') . "\n"); return 0; }
public function signRequest(RequestInterface $request, CredentialsInterface $credentials) { // Ensure that the signable query string parameters are sorted sort($this->signableQueryString); // Add the security token header if one is being used by the credentials if ($token = $credentials->getSecurityToken()) { $request->setHeader('x-amz-security-token', $token); } $request->removeHeader('x-amz-date'); $request->setHeader('Date', gmdate(\DateTime::RFC2822)); $stringToSign = $this->createCanonicalizedString($request); $request->getParams()->set('aws.string_to_sign', $stringToSign); $request->setHeader('Authorization', 'AWS ' . $credentials->getAccessKeyId() . ':' . $this->signString($stringToSign, $credentials)); // COMMONLOG(DEBUG, "send header:%s",$request->getRawHeaders()); // if(self::$isFile) // { // if(self::$filePath) // COMMONLOG(DEBUG, "souce file:%s",self::$filePath); // } // else // { // if(get_class($request) === 'Guzzle\Http\Message\EntityEnclosingRequest' && get_class($request->getBody()) === 'Guzzle\Http\EntityBody' && $request->getBody()->getContentLength() != 0) // { // COMMONLOG(DEBUG, "send msg:%s",$request->getBody()); // } // } }
private function get_data() { $this->ci->db->join('rm r', 'r.mid = m.mid'); $this->ci->db->join('url u', 'u.rid = r.rid'); $query = $this->ci->db->get_where('mn m', ['u.uid' => $this->id, 'm.mstat' => TRUE]); $result = $query->result_array(); if (!empty($result)) { $data = []; $tmp = []; foreach ($result as $val) { $mpar = $val['mpar'] == 1 ? 0 : $val['mpar']; $tmp[$val['mid']][] = json_decode_db($val['rmk']); $data[$val['mid']] = ['mid' => $val['mid'], 'mpar' => $mpar, 'mnme' => $val['mnme'], 'mico' => $val['mico'], 'mlnk' => $val['mlnk']]; } $array_key = []; foreach ($tmp as $k => $v) { $array_key[$k] = []; foreach ($v as $vv) { if (is_array($vv) == FALSE) { continue; } $array_key[$k] = array_merge($array_key[$k], $vv); } $array_key[$k] = array_unique($array_key[$k]); sort($array_key[$k]); } foreach ($data as $kk => $vvv) { $data[$kk]['key'] = $array_key[$kk]; } } return isset($data) ? $data : []; }
function test_nonunique_postmeta() { // Add two non unique post meta item $this->assertInternalType('integer', add_post_meta($this->post_id, 'nonunique', 'value')); $this->assertInternalType('integer', add_post_meta($this->post_id, 'nonunique', 'another value')); //Check they exists $this->assertEquals('value', get_post_meta($this->post_id, 'nonunique', true)); $this->assertEquals(array('value', 'another value'), get_post_meta($this->post_id, 'nonunique', false)); //Fail to delete the wrong value $this->assertFalse(delete_post_meta($this->post_id, 'nonunique', 'wrong value')); //Delete the first one $this->assertTrue(delete_post_meta($this->post_id, 'nonunique', 'value')); //Check the remainder exists $this->assertEquals('another value', get_post_meta($this->post_id, 'nonunique', true)); $this->assertEquals(array('another value'), get_post_meta($this->post_id, 'nonunique', false)); //Add a third one $this->assertInternalType('integer', add_post_meta($this->post_id, 'nonunique', 'someother value')); //Check they exists $expected = array('someother value', 'another value'); sort($expected); $this->assertTrue(in_array(get_post_meta($this->post_id, 'nonunique', true), $expected)); $actual = get_post_meta($this->post_id, 'nonunique', false); sort($actual); $this->assertEquals($expected, $actual); //Delete the lot $this->assertTrue(delete_post_meta_by_key('nonunique')); }
/** * @inheritdoc */ public function visitTagNode($tag, $definition) { // If the tag is not closed or if nest limit is not set then continue with the children if ($tag->getClosed() !== TagNode::CLOSED || is_null($definition->nestLimit)) { foreach ($tag->getChildren() as $child) { $child->accept($this); } return; } // Visitor applies. Retrieve the proper tagName to check against if (isset($definition->nestGroup)) { sort($definition->nestGroup); $tagName = implode(':', $definition->nestGroup); } else { $tagName = $definition->tag; } // Increment current tag count $this->tagList[$tagName] = ($this->tagList[$tagName] ?? 0) + 1; // Check for over-nesting if ($this->tagList[$tagName] > $definition->nestLimit) { $this->engine->addError($tagName, '[' . $tagName . '] cannot be nested more than ' . $definition->nestLimit . ' times.'); $tag->setClosed(TagNode::PARTIAL); } // Check the children foreach ($tag->getChildren() as $child) { $child->accept($this); } // Decrement current tag number --$this->tagList[$tagName]; }
public function fetch() { // Обработка действий if ($this->request->method('post')) { // Действия с выбранными $ids = $this->request->post('check'); if (is_array($ids)) { switch ($this->request->post('action')) { case 'delete': foreach ($ids as $id) { $this->brands->delete_brand($id); } break; } } // Сортировка $positions = $this->request->post('positions'); $ids = array_keys($positions); sort($positions); foreach ($positions as $i => $position) { $this->brands->update_brand($ids[$i], array('position' => $position)); } } $brands = $this->brands->get_brands(); $this->design->assign('brands', $brands); return $this->body = $this->design->fetch('brands.tpl'); }
/** * @inheritdoc */ public function render($context, $targetDir) { parent::render($context, $targetDir); if ($this->controller !== null) { $this->controller->stdout("writing packages file..."); } $packages = []; $notNamespaced = []; foreach (array_merge($context->classes, $context->interfaces, $context->traits) as $type) { /* @var $type TypeDoc */ if (empty($type->namespace)) { $notNamespaced[] = str_replace('\\', '-', $type->name); } else { $packages[$type->namespace][] = str_replace('\\', '-', $type->name); } } ksort($packages); $packages = array_merge(['Not namespaced' => $notNamespaced], $packages); foreach ($packages as $name => $classes) { sort($packages[$name]); } file_put_contents($targetDir . '/packages.txt', serialize($packages)); if ($this->controller !== null) { $this->controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); } }
public function getHTML() { wfProfileIn(__METHOD__); $this->report->loadSources(); $aData = array(); $aLabel = array(); if (count($this->report->reportSources) == 0) { return ''; } foreach ($this->report->reportSources as $reportSource) { $reportSource->getData(); $this->actualDate = $reportSource->actualDate; if (!empty($reportSource->dataAll) && !empty($reportSource->dataTitles)) { if (is_array($reportSource->dataAll)) { foreach ($reportSource->dataAll as $key => $val) { if (isset($aData[$key])) { $aData[$key] = array_merge($aData[$key], $val); } else { $aData[$key] = $val; } } } $aLabel += $reportSource->dataTitles; } } sort($aData); $this->sourceData = array_reverse($aData); $this->sourceLabels = array_reverse($aLabel); $oTmpl = F::build('EasyTemplate', array(dirname(__FILE__) . "/templates/")); /** @var $oTmpl EasyTemplate */ $oTmpl->set_vars(array('data' => $this->sourceData, 'labels' => $this->sourceLabels)); wfProfileOut(__METHOD__); $this->beforePrint(); return $oTmpl->render('../../templates/output/' . self::TEMPLATE_MAIN); }
/** * Execute the action. * @param array $args command line parameters specific for this command * @return integer non zero application exit code after printing help */ public function run($args) { $runner = $this->getCommandRunner(); $commands = $runner->commands; if (isset($args[0])) { $name = strtolower($args[0]); } if (!isset($args[0]) || !isset($commands[$name])) { if (!empty($commands)) { echo "Yii command runner (based on Yii v" . Yii::getVersion() . ")\n"; echo "Usage: " . $runner->getScriptName() . " <command-name> [parameters...]\n"; echo "\nThe following commands are available:\n"; $commandNames = array_keys($commands); sort($commandNames); echo ' - ' . implode("\n - ", $commandNames); echo "\n\nTo see individual command help, use the following:\n"; echo " " . $runner->getScriptName() . " help <command-name>\n"; } else { echo "No available commands.\n"; echo "Please define them under the following directory:\n"; echo "\t" . Yii::app()->getCommandPath() . "\n"; } } else { echo $runner->createCommand($name)->getHelp(); } return 1; }
public function view() { $params = array(); $filter = $_GET['filter']; if ($_GET['template']) { $this->template = General::sanitize($_GET['template']); } // Environment parameters if ($filter == 'env') { $params = array_merge($params, $this->__getEnvParams()); // Page parameters } elseif ($filter == 'page') { $params = array_merge($params, $this->__getPageParams()); // Data source parameters } elseif ($filter == 'ds') { $params = array_merge($params, $this->__getDSParams()); // All parameters } else { $params = array_merge($params, $this->__getEnvParams()); $params = array_merge($params, $this->__getPageParams()); $params = array_merge($params, $this->__getDSParams()); } sort($params); $this->_Result = $params; }
function compute_diff($base, $change) { print "<H3>Experiment {$change}</H3><TABLE>"; // get parameter values for the two runs $parameter_base = load_parameter($base); $parameter_change = load_parameter($change); // get parameters and sort them $all_parameters = array_keys($parameter_base); foreach (array_keys($parameter_change) as $parameter) { if (!array_key_exists($parameter, $parameter_base)) { $all_parameters[] = $parameter; } } sort($all_parameters); // display differences foreach ($all_parameters as $parameter) { if (!array_key_exists($parameter, $parameter_base)) { $parameter_base[$parameter] = ""; } if (!array_key_exists($parameter, $parameter_change)) { $parameter_change[$parameter] = ""; } if ($parameter_base[$parameter] != $parameter_change[$parameter]) { output_diff_line($parameter, $parameter_base[$parameter], $parameter_change[$parameter]); } } print "</TABLE>\n"; }
/** * * Sanitizes a file-upload information array. If no file has been * uploaded, the information will be returned as null. * * @param array $value An array of file-upload information. * * @return mixed The sanitized upload information array, or null. * */ public function sanitizeUpload($value) { // if the value is not required, and is blank, sanitize to null $null = !$this->_filter->getRequire() && $this->_filter->validateBlank($value); if ($null) { return null; } // has to be an array if (!is_array($value)) { return null; } // presorted list of expected keys $expect = array('error', 'name', 'size', 'tmp_name', 'type'); // remove unexpected keys foreach ($value as $key => $val) { if (!in_array($key, $expect)) { unset($value[$key]); } } // sort the list of remaining actual keys $actual = array_keys($value); sort($actual); // make sure the expected and actual keys match up if ($expect != $actual) { return null; } // if all the non-error values are empty, still null $empty = empty($value['name']) && empty($value['size']) && empty($value['tmp_name']) && empty($value['type']); if ($empty) { return null; } // everything looks ok, return as-is return $value; }
/** * Fonction qui permet de connaitre la classe d'un étudiant * @param $username : le nom d'utilisateur AD d'un étudiant * @return $classe : la classe de l'étudiant */ public static function getInfosUser($login, $password) { $user = new User(); $listeAgent = array(); $isConnected = AuthentificationLDAP::open($login, $password); if ($isConnected) { $resultat = ldap_search(self::$connexion, self::$dn, self::$user_filter); if (FALSE !== $resultat) { $entries = ldap_get_entries(self::$connexion, $resultat); foreach ($entries as $unAgent) { // On enlève les user qui servent à rien if (strpos($unAgent['dn'], "OU=Autres")) { } else { array_push($listeAgent, $unAgent['samaccountname'][0]); $user->setPrenom($unAgent[1]["dn"][0]); $user->setNom($unAgent["cn"][0]); //$user->setMail($unAgent["mail"][0]); //$user->setlstGroup($unAgent["memberof"][0]); } } if ($listeAgent[0] == NULL) { array_shift($listeAgent); } sort($listeAgent); } } else { // LEVER ERREUR ICI } return $user; }
/** * Build the Site Map */ protected function buildSiteMap() { $postsInfo = $this->getPostsInfo(); $dates = array_values($postsInfo); sort($dates); $lastmod = last($dates); $url = trim(url(), '/') . '/'; $xml = []; $xml[] = '<?xml version="1.0" encoding="UTF-8"?' . '>'; $xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $xml[] = ' <url>'; $xml[] = " <loc>{$url}</loc>"; $xml[] = " <lastmod>{$lastmod}</lastmod>"; $xml[] = ' <changefreq>daily</changefreq>'; $xml[] = ' <priority>0.8</priority>'; $xml[] = ' </url>'; foreach ($postsInfo as $slug => $lastmod) { $xml[] = ' <url>'; $xml[] = " <loc>{$url}home/{$slug}</loc>"; $xml[] = " <lastmod>{$lastmod}</lastmod>"; $xml[] = " </url>"; } $xml[] = '</urlset>'; return join("\n", $xml); }
/** Find the greatest key that is less than or equal to a given upper * bound, and return the value associated with that key. * * @param integer|null $maximumKey The upper bound for keys. If null, the * maxiumum valued key will be found. * @param array $collection An two-dimensional array of key/value pairs * to search through. * @returns mixed The value corresponding to the located key. * @throws \Zend\GData\App\Exception Thrown if $collection is empty. */ public static function findGreatestBoundedValue($maximumKey, $collection) { $found = false; $foundKey = $maximumKey; // Sanity check: Make sure that the collection isn't empty if (sizeof($collection) == 0) { throw new Exception("Empty namespace collection encountered."); } if ($maximumKey === null) { // If the key is null, then we return the maximum available $keys = array_keys($collection); sort($keys); $found = true; $foundKey = end($keys); } else { // Otherwise, we optimistically guess that the current version // will have a matching namespce. If that fails, we decrement the // version until we find a match. while (!$found && $foundKey >= 0) { if (array_key_exists($foundKey, $collection)) { $found = true; } else { $foundKey--; } } } // Guard: A namespace wasn't found. Either none were registered, or // the current protcol version is lower than the maximum namespace. if (!$found) { throw new Exception("Namespace compatible with current protocol not found."); } return $foundKey; }
public function index() { $this->set_default_side_bar(); $this->title = 'Pearfarm Help'; Nimble::set_title($this->title); sort($this->files); }
public function index() { $this->load_language('product/manufacturer'); $this->load->model('catalog/manufacturer'); $this->load->model('tool/image'); $this->document->setTitle($this->language->get('heading_title')); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false); $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'), 'separator' => $this->language->get('text_separator')); $this->data['categories'] = array(); $results = $this->model_catalog_manufacturer->getManufacturers(); foreach ($results as $result) { if (is_int(substr($result['name'], 0, 1))) { $key = '0 - 9'; } else { $key = substr(strtoupper($this->getFirstLetter($result['name'])), 0, 1); } if (!isset($this->data['manufacturers'][$key])) { $this->data['categories'][$key]['name'] = $key; } $this->data['categories'][$key]['manufacturer'][] = array('name' => $result['name'], 'href' => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $result['manufacturer_id'])); } sort($this->data['categories']); $this->data['continue'] = $this->url->link('common/home'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/manufacturer_list.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/manufacturer_list.tpl'; } else { $this->template = 'default/template/product/manufacturer_list.tpl'; } $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $this->response->setOutput($this->render()); }
/** * @return string */ public function buildSiteMap() { // we get all site pages $site_pages = $this->getSitePages(); // we only take the last mod column from the site pages $dates = array_column($site_pages, 'last_mod'); // we sort it sort($dates); // we get the website last modification date $lastmod = last($dates); // we get the base url from the website $url = route('home'); $xml = []; $xml[] = '<?xml version="1.0" encoding="UTF-8"?' . '>'; $xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $xml[] = ' <url>'; $xml[] = " <loc>{$url}</loc>"; $xml[] = " <lastmod>{$lastmod}</lastmod>"; $xml[] = ' <changefreq>daily</changefreq>'; $xml[] = ' <priority>0.8</priority>'; $xml[] = ' </url>'; foreach ($site_pages as $page) { $xml[] = " <url>"; $xml[] = " <loc>{$page['url']}</loc>"; $xml[] = " <lastmod>{$page['last_mod']}</lastmod>"; $xml[] = " </url>"; } $xml[] = '</urlset>'; return join("\n", $xml); }
protected function getInput() { $html = ''; $options = array(); $base = JPATH_ROOT . DIRECTORY_SEPARATOR . 'images'; $attr = ''; $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $options[] = JHTML::_('select.option', '', JText::_('AVATAR_SELECT_FOLDER')); $folders = JFolder::folders($base, '.', true, true); foreach ($folders as $folder) { $folder = str_replace($base, '', $folder); $value = str_replace(DIRECTORY_SEPARATOR, '/', substr($folder, 1)); $text = str_replace(DIRECTORY_SEPARATOR, '/', $folder); $options[] = JHTML::_('select.option', $value, $text); } if (is_array($options)) { sort($options); } $html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); return $html; }