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')); } }
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; }
/** * 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; }
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')); } }
/** * 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; }
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 ''"))); }
/** * 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>"; }
/** * 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; }
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'); }
/** * 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&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); }
/** * 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'))); }
/** * 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); }]]); } }
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); }
/** * 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 ''"); }
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(); }
public function generateBreadcrumbHook($arrItems, $objModule) { global $objPage; $pages = array($objPage->row()); if (\Input::get('auto_item') && $objPage->alias != \Input::get('auto_item')) { array_insert($arrItems, count($arrItems) - 1, array(array('isRoot' => false, 'isActive' => false, 'href' => $this->generateFrontendUrl($objPage->row()), 'title' => $pages[0]['title'], 'link' => $pages[0]['title'], 'data' => $pages[0], 'class' => ''))); // set pointer to last element end($arrItems); // get key for last item $idxLastItem = key($arrItems); $arrItems[$idxLastItem]['href'] = \Environment::get('request'); // hide news, event itself … if ($objModule->hideAutoItem && is_array($arrItems)) { // remove last element (news, event, ..) $arrItems = array_slice($arrItems, 0, count($arrItems) - 1); // set new last element active $arrItems[count($arrItems) - 1]['isActive'] = true; } } return $arrItems; }
/** * Get page data / layout, replace article placeholders with articles and return as array with page id key * @param array * @return array */ protected function getPageData($arrPages) { $arrPageData = $this->getModulesInPageLayouts($arrPages); if (count($arrPageData) < 1) { return ''; } // insert articles in placeholders in modules array foreach ($arrPageData as $pageId => $sections) { foreach ($sections as $column => $itemList) { // replace article placeholders with articles foreach ($itemList as $index => $item) { if ($item[0] == 'article_placeholder') { $arrArticles = $this->getArticles($pageId, $column); array_insert($arrPageData[$pageId][$column], $index, $arrArticles); // delete placeholder $newIndex = $index + count($arrArticles); unset($arrPageData[$pageId][$column][$newIndex]); } } } } return $arrPageData; }
/** * Split the current request into fragments, strip the URL suffix, recreate the $_GET array and return the page ID * @return mixed */ public static function getPageIdFromUrl() { if ($GLOBALS['TL_CONFIG']['disableAlias']) { return is_numeric(\Input::get('id')) ? \Input::get('id') : null; } if (\Environment::get('request') == '') { return null; } // Get the request string without the index.php fragment if (\Environment::get('request') == 'index.php') { $strRequest = ''; } else { list($strRequest) = explode('?', str_replace('index.php/', '', \Environment::get('request')), 2); } // Remove the URL suffix if not just a language root (e.g. en/) is requested if ($strRequest != '' && (!$GLOBALS['TL_CONFIG']['addLanguageToUrl'] || !preg_match('@^[a-z]{2}/$@', $strRequest))) { $intSuffixLength = strlen($GLOBALS['TL_CONFIG']['urlSuffix']); // Return false if the URL suffix does not match (see #2864) if ($intSuffixLength > 0) { if (substr($strRequest, -$intSuffixLength) != $GLOBALS['TL_CONFIG']['urlSuffix']) { return false; } $strRequest = substr($strRequest, 0, -$intSuffixLength); } } // Extract the language if ($GLOBALS['TL_CONFIG']['addLanguageToUrl']) { $arrMatches = array(); // Use the matches instead of substr() (thanks to Mario Müller) if (preg_match('@^([a-z]{2})/(.*)$@', $strRequest, $arrMatches)) { \Input::setGet('language', $arrMatches[1]); // Trigger the root page if only the language was given if ($arrMatches[2] == '') { return null; } $strRequest = $arrMatches[2]; } else { return false; // Language not provided } } $arrFragments = null; // Use folder-style URLs if ($GLOBALS['TL_CONFIG']['folderUrl'] && strpos($strRequest, '/') !== false) { $strAlias = $strRequest; $arrOptions = array($strAlias); // Compile all possible aliases by applying dirname() to the request (e.g. news/archive/item, news/archive, news) while ($strAlias != '/' && strpos($strAlias, '/') !== false) { $strAlias = dirname($strAlias); $arrOptions[] = $strAlias; } // Check if there are pages with a matching alias $objPages = \PageModel::findByAliases($arrOptions); if ($objPages !== null) { $arrPages = array(); // Order by domain and language while ($objPages->next()) { $objPage = static::getPageDetails($objPages->current()); $domain = $objPage->domain ?: '*'; $arrPages[$domain][$objPage->rootLanguage][] = $objPage; // Also store the fallback language if ($objPage->rootIsFallback) { $arrPages[$domain]['*'][] = $objPage; } } $strHost = \Environment::get('host'); // Look for a root page whose domain name matches the host name if (isset($arrPages[$strHost])) { $arrLangs = $arrPages[$strHost]; } else { $arrLangs = $arrPages['*']; // Empty domain } $arrAliases = array(); // Use the first result (see #4872) if (!$GLOBALS['TL_CONFIG']['addLanguageToUrl']) { $arrAliases = current($arrLangs); } elseif (($lang = \Input::get('language')) != '' && isset($arrLangs[$lang])) { $arrAliases = $arrLangs[$lang]; } // Return if there are no matches if (empty($arrAliases)) { return false; } $objPage = $arrAliases[0]; // The request consists of the alias only if ($strRequest == $objPage->alias) { $arrFragments = array($strRequest); } else { $arrFragments = explode('/', substr($strRequest, strlen($objPage->alias) + 1)); array_unshift($arrFragments, $objPage->alias); } } } // If folderUrl is deactivated or did not find a matching page if ($arrFragments === null) { if ($strRequest == '/') { return false; } else { $arrFragments = explode('/', $strRequest); } } // Add the second fragment as auto_item if the number of fragments is even if ($GLOBALS['TL_CONFIG']['useAutoItem'] && count($arrFragments) % 2 == 0) { array_insert($arrFragments, 1, array('auto_item')); } // HOOK: add custom logic if (isset($GLOBALS['TL_HOOKS']['getPageIdFromUrl']) && is_array($GLOBALS['TL_HOOKS']['getPageIdFromUrl'])) { foreach ($GLOBALS['TL_HOOKS']['getPageIdFromUrl'] as $callback) { $arrFragments = static::importStatic($callback[0])->{$callback}[1]($arrFragments); } } // Return if the alias is empty (see #4702 and #4972) if ($arrFragments[0] == '' && count($arrFragments) > 1) { return false; } $arrFragments = array_map('urldecode', $arrFragments); // Add the fragments to the $_GET array for ($i = 1; $i < count($arrFragments); $i += 2) { // Skip key value pairs if the key is empty (see #4702) if ($arrFragments[$i] == '') { continue; } // Return false if the request contains an auto_item keyword (duplicate content) (see #4012) if ($GLOBALS['TL_CONFIG']['useAutoItem'] && in_array($arrFragments[$i], $GLOBALS['TL_AUTO_ITEM'])) { return false; } \Input::setGet($arrFragments[$i], $arrFragments[$i + 1]); } return $arrFragments[0] ?: null; }
* * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program. If not, please visit the Free * Software Foundation website at <http://www.gnu.org/licenses/>. * * PHP version 5 * @copyright Leo Feyer 2005-2011 * @author Leo Feyer <http://www.contao.org> * @package Glossary * @license LGPL * @filesource */ /** * Add back end modules */ $GLOBALS['BE_MOD']['content']['glossary'] = array('tables' => array('tl_glossary', 'tl_glossary_term'), 'icon' => 'system/modules/glossary/html/icon.gif'); /** * Add front end modules */ array_insert($GLOBALS['FE_MOD'], 4, array('glossary' => array('glossaryMenu' => 'ModuleGlossaryMenu', 'glossaryList' => 'ModuleGlossaryList')));
protected function createDataContainerWithVariants($objMetaModel, $arrDCASetting, &$arrDCA) { $arrDCA['list']['sorting']['mode'] = 5; $arrDCA['dca_config']['data_provider']['parent']['source'] = $objMetaModel->getTableName(); $arrDCA['dca_config']['child_list']['self']['fields'] = array('id', 'tstamp'); $arrDCA['dca_config']['childCondition'] = array(array('from' => 'self', 'to' => 'self', 'setOn' => array(array('to_field' => 'varbase', 'value' => '0'), array('to_field' => 'vargroup', 'from_field' => 'vargroup')), 'filter' => array(array('local' => 'vargroup', 'remote' => 'id', 'operation' => '='), array('local' => 'vargroup', 'remote' => 'vargroup', 'operation' => '='), array('local' => 'varbase', 'remote_value' => '0', 'operation' => '=')))); $arrDCA['dca_config']['rootEntries']['self'] = array('setOn' => array(array('property' => 'varbase', 'value' => '1')), 'filter' => array(array('property' => 'varbase', 'operation' => '=', 'value' => '1'))); // TODO: do only show variant bases if we are told so, i.e. render child view. $arrDCA['fields']['varbase'] = array('label' => &$GLOBALS['TL_LANG']['tl_metamodel_item']['varbase'], 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'doNotShow' => true)); if ($arrDCASetting['ptable']) { if ($arrDCASetting['ptable'] == $objMetaModel->get('tableName')) { $pidValue = 0; } else { $pidValue = $this->Input->get('id_' . $arrDCASetting['ptable']); } $arrDCA['list']['sorting']['filter'] = array_merge_recursive(array(array('pid', $pidValue)), (array) $arrDCA['list']['sorting']['filter']); $arrDCA['dca_config']['rootEntries']['self']['filter'][] = array('property' => 'pid', 'operation' => '=', 'value' => $pidValue); $arrDCA['dca_config']['rootEntries']['self']['setOn'][] = array('property' => 'pid', 'value' => $pidValue); } $arrOperationCreateVariant = array('label' => &$GLOBALS['TL_LANG']['tl_metamodel_item']['createvariant'], 'href' => 'act=createvariant', 'icon' => 'system/modules/metamodels/html/variants.png', 'button_callback' => array('MetaModelDatabase', 'buttonCallbackCreateVariant')); // only rewrite the url if the operation has been registered. if (array_key_exists('copy', $arrDCA['list']['operations'])) { $arrDCA['list']['operations']['copy']['href'] = 'act=paste&mode=copy'; } // search for copy operation and insert just behind that one $intPos = array_search('copy', array_keys($arrDCA['list']['operations'])); if ($intPos !== false) { array_insert($arrDCA['list']['operations'], $intPos + 1, array('createvariant' => $arrOperationCreateVariant)); } else { // or append to the end, if copy operation has not been found $arrDCA['list']['operations']['createvariant'] = $arrOperationCreateVariant; } }
/** * Update an ordering array internally. * Called from {@link move_panel()}. * @param string $id Name of the panel to move. * @param integer $index Position in the ordering. * @param PANEL[] &$panels List of panels to move. * @access private */ protected function _move_panel_to($id, $index, &$panels) { $old_index = array_search($id, $panels); if ($old_index !== false) { unset($panels[$old_index]); } array_insert($panels, $index, $id); }
function jobman_conf() { global $jobman_formats; $options = get_option('jobman_options'); if (array_key_exists('tab', $_REQUEST)) { switch ($_REQUEST['tab']) { case 'display': jobman_display_conf(); return; case 'appform': jobman_application_setup(); return; case 'jobform': jobman_job_setup(); return; } } if (array_key_exists('jobmanconfsubmit', $_REQUEST)) { // Configuration form as been submitted. Updated the database. check_admin_referer('jobman-conf-updatedb'); jobman_conf_updatedb(); } else { if (array_key_exists('jobmanresumesubmit', $_REQUEST)) { check_admin_referer('jobman-resume-settings-updatedb'); jobman_resume_settings_updatedb(); } else { if (array_key_exists('jobmancatsubmit', $_REQUEST)) { check_admin_referer('jobman-categories-updatedb'); jobman_categories_updatedb(); } else { if (array_key_exists('jobmaniconsubmit', $_REQUEST)) { check_admin_referer('jobman-icons-updatedb'); jobman_icons_updatedb(); } else { if (array_key_exists('jobmanusersubmit', $_REQUEST)) { check_admin_referer('jobman-users-updatedb'); jobman_users_updatedb(); } else { if (array_key_exists('jobmanappemailsubmit', $_REQUEST)) { check_admin_referer('jobman-application-email-updatedb'); jobman_application_email_updatedb(); } else { if (array_key_exists('jobmaninterviewsubmit', $_REQUEST)) { check_admin_referer('jobman-interview-updatedb'); jobman_interview_updatedb(); } else { if (array_key_exists('jobmanotherpluginssubmit', $_REQUEST)) { check_admin_referer('jobman-other-plugins-updatedb'); jobman_other_plugins_updatedb(); } else { if (array_key_exists('jobmanuninstallsubmit', $_REQUEST)) { check_admin_referer('jobman-uninstall-updatedb'); jobman_uninstall_updatedb(); } } } } } } } } } ?> <div class="wrap"> <?php jobman_print_settings_tabs(); if (!get_option('smb_consulting')) { $widths = array('78%', '20%'); $functions = array(array('jobman_print_settings_box', 'jobman_print_categories_box', 'jobman_print_icons_box', 'jobman_print_user_box', 'jobman_print_application_email_box', 'jobman_print_other_plugins_box', 'jobman_print_uninstall_box'), array('jobman_print_survey_box', 'jobman_print_donate_box', 'jobman_print_about_box', 'jobman_print_translators_box')); $titles = array(array(__('Settings', 'jobman'), __('Categories', 'jobman'), __('Icons', 'jobman'), __('User Settings', 'jobman'), __('Application Email Settings', 'jobman'), __('Other Plugins', 'jobman'), __('Uninstall Settings', 'jobman')), array(__('Job Manager - SURVEY -', 'jobman'), __('Donate', 'jobman'), __('About This Plugin', 'jobman'), __('Translators', 'jobman'))); if ($options['interviews']) { $functions[0] = array_insert($functions[0], 5, 'jobman_print_interview_box'); $titles[0] = array_insert($titles[0], 5, __('Interview Settings', 'jobman')); } } else { $widths = array('49%', '49%'); $functions = array(array('jobman_print_settings_box', 'jobman_print_categories_box', 'jobman_print_other_plugins_box'), array('jobman_print_icons_box', 'jobman_print_user_box', 'jobman_print_application_email_box', 'jobman_print_uninstall_box')); $titles = array(array(__('Settings', 'jobman'), __('Categories', 'jobman'), __('Other Plugins', 'jobman')), array(__('Icons', 'jobman'), __('User Settings', 'jobman'), __('Application Email Settings', 'jobman'), __('Uninstall Settings', 'jobman'))); if ($options['interviews']) { $functions[1] = array_insert($functions[1], 3, 'jobman_print_interview_box'); $titles[1] = array_insert($titles[1], 3, __('Interview Settings', 'jobman')); } } jobman_create_dashboard($widths, $functions, $titles); ?> </div> <?php }
* * @author Lionel Maccaud * @copyright Lionel Maccaud * @package galerie * @license MIT */ /** * ------------------------------------------------------------------------- * BACK END MODULES * ------------------------------------------------------------------------- */ $GLOBALS['BE_MOD']['content']['galerie'] = array('tables' => array('tl_galerie', 'tl_galerie_pictures'), 'icon' => 'system/modules/galerie/html/img/galleria-icon.png'); /** * ------------------------------------------------------------------------- * FRONT END MODULES * ------------------------------------------------------------------------- */ array_insert($GLOBALS['FE_MOD']['application'], 0, array('galerie' => 'Galleria\\ModuleGalerie')); /** * ------------------------------------------------------------------------- * CONTENT ELEMENTS * ------------------------------------------------------------------------- */ $GLOBALS['TL_CTE']['media']['galerie'] = 'Galleria\\ContentGalerie'; /** * ------------------------------------------------------------------------- * PERMISSIONS * ------------------------------------------------------------------------- */ $GLOBALS['TL_PERMISSIONS'][] = 'galleria'; $GLOBALS['TL_PERMISSIONS'][] = 'galleria_permission';
function insert_line_breaks($str, $lines) { $i = 0; $t = 0; $n = strlen($str) / $lines; $array = explode(' ', $str); foreach ($array as $a) { $i++; $t += strlen($a); if ($t > $n) { array_insert($array, $i, array("\n")); $t = 0; } } return implode(' ', $array); }
<?php /** * PHP version 5 * @copyright sr-tag.de 2015 * @author Sven Rhinow * @package simple_recipes * @license LGPL * @filesource */ /** * Add back end modules */ array_insert($GLOBALS['BE_MOD'], 1, array('simple_recipes' => array())); $GLOBALS['BE_MOD']['simple_recipes']['simple_recipes_categories'] = array('tables' => array('tl_simple_recipes_categories'), 'icon' => 'system/modules/simple_recipes/assets/icons/category.png'); $GLOBALS['BE_MOD']['simple_recipes']['simple_recipes_entries'] = array('tables' => array('tl_simple_recipes_entries'), 'icon' => 'system/modules/simple_recipes/assets/icons/cutlery.png'); /** * Frontend modules */ // $GLOBALS['FE_MOD']['beekeeping_colonies'] = array('bk_colonies' => 'ModuleColonyTable'); /** * HOOKS */ // $GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('mpMembers', 'changeIAOTags'); /** * Permissions are access settings for user and groups (fields in tl_user and tl_user_group) */ $GLOBALS['TL_PERMISSIONS'][] = 'simple_recipes_modules';
* @author Samuel Heer * @license GNU/LGPL * @copyright Samuel Heer 2014 */ /** * BACK END MODULES **/ array_insert($GLOBALS['BE_MOD']['content'], 1, array('sermoner' => array('tables' => array('tl_sermon_archive', 'tl_sermoner_items', 'tl_sermon_feed'), 'icon' => 'system/modules/sermoner/assets/icon.png', 'table' => array('TableWizard', 'importTable'), 'list' => array('ListWizard', 'importList'), 'stylesheet' => 'system/modules/sermoner/assets/style.css', 'import' => array('SermonerItems', 'importSermon')))); /** * FRONT END MODULES **/ array_insert($GLOBALS['FE_MOD'], 1, array('sermoner' => array('sermonlist' => 'ModuleSermonList', 'sermonreader' => 'ModuleSermonReader'))); /** * CONTENT ELEMENTS **/ array_insert($GLOBALS['TL_CTE']['includes'], 1, array('chosenSermon' => 'ContentChosenSermon', 'latestSermon' => 'ContentLatestSermon')); /** * Cron jobs */ $GLOBALS['TL_CRON']['daily'][] = array('Sermoner', 'generateFeeds'); /** * Register hook to add news items to the indexer */ $GLOBALS['TL_HOOKS']['removeOldFeeds'][] = array('Sermoner', 'purgeOldFeeds'); $GLOBALS['TL_HOOKS']['getSearchablePages'][] = array('Sermoner', 'getSearchablePages'); $GLOBALS['TL_HOOKS']['generateXmlFiles'][] = array('Sermoner', 'generateFeeds'); /** * Add permissions */ $GLOBALS['TL_PERMISSIONS'][] = 'sermoner'; $GLOBALS['TL_PERMISSIONS'][] = 'sermonerp';
<?php /** * Contao Open Source CMS * * Copyright (c) 2005-2016 Leo Feyer * * @license LGPL-3.0+ */ /** * Back end modules */ array_insert($GLOBALS['BE_MOD']['content'], 4, array('newsletter' => array('tables' => array('tl_newsletter_channel', 'tl_newsletter', 'tl_newsletter_recipients'), 'send' => array('Newsletter', 'send'), 'import' => array('Newsletter', 'importRecipients'), 'stylesheet' => 'bundles/contaonewsletter/style.css'))); /** * Front end modules */ array_insert($GLOBALS['FE_MOD'], 4, array('newsletter' => array('subscribe' => 'ModuleSubscribe', 'unsubscribe' => 'ModuleUnsubscribe', 'newsletterlist' => 'ModuleNewsletterList', 'newsletterreader' => 'ModuleNewsletterReader'))); /** * Register hooks */ $GLOBALS['TL_HOOKS']['createNewUser'][] = array('Newsletter', 'createNewUser'); $GLOBALS['TL_HOOKS']['activateAccount'][] = array('Newsletter', 'activateAccount'); $GLOBALS['TL_HOOKS']['getSearchablePages'][] = array('Newsletter', 'getSearchablePages'); $GLOBALS['TL_HOOKS']['closeAccount'][] = array('Newsletter', 'removeSubscriptions'); /** * Add permissions */ $GLOBALS['TL_PERMISSIONS'][] = 'newsletters'; $GLOBALS['TL_PERMISSIONS'][] = 'newsletterp';
<?php /** * Contao Open Source CMS * * Copyright (c) 2016 Heimrich & Hannot GmbH * * @author Rico Kaltofen <*****@*****.**> * @license http://www.gnu.org/licences/lgpl-3.0.html LGPL */ $dc =& $GLOBALS['TL_DCA']['tl_content']; $dc['config']['onload_callback'][] = array('HeimrichHannot\\Teaser\\Backend\\Content', 'modifyPalette'); /** * Selector */ array_insert($dc['palettes']['__selector__'], 0, 'source'); /** * Palettes */ $dc['palettes']['linkteaser'] = ' {type_legend},type,headline; {teaser_legend},source,teaserLinkText,teaserLinkCssClass,teaserLinkBehaviour,teaserContentTemplate; {text_legend},text; {image_legend},addImage; {template_legend:hide},customTpl; {protected_legend:hide},protected; {expert_legend:hide},guests,cssID,space; {invisible_legend:hide},invisible,start,stop'; /** * Subpalettes */
/** * Return the IDs of all child records of a particular record (see #2475) * * @author Andreas Schempp * * @param mixed $arrParentIds An array of parent IDs * @param string $strTable The table name * @param boolean $blnSorting True if the table has a sorting field * @param array $arrReturn The array to be returned * @param string $strWhere Additional WHERE condition * * @return array An array of child record IDs */ public function getChildRecords($arrParentIds, $strTable, $blnSorting = false, $arrReturn = array(), $strWhere = '') { if (!is_array($arrParentIds)) { $arrParentIds = array($arrParentIds); } if (empty($arrParentIds)) { return $arrReturn; } $arrParentIds = array_map('intval', $arrParentIds); $objChilds = $this->query("SELECT id, pid FROM " . $strTable . " WHERE pid IN(" . implode(',', $arrParentIds) . ")" . ($strWhere ? " AND {$strWhere}" : "") . ($blnSorting ? " ORDER BY " . $this->findInSet('pid', $arrParentIds) . ", sorting" : "")); if ($objChilds->numRows > 0) { if ($blnSorting) { $arrChilds = array(); $arrOrdered = array(); while ($objChilds->next()) { $arrChilds[] = $objChilds->id; $arrOrdered[$objChilds->pid][] = $objChilds->id; } foreach (array_reverse(array_keys($arrOrdered)) as $pid) { $pos = (int) array_search($pid, $arrReturn); array_insert($arrReturn, $pos + 1, $arrOrdered[$pid]); } $arrReturn = $this->getChildRecords($arrChilds, $strTable, $blnSorting, $arrReturn, $strWhere); } else { $arrChilds = $objChilds->fetchEach('id'); $arrReturn = array_merge($arrChilds, $this->getChildRecords($arrChilds, $strTable, $blnSorting, $arrReturn, $strWhere)); } } return $arrReturn; }
private function joinitems(array $items, array $subitems) { if (count($subitems) == 0) { return $items; } if (count($items) > 0) { //delete copies for ($i = count($items) - 1; $i >= 0; $i--) { $id = $items[$i]['id']; foreach ($subitems as $subitem) { if ($id == $subitem['id']) { array_delete($items, $i); } } } } //join foreach ($subitems as $item) { $count = count($items); $order = $item['order']; if ($order < 0 || $order >= $count) { $items[] = $item; } else { array_insert($items, $item, $order); } } return $items; }