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


PHP Lang::createHandle方法代码示例

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


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

示例1: convertToXML

 /**
  * Given a CSV file, generate a resulting XML tree
  *
  * @param  string $data
  * @return string
  */
 public static function convertToXML($data)
 {
     $headers = array();
     // Get CSV settings
     $settings = array('csv-delimiter' => ',', 'csv-enclosure' => '"', 'csv-escape' => '\\');
     $settings = array_merge($settings, (array) Symphony::Configuration()->get('remote_datasource'));
     // DOMDocument
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->formatOutput = true;
     $root = $doc->createElement('data');
     $doc->appendChild($root);
     foreach (str_getcsv($data, PHP_EOL) as $i => $row) {
         if (empty($row)) {
             continue;
         }
         if ($i == 0) {
             foreach (str_getcsv($row, $settings['csv-delimiter'], $settings['csv-enclosure'], $settings['csv-escape']) as $i => $head) {
                 if (class_exists('Lang')) {
                     $head = Lang::createHandle($head);
                 }
                 $headers[] = $head;
             }
         } else {
             self::addRow($doc, $root, str_getcsv($row, $settings['csv-delimiter'], $settings['csv-enclosure'], $settings['csv-escape']), $headers);
         }
     }
     $output = $doc->saveXML($doc->documentElement);
     return trim($output);
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:35,代码来源:class.csv.php

示例2: displayPublishPanel

 function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     $note = isset($data['value']) ? $data['value'] : $this->get('note');
     $editable = $this->get('editable');
     # Add <div>
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
     $wrapper->appendChild($div);
     # Editable
     if (isset($editable) && $editable) {
         $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
         $edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit"));
         $wrapper->appendChild($edit);
         # Add <textarea>
         $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
         $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL);
         $label->appendChild($textarea);
         $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
         $label->appendChild($control);
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::Error($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:25,代码来源:field.publishnotes.php

示例3: __actionIndex

 function __actionIndex()
 {
     $checked = @array_keys($_POST['items']);
     if (is_array($checked) && !empty($checked)) {
         switch ($_POST['with-selected']) {
             case 'delete':
                 $pages = $checked;
                 ## TODO: Fix Me
                 ###
                 # Delegate: Delete
                 # Description: Prior to deletion. Provided with an array of pages for deletion that can be modified.
                 //$ExtensionManager->notifyMembers('Delete', getCurrentPage(), array('pages' => &$pages));
                 $pagesList = join(', ', array_map('intval', $pages));
                 // 1. Fetch page details
                 $query = 'SELECT `id`, `sortorder`, `handle`, `path`, `title` FROM tbl_pages_templates WHERE `id` IN (' . $pagesList . ')';
                 $details = $this->_Parent->Database->fetch($query);
                 $this->_Parent->Database->delete('tbl_pages_templates', " `id` IN('" . implode("','", $checked) . "')");
                 $this->_Parent->Database->delete('tbl_pages_types', " `page_id` IN('" . implode("','", $checked) . "')");
                 foreach ($details as $r) {
                     $filename = Lang::createHandle($r['title']);
                     // echo PAGES . "/templates/" . $filename . ".xsl";
                     $this->_Parent->Database->query("UPDATE tbl_pages_templates SET `sortorder` = (`sortorder` + 1) WHERE `sortorder` < '" . $r['sortorder'] . "'");
                     General::deleteFile(PAGES . "/templates/" . $filename . ".xsl");
                 }
                 redirect($this->_Parent->getCurrentPageURL());
                 break;
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:29,代码来源:content.manage.php

示例4: view

 public function view()
 {
     $params = array('{$today}', '{$current-time}', '{$this-year}', '{$this-month}', '{$this-day}', '{$timezone}', '{$website-name}', '{$page-title}', '{$root}', '{$workspace}', '{$root-page}', '{$current-page}', '{$current-page-id}', '{$current-path}', '{$current-query-string}', '{$current-url}', '{$cookie-username}', '{$cookie-pass}', '{$page-types}', '{$upload-limit}');
     // Get page parameters
     $pages = PageManager::fetch(true, array('params'));
     foreach ($pages as $key => $pageparams) {
         if (empty($pageparams['params'])) {
             continue;
         }
         $pageparams = explode('/', $pageparams['params']);
         foreach ($pageparams as $pageparam) {
             $param = '{$' . $pageparam . '}';
             if (!in_array($param, $params)) {
                 $params[] = $param;
             }
         }
     }
     // Get Data Sources output parameters
     $datasources = DatasourceManager::listAll();
     foreach ($datasources as $datasource) {
         $current = DatasourceManager::create($datasource['handle'], array(), false);
         $prefix = '{$ds-' . Lang::createHandle($datasource['name']) . '.';
         $suffix = '}';
         // Get parameters
         if (is_array($current->dsParamPARAMOUTPUT)) {
             foreach ($current->dsParamPARAMOUTPUT as $id => $param) {
                 $params[] = $prefix . $param . $suffix;
             }
         }
     }
     sort($params);
     $this->_Result = json_encode($params);
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:33,代码来源:content.ajaxparameters.php

示例5: createArray

 /**
  *
  * Convert the $source string into a array.
  * This array should always respect the scheme defined by the
  * getDataFromSource method of the ServiceDriver
  * @param string $source
  * @return string
  */
 public function createArray($source, $driver, $url, &$errorFlag)
 {
     // trying to load XML into DOM Document
     $doc = new DOMDocument();
     $doc->preserveWhiteSpace = false;
     $doc->formatOutput = false;
     // ignore errors, but save it if was successful
     $errorFlag = !@$doc->loadXML($source);
     if (!$errorFlag) {
         $xml['xml'] = @$doc->saveXML();
         if ($xml['xml'] === FALSE) {
             $errorFlag = true;
         } else {
             // add id to array
             $idTagName = $driver->getIdTagName();
             if ($idTagName == null) {
                 $xml['id'] = Lang::createHandle($url);
             } else {
                 $xml['id'] = $doc->getElementsByTagName($idTagName)->item(0)->nodeValue;
             }
             $xml['title'] = $doc->getElementsByTagName($driver->getTitleTagName())->item(0)->nodeValue;
             $xml['thumb'] = $doc->getElementsByTagName($driver->getThumbnailTagName())->item(0)->nodeValue;
         }
     }
     if ($errorFlag) {
         // return error message
         $xml['error'] = __('Symphony could not parse XML from oEmbed remote service');
     }
     return $xml;
 }
开发者ID:justinjaywang,项目名称:oembed_field,代码行数:38,代码来源:class.parser.xml.php

示例6: grab

 public function grab(&$param_pool)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     foreach ($this->_env as $key => $value) {
         switch ($key) {
             case 'param':
                 //$group = new XMLElement('params');
                 foreach ($this->_env[$key] as $key => $value) {
                     $param = new XMLElement($key, General::sanitize($value));
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
             case 'env':
                 //$group = new XMLElement('pool');
                 foreach ($this->_env[$key]['pool'] as $key => $value) {
                     $param = new XMLElement($key);
                     if (is_array($value)) {
                         $param->setAttribute('count', count($value));
                         foreach ($value as $key => $value) {
                             $item = new XMLElement('item', General::sanitize($value));
                             $item->setAttribute('handle', Lang::createHandle($value));
                             $param->appendChild($item);
                         }
                     } else {
                         $param->setValue(General::sanitize($value));
                     }
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
         }
     }
     return $result;
 }
开发者ID:ErisDS,项目名称:Bugaroo,代码行数:35,代码来源:data.zzz_param_pool.php

示例7: get

 public static function get()
 {
     $response = new XMLElement('response');
     foreach (self::$_sections as $section) {
         $section_xml = new XMLElement('section');
         $meta = $section->get();
         foreach ($meta as $key => $value) {
             $section_xml->setAttribute(Lang::createHandle($key), $value);
         }
         $fields = $section->fetchFields();
         foreach ($fields as $field) {
             $meta = $field->get();
             unset($meta['field_id']);
             $field_xml = new XMLElement($meta['element_name'], null);
             foreach (self::$_field_attributes as $attr) {
                 $field_xml->setAttribute(Lang::createHandle($attr), $meta[$attr]);
             }
             foreach ($meta as $key => $value) {
                 if (in_array($key, self::$_field_attributes)) {
                     continue;
                 }
                 $value = General::sanitize($value);
                 if ($value != '') {
                     $field_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value)));
                 }
             }
             $section_xml->appendChild($field_xml);
         }
         $response->appendChild($section_xml);
     }
     REST_API::sendOutput($response);
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:32,代码来源:rest.sections.php

示例8: convertToXML

 /**
  * Given a CSV file, generate a resulting XML tree
  *
  * @param  string $data
  * @return string
  */
 public static function convertToXML($data)
 {
     $headers = array();
     // DOMDocument
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->formatOutput = true;
     $root = $doc->createElement('data');
     $doc->appendChild($root);
     foreach (str_getcsv($data, PHP_EOL) as $i => $row) {
         if (empty($row)) {
             continue;
         }
         if ($i == 0) {
             foreach (str_getcsv($row) as $i => $head) {
                 if (class_exists('Lang')) {
                     $head = Lang::createHandle($head);
                 }
                 $headers[] = $head;
             }
         } else {
             self::addRow($doc, $root, str_getcsv($row), $headers);
         }
     }
     $output = $doc->saveXML($doc->documentElement);
     return trim($output);
 }
开发者ID:beaubbe,项目名称:remote_datasource,代码行数:32,代码来源:class.csv.php

示例9: view

 public function view()
 {
     $name = General::sanitize($_REQUEST['name']);
     $section = General::sanitize($_REQUEST['section']);
     $filters = self::processFilters($_REQUEST['filters']);
     $rootelement = Lang::createHandle($name);
     $doc_parts = array();
     // Add Documentation (Success/Failure)
     $this->addEntrySuccessDoc($doc_parts, $rootelement, $filters);
     $this->addEntryFailureDoc($doc_parts, $rootelement, $filters);
     // Filters
     $this->addDefaultFiltersDoc($doc_parts, $rootelement, $filters);
     // Frontend Markup
     $this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
     $this->addSendMailFilterDoc($doc_parts, $filters);
     /**
      * Allows adding documentation for new filters. A reference to the $documentation
      * array is provided, along with selected filters
      *
      * @delegate AppendEventFilterDocumentation
      * @param string $context
      * '/blueprints/events/(edit|new|info)/'
      * @param array $selected
      *  An array of all the selected filters for this Event
      * @param array $documentation
      *  An array of all the documentation XMLElements, passed by reference
      * @param string $rootelment
      *  The name of this event, as a handle.
      */
     Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/', array('selected' => $filters, 'documentation' => &$doc_parts, 'rootelement' => $rootelement));
     $documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
     $documentation = str_replace('\'', '\\\'', $documentation);
     $documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
     $this->_Result = $documentation;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:35,代码来源:content.ajaxeventdocumentation.php

示例10: createArray

 /**
  *
  * Convert the $source string into a array.
  * This array should always respect the scheme defined by the
  * getDataFromSource method of the ServiceDriver
  * @param string $source
  * @return string
  */
 public function createArray($source, $driver, $url, &$errorFlag)
 {
     // get the data as an array
     $data = @json_decode($source, true);
     if ($data === FALSE) {
         $errorFlag = true;
     }
     if (!$errorFlag) {
         // original content
         $xml['xml'] = $source;
         $idTagName = $driver->getIdTagName();
         if ($idTagName == null || !isset($data[$idTagName])) {
             $xml['id'] = Lang::createHandle($url);
         } else {
             $xml['id'] = $data[$idTagName];
         }
         $xml['title'] = $data[$driver->getTitleTagName()];
         $xml['thumb'] = $data[$driver->getThumbnailTagName()];
     }
     if ($errorFlag) {
         // return error message
         $xml['error'] = __('Symphony could not parse JSON from oEmbed remote service');
     }
     return $xml;
 }
开发者ID:justinjaywang,项目名称:oembed_field,代码行数:33,代码来源:class.parser.json.php

示例11: displayPublishPanel

 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $note = $this->get('note');
     if (!isset($note)) {
         return;
     }
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label'))));
     $wrapper->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:9,代码来源:field.publishnotes.php

示例12: __get

 public function __get($name)
 {
     if ($name == 'handle') {
         return Lang::createHandle($this->name);
     } else {
         if (!isset($this->{$name})) {
             return null;
         }
     }
     return $this->about[$name];
 }
开发者ID:symphonists,项目名称:mobiledevicedetection,代码行数:11,代码来源:class.mobiledevice.php

示例13: __buildAuthorXML

 private static function __buildAuthorXML($author)
 {
     $author_xml = new XMLElement('author');
     foreach ($author->get() as $key => $value) {
         $value = General::sanitize($value);
         if ($value != '') {
             $author_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value)));
         }
     }
     return $author_xml;
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:11,代码来源:rest.authors.php

示例14: getSectionIDByName

 public static function getSectionIDByName($section_name)
 {
     self::_assert(false, true);
     if (is_array($section_name)) {
         $ret = array();
         foreach ($section_name as $name) {
             $ret[$name] = self::$sm->fetchIDFromHandle(Lang::createHandle($name));
         }
         return $ret;
     }
     return self::$sm->fetchIDFromHandle(Lang::createHandle($section_name));
 }
开发者ID:ErisDS,项目名称:Bugaroo,代码行数:12,代码来源:class.databasemanipulator.php

示例15: grab

 function grab($param = array())
 {
     extract($this->_env, EXTR_PREFIX_ALL, 'env');
     include_once TOOLKIT . '/class.entrymanager.php';
     $entryManager = new EntryManager($this->_parent);
     $section_id = $entryManager->fetchSectionIDFromHandle($this->__resolveDefine("dsFilterPARENTSECTION"));
     $schema = $entryManager->fetchEntryFieldSchema($section_id, NULL, $this->_dsFilterCUSTOMFIELD);
     $schema = $schema[0];
     ##Check the cache
     $hash_id = md5(get_class($this));
     if ($param['caching'] && ($cache = $this->check_cache($hash_id))) {
         return $cache;
         exit;
     }
     ##------------------------------
     ##Create the XML container
     $xml = new XMLElement("categories-list");
     $xml->setAttribute("section", "customfield");
     ##Populate the XML
     if (empty($schema) || !is_array($schema)) {
         $xml->addChild(new XMLElement("error", "No Records Found."));
         return $xml;
     } else {
         $ops = preg_split('/,/', $schema['values'], -1, PREG_SPLIT_NO_EMPTY);
         $ops = array_map("trim", $ops);
         $xml->addChild(new XMLElement("name", $schema['name']));
         $xml->setAttribute("handle", $schema['handle']);
         $options = new XMLElement("options");
         foreach ($ops as $o) {
             if ($schema['type'] == 'multiselect') {
                 $table = 'tbl_entries2customfields_list';
             } else {
                 $table = 'tbl_entries2customfields';
             }
             $count = $this->_db->fetchVar('count', 0, "SELECT count(id) AS `count` FROM `{$table}` WHERE `field_id` = '" . $schema['id'] . "' AND value_raw = '{$o}' ");
             $xO = new XMLElement("option", $o);
             $xO->setAttribute('entry-count', $count);
             $xO->setAttribute('handle', Lang::createHandle($o, $this->_parent->getConfigVar('handle_length', 'admin')));
             $options->addChild($xO);
         }
         $xml->addChild($options);
     }
     ##------------------------------
     ##Write To Cache
     if ($param['caching']) {
         $result = $xml->generate($param['indent'], $param['indent-depth']);
         $this->write_to_cache($hash_id, $result, $this->_cache_sections);
         return $result;
     }
     return $xml;
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:51,代码来源:data.categories_list.php


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