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


PHP DataSource::replaceParametersInString方法代码示例

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


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

示例1: buildFilterQuery

 public function buildFilterQuery($filter, &$joins, array &$where, Register $parameter_output)
 {
     $filter = $this->processFilter($filter);
     $filter_join = DataSource::FILTER_OR;
     $db = Symphony::Database();
     // Boolean searches:
     if ($filter->type == 'boolean-search') {
         $handle = $this->buildFilterJoin($joins);
         $value = DataSource::replaceParametersInString(trim($filter->value), $parameter_output);
         $mode = preg_match('/^not(\\W)/i', $value) ? '-' : '+';
         // Replace ' and ' with ' +':
         $value = preg_replace('/(\\W)and(\\W)/i', '\\1+\\2', $value);
         $value = preg_replace('/(^)and(\\W)|(\\W)and($)/i', '\\2\\3', $value);
         $value = preg_replace('/(\\W)not(\\W)/i', '\\1-\\2', $value);
         $value = preg_replace('/(^)not(\\W)|(\\W)not($)/i', '\\2\\3', $value);
         $value = preg_replace('/([\\+\\-])\\s*/', '\\1', $mode . $value);
         $statement = $db->prepareQuery("MATCH ({$handle}.value) AGAINST ('%s' IN BOOLEAN MODE)", array($value));
         $where[] = "(\n\t{$statement}\n)";
         return true;
     }
     return parent::buildFilterQuery($filter, $joins, $where, $parameter_output);
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:22,代码来源:field.join.php

示例2: buildFilterQuery

 public function buildFilterQuery($filter, &$joins, array &$where, Register $parameter_output = null)
 {
     $filter = $this->processFilter($filter);
     $db = Symphony::Database();
     $statements = array();
     if (!is_array($values)) {
         $values = array();
     }
     // Exact matches:
     switch ($filter->type) {
         case 'is':
             $operator = '=';
             break;
         case 'is-not':
             $operator = '!=';
             break;
         case 'earlier-than':
             $operator = '>';
             break;
         case 'earlier-than-or-equal':
             $operator = '>=';
             break;
         case 'later-than':
             $operator = '<';
             break;
         case 'later-than-or-equal':
             $operator = '<=';
             break;
     }
     if (empty($this->last_handle)) {
         $this->join_handle = $this->buildFilterJoin($joins);
     }
     $handle = $this->join_handle;
     $value = DataSource::replaceParametersInString(trim($filter->value), $parameter_output);
     if ($filter->gmt == 'yes') {
         $value = strtotime($value);
     } else {
         $value = DateTimeObj::fromGMT($value);
     }
     $value = date('Y-m-d H:i:s', $value);
     $statements[] = $db->prepareQuery("'%s' {$operator} {$handle}.value", array($value));
     if (empty($statements)) {
         return true;
     }
     if ($filter_join == DataSource::FILTER_OR) {
         $statement = "(\n\t" . implode("\n\tOR ", $statements) . "\n)";
     } else {
         $statement = "(\n\t" . implode("\n\tAND ", $statements) . "\n)";
     }
     $where[] = $statement;
     return true;
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:52,代码来源:field.date.php

示例3: render

 public function render(Register $parameter_output)
 {
     $document = new XMLDocument();
     $root = $document->createElement($this->parameters()->{'root-element'});
     $addresses = DataSource::replaceParametersInString(trim($this->parameters()->{'addresses'}), $parameter_output);
     $addresses = preg_split('%,\\s*%', $addresses);
     $params = array('s' => $this->parameters()->{'size'}, 'r' => $this->parameters()->{'rating'}, 'd' => $this->parameters()->{'default'});
     foreach ($params as $key => $value) {
         $value = DataSource::replaceParametersInString($value, $parameter_output);
         if ($key == 's') {
             $value = (int) $value;
         }
         $params[$key] = $value;
     }
     if ($params['s'] < 1 or $params['s'] > 512) {
         unset($params['s']);
     }
     if (!in_array($params['r'], array('g', 'pg', 'r', 'x'))) {
         unset($params['r']);
     }
     if (is_null($params['d'])) {
         unset($params['d']);
     }
     foreach ($addresses as $address) {
         $address = trim($address);
         if (empty($address)) {
             continue;
         }
         $hash = md5($address);
         $url = new URLWriter('http://www.gravatar.com/avatar/' . $hash, $params);
         $element = $document->createElement('avatar');
         $element->setAttribute('email', $address);
         $element->setAttribute('url', (string) $url);
         $root->appendChild($element);
     }
     $document->appendChild($root);
     return $document;
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:38,代码来源:class.datasource.php


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