Changeset 2665:2976f191aadb for inc
- Timestamp:
- 02/19/14 15:19:21 (11 years ago)
- Branch:
- default
- Location:
- inc/public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/class.dc.template.php
r2646 r2665 276 276 $p[3] = '0'; # lower_case 277 277 $p[4] = '0'; # upper_case or capitalize 278 $p[5] = '0'; # encode_url 278 279 279 280 $p[0] = (integer) (!empty($attr['encode_xml']) || !empty($attr['encode_html'])); … … 287 288 $p[4] = (integer) !empty($attr['upper_case']); 288 289 $p[4] = (!empty($attr['capitalize']) ? 2 : $p[4]); 290 $p[5] = (integer) !empty($attr['encode_url']); 289 291 290 292 return "context::global_filter(%s,".implode(",",$p).",'".addslashes($this->current_tag)."')"; -
inc/public/lib.tpl.context.php
r2639 r2665 100 100 101 101 102 # Static methods 103 public static function global_filter($str, 104 $encode_xml, $remove_html, $cut_string, $lower_case, $upper_case ,$tag='') 105 { 106 $args = func_get_args(); 107 array_pop($args); 108 $args[0] =& $str; 109 110 # --BEHAVIOR-- publicBeforeContentFilter 111 $res = $GLOBALS['core']->callBehavior('publicBeforeContentFilter',$GLOBALS['core'],$tag,$args); 112 113 if ($remove_html) { 114 $str = self::remove_html($str); 115 $str = preg_replace('/\s+/',' ',$str); 116 } 117 118 if ($encode_xml) { 119 $str = self::encode_xml($str); 120 } 121 122 if ($cut_string) { 123 $str = self::cut_string($str,(integer) $cut_string); 124 } 125 126 if ($lower_case) { 127 $str = self::lower_case($str); 128 } elseif ($upper_case) { 129 if ($upper_case == 2) { 130 $str = self::capitalize($str); 131 } else { 132 $str = self::upper_case($str); 133 } 134 } 135 136 # --BEHAVIOR-- publicAfterContentFilter 137 $res = $GLOBALS['core']->callBehavior('publicAfterContentFilter',$GLOBALS['core'],$tag,$args); 138 139 return $str; 140 } 141 102 # Static methods 103 public static function global_filter($str, 104 $encode_xml, $remove_html, $cut_string, $lower_case, $upper_case ,$encode_url ,$tag='') 105 { 106 $args = func_get_args(); 107 array_pop($args); 108 $args[0] =& $str; 109 110 # --BEHAVIOR-- publicBeforeContentFilter 111 $res = $GLOBALS['core']->callBehavior('publicBeforeContentFilter',$GLOBALS['core'],$tag,$args); 112 113 if ($remove_html) { 114 $str = self::remove_html($str); 115 $str = preg_replace('/\s+/',' ',$str); 116 } 117 118 if ($encode_xml) { 119 $str = self::encode_xml($str); 120 } 121 122 if ($cut_string) { 123 $str = self::cut_string($str,(integer) $cut_string); 124 } 125 126 if ($lower_case) { 127 $str = self::lower_case($str); 128 } elseif ($upper_case) { 129 if ($upper_case == 2) { 130 $str = self::capitalize($str); 131 } else { 132 $str = self::upper_case($str); 133 } 134 } 135 if ($encode_url) { 136 $str = self::encode_url($str); 137 } 138 139 # --BEHAVIOR-- publicAfterContentFilter 140 $res = $GLOBALS['core']->callBehavior('publicAfterContentFilter',$GLOBALS['core'],$tag,$args); 141 142 return $str; 143 } 144 145 public static function encode_url($str) 146 { 147 return urlencode($str); 148 } 142 149 143 150 public static function cut_string($str,$l)
Note: See TracChangeset
for help on using the changeset viewer.