Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into …

…develop
  • Loading branch information...
commit 50ffe05f2a8c7f136187f8884c5fc6b65c8c21fb 2 parents abc29be + b9772ec
Timothy Warren authored
53 system/libraries/Typography.php
@@ -25,13 +25,11 @@
25 25 * @filesource
26 26 */
27 27
28   -// ------------------------------------------------------------------------
29   -
30 28 /**
31 29 * Typography Class
32 30 *
33   - *
34   - * @access protected
  31 + * @package CodeIgniter
  32 + * @subpackage Libraries
35 33 * @category Helpers
36 34 * @author EllisLab Dev Team
37 35 * @link http://codeigniter.com/user_guide/libraries/typography.html
@@ -67,7 +65,6 @@ class CI_Typography {
67 65 * - Converts double dashes into em-dashes.
68 66 * - Converts two spaces into entities
69 67 *
70   - * @access public
71 68 * @param string
72 69 * @param bool whether to reduce more then two consecutive newlines to two
73 70 * @return string
@@ -94,15 +91,12 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
94 91
95 92 // HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed
96 93 $html_comments = array();
97   - if (strpos($str, '<!--') !== FALSE)
  94 + if (strpos($str, '<!--') !== FALSE && preg_match_all('#(<!\-\-.*?\-\->)#s', $str, $matches))
98 95 {
99   - if (preg_match_all("#(<!\-\-.*?\-\->)#s", $str, $matches))
  96 + for ($i = 0, $total = count($matches[0]); $i < $total; $i++)
100 97 {
101   - for ($i = 0, $total = count($matches[0]); $i < $total; $i++)
102   - {
103   - $html_comments[] = $matches[0][$i];
104   - $str = str_replace($matches[0][$i], '{@HC'.$i.'}', $str);
105   - }
  98 + $html_comments[] = $matches[0][$i];
  99 + $str = str_replace($matches[0][$i], '{@HC'.$i.'}', $str);
106 100 }
107 101 }
108 102
@@ -110,22 +104,22 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
110 104 // not contain <pre> tags, and it keeps the PCRE patterns below simpler and faster
111 105 if (strpos($str, '<pre') !== FALSE)
112 106 {
113   - $str = preg_replace_callback("#<pre.*?>.*?</pre>#si", array($this, '_protect_characters'), $str);
  107 + $str = preg_replace_callback('#<pre.*?>.*?</pre>#si', array($this, '_protect_characters'), $str);
114 108 }
115 109
116 110 // Convert quotes within tags to temporary markers.
117   - $str = preg_replace_callback("#<.+?>#si", array($this, '_protect_characters'), $str);
  111 + $str = preg_replace_callback('#<.+?>#si', array($this, '_protect_characters'), $str);
118 112
119 113 // Do the same with braces if necessary
120 114 if ($this->protect_braced_quotes === TRUE)
121 115 {
122   - $str = preg_replace_callback("#\{.+?\}#si", array($this, '_protect_characters'), $str);
  116 + $str = preg_replace_callback('#\{.+?\}#si', array($this, '_protect_characters'), $str);
123 117 }
124 118
125 119 // Convert "ignore" tags to temporary marker. The parser splits out the string at every tag
126 120 // it encounters. Certain inline tags, like image tags, links, span tags, etc. will be
127 121 // adversely affected if they are split out so we'll convert the opening bracket < temporarily to: {@TAG}
128   - $str = preg_replace("#<(/*)(".$this->inline_elements.")([ >])#i", "{@TAG}\\1\\2\\3", $str);
  122 + $str = preg_replace('#<(/*)('.$this->inline_elements.')([ >])#i', '{@TAG}\\1\\2\\3', $str);
129 123
130 124 /* Split the string at every tag. This expression creates an array with this prototype:
131 125 *
@@ -148,9 +142,9 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
148 142 {
149 143 // Are we dealing with a tag? If so, we'll skip the processing for this cycle.
150 144 // Well also set the "process" flag which allows us to skip <pre> tags and a few other things.
151   - if (preg_match("#<(/*)(".$this->block_elements.").*?>#", $chunks[$i], $match))
  145 + if (preg_match('#<(/*)('.$this->block_elements.').*?>#', $chunks[$i], $match))
152 146 {
153   - if (preg_match("#".$this->skip_elements."#", $match[2]))
  147 + if (preg_match('#'.$this->skip_elements.'#', $match[2]))
154 148 {
155 149 $process = ($match[1] === '/');
156 150 }
@@ -180,10 +174,10 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
180 174 $str .= $this->_format_newlines($chunks[$i]);
181 175 }
182 176
183   - // No opening block level tag? Add it if needed.
184   - if ( ! preg_match("/^\s*<(?:".$this->block_elements.")/i", $str))
  177 + // No opening block level tag? Add it if needed.
  178 + if ( ! preg_match('/^\s*<(?:'.$this->block_elements.')/i', $str))
185 179 {
186   - $str = preg_replace("/^(.*?)<(".$this->block_elements.")/i", '<p>$1</p><$2', $str);
  180 + $str = preg_replace('/^(.*?)<('.$this->block_elements.')/i', '<p>$1</p><$2', $str);
187 181 }
188 182
189 183 // Convert quotes, elipsis, em-dashes, non-breaking spaces, and ampersands
@@ -230,7 +224,7 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
230 224
231 225 // Similarly, there might be cases where a closing </block> will follow
232 226 // a closing </p> tag, so we'll correct it by adding a newline in between
233   - "#</p></#" => "</p>\n</"
  227 + '#</p></#' => "</p>\n</"
234 228 );
235 229
236 230 // Do we need to reduce empty lines?
@@ -258,7 +252,6 @@ public function auto_typography($str, $reduce_linebreaks = FALSE)
258 252 * to curly entities, but it also converts em-dashes,
259 253 * double spaces, and ampersands
260 254 *
261   - * @access public
262 255 * @param string
263 256 * @return string
264 257 */
@@ -322,13 +315,12 @@ public function format_characters($str)
322 315 *
323 316 * Converts newline characters into either <p> tags or <br />
324 317 *
325   - * @access protected
326 318 * @param string
327 319 * @return string
328 320 */
329 321 protected function _format_newlines($str)
330 322 {
331   - if ($str == '' OR (strpos($str, "\n") === FALSE AND ! in_array($this->last_block_element, $this->inner_block_required)))
  323 + if ($str == '' OR (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)))
332 324 {
333 325 return $str;
334 326 }
@@ -337,7 +329,7 @@ protected function _format_newlines($str)
337 329 $str = str_replace("\n\n", "</p>\n\n<p>", $str);
338 330
339 331 // Convert single spaces to <br /> tags
340   - $str = preg_replace("/([^\n])(\n)([^\n])/", "\\1<br />\\2\\3", $str);
  332 + $str = preg_replace("/([^\n])(\n)([^\n])/", '\\1<br />\\2\\3', $str);
341 333
342 334 // Wrap the whole enchilada in enclosing paragraphs
343 335 if ($str != "\n")
@@ -350,9 +342,7 @@ protected function _format_newlines($str)
350 342
351 343 // Remove empty paragraphs if they are on the first line, as this
352 344 // is a potential unintended consequence of the previous code
353   - $str = preg_replace("/<p><\/p>(.*)/", "\\1", $str, 1);
354   -
355   - return $str;
  345 + return preg_replace('/<p><\/p>(.*)/', '\\1', $str, 1);
356 346 }
357 347
358 348 // ------------------------------------------------------------------------
@@ -365,7 +355,6 @@ protected function _format_newlines($str)
365 355 * and we don't want double dashes converted to emdash entities, so they are marked with {@DD}
366 356 * likewise double spaces are converted to {@NBS} to prevent entity conversion
367 357 *
368   - * @access protected
369 358 * @param array
370 359 * @return string
371 360 */
@@ -379,7 +368,6 @@ protected function _protect_characters($match)
379 368 /**
380 369 * Convert newlines to HTML line breaks except within PRE tags
381 370 *
382   - * @access public
383 371 * @param string
384 372 * @return string
385 373 */
@@ -399,7 +387,6 @@ public function nl2br_except_pre($str)
399 387 }
400 388
401 389 }
402   -// END Typography Class
403 390
404 391 /* End of file Typography.php */
405   -/* Location: ./system/libraries/Typography.php */
  392 +/* Location: ./system/libraries/Typography.php */
64 system/libraries/Xmlrpcs.php
@@ -54,10 +54,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc
54 54 public $controller_obj;
55 55 public $object = FALSE;
56 56
57   - /**
58   - * Constructor
59   - */
60   - public function __construct($config=array())
  57 + public function __construct($config = array())
61 58 {
62 59 parent::__construct();
63 60 $this->set_system_methods();
@@ -67,7 +64,7 @@ public function __construct($config=array())
67 64 $this->methods = array_merge($this->methods, $config['functions']);
68 65 }
69 66
70   - log_message('debug', "XML-RPC Server Class Initialized");
  67 + log_message('debug', 'XML-RPC Server Class Initialized');
71 68 }
72 69
73 70 // --------------------------------------------------------------------
@@ -75,7 +72,6 @@ public function __construct($config=array())
75 72 /**
76 73 * Initialize Prefs and Serve
77 74 *
78   - * @access public
79 75 * @param mixed
80 76 * @return void
81 77 */
@@ -107,7 +103,6 @@ public function initialize($config = array())
107 103 /**
108 104 * Setting of System Methods
109 105 *
110   - * @access public
111 106 * @return void
112 107 */
113 108 public function set_system_methods()
@@ -137,7 +132,6 @@ public function set_system_methods()
137 132 /**
138 133 * Main Server Function
139 134 *
140   - * @access public
141 135 * @return void
142 136 */
143 137 public function serve()
@@ -145,8 +139,8 @@ public function serve()
145 139 $r = $this->parseRequest();
146 140 $payload = '<?xml version="1.0" encoding="'.$this->xmlrpc_defencoding.'"?'.'>'."\n".$this->debug_msg.$r->prepare_response();
147 141
148   - header("Content-Type: text/xml");
149   - header("Content-Length: ".strlen($payload));
  142 + header('Content-Type: text/xml');
  143 + header('Content-Length: '.strlen($payload));
150 144 exit($payload);
151 145 }
152 146
@@ -155,7 +149,6 @@ public function serve()
155 149 /**
156 150 * Add Method to Class
157 151 *
158   - * @access public
159 152 * @param string method name
160 153 * @param string function
161 154 * @param string signature
@@ -176,7 +169,6 @@ public function add_to_map($methodname, $function, $sig, $doc)
176 169 /**
177 170 * Parse Server Request
178 171 *
179   - * @access public
180 172 * @param string data
181 173 * @return object xmlrpc response
182 174 */
@@ -198,7 +190,7 @@ public function parseRequest($data = '')
198 190 //-------------------------------------
199 191
200 192 $parser = xml_parser_create($this->xmlrpc_defencoding);
201   - $parser_object = new XML_RPC_Message("filler");
  193 + $parser_object = new XML_RPC_Message('filler');
202 194
203 195 $parser_object->xh[$parser] = array(
204 196 'isf' => 0,
@@ -215,7 +207,6 @@ public function parseRequest($data = '')
215 207 xml_set_character_data_handler($parser, 'character_data');
216 208 //xml_set_default_handler($parser, 'default_handler');
217 209
218   -
219 210 //-------------------------------------
220 211 // PARSE + PROCESS XML DATA
221 212 //-------------------------------------
@@ -245,7 +236,7 @@ public function parseRequest($data = '')
245 236 {
246 237 if ($this->debug === TRUE)
247 238 {
248   - $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";
  239 + $plist .= $i.' - '.print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE).";\n";
249 240 }
250 241
251 242 $m->addParam($parser_object->xh[$parser]['params'][$i]);
@@ -276,7 +267,6 @@ public function parseRequest($data = '')
276 267 /**
277 268 * Executes the Method
278 269 *
279   - * @access protected
280 270 * @param object
281 271 * @return mixed
282 272 */
@@ -305,7 +295,7 @@ protected function _execute($m)
305 295 // Check for Method (and Object)
306 296 //-------------------------------------
307 297
308   - $method_parts = explode(".", $this->methods[$methName]['function']);
  298 + $method_parts = explode('.', $this->methods[$methName]['function']);
309 299 $objectCall = (isset($method_parts[1]) && $method_parts[1] != '');
310 300
311 301 if ($system_call === TRUE)
@@ -315,14 +305,11 @@ protected function _execute($m)
315 305 return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
316 306 }
317 307 }
318   - else
  308 + elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1])))
  309 + OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function']))
  310 + )
319 311 {
320   - if (($objectCall AND ! is_callable(array($method_parts[0], $method_parts[1])))
321   - OR ( ! $objectCall AND ! is_callable($this->methods[$methName]['function']))
322   - )
323   - {
324   - return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
325   - }
  312 + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
326 313 }
327 314
328 315 //-------------------------------------
@@ -351,7 +338,7 @@ protected function _execute($m)
351 338 return new XML_RPC_Response(0,
352 339 $this->xmlrpcerr['incorrect_params'],
353 340 $this->xmlrpcstr['incorrect_params'] .
354   - ": Wanted {$wanted}, got {$pt} at param {$pno})");
  341 + ': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')');
355 342 }
356 343 }
357 344 }
@@ -393,7 +380,6 @@ protected function _execute($m)
393 380 /**
394 381 * Server Function: List Methods
395 382 *
396   - * @access public
397 383 * @param mixed
398 384 * @return object
399 385 */
@@ -409,7 +395,7 @@ public function listMethods($m)
409 395
410 396 foreach ($this->system_methods as $key => $value)
411 397 {
412   - $output[]= new XML_RPC_Values($key, 'string');
  398 + $output[] = new XML_RPC_Values($key, 'string');
413 399 }
414 400
415 401 $v->addArray($output);
@@ -421,7 +407,6 @@ public function listMethods($m)
421 407 /**
422 408 * Server Function: Return Signature for Method
423 409 *
424   - * @access public
425 410 * @param mixed
426 411 * @return object
427 412 */
@@ -447,18 +432,14 @@ public function methodSignature($m)
447 432 }
448 433 $sigs[] = new XML_RPC_Values($cursig, 'array');
449 434 }
450   - $r = new XML_RPC_Response(new XML_RPC_Values($sigs, 'array'));
451   - }
452   - else
453   - {
454   - $r = new XML_RPC_Response(new XML_RPC_Values('undef', 'string'));
  435 +
  436 + return new XML_RPC_Response(new XML_RPC_Values($sigs, 'array'));
455 437 }
  438 +
  439 + return new XML_RPC_Response(new XML_RPC_Values('undef', 'string'));
456 440 }
457   - else
458   - {
459   - $r = new XML_RPC_Response(0,$this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']);
460   - }
461   - return $r;
  441 +
  442 + return new XML_RPC_Response(0,$this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']);
462 443 }
463 444
464 445 // --------------------------------------------------------------------
@@ -466,7 +447,6 @@ public function methodSignature($m)
466 447 /**
467 448 * Server Function: Doc String for Method
468 449 *
469   - * @access public
470 450 * @param mixed
471 451 * @return object
472 452 */
@@ -492,7 +472,6 @@ public function methodHelp($m)
492 472 /**
493 473 * Server Function: Multi-call
494 474 *
495   - * @access public
496 475 * @param mixed
497 476 * @return object
498 477 */
@@ -536,7 +515,6 @@ public function multicall($m)
536 515 /**
537 516 * Multi-call Function: Error Handling
538 517 *
539   - * @access public
540 518 * @param mixed
541 519 * @return object
542 520 */
@@ -556,7 +534,6 @@ public function multicall_error($err)
556 534 /**
557 535 * Multi-call Function: Processes method
558 536 *
559   - * @access public
560 537 * @param mixed
561 538 * @return object
562 539 */
@@ -610,7 +587,6 @@ public function do_multicall($call)
610 587 }
611 588
612 589 }
613   -// END XML_RPC_Server class
614 590
615 591 /* End of file Xmlrpcs.php */
616   -/* Location: ./system/libraries/Xmlrpcs.php */
  592 +/* Location: ./system/libraries/Xmlrpcs.php */
2  user_guide_src/source/database/utilities.rst
Source Rendered
@@ -117,7 +117,7 @@ query. Example::
117 117 echo $this->dbutil->csv_from_result($query);
118 118
119 119 The second, third, and fourth parameters allow you to set the delimiter
120   -newline, and enclosure characters respectively. By default tabs are
  120 +newline, and enclosure characters respectively. By default commas are
121 121 used as the delimiter, "\n" is used as a new line, and a double-quote
122 122 is used as the enclosure. Example::
123 123

0 comments on commit 50ffe05

Please sign in to comment.
Something went wrong with that request. Please try again.