本文整理汇总了PHP中uasort函数的典型用法代码示例。如果您正苦于以下问题:PHP uasort函数的具体用法?PHP uasort怎么用?PHP uasort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uasort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getActions
/**
* Get actions
*
* @return array
*/
public function getActions()
{
uasort($this->actions, function ($a, $b) {
return strnatcasecmp($a['label'], $b['label']);
});
return $this->actions;
}
开发者ID:woakes070048,项目名称:mautic,代码行数:12,代码来源:PointBuilderEvent.php
示例2: checkFilters
public function checkFilters($filters)
{
// Get the admin filter
$adminFilter['admin'] = $filters['admin'];
unset($filters['admin']);
// Sort filters by length
uasort($filters, array($this, 'sortByLength'));
// Push the admin filter first
$filters = $adminFilter + $filters;
$this->filters = $filters;
foreach ($filters as $filterName => $filterURI) {
// $slug will be FALSE if the filter is not included in the URI.
$slug = $this->getSlugAfterFilter($filterURI);
if ($slug !== false) {
$this->slug = $slug;
$this->whereAmI = $filterName;
// If the slug is empty
if (Text::isEmpty($slug)) {
if ($filterURI === '/') {
$this->whereAmI = 'home';
break;
}
if ($filterURI === $adminFilter['admin']) {
$this->whereAmI = 'admin';
$this->slug = 'dashboard';
break;
}
$this->setNotFound(true);
}
break;
}
}
}
开发者ID:clstrfcuk,项目名称:bludit,代码行数:33,代码来源:url.class.php
示例3: qa_sort_by
function qa_sort_by(&$array, $by1, $by2 = null)
{
global $qa_sort_by_1, $qa_sort_by_2;
$qa_sort_by_1 = $by1;
$qa_sort_by_2 = $by2;
uasort($array, 'qa_sort_by_fn');
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:7,代码来源:sort.php
示例4: convertCreditCards
/**
* Convert credit cards xml tree to array
*
* @param \DOMXPath $xpath
* @return array
*/
protected function convertCreditCards(\DOMXPath $xpath)
{
$creditCards = [];
/** @var \DOMNode $type */
foreach ($xpath->query('/payment/adyen_credit_cards/type') as $type) {
$typeArray = [];
/** @var $typeSubNode \DOMNode */
foreach ($type->childNodes as $typeSubNode) {
switch ($typeSubNode->nodeName) {
case 'label':
$typeArray['name'] = $typeSubNode->nodeValue;
break;
case 'code_alt':
$typeArray['code_alt'] = $typeSubNode->nodeValue;
default:
break;
}
}
$typeAttributes = $type->attributes;
$typeArray['order'] = $typeAttributes->getNamedItem('order')->nodeValue;
$ccId = $typeAttributes->getNamedItem('id')->nodeValue;
$creditCards[$ccId] = $typeArray;
}
uasort($creditCards, [$this, '_compareCcTypes']);
$config = [];
foreach ($creditCards as $code => $data) {
$config[$code] = $data;
}
return $config;
}
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:36,代码来源:Converter.php
示例5: getFieldsets
public function getFieldsets()
{
$hlp = Mage::helper('udropship');
$visible = Mage::getStoreConfig('udropship/vendor/visible_preferences');
$visible = $visible ? explode(',', $visible) : false;
$fieldsets = array();
$fieldsets['account'] = array('position' => 0, 'legend' => 'Account Information', 'fields' => array('vendor_name' => array('position' => 1, 'name' => 'vendor_name', 'type' => 'text', 'label' => 'Vendor Name'), 'vendor_attn' => array('position' => 2, 'name' => 'vendor_attn', 'type' => 'text', 'label' => 'Attention To'), 'subdomain' => array('position' => 2, 'name' => 'subdomain', 'type' => 'text', 'label' => 'Subdomain'), 'email' => array('position' => 3, 'name' => 'email', 'type' => 'text', 'label' => 'Email Address / Login'), 'password' => array('position' => 4, 'name' => 'password', 'type' => 'text', 'label' => 'Login Password'), 'telephone' => array('position' => 5, 'name' => 'telephone', 'type' => 'text', 'label' => 'Telephone')));
$countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray();
$countryId = Mage::registry('vendor_data') ? Mage::registry('vendor_data')->getCountryId() : null;
if (!$countryId) {
$countryId = Mage::getStoreConfig('general/country/default');
}
$regionCollection = Mage::getModel('directory/region')->getCollection()->addCountryFilter($countryId);
$regions = $regionCollection->toOptionArray();
if ($regions) {
$regions[0]['label'] = $hlp->__('Please select state...');
} else {
$regions = array(array('value' => '', 'label' => ''));
}
$fieldsets['shipping_origin'] = array('position' => 1, 'legend' => 'Shipping Origin Address', 'fields' => array('street' => array('position' => 1, 'name' => 'street', 'type' => 'textarea', 'label' => 'Street'), 'limit_zipcode' => array('position' => 1, 'name' => 'limit_zipcode', 'type' => 'textarea', 'label' => 'Zipcodes'), 'city' => array('position' => 2, 'name' => 'city', 'type' => 'text', 'label' => 'City'), 'zip' => array('position' => 3, 'name' => 'zip', 'type' => 'text', 'label' => 'Zip / Postal code'), 'country_id' => array('position' => 4, 'name' => 'country_id', 'type' => 'select', 'label' => 'Country', 'options' => $countries), 'region_id' => array('position' => 5, 'name' => 'region_id', 'type' => 'select', 'label' => 'State', 'options' => $regions)));
$_v = Mage::getSingleton('udropship/session')->getVendor();
$hlp = Mage::helper('udropship');
$fieldsets['delivery_time'] = array('position' => 2, 'legend' => 'Delivery Time', 'fields' => array('cut_off_time' => array('position' => 1, 'name' => 'cut_off_time', 'type' => 'text', 'label' => 'Cut Off Time', 'note' => 'It must be in (24 hour format). <br/>'), 'non_working_days' => array('position' => 2, 'name' => 'non_working_days', 'type' => 'multiselect', 'label' => 'Non Delivery Days', 'options' => array(array('label' => 'Monday', 'value' => 'Monday'), array('label' => 'Tuesday', 'value' => 'Tuesday'), array('label' => 'Wednesday', 'value' => 'Wednesday'), array('label' => 'Thursday', 'value' => 'Thursday'), array('label' => 'Friday', 'value' => 'Friday'), array('label' => 'Saturday', 'value' => 'Saturday'), array('label' => 'Sunday', 'value' => 'Sunday')))));
$fieldsets['delivery_charge'] = array('position' => 3, 'legend' => 'Delivery Charge', 'fields' => array('delivery_charge' => array('position' => 1, 'name' => 'delivery_charge', 'type' => 'text', 'label' => 'Delivery Charge')));
$fieldsets['social_accounts'] = array('position' => 4, 'legend' => 'Google Reference', 'fields' => array('google_reference' => array('position' => 1, 'name' => 'google_reference', 'type' => 'text', 'label' => 'Google Reference ID')));
Mage::dispatchEvent('udropship_vendor_front_preferences', array('fieldsets' => &$fieldsets));
uasort($fieldsets, array($hlp, 'usortByPosition'));
foreach ($fieldsets as $k => $v) {
if (empty($v['fields'])) {
continue;
}
uasort($v['fields'], array($hlp, 'usortByPosition'));
}
return $fieldsets;
}
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:35,代码来源:Preferences.php
示例6: collectBundles
protected function collectBundles()
{
$finder = new Finder();
$bundles = array();
$finder->files()->followLinks()->in(array($this->getRootDir() . '/../src', $this->getRootDir() . '/../vendor'))->name('bundles.yml');
foreach ($finder as $file) {
$import = Yaml::parse($file->getRealpath());
foreach ($import['bundles'] as $bundle) {
$kernel = false;
$priority = 0;
if (is_array($bundle)) {
$class = $bundle['name'];
$kernel = isset($bundle['kernel']) && true == $bundle['kernel'];
$priority = isset($bundle['priority']) ? (int) $bundle['priority'] : 0;
} else {
$class = $bundle;
}
if (!isset($bundles[$class])) {
$bundles[$class] = array('name' => $class, 'kernel' => $kernel, 'priority' => $priority);
}
}
}
uasort($bundles, array($this, 'compareBundles'));
return $bundles;
}
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:25,代码来源:OroKernel.php
示例7: getDerivativeDefinitions
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition)
{
$base_plugin_id = $base_plugin_definition['id'];
try {
/** @var \Drupal\Core\Entity\EntityStorageInterface $views_storage */
$views_storage = $this->entityTypeManager->getStorage('view');
$all_views = $views_storage->loadMultiple();
} catch (PluginNotFoundException $e) {
return [];
}
if (!isset($this->derivatives[$base_plugin_id])) {
$plugin_derivatives = array();
/** @var \Drupal\views\Entity\View $view */
foreach ($all_views as $view) {
// Hardcoded usage of Search API views, for now.
if (strpos($view->get('base_table'), 'search_api_index') !== FALSE) {
$displays = $view->get('display');
foreach ($displays as $display_id => $display_info) {
// We only support pages and blocks because those are the ones that
// we've tested. They are also the only ones that support for
// ::isRenderedInCurrentRequest() and ::getPath().
if (in_array($display_info['display_plugin'], ['page', 'block'])) {
$machine_name = $view->id() . PluginBase::DERIVATIVE_SEPARATOR . $display_id;
$label_arguments = ['%view_name' => $view->label(), '%display_title' => $display_info['display_title'], '%display_type' => $display_info['display_plugin']];
$plugin_derivatives[$machine_name] = ['id' => $base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $machine_name, 'label' => $this->t('Search API view: %view_name, display: %display_title (%display_type)', $label_arguments), 'description' => $this->t('Provides a facet source.'), 'view_id' => $view->id(), 'view_display' => $display_id] + $base_plugin_definition;
$sources[] = $this->t('Search API view: %view, display: %display', ['%view' => $view->label(), '%display' => $display_info['display_title']]);
}
}
}
}
uasort($plugin_derivatives, array($this, 'compareDerivatives'));
$this->derivatives[$base_plugin_id] = $plugin_derivatives;
}
return $this->derivatives[$base_plugin_id];
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:38,代码来源:SearchApiViewsDeriver.php
示例8: __construct
/**
* Constructor.
*/
public function __construct()
{
add_action('wp', array($this, 'process'));
$this->steps = (array) apply_filters('submit_job_steps', array('submit' => array('name' => __('Submit Details', 'wp-job-manager'), 'view' => array($this, 'submit'), 'handler' => array($this, 'submit_handler'), 'priority' => 10), 'preview' => array('name' => __('Preview', 'wp-job-manager'), 'view' => array($this, 'preview'), 'handler' => array($this, 'preview_handler'), 'priority' => 20), 'done' => array('name' => __('Done', 'wp-job-manager'), 'view' => array($this, 'done'), 'priority' => 30)));
uasort($this->steps, array($this, 'sort_by_priority'));
// Get step/job
if (isset($_POST['step'])) {
$this->step = is_numeric($_POST['step']) ? max(absint($_POST['step']), 0) : array_search($_POST['step'], array_keys($this->steps));
} elseif (!empty($_GET['step'])) {
$this->step = is_numeric($_GET['step']) ? max(absint($_GET['step']), 0) : array_search($_GET['step'], array_keys($this->steps));
}
$this->job_id = !empty($_REQUEST['job_id']) ? absint($_REQUEST['job_id']) : 0;
// Allow resuming from cookie.
if (!$this->job_id && !empty($_COOKIE['wp-job-manager-submitting-job-id']) && !empty($_COOKIE['wp-job-manager-submitting-job-key'])) {
$job_id = absint($_COOKIE['wp-job-manager-submitting-job-id']);
$job_status = get_post_status($job_id);
if ('preview' === $job_status && get_post_meta($job_id, '_submitting_key', true) === $_COOKIE['wp-job-manager-submitting-job-key']) {
$this->job_id = $job_id;
}
}
// Load job details
if ($this->job_id) {
$job_status = get_post_status($this->job_id);
if ('expired' === $job_status) {
if (!job_manager_user_can_edit_job($this->job_id)) {
$this->job_id = 0;
$this->step = 0;
}
} elseif (!in_array($job_status, apply_filters('job_manager_valid_submit_job_statuses', array('preview')))) {
$this->job_id = 0;
$this->step = 0;
}
}
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:37,代码来源:class-wp-job-manager-form-submit-job.php
示例9: buildTypeMap
private function buildTypeMap($paths)
{
global $prefs;
$cacheKey = 'fieldtypes.' . $prefs['language'];
if ($this->getPreCacheTypeMap()) {
return;
}
$cachelib = TikiLib::lib('cache');
if ($data = $cachelib->getSerialized($cacheKey)) {
$this->typeMap = $data['typeMap'];
$this->infoMap = $data['infoMap'];
$this->setPreCacheTypeMap($data);
return;
}
foreach ($paths as $path => $prefix) {
foreach (glob("{$path}/*.php") as $file) {
if ($file === "{$path}/index.php") {
continue;
}
$class = $prefix . substr($file, strlen($path) + 1, -4);
$reflected = new ReflectionClass($class);
if ($reflected->isInstantiable() && $reflected->implementsInterface('Tracker_Field_Interface')) {
$providedFields = call_user_func(array($class, 'getTypes'));
foreach ($providedFields as $key => $info) {
$this->typeMap[$key] = $class;
$this->infoMap[$key] = $info;
}
}
}
}
uasort($this->infoMap, array($this, 'compareName'));
$data = array('typeMap' => $this->typeMap, 'infoMap' => $this->infoMap);
$cachelib->cacheItem($cacheKey, serialize($data));
$this->setPreCacheTypeMap($data);
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:35,代码来源:Factory.php
示例10: getRestResources
/**
* [geRest get a list of Rest Resouces].
*
* @param bool $rest_status return Rest Resources by status
*
* @return array list of rest resources
*/
public function getRestResources($rest_status = false)
{
$config = $this->getRestDrupalConfig();
$resourcePluginManager = $this->getPluginManagerRest();
$resources = $resourcePluginManager->getDefinitions();
$enabled_resources = array_combine(array_keys($config), array_keys($config));
$available_resources = array('enabled' => array(), 'disabled' => array());
foreach ($resources as $id => $resource) {
$status = in_array($id, $enabled_resources) ? 'enabled' : 'disabled';
$available_resources[$status][$id] = $resource;
}
// Sort the list of resources by label.
$sort_resources = function ($resource_a, $resource_b) {
return strcmp($resource_a['label'], $resource_b['label']);
};
if (!empty($available_resources['enabled'])) {
uasort($available_resources['enabled'], $sort_resources);
}
if (!empty($available_resources['disabled'])) {
uasort($available_resources['disabled'], $sort_resources);
}
if (isset($available_resources[$rest_status])) {
return array($rest_status => $available_resources[$rest_status]);
}
return $available_resources;
}
开发者ID:GoZOo,项目名称:DrupalConsole,代码行数:33,代码来源:ContainerAwareCommand.php
示例11: _beforeToHtml
protected function _beforeToHtml()
{
$categoryData = Mage::helper('M2ePro/Data_Global')->getValue('chooser_data');
$specificBlocks = array();
$templates = array();
$uniqueIdCounter = 0;
if (!empty($categoryData['templates'])) {
foreach ($categoryData['templates'] as $template) {
$uniqueId = 'sb' . $uniqueIdCounter;
$specificBlocks[] = array('create_date' => $template['date'], 'template_id' => $template['id'], 'unique_id' => $uniqueId, 'block' => $this->createSpecificsBlock(array(), $uniqueId));
$uniqueIdCounter++;
}
} else {
$specificsSets = $this->getSpecificsSets();
uasort($specificsSets, array($this, 'specificsSetsSortCallback'));
foreach ($specificsSets as $templateId => $specificsSet) {
$uniqueId = 'sb' . $uniqueIdCounter;
$date = $specificsSet['create_date']->format('Y-m-d h:i');
$templates[] = array('id' => $templateId, 'date' => $date);
$specificBlocks[] = array('create_date' => $date, 'template_id' => $templateId, 'unique_id' => $uniqueId, 'block' => $this->createSpecificsBlock($specificsSet['specifics'], $uniqueId));
$uniqueIdCounter++;
}
}
$this->templates = $templates;
$this->specificsBlocks = $specificBlocks;
return parent::_beforeToHtml();
}
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:27,代码来源:Specific.php
示例12: process
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasParameter($this->connections)) {
return;
}
$this->container = $container;
$this->connections = $container->getParameter($this->connections);
$sortFunc = function ($a, $b) {
$a = isset($a['priority']) ? $a['priority'] : 0;
$b = isset($b['priority']) ? $b['priority'] : 0;
return $a > $b ? -1 : 1;
};
$subscribersPerCon = $this->groupByConnection($container->findTaggedServiceIds($this->tagPrefix . '.event_subscriber'));
foreach ($subscribersPerCon as $con => $subscribers) {
$em = $this->getEventManager($con);
uasort($subscribers, $sortFunc);
foreach ($subscribers as $id => $instance) {
$em->addMethodCall('addEventSubscriber', array(new Reference($id)));
}
}
$listenersPerCon = $this->groupByConnection($container->findTaggedServiceIds($this->tagPrefix . '.event_listener'), true);
foreach ($listenersPerCon as $con => $listeners) {
$em = $this->getEventManager($con);
uasort($listeners, $sortFunc);
foreach ($listeners as $id => $instance) {
$em->addMethodCall('addEventListener', array(array_unique($instance['event']), isset($instance['lazy']) && $instance['lazy'] ? $id : new Reference($id)));
}
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:32,代码来源:RegisterEventListenersAndSubscribersPass.php
示例13: buildJavascriptConfiguration
/**
* 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)) . '";';
}
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:35,代码来源:MicroDataSchema.php
示例14: getNavigation
/**
* @return array
*/
public function getNavigation()
{
//$this->setActiveElements();
$return = [];
foreach ($this->pages as $block => $blockPages) {
if (is_array($blockPages) && count($blockPages) > 0 && $blockPages[0] instanceof rex_be_page_main) {
uasort($blockPages, function (rex_be_page_main $a, rex_be_page_main $b) {
$a_prio = (int) $a->getPrio();
$b_prio = (int) $b->getPrio();
if ($a_prio == $b_prio || $a_prio <= 0 && $b_prio <= 0) {
return strcmp($a->getTitle(), $b->getTitle());
}
if ($a_prio <= 0) {
return 1;
}
if ($b_prio <= 0) {
return -1;
}
return $a_prio > $b_prio ? 1 : -1;
});
}
$n = $this->_getNavigation($blockPages);
if (count($n) > 0) {
$fragment = new rex_fragment();
$fragment->setVar('navigation', $n, false);
$return[] = ['navigation' => $n, 'headline' => ['title' => $this->getHeadline($block)]];
}
}
return $return;
}
开发者ID:staabm,项目名称:redaxo,代码行数:33,代码来源:navigation.php
示例15: dump_export_data
public function dump_export_data()
{
if ($this->exporter->get('viewexportmode') == PluginExport::EXPORT_LIST_OF_VIEWS && $this->exporter->get('artefactexportmode') == PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS) {
// Dont' care about profile information in this case
return;
}
$smarty = $this->exporter->get_smarty('../../', 'internal');
$smarty->assign('page_heading', get_string('profilepage', 'artefact.internal'));
// Profile page
$profileviewid = $this->exporter->get('user')->get_profile_view()->get('id');
foreach ($this->exporter->get('views') as $viewid => $view) {
if ($profileviewid == $viewid) {
$smarty->assign('breadcrumbs', array(array('text' => 'Profile page', 'path' => 'profilepage.html')));
$view = $this->exporter->get('user')->get_profile_view();
$outputfilter = new HtmlExportOutputFilter('../../');
$smarty->assign('view', $outputfilter->filter($view->build_columns()));
$content = $smarty->fetch('export:html/internal:profilepage.tpl');
if (!file_put_contents($this->fileroot . 'profilepage.html', $content)) {
throw new SystemException("Unable to write profile page");
}
$this->profileviewexported = true;
break;
}
}
// Generic profile information
$smarty->assign('page_heading', get_string('profileinformation', 'artefact.internal'));
$smarty->assign('breadcrumbs', array(array('text' => 'Profile information', 'path' => 'index.html')));
// Organise profile information by sections, ordered how it's ordered
// on the 'edit profile' page
$sections = array('aboutme' => array(), 'contact' => array(), 'messaging' => array(), 'general' => array());
$elementlist = call_static_method('ArtefactTypeProfile', 'get_all_fields');
$elementlistlookup = array_flip(array_keys($elementlist));
$profilefields = get_column_sql('SELECT id FROM {artefact} WHERE owner=? AND artefacttype IN (' . join(",", array_map(create_function('$a', 'return db_quote($a);'), array_keys($elementlist))) . ")", array($this->exporter->get('user')->get('id')));
foreach ($profilefields as $id) {
$artefact = artefact_instance_from_id($id);
$rendered = $artefact->render_self(array('link' => true));
if ($artefact->get('artefacttype') == 'introduction') {
$outputfilter = new HtmlExportOutputFilter('../../');
$rendered['html'] = $outputfilter->filter($rendered['html']);
}
$sections[$this->get_category_for_artefacttype($artefact->get('artefacttype'))][$artefact->get('artefacttype')] = array('html' => $rendered['html'], 'weight' => $elementlistlookup[$artefact->get('artefacttype')]);
}
// Sort the data and then drop the weighting information
foreach ($sections as &$section) {
uasort($section, create_function('$a, $b', 'return $a["weight"] > $b["weight"];'));
foreach ($section as &$data) {
$data = $data['html'];
}
}
$smarty->assign('sections', $sections);
$iconid = $this->exporter->get('user')->get('profileicon');
if ($iconid) {
$icon = artefact_instance_from_id($iconid);
$smarty->assign('icon', '<img src="../../static/profileicons/200px-' . PluginExportHtml::sanitise_path($icon->get('title')) . '" alt="Profile Icon">');
}
$content = $smarty->fetch('export:html/internal:index.tpl');
if (!file_put_contents($this->fileroot . 'index.html', $content)) {
throw new SystemException("Unable to write profile information page");
}
}
开发者ID:Br3nda,项目名称:mahara,代码行数:60,代码来源:lib.php
示例16: checkFilters
public function checkFilters($filters)
{
// Get the admin filter
$adminFilter['admin'] = $filters['admin'];
unset($filters['admin']);
// Sort by filter length
uasort($filters, array($this, 'sortByLength'));
// Push the admin filter first
$filters = $adminFilter + $filters;
$this->filters = $filters;
foreach ($filters as $filterKey => $filter) {
// getSlugAfterFilter() set the variable $this->slug
$slug = $this->getSlugAfterFilter($filter);
// If the filter is included in the URI.
if ($slug !== false) {
// Where Am I is the filter now, because is in the URI.
$this->whereAmI = $filterKey;
// If the slug empty
if (empty($slug)) {
if ($filter === '/') {
$this->whereAmI = 'home';
break;
}
if ($filter === $adminFilter['admin']) {
$this->whereAmI = 'admin';
$this->slug = 'dashboard';
break;
}
$this->setNotFound(true);
}
break;
}
}
}
开发者ID:hxii,项目名称:bludit,代码行数:34,代码来源:url.class.php
示例17: get_terms_for_site
/**
* Return the terms for the given type.
*
* @param int $site_id Blog ID.
*
* @return array
*/
public function get_terms_for_site($site_id)
{
$out = [];
switch_to_blog($site_id);
$taxonomy_object = get_taxonomy($this->taxonomy_name);
if (!current_user_can($taxonomy_object->cap->edit_terms)) {
$terms = [];
} else {
$terms = get_terms($this->taxonomy_name, ['hide_empty' => FALSE]);
}
foreach ($terms as $term) {
if (is_taxonomy_hierarchical($this->taxonomy_name)) {
$ancestors = get_ancestors($term->term_id, $this->taxonomy_name);
if (!empty($ancestors)) {
foreach ($ancestors as $ancestor) {
$parent_term = get_term($ancestor, $this->taxonomy_name);
$term->name = $parent_term->name . '/' . $term->name;
}
}
}
$out[$term->term_taxonomy_id] = esc_html($term->name);
}
restore_current_blog();
uasort($out, 'strcasecmp');
return $out;
}
开发者ID:inpsyde,项目名称:multilingual-press,代码行数:33,代码来源:Mlp_Term_Translation_Presenter.php
示例18: onRequest
/**
* Registers node routes
*/
public function onRequest()
{
$site = App::module('system/site');
$frontpage = $site->config('frontpage');
$nodes = Node::findAll(true);
uasort($nodes, function ($a, $b) {
return strcmp(substr_count($a->path, '/'), substr_count($b->path, '/')) * -1;
});
foreach ($nodes as $node) {
if ($node->status !== 1 || !($type = $site->getType($node->type))) {
continue;
}
$type = array_replace(['alias' => '', 'redirect' => '', 'controller' => ''], $type);
$type['defaults'] = array_merge(isset($type['defaults']) ? $type['defaults'] : [], $node->get('defaults', []), ['_node' => $node->id]);
$type['path'] = $node->path;
$route = null;
if ($node->get('alias')) {
App::routes()->alias($node->path, $node->link, $type['defaults']);
} elseif ($node->get('redirect')) {
App::routes()->redirect($node->path, $node->get('redirect'), $type['defaults']);
} elseif ($type['controller']) {
App::routes()->add($type);
}
if (!$frontpage && isset($type['frontpage']) && $type['frontpage']) {
$frontpage = $node->id;
}
}
if ($frontpage && isset($nodes[$frontpage])) {
App::routes()->alias('/', $nodes[$frontpage]->link);
} else {
App::routes()->get('/', function () {
return __('No Frontpage assigned.');
});
}
}
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:38,代码来源:NodesListener.php
示例19: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $packageID, $languageIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get all taggable types
$sql = "SELECT\t\ttaggable.taggableID, taggable.name\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\twcf" . WCF_N . "_tag_taggable taggable\n\t\t\tWHERE \t\ttaggable.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
$itemIDs = array();
while ($row = WCF::getDB()->fetchArray($result)) {
$itemIDs[$row['name']] = $row['taggableID'];
}
if (count($itemIDs) > 0) {
// get tag ids
$tagIDs = array();
$sql = "SELECT\t\tCOUNT(*) AS counter, object.tagID\n\t\t\t\tFROM \t\twcf" . WCF_N . "_tag_to_object object\n\t\t\t\tWHERE \t\tobject.taggableID IN (" . implode(',', $itemIDs) . ")\n\t\t\t\t\t\tAND object.languageID IN (" . $languageIDs . ")\n\t\t\t\tGROUP BY \tobject.tagID\n\t\t\t\tORDER BY \tcounter DESC";
$result = WCF::getDB()->sendQuery($sql, 500);
while ($row = WCF::getDB()->fetchArray($result)) {
$tagIDs[$row['tagID']] = $row['counter'];
}
// get tags
if (count($tagIDs)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDs)) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDs[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
$data = $this->tags;
}
}
return $data;
}
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:37,代码来源:CacheBuilderTagCloud.class.php
示例20: _renderOrders
/**
* Render sql select orders
*
* @return Mana_Db_Resource_Entity_JsonCollection
*/
protected function _renderOrders()
{
if (count($this->_orders)) {
uasort($this->_data, array($this, '_compareItems'));
}
return $this;
}
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:12,代码来源:JsonCollection.php
注:本文中的uasort函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论