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


PHP JCckDevHelper::getBranch方法代码示例

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


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

示例1: onCCK_StoragePrepareSearch

 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
 {
     $sql = '';
     $TA = '(::' . $name . $name2 . '::)';
     $TZ = '(::/' . $name . $name2 . '::)';
     //if ( !empty( $field->match_target ) && $field->match_target != '~' ) {
     //	$target	=	self::_getTarget( $name, $field->match_target );
     //	$TA		=	'';
     //	$TZ		=	'';
     //}
     switch ($match) {
         case 'exact':
             $sql = !$TA ? $target . ' = "' . $TA . $value . $TZ . '"' : $target . ' REGEXP "' . $TA . $value . $TZ . '"';
             break;
         case 'empty':
             $sql = $target . ' REGEXP "' . $TA . $TZ . '"';
             break;
         case 'alpha':
             $sql = $target . ' REGEXP "' . $TA . $value . '.*' . $TZ . '"';
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' REGEXP "' . $TA . '.*' . $value . $TZ . '"';
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'each':
         case 'each_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 if ($match == 'each_exact') {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = (!$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"') . $target . ' REGEXP "' . $TA . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $separator . '.*' . $TZ . '"' . $target . ' REGEXP "' . $TA . '.*' . $separator . $v . $TZ . '"';
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' REGEXP "' . $TA . '.*' . $v . '.*' . $TZ . '"';
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
         case 'date_past':
         case 'date_future':
         case 'date_future_only':
             JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_DATE_AND_TIME_MATCH_ONLY_WITH_STANDARD'), 'notice');
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $values = JCckDevHelper::getBranch($table, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if ($v != '') {
                         $fragments[] = !$TA ? $target . ' = "' . $TA . $v . $TZ . '"' : $target . ' REGEXP "' . $TA . $v . $TZ . '"';
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'num_higher':
//.........这里部分代码省略.........
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:101,代码来源:custom.php

示例2: onCCK_StoragePrepareSearch

 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target, $fields = array(), &$config = array())
 {
     $sql = '';
     switch ($match) {
         case 'exact':
             $sql = $target . ' = ' . JCckDatabase::quote($value);
             break;
         case 'empty':
             $sql = $target . ' = ""';
             break;
         case 'alpha':
             $sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 $var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
                 if (!$var_type) {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $v;
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'each':
         case 'each_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 if ($match == 'each_exact') {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' = ' . JCckDatabase::quote($v) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true), false);
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'date_past':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'date_future':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'date_future_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $column = 'id';
             $values = JCckDevHelper::getBranch($table, $value);
             if ($column != 'id') {
                 if (count($values)) {
                     $fragments = array();
                     foreach ($values as $v) {
//.........这里部分代码省略.........
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:101,代码来源:standard.php

示例3: onCCK_StoragePrepareSearch

 public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
 {
     $sql = '';
     switch ($match) {
         case 'exact':
             $sql = $target . ' = ' . JCckDatabase::quote($value);
             break;
         case 'alpha':
             $sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
             break;
         case 'zeta':
             /* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
             $sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
             break;
         case 'any':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') OR (', $fragments) . '))';
                 }
             }
             break;
         case 'any_exact':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 $var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
                 if (!$var_type) {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = $v;
                         }
                     }
                 } else {
                     foreach ($values as $v) {
                         if (strlen($v) > 0) {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                 }
                 if (count($fragments)) {
                     $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                 }
             }
             break;
         case 'each':
             $separator = $field->match_value ? $field->match_value : ' ';
             $values = explode($separator, $value);
             if (count($values)) {
                 $fragments = array();
                 foreach ($values as $v) {
                     if (strlen($v) > 0) {
                         $fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
                     }
                 }
                 if (count($fragments)) {
                     $sql = '((' . implode(') AND (', $fragments) . '))';
                 }
             }
             break;
         case 'date_past_only':
             $sql = $target . ' < ' . JCckDatabase::quote($value);
             break;
         case 'date_past':
             $sql = $target . ' <= ' . JCckDatabase::quote($value);
             break;
         case 'date_future':
             $sql = $target . ' >= ' . JCckDatabase::quote($value);
             break;
         case 'date_future_only':
             $sql = $target . ' > ' . JCckDatabase::quote($value);
             break;
         case 'nested_exact':
             $table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
             $column = 'id';
             $values = JCckDevHelper::getBranch($table, $value);
             if ($column != 'id') {
                 if (count($values)) {
                     $fragments = array();
                     foreach ($values as $v) {
                         if ($v != '') {
                             $fragments[] = JCckDatabase::quote($v);
                         }
                     }
                     if (count($fragments)) {
                         $sql = $target . ' IN (' . implode(',', $fragments) . ')';
                     }
                 }
             } else {
                 if (count($values)) {
                     $sql = $target . ' IN (' . implode(',', $values) . ')';
                 }
//.........这里部分代码省略.........
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:101,代码来源:standard.php


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