當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。