当前位置: 首页>>代码示例>>PHP>>正文


PHP array_insert函数代码示例

本文整理汇总了PHP中array_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP array_insert函数的具体用法?PHP array_insert怎么用?PHP array_insert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了array_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addChildRecordCallback

 public function addChildRecordCallback($table)
 {
     if ($table === 'tl_content') {
         $callback =& $GLOBALS['TL_DCA'][$table]['list']['sorting']['child_record_callback'];
         array_insert($callback, 0, array('ContaoBlackforest\\Backend\\DCA\\Content\\Device', 'addDeviceVisibility'));
     }
 }
开发者ID:contaoblackforest,项目名称:contao-content-device,代码行数:7,代码来源:Device.php

示例2: addComponents

 public static function addComponents($strGroup, $arrNew = array(), $arrCurrent = array())
 {
     if (!isset($arrNew['files'])) {
         return $arrCurrent;
     }
     $arrFiles = $arrNew['files'];
     $intIndex = $arrNew['sort'];
     if (!is_array($arrFiles)) {
         $arrFiles = array($arrFiles);
     }
     if (!is_array($arrCurrent)) {
         $arrCurrent = array($arrCurrent);
     }
     $arrReplace = array();
     foreach ($arrFiles as $key => $strFile) {
         // do not add the same file multiple times
         if (in_array($strFile, $arrCurrent)) {
             continue;
         }
         $arrReplace[$strGroup . '.' . $key] = $strFile;
     }
     if ($intIndex !== null) {
         array_insert($arrCurrent, $intIndex, $arrReplace);
         return $arrCurrent;
     }
     return $arrCurrent + $arrReplace;
 }
开发者ID:heimrichhannot,项目名称:contao-bootstrapper,代码行数:27,代码来源:BootstrapperAssets.php

示例3: thb_array_insert

 /**
  * Insert an element into an array at a specific position.
  * 
  * @param array &$array The original array.
  * @param Mixed $element The element about to be inserted.
  * @param int $position The insertion index.
  * @return array
  */
 function thb_array_insert(&$array, $element, $position = null)
 {
     if (count($array) == 0) {
         $array[] = $element;
     } elseif (is_numeric($position) && $position < 0) {
         if (count($array) + position < 0) {
             $array = array_insert($array, $element, 0);
         } else {
             $array[count($array) + $position] = $element;
         }
     } elseif (is_numeric($position) && isset($array[$position])) {
         $part1 = array_slice($array, 0, $position, true);
         $part2 = array_slice($array, $position, null, true);
         $array = array_merge($part1, array($position => $element), $part2);
         foreach ($array as $key => $item) {
             if (is_null($item)) {
                 unset($array[$key]);
             }
         }
     } elseif (is_null($position)) {
         $array[] = $element;
     } elseif (!isset($array[$position])) {
         $array[$position] = $element;
     }
     $array = array_merge($array);
     return $array;
 }
开发者ID:alfredpp,项目名称:sarath-portfolio,代码行数:35,代码来源:helper.array.php

示例4: addLabelCallback

 public function addLabelCallback($table)
 {
     if ($table === 'tl_article') {
         $callback =& $GLOBALS['TL_DCA'][$table]['list']['label']['label_callback'];
         array_insert($callback, 0, array('ContaoBlackforest\\Backend\\DCA\\Article\\Device', 'addDeviceVisibility'));
     }
 }
开发者ID:contaoblackforest,项目名称:contao-article-device,代码行数:7,代码来源:Device.php

示例5: getAddressOptions

 /**
  * Get available address options
  * @return  array
  */
 protected function getAddressOptions()
 {
     $arrOptions = parent::getAddressOptions();
     array_insert($arrOptions, 0, array(array('value' => '-1', 'label' => Isotope::getCart()->requiresPayment() ? $GLOBALS['TL_LANG']['MSC']['useBillingAddress'] : $GLOBALS['TL_LANG']['MSC']['useCustomerAddress'], 'default' => '1')));
     $arrOptions[] = array('value' => '0', 'label' => $GLOBALS['TL_LANG']['MSC']['differentShippingAddress'], 'default' => $this->getDefaultAddress()->id == Isotope::getCart()->shipping_address_id);
     return $arrOptions;
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:11,代码来源:ShippingAddress.php

示例6: insert_wizard_fields

 public function insert_wizard_fields($table = NULL)
 {
     if ($table === NULL) {
         $table = \Input::get('table');
     }
     $fieldsSize = count($GLOBALS['TL_DCA'][$table]['fields']) - 1;
     array_insert($GLOBALS['TL_DCA'][$table]['fields'], $fieldsSize, array('ftc_preset_id' => array('label' => &$GLOBALS['TL_LANG']['MSC']['ftc_preset_id'], 'default' => '-', 'exclude' => true, 'sorting' => true, 'filter' => true, 'inputType' => 'PresetsSelectWizard', 'options_callback' => array('PresetsModel', 'getPresets'), 'load_callback' => array(array('PresetsModel', 'getSelectedPreset')), 'save_callback' => array(array('PresetsModel', 'getSelectedPreset')), 'eval' => array('helpwizard' => false, 'chosen' => true, 'submitOnChange' => true, 'tl_class' => 'long clr m12'), 'sql' => "varchar(255) NOT NULL default '-'", 'combined' => 'ftc_preset_full'), 'ftc_preset_full' => array('label' => &$GLOBALS['TL_LANG']['MSC']['ftc_preset_full'], 'exclude' => true, 'inputType' => 'hidden', 'eval' => array('hideInput' => true, 'doNotShow' => true), 'sql' => "text NULL"), 'ftc_preset_custom' => array('label' => &$GLOBALS['TL_LANG']['MSC']['ftc_preset_custom'], 'exclude' => true, 'inputType' => 'PresetsCustomWizard', 'eval' => array('tl_class' => 'clr', 'doNotShow' => true), 'sql' => "text NULL"), 'ftc_preset_add_custom' => array('label' => &$GLOBALS['TL_LANG']['MSC']['ftc_preset_add_custom'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''")));
 }
开发者ID:designs2,项目名称:codeowl_design_presets,代码行数:8,代码来源:DCA.php

示例7: run

 /**
  * Modify the page or layout object - Add in Foundation JS and CSS first!
  * @param objPage
  * @param objPage
  * @return void
  */
 public function run($objPage, &$objLayout, $objPageRegular)
 {
     //Load up our Required Foundation JS into a Combiner
     $objCombiner = new \Combiner();
     foreach ($GLOBALS['FOUNDATION_JS'] as $strFile) {
         $objCombiner->add($strFile);
     }
     array_insert($GLOBALS['TL_JAVASCRIPT'], 0, array($objCombiner->getCombinedFile() . "|static"));
     //Load in Foundation CSS by Theme
     array_insert($GLOBALS['TL_CSS'], 0, array(SCSS::compile($objLayout->getRelated('pid')) . "|screen|static"));
     $objLayout->script .= "\n" . "<script>(function(\$) { \$(document).foundation(); })(jQuery);</script>";
 }
开发者ID:hb-agency,项目名称:contao_zurb_foundation,代码行数:18,代码来源:Foundation.php

示例8: getWebServices

 /**
  * Get the list of web services.
  *
  * @return array
  */
 public function getWebServices()
 {
     $webservices = $this->webServices;
     if ($this->preferredWebService) {
         if ($key = $this->searchWebServiceByName($this->preferredWebService)) {
             $service = $webservices[$key];
             unset($webservices[$key]);
             array_insert($webservices, $service, 0);
         }
     }
     return $webservices;
 }
开发者ID:wsorprendente,项目名称:zipcode,代码行数:17,代码来源:WebServices.php

示例9: update590

function update590()
{
    $js = tjsmerger::i();
    $js->lock();
    if ($i = array_search('/js/jquery/ui/tabs.min.js', $js->items['admin']['files'])) {
        array_insert($js->items['admin']['files'], '/js/jquery/ui/effect.min.js', $i);
    } else {
        $js->add('admin', '/js/jquery/ui/effect.min.js');
    }
    $js->unlock();
    tcssmerger::i()->add('admin', '/js/litepublisher/css/form.inline.min.css');
}
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:update.5.90.php

示例10: loadExportConfigs

 /**
  * Load the export configs.
  */
 public function loadExportConfigs()
 {
     $objConfigs = \Database::getInstance()->prepare("SELECT * FROM tl_lead_export WHERE pid=? AND tstamp>0 ORDER BY name")->execute(\Input::get('master'));
     if (!$objConfigs->numRows) {
         return;
     }
     $arrOperations = array();
     while ($objConfigs->next()) {
         $arrOperations['export_' . $objConfigs->id] = array('label' => $objConfigs->name, 'href' => 'key=export&amp;config=' . $objConfigs->id, 'class' => 'leads-export header_export_excel', 'attributes' => 'onclick="Backend.getScrollOffset();"');
     }
     array_insert($GLOBALS['TL_DCA']['tl_lead']['list']['global_operations'], 0, $arrOperations);
 }
开发者ID:terminal42,项目名称:contao-leads,代码行数:15,代码来源:tl_lead.php

示例11: attach

 /**
  * Attach to the collector and HOOKs.
  *
  * @param HookInspectionCollector $collector     The collector.
  *
  * @param TimeDataCollector       $timeCollector The time collector.
  *
  * @return void
  */
 public static function attach($collector, TimeDataCollector $timeCollector = null)
 {
     self::$collector = $collector;
     self::$timeCollector = $timeCollector;
     $hooks = self::getHookNames();
     foreach ($hooks as $k) {
         if (in_array($k, array('outputBackendTemplate', 'outputFrontendTemplate'))) {
             continue;
         }
         if (!array_key_exists($k, $GLOBALS['TL_HOOKS'])) {
             $GLOBALS['TL_HOOKS'][$k] = array();
         }
         array_insert($GLOBALS['TL_HOOKS'][$k], 0, array(array(__CLASS__, 'in_' . $k)));
     }
     array_insert($GLOBALS['TL_HOOKS']['initializeSystem'], 0, array(array(__CLASS__, 'initializeSystem')));
 }
开发者ID:cyberspectrum,项目名称:contao-debugger,代码行数:25,代码来源:HookRegistry.php

示例12: onLoad

 /**
  * Handler for onload_callback.
  *
  * @param DataContainer $dc
  */
 public function onLoad(DataContainer $dc)
 {
     if ($dc->table !== $this->table) {
         return;
     }
     $this->dataContainer = $dc;
     $id = (string) \Input::get('switchLanguage');
     if ('' !== $id) {
         $this->doSwitchView($id);
     }
     if (($page = $this->getCurrentPage()) !== null && count($languages = $this->getAvailableLanguages($page)) !== 0) {
         $GLOBALS['TL_CSS'][] = 'system/modules/changelanguage/assets/backend.css';
         array_insert($GLOBALS['TL_DCA'][$this->table]['list']['global_operations'], 0, ['switchLanguage' => ['showOnSelect' => true, 'button_callback' => function () use($page, $languages) {
             return $this->onSwitchButtonCallback($page, $languages);
         }]]);
     }
 }
开发者ID:terminal42,项目名称:contao-changelanguage,代码行数:22,代码来源:AbstractViewListener.php

示例13: get_sitemap

 public function get_sitemap($lang = LANG)
 {
     //GET PAGE DATA
     $data = CmsPage::with(array('files' => function ($query) {
         $query->where_is_image(1)->where_is_valid(1);
     }))->where_parent_id(0)->where_lang($lang)->order_by('is_home', 'desc')->order_by('slug', 'asc')->get();
     $new_data = array();
     foreach ($data as $value) {
         $new_data[$value->id] = $value;
     }
     foreach ($new_data as $page) {
         $recursive = call_user_func_array('CmsPage::recursive_site_sitemap', array($page->id));
         $new_data = array_insert($new_data, $page->id, $recursive);
     }
     $view = View::make('cms::theme.' . THEME . '.templates.sitemap')->with('encoding', '<?xml version="1.0" encoding="UTF-8" ?>')->with('base', Config::get('application.url'))->with('data', $new_data);
     $headers = array('Content-Type' => 'text/xml');
     return Response::make($view, 200, $headers);
 }
开发者ID:SerdarSanri,项目名称:PongoCMS-Laravel-cms-bundle,代码行数:18,代码来源:site.php

示例14: run

 /**
  * Runs the update.
  */
 public function run()
 {
     $statement = $this->connection->query("SELECT id, framework FROM tl_layout WHERE framework!=''");
     while (false !== ($layout = $statement->fetch(\PDO::FETCH_OBJ))) {
         $framework = '';
         $tmp = deserialize($layout->framework);
         if (!empty($tmp) && is_array($tmp)) {
             if (false !== ($key = array_search('layout.css', $tmp))) {
                 array_insert($tmp, $key + 1, 'responsive.css');
             }
             $framework = serialize(array_values(array_unique($tmp)));
         }
         $stmt = $this->connection->prepare('UPDATE tl_layout SET framework=:framework WHERE id=:id');
         $stmt->execute([':framework' => $framework, ':id' => $layout->id]);
     }
     // Add the "viewport" field (triggers the version 3.3 update)
     $this->connection->query("ALTER TABLE `tl_layout` ADD `viewport` varchar(255) NOT NULL default ''");
 }
开发者ID:aschempp,项目名称:contao-installation-bundle,代码行数:21,代码来源:Version330Update.php

示例15: add

 public function add()
 {
     if (litepublisher::$urlmap->is404) {
         return;
     }
     $url = litepublisher::$urlmap->url;
     $title = litepublisher::$urlmap->context->title;
     foreach ($this->items as $i => $item) {
         if ($url == $item['url']) {
             array_delete($this->items, $i);
             break;
         }
     }
     if (count($this->items) == 10) {
         array_delete($this->items, 9);
     }
     array_insert($this->items, array('url' => $url, 'title' => $title), 0);
     $this->save();
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:19,代码来源:adminhistory.php


注:本文中的array_insert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。