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


PHP General::array_remove_duplicates方法代码示例

本文整理汇总了PHP中General::array_remove_duplicates方法的典型用法代码示例。如果您正苦于以下问题:PHP General::array_remove_duplicates方法的具体用法?PHP General::array_remove_duplicates怎么用?PHP General::array_remove_duplicates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在General的用法示例。


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

示例1: __fetchAvailablePageTypes

 /**
  * Returns all the page types that exist in this Symphony install.
  * There are 5 default system page types, and new types can be added
  * by Developers via the Page Editor.
  *
  * @return array
  *  An array of strings of the page types used in this Symphony
  *  install. At the minimum, this will be an array with the values
  * 'index', 'XML', 'admin', '404' and '403'.
  */
 public function __fetchAvailablePageTypes()
 {
     $system_types = array('index', 'XML', 'admin', '404', '403');
     if (!($types = Symphony::Database()->fetchCol('type', "SELECT `type` FROM `tbl_pages_types` ORDER BY `type` ASC"))) {
         return $system_types;
     }
     return is_array($types) && !empty($types) ? General::array_remove_duplicates(array_merge($system_types, $types)) : $system_types;
 }
开发者ID:benesch,项目名称:hilton-unar,代码行数:18,代码来源:class.administrationpage.php

示例2: fetchTypes

 function fetchTypes()
 {
     $structure = General::listStructure(TOOLKIT . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', TOOLKIT . '/fields');
     $extensions = $this->_Parent->ExtensionManager->listInstalledHandles();
     if (is_array($extensions) && !empty($extensions)) {
         foreach ($extensions as $handle) {
             if (is_dir(EXTENSIONS . '/' . $handle . '/fields')) {
                 $tmp = General::listStructure(EXTENSIONS . '/' . $handle . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', EXTENSIONS . '/' . $handle . '/fields');
                 if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
                     $structure['filelist'] = array_merge($structure['filelist'], $tmp['filelist']);
                 }
             }
         }
         $structure['filelist'] = General::array_remove_duplicates($structure['filelist']);
     }
     $types = array();
     for ($ii = 0; $ii < count($structure['filelist']); $ii++) {
         $types[] = str_replace(array('field.', '.php'), '', $structure['filelist'][$ii]);
     }
     return $types;
 }
开发者ID:bauhouse,项目名称:sym-fluidgrids,代码行数:21,代码来源:class.fieldmanager.php

示例3: fetchUsedTypes

 public static function fetchUsedTypes()
 {
     $types = array();
     foreach (new ViewIterator() as $v) {
         $types = array_merge((array) $v->types, $types);
     }
     return General::array_remove_duplicates($types);
 }
开发者ID:plasticine,项目名称:symphony-3,代码行数:8,代码来源:class.view.php

示例4: processRawFieldData

 function processRawFieldData($data, &$status, $simulate = false, $entry_id = NULL)
 {
     $status = self::__OK__;
     $data = preg_split('/\\,\\s*/i', $data, -1, PREG_SPLIT_NO_EMPTY);
     $data = array_map('trim', $data);
     if (empty($data)) {
         return;
     }
     $data = General::array_remove_duplicates($data);
     sort($data);
     $result = array();
     foreach ($data as $value) {
         $result['value'][] = $value;
         $result['handle'][] = Lang::createHandle($value);
     }
     return $result;
 }
开发者ID:njmcgee,项目名称:taxcheck,代码行数:17,代码来源:field.taglist.php

示例5: __formAction


//.........这里部分代码省略.........
                     $params['static'] = sprintf('%s', trim($fields['static_xml']));
                     break;
                 default:
                     $extends = 'SectionDatasource';
                     $elements = $fields['xml_elements'];
                     if (is_array($fields['filter']) && !empty($fields['filter'])) {
                         $filters = array();
                         foreach ($fields['filter'] as $f) {
                             foreach ($f as $key => $val) {
                                 $filters[$key] = $val;
                             }
                         }
                     }
                     $params['order'] = $fields['order'];
                     $params['group'] = $fields['group'];
                     $params['paginateresults'] = $fields['paginate_results'];
                     $params['limit'] = $fields['max_records'];
                     $params['startpage'] = $fields['page_number'];
                     $params['redirectonempty'] = $fields['redirect_on_empty'];
                     $params['redirectonforbidden'] = $fields['redirect_on_forbidden'];
                     $params['redirectonrequired'] = $fields['redirect_on_required'];
                     $params['requiredparam'] = trim($fields['required_url_param']);
                     $params['negateparam'] = trim($fields['negate_url_param']);
                     $params['paramoutput'] = $fields['param'];
                     $params['sort'] = $fields['sort'];
                     $params['htmlencode'] = $fields['html_encode'];
                     $params['associatedentrycounts'] = $fields['associated_entry_counts'];
                     break;
             }
             $this->__injectVarList($dsShell, $params);
             $this->__injectIncludedElements($dsShell, $elements);
             self::injectFilters($dsShell, $filters);
             if (preg_match_all('@(\\$ds-[0-9a-z_\\.\\-]+)@i', $dsShell, $matches)) {
                 $dependencies = General::array_remove_duplicates($matches[1]);
                 $dsShell = str_replace('<!-- DS DEPENDENCY LIST -->', "'" . implode("', '", $dependencies) . "'", $dsShell);
             }
             $dsShell = str_replace('<!-- CLASS EXTENDS -->', $extends, $dsShell);
             $dsShell = str_replace('<!-- SOURCE -->', $source, $dsShell);
         }
         if ($this->_context[0] == 'new') {
             /**
              * Prior to creating the Datasource, the file path where it will be written to
              * is provided and well as the contents of that file.
              *
              * @delegate DatasourcePreCreate
              * @since Symphony 2.2
              * @param string $context
              * '/blueprints/datasources/'
              * @param string $file
              *  The path to the Datasource file
              * @param string $contents
              *  The contents for this Datasource as a string passed by reference
              * @param array $params
              *  An array of all the `$dsParam*` values
              * @param array $elements
              *  An array of all the elements included in this datasource
              * @param array $filters
              *  An associative array of all the filters for this datasource with the key
              *  being the `field_id` and the value the filter.
              * @param array $dependencies
              *  An array of dependencies that this datasource has
              */
             Symphony::ExtensionManager()->notifyMembers('DatasourcePreCreate', '/blueprints/datasources/', array('file' => $file, 'contents' => &$dsShell, 'params' => $params, 'elements' => $elements, 'filters' => $filters, 'dependencies' => $dependencies));
         } else {
             /**
              * Prior to editing a Datasource, the file path where it will be written to
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:67,代码来源:content.blueprintsdatasources.php

示例6: __formAction


//.........这里部分代码省略.........
             case 'authors':
                 $filters = $fields['filter']['author'];
                 $elements = $fields['xml_elements'];
                 $params['order'] = $fields['order'];
                 $params['limit'] = $fields['max_records'];
                 $params['redirectonempty'] = isset($fields['redirect_on_empty']) ? 'yes' : 'no';
                 $params['requiredparam'] = $fields['required_url_param'];
                 $params['paramoutput'] = $fields['param'];
                 $params['sort'] = $fields['sort'];
                 $params['startpage'] = $fields['page_number'];
                 $dsShell = str_replace('<!-- GRAB -->', "include(TOOLKIT . '/data-sources/datasource.author.php');", $dsShell);
                 break;
             case 'navigation':
                 $filters = $fields['filter']['navigation'];
                 $params['order'] = $fields['order'];
                 $params['redirectonempty'] = isset($fields['redirect_on_empty']) ? 'yes' : 'no';
                 $params['requiredparam'] = $fields['required_url_param'];
                 $dsShell = str_replace('<!-- GRAB -->', "include(TOOLKIT . '/data-sources/datasource.navigation.php');", $dsShell);
                 break;
             case 'dynamic_xml':
                 $namespaces = $fields['dynamic_xml']['namespace'];
                 $filters = array();
                 for ($ii = 0; $ii < count($namespaces['name']); $ii++) {
                     $filters[$namespaces['name'][$ii]] = $namespaces['uri'][$ii];
                 }
                 $params['url'] = $fields['dynamic_xml']['url'];
                 $params['xpath'] = $fields['dynamic_xml']['xpath'];
                 $params['cache'] = $fields['dynamic_xml']['cache'];
                 $dsShell = str_replace('<!-- GRAB -->', "include(TOOLKIT . '/data-sources/datasource.dynamic_xml.php');", $dsShell);
                 break;
             case 'static_xml':
                 $value = sprintf('$result = "%s";', addslashes($fields['static_xml']));
                 $dsShell = str_replace('<!-- GRAB -->', $value, $dsShell);
                 break;
             default:
                 $elements = $fields['xml_elements'];
                 if (is_array($fields['filter']) && !empty($fields['filter'])) {
                     $filters = array();
                     foreach ($fields['filter'] as $f) {
                         foreach ($f as $key => $val) {
                             $filters[$key] = $val;
                         }
                     }
                 }
                 $params['order'] = $fields['order'];
                 $params['group'] = $fields['group'];
                 $params['limit'] = $fields['max_records'];
                 $params['redirectonempty'] = isset($fields['redirect_on_empty']) ? 'yes' : 'no';
                 $params['requiredparam'] = $fields['required_url_param'];
                 $params['paramoutput'] = $fields['param'];
                 $params['sort'] = $fields['sort'];
                 $params['startpage'] = $fields['page_number'];
                 $params['htmlencode'] = $fields['html_encode'];
                 $dsShell = str_replace('<!-- GRAB -->', "include(TOOLKIT . '/data-sources/datasource.section.php');", $dsShell);
                 break;
         }
         $this->__injectVarList($dsShell, $params);
         $this->__injectAboutInformation($dsShell, $about);
         $this->__injectIncludedElements($dsShell, $elements);
         $this->__injectFilters($dsShell, $filters);
         $dsShell = str_replace('<!-- CLASS NAME -->', $classname, $dsShell);
         $dsShell = str_replace('<!-- SOURCE -->', $source, $dsShell);
         if (preg_match_all('@{(\\$ds-[^}]+)}@i', $dsShell, $matches)) {
             $dependancies = array();
             foreach ($matches[1] as $match) {
                 if (preg_match_all('/(\\$ds-[^:]+)/i', $match, $inner_matches)) {
                     $dependancies = array_merge($dependancies, $inner_matches[1]);
                 }
             }
             $dependancies = General::array_remove_duplicates($dependancies);
             $dsShell = str_replace('<!-- DS DEPENDANCY LIST -->', "'" . implode("', '", $dependancies) . "'", $dsShell);
         }
         ## Remove left over placeholders
         $dsShell = preg_replace(array('/<!--[\\w ]++-->/', '/(\\r\\n){2,}/', '/(\\t+[\\r\\n]){2,}/'), '', $dsShell);
         ##Write the file
         if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $dsShell, $this->_Parent->Configuration->get('write_mode', 'file')))) {
             $this->pageAlert(__('Failed to write Data source to <code>%s</code>. Please check permissions.', array(DATASOURCES)), Alert::ERROR);
         } else {
             if ($queueForDeletion) {
                 General::deleteFile($queueForDeletion);
                 ## Update pages that use this DS
                 $sql = "SELECT * FROM `tbl_pages` WHERE `data_sources` REGEXP '[[:<:]]" . $existing_handle . "[[:>:]]' ";
                 $pages = $this->_Parent->Database->fetch($sql);
                 if (is_array($pages) && !empty($pages)) {
                     foreach ($pages as $page) {
                         $page['data_sources'] = preg_replace('/\\b' . $existing_handle . '\\b/i', $classname, $page['data_sources']);
                         $this->_Parent->Database->update($page, 'tbl_pages', "`id` = '" . $page['id'] . "'");
                     }
                 }
             }
             ### TODO: Fix me
             ###
             # Delegate: Create
             # Description: After saving the datasource, the file path is provided and an array
             #              of variables set by the editor
             #$ExtensionManager->notifyMembers('Create', getCurrentPage(), array('file' => $file, 'defines' => $defines, 'var' => $var));
             redirect(URL . '/symphony/blueprints/datasources/edit/' . $classname . '/' . ($this->_context[0] == 'new' ? 'created' : 'saved') . '/');
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-site,代码行数:101,代码来源:content.blueprintsdatasources.php

示例7: processRawFieldData

 public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = NULL)
 {
     $status = self::__OK__;
     $data = preg_split('/\\' . $this->get('delimiter') . '\\s*/i', $data, -1, PREG_SPLIT_NO_EMPTY);
     $data = array_map('trim', $data);
     if (empty($data)) {
         return;
     }
     $data = General::array_remove_duplicates($data);
     if ($this->get('ordered') != 'yes') {
         sort($data);
     }
     $result = array();
     foreach ($data as $value) {
         $result['value'][] = $value;
         $result['handle'][] = Lang::createHandle($value);
     }
     return $result;
 }
开发者ID:symphonists,项目名称:enhancedtaglist,代码行数:19,代码来源:field.enhancedtaglist.php

示例8: buildXSL

 function buildXSL($page_handle = NULL, $utilities = NULL, $param = NULL)
 {
     $xsl = array();
     $sql = "SELECT t1.*,\n\t\t\t\t\t\t   t2.events as `master_events`,\n\t\t\t\t\t\t   t2.data_sources as `master_data_sources`\n\n\t\t\t\t\tFROM `tbl_pages` AS `t1`\n\t\t\t\t\tLEFT JOIN `tbl_masters` AS `t2` ON t1.`master` = concat(t2.`name`, '.xsl')\n\t\t\t\t\tWHERE t1.`handle` = '" . $this->_page . "' LIMIT 1";
     if (!($page = $this->_db->fetchRow(0, $sql))) {
         $this->fatalError("Requested page '" . $this->_page . "' could not be found");
     }
     $page_data = preg_split('/,/', $page['data_sources'] . "," . $page['master_data_sources'], -1, PREG_SPLIT_NO_EMPTY);
     $page_data = General::array_remove_duplicates($page_data);
     $page_events = preg_split('/,/', $page['events'] . "," . $page['master_events'], -1, PREG_SPLIT_NO_EMPTY);
     $page_events = General::array_remove_duplicates($page_events);
     $master = $page['master'];
     if (!is_array($utilities) || empty($utilities)) {
         $utilities = $this->_db->fetch("SELECT DISTINCT t1.*\n\t\t\t\t\t\t\t\t\t\t FROM `tbl_utilities` as t1\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `tbl_utilities2datasources` as t2 ON t1.id = t2.utility_id\n\t\t\t\t\t\t\t\t\t\t LEFT JOIN `tbl_utilities2events` as t3 ON t1.id = t3.utility_id\n\t\t\t\t\t\t\t\t\t\t WHERE (t2.`data_source` IS NULL AND t3.`event` IS NULL)\n\t\t\t\t\t\t\t\t\t\t OR (t2.`data_source` IN ('" . @implode("', '", $page_data) . "')\n\t\t\t\t\t\t\t\t\t\t OR t3.`event` IN ('" . @implode("', '", $page_events) . "'))");
         $utilities = General::array_remove_duplicates($utilities);
     }
     if (!($xsl['page'] = @file_get_contents(WORKSPACE . "/pages/" . $this->_page . ".xsl"))) {
         $this->fatalError("Specified page '" . $this->_page . "' could not be loaded");
     }
     if (is_array($utilities) && !empty($utilities)) {
         foreach ($utilities as $u) {
             if (!@file_exists(WORKSPACE . "/utilities/" . $u['handle'] . ".xsl")) {
                 $this->fatalError("Specified utility '" . $u['name'] . "' could not be loaded");
             }
             $xsl['utilities'][] = file_get_contents(WORKSPACE . "/utilities/" . $u['handle'] . ".xsl");
         }
     }
     if ($master != NULL) {
         if (!($xsl['master'] = @file_get_contents(WORKSPACE . "/masters/" . $master))) {
             $this->fatalError("Specified master '" . $master . "' could not be loaded");
         }
         $xsl['master'] = trim($xsl['master']);
         $xsl['master'] = str_replace("</xsl:stylesheet>", "", trim($xsl['master']));
     } else {
         $xsl['page'] = str_replace("</xsl:stylesheet>", "", trim($xsl['page']));
     }
     $this->_xsl_final = trim($xsl['master']) . CRLF . $xsl['page'] . CRLF . @implode(CRLF, array_map("trim", $xsl['utilities'])) . "\n</xsl:stylesheet>";
     ##Compile the final stylesheet
     $xsl_param = NULL;
     if (is_array($param) && !empty($param)) {
         foreach ($param as $key => $val) {
             $val = preg_replace('/[\'"]/', '', stripslashes($val));
             $xsl_param .= '    <xsl:param name="' . $key . '" select="\'' . $val . '\'" />' . CRLF;
         }
         if (!_USING_SABLOTRON_) {
             $xsl_param = '<!--' . CRLF . '    // Parameters are defined via PHP in the background //' . CRLF . $xsl_param . '-->';
         }
         preg_match_all('/(<xsl:output[\\s\\w="\'-\\/:.@]*\\/>)/', $this->_xsl_final, $result, PREG_SET_ORDER);
         $this->_xsl_final = str_replace($result[0][1], $result[0][1] . CRLF . CRLF . $xsl_param, $this->_xsl_final);
     }
     $this->_xsl_final = trim($this->_xsl_final);
     return $this->_xsl_final;
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:53,代码来源:class.site.php

示例9: __formAction


//.........这里部分代码省略.........
                     $params['static'] = sprintf('%s', addslashes(trim($fields['static_xml'])));
                     break;
                 default:
                     $extends = 'SectionDatasource';
                     $elements = $fields['xml_elements'];
                     if (is_array($fields['filter']) && !empty($fields['filter'])) {
                         $filters = array();
                         foreach ($fields['filter'] as $f) {
                             foreach ($f as $key => $val) {
                                 $filters[$key] = $val;
                             }
                         }
                     }
                     $params['order'] = $fields['order'];
                     $params['group'] = $fields['group'];
                     $params['paginateresults'] = isset($fields['paginate_results']) ? 'yes' : 'no';
                     $params['limit'] = $fields['max_records'];
                     $params['startpage'] = $fields['page_number'];
                     $params['redirectonempty'] = isset($fields['redirect_on_empty']) ? 'yes' : 'no';
                     $params['requiredparam'] = trim($fields['required_url_param']);
                     $params['paramoutput'] = $fields['param'];
                     $params['sort'] = $fields['sort'];
                     $params['htmlencode'] = $fields['html_encode'];
                     $params['associatedentrycounts'] = $fields['associated_entry_counts'];
                     if ($params['associatedentrycounts'] == NULL) {
                         $params['associatedentrycounts'] = 'no';
                     }
                     break;
             }
             $this->__injectVarList($dsShell, $params);
             $this->__injectIncludedElements($dsShell, $elements);
             self::injectFilters($dsShell, $filters);
             if (preg_match_all('@(\\$ds-[0-9a-z_\\.\\-]+)@i', $dsShell, $matches)) {
                 $dependencies = General::array_remove_duplicates($matches[1]);
                 $dsShell = str_replace('<!-- DS DEPENDENCY LIST -->', "'" . implode("', '", $dependencies) . "'", $dsShell);
             }
             $dsShell = str_replace('<!-- CLASS EXTENDS -->', $extends, $dsShell);
             $dsShell = str_replace('<!-- SOURCE -->', $source, $dsShell);
         }
         if ($this->_context[0] == 'new') {
             /**
              * Prior to creating the Datasource, the file path where it will be written to
              * is provided and well as the contents of that file.
              *
              * @delegate DatasourcePreCreate
              * @since Symphony 2.2
              * @param string $context
              * '/blueprints/datasources/'
              * @param string $file
              *  The path to the Datasource file
              * @param string $contents
              *  The contents for this Datasource as a string passed by reference
              * @param array $params
              *  An array of all the `$dsParam*` values
              * @param array $elements
              *  An array of all the elements included in this datasource
              * @param array $filters
              *  An associative array of all the filters for this datasource with the key
              *  being the `field_id` and the value the filter.
              * @param array $dependencies
              *  An array of dependencies that this datasource has
              */
             Symphony::ExtensionManager()->notifyMembers('DatasourcePreCreate', '/blueprints/datasources/', array('file' => $file, 'contents' => &$dsShell, 'params' => $params, 'elements' => $elements, 'filters' => $filters, 'dependencies' => $dependencies));
         } else {
             /**
              * Prior to editing a Datasource, the file path where it will be written to
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:67,代码来源:content.blueprintsdatasources.php

示例10: appendDataSourceConditions

 public function appendDataSourceConditions(&$context)
 {
     /*
     						'file' => $file,
     						'contents' => &$dsShell,
     						'params' => $params,
     						'elements' => $elements,
     						'filters' => $filters,
     						'dependencies' => $dependencies
     */
     if (!isset($_POST['conditionalizer']) || empty($_POST['conditionalizer'])) {
         return;
     }
     $data = var_export($_POST['conditionalizer'], true) . ";\n";
     // Store condition in data-source
     $context['contents'] = preg_replace('/public \\$dsParamROOTELEMENT [^\\n]+\\n/', '$0		public \\$dsParamConditionalizer = ' . $data, $context['contents']);
     // Update dependencies
     // From content.blueprintsdatasources.php
     if (preg_match_all('@(\\$ds-[-_0-9a-z]+)@i', $data, $matches)) {
         if (!is_array($context['dependencies'])) {
             $context['dependencies'] = array();
         }
         $context['dependencies'] = General::array_remove_duplicates(array_merge($matches[1], $context['dependencies']));
         $context['contents'] = preg_replace('/' . preg_quote('$this->_dependencies = array(') . '[^\\)]*\\);/', '$this->_dependencies = array(\'' . implode("', '", $context['dependencies']) . '\');', $context['contents']);
     }
 }
开发者ID:ahwayakchih,项目名称:conditionalizer,代码行数:26,代码来源:extension.driver.php

示例11: __formAction


//.........这里部分代码省略.........
                 $elements = $fields['xml_elements'];
                 if (is_array($fields['filter']) && !empty($fields['filter'])) {
                     $filters = array();
                     foreach ($fields['filter'] as $f) {
                         foreach ($f as $key => $val) {
                             $filters[$key] = $val;
                         }
                     }
                 }
                 $params['order'] = $fields['order'];
                 $params['group'] = $fields['group'];
                 $params['paginateresults'] = isset($fields['paginate_results']) ? 'yes' : 'no';
                 $params['limit'] = $fields['max_records'];
                 $params['startpage'] = $fields['page_number'];
                 $params['redirectonempty'] = isset($fields['redirect_on_empty']) ? 'yes' : 'no';
                 $params['requiredparam'] = trim($fields['required_url_param']);
                 $params['paramoutput'] = $fields['param'];
                 $params['sort'] = $fields['sort'];
                 $params['htmlencode'] = $fields['html_encode'];
                 $params['associatedentrycounts'] = $fields['associated_entry_counts'];
                 if ($params['associatedentrycounts'] == NULL) {
                     $params['associatedentrycounts'] = 'no';
                 }
                 $dsShell = str_replace('<!-- GRAB -->', "include(TOOLKIT . '/data-sources/datasource.section.php');", $dsShell);
                 break;
         }
         $this->__injectVarList($dsShell, $params);
         $this->__injectAboutInformation($dsShell, $about);
         $this->__injectIncludedElements($dsShell, $elements);
         $this->__injectFilters($dsShell, $filters);
         $dsShell = str_replace('<!-- CLASS NAME -->', $classname, $dsShell);
         $dsShell = str_replace('<!-- SOURCE -->', $source, $dsShell);
         if (preg_match_all('@(\\$ds-[-_0-9a-z]+)@i', $dsShell, $matches)) {
             $dependencies = General::array_remove_duplicates($matches[1]);
             $dsShell = str_replace('<!-- DS DEPENDENCY LIST -->', "'" . implode("', '", $dependencies) . "'", $dsShell);
         }
         ## Remove left over placeholders
         $dsShell = preg_replace(array('/<!--[\\w ]++-->/', '/(\\r\\n){2,}/', '/(\\t+[\\r\\n]){2,}/'), '', $dsShell);
         if ($this->_context[0] == 'new') {
             /**
              * Prior to creating the Datasource, the file path where it will be written to
              * is provided and well as the contents of that file.
              *
              * @delegate DatasourcePreCreate
              * @since Symphony 2.2
              * @param string $context
              * '/blueprints/datasources/'
              * @param string $file
              *  The path to the Datasource file
              * @param string $contents
              *  The contents for this Datasource as a string passed by reference
              * @param array $params
              *  An array of all the `$dsParam*` values
              * @param array $elements
              *  An array of all the elements included in this datasource
              * @param array $filters
              *  An associative array of all the filters for this datasource with the key
              *  being the `field_id` and the value the filter.
              * @param array $dependencies
              *  An array of dependencies that this datasource has
              */
             Symphony::ExtensionManager()->notifyMembers('DatasourcePreCreate', '/blueprints/datasources/', array('file' => $file, 'contents' => &$dsShell, 'params' => $params, 'elements' => $elements, 'filters' => $filters, 'dependencies' => $dependencies));
         } else {
             /**
              * Prior to editing a Datasource, the file path where it will be written to
              * is provided and well as the contents of that file.
开发者ID:benesch,项目名称:hilton-unar,代码行数:67,代码来源:content.blueprintsdatasources.php

示例12: prepareImportValue

 /**
  * Give the field some data and ask it to return a value.
  *
  * @param mixed $data
  * @param integer $entry_id
  * @return array|null
  */
 public function prepareImportValue($data, $entry_id = null)
 {
     $data = preg_split('/\\,\\s*/i', $data, -1, PREG_SPLIT_NO_EMPTY);
     $data = array_map('trim', $data);
     $result = array();
     if (empty($data)) {
         return null;
     }
     $result = array('value' => array(), 'handle' => array());
     // Do a case insensitive removal of duplicates:
     $data = General::array_remove_duplicates($data, true);
     sort($data);
     foreach ($data as $value) {
         $result['value'][] = $value;
         $result['handle'][] = Lang::createHandle($value);
     }
     return $result;
 }
开发者ID:readona,项目名称:symphonyno5,代码行数:25,代码来源:field.taglist.php

示例13: fetchUsedNavigationGroups

 public static function fetchUsedNavigationGroups()
 {
     $groups = array();
     foreach (new SectionIterator() as $s) {
         $groups[] = $s->{'navigation-group'};
     }
     return General::array_remove_duplicates($groups);
 }
开发者ID:pointybeard,项目名称:symphony-3,代码行数:8,代码来源:class.section.php

示例14: __fetchAvailableViewTypes

 private static function __fetchAvailableViewTypes()
 {
     // TODO: Delegate here so extensions can add custom view types?
     $types = array('index', 'XML', 'admin', '404', '403');
     foreach (View::fetchUsedTypes() as $t) {
         $types[] = $t;
     }
     return General::array_remove_duplicates($types);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:9,代码来源:content.blueprintsviews.php

示例15: appendDataSourceParameters

 public function appendDataSourceParameters(&$context)
 {
     /*
     						'file' => $file,
     						'contents' => &$dsShell,
     						'params' => $params,
     						'elements' => $elements,
     						'filters' => $filters,
     						'dependencies' => $dependencies
     */
     if (!isset($_POST['parametrisator']['xpaths']) || empty($_POST['parametrisator']['xpaths'])) {
         return;
     }
     if (!empty($_POST['parametrisator']['xslt'])) {
         $XSLT = UTILITIES . '/' . preg_replace(array('%/+%', '%(^|/)\\.\\./%'), '/', $_POST['parametrisator']['xslt']);
         if (file_exists($XSLT)) {
             $parametrisator['xslt'] = $_POST['parametrisator']['xslt'];
         }
     } else {
         $parametrisator['xslt'] = false;
     }
     $parametrisator['xpaths'] = array_filter(array_combine(array_map(array('Lang', 'createHandle'), $_POST['parametrisator']['xpaths']['name']), $_POST['parametrisator']['xpaths']['xpath']));
     if (empty($parametrisator['xpaths'])) {
         return;
     }
     $parametrisator = preg_replace(array("/\n  /", "/\n\\)\\s*\$/"), array("\n\t\t\t", "\n\t\t);"), var_export($parametrisator, true)) . "\n";
     // Store XPaths in data-source
     $context['contents'] = preg_replace('/public \\$dsParamROOTELEMENT [^\\n]+\\n/', '$0		public \\$dsParamParametrisator = ' . $parametrisator, $context['contents']);
     // Update dependencies
     // From content.blueprintsdatasources.php
     if (preg_match_all('@(\\$ds-[-_0-9a-z]+)@i', $parametrisator, $matches)) {
         if (!is_array($context['dependencies'])) {
             $context['dependencies'] = array();
         }
         $context['dependencies'] = General::array_remove_duplicates(array_merge($matches[1], $context['dependencies']));
         $context['contents'] = preg_replace('/' . preg_quote('$this->_dependencies = array(') . '[^\\)]*\\);/', '$this->_dependencies = array(\'' . implode("', '", $context['dependencies']) . '\');', $context['contents']);
     }
     // Modify data-source grab() to make it output additional parameters
     $this->injectPHP($context['contents']);
 }
开发者ID:nickdunn,项目名称:parametrisator,代码行数:40,代码来源:extension.driver.php


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