Completed
Push — master ( 2eaff4...01b8ab )
by Christopher
03:35
created
src/PhpQuery.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace PhpQuery;
16 16
 
17
-require_once __DIR__ . '/bootstrap.php';
17
+require_once __DIR__.'/bootstrap.php';
18 18
 
19 19
 /**
20 20
  * Shortcut to PhpQuery::pq($arg1, $context)
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
     public static function use_function($ns = '\\', $func = 'pq')
124 124
     {
125 125
         if ($ns{0} !== '\\') {
126
-            $ns = '\\' . $ns;
126
+            $ns = '\\'.$ns;
127 127
         }
128
-        if (!function_exists($ns . '\\' . $func)) {
128
+        if (!function_exists($ns.'\\'.$func)) {
129 129
             if ($ns === '\\') {
130 130
                 eval("function $func(\$a, \$b = '') { return \\PhpQuery\\PhpQuery::pq(\$a, \$b); }");
131 131
             } else {
@@ -424,18 +424,18 @@  discard block
 block discarded – undo
424 424
 
425 425
     public static function _phpToMarkupCallback($m, $charset = 'utf-8')
426 426
     {
427
-        return $m[1] . $m[2]
427
+        return $m[1].$m[2]
428 428
         . htmlspecialchars(
429
-            "<" . "?php" . $m[4] . "?" . ">",
429
+            "<"."?php".$m[4]."?".">",
430 430
             ENT_QUOTES
431 431
             | ENT_NOQUOTES,
432 432
             $charset
433
-        ) . $m[5] . $m[2];
433
+        ).$m[5].$m[2];
434 434
     }
435 435
 
436 436
     public static function _markupToPHPCallback($m)
437 437
     {
438
-        return "<" . "?php " . htmlspecialchars_decode($m[1]) . " ?" . ">";
438
+        return "<"."?php ".htmlspecialchars_decode($m[1])." ?".">";
439 439
     }
440 440
 
441 441
     /**
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
         if (in_array($class, self::$pluginsLoaded))
669 669
             return true;
670 670
         if (!$file)
671
-            $file = $class . '.php';
672
-        $objectClassExists = class_exists('\\PhpQuery\\Plugin\\' . $class);
673
-        $staticClassExists = class_exists('\PhpQuery\Plugin\Util' . $class);
671
+            $file = $class.'.php';
672
+        $objectClassExists = class_exists('\\PhpQuery\\Plugin\\'.$class);
673
+        $staticClassExists = class_exists('\PhpQuery\Plugin\Util'.$class);
674 674
         if (!$objectClassExists && !$staticClassExists)
675 675
             require_once($file);
676 676
         self::$pluginsLoaded[] = $class;
677 677
         // static methods
678
-        if (class_exists('\PhpQuery\Plugin\Util' . $class)) {
679
-            $realClass = '\PhpQuery\Plugin\Util' . $class;
678
+        if (class_exists('\PhpQuery\Plugin\Util'.$class)) {
679
+            $realClass = '\PhpQuery\Plugin\Util'.$class;
680 680
             $vars      = get_class_vars($realClass);
681 681
             $loop      = isset($vars['PhpQueryMethods'])
682 682
             && !is_null($vars['PhpQueryMethods']) ? $vars['PhpQueryMethods']
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
                     continue;
695 695
                 if (isset(self::$pluginsStaticMethods[$method])) {
696 696
                     throw new \Exception("Duplicate method '{$method}' from plugin '{$c}' conflicts with same method from plugin '"
697
-                                         . self::$pluginsStaticMethods[$method] . "'");
697
+                                         . self::$pluginsStaticMethods[$method]."'");
698 698
                 }
699 699
                 self::$pluginsStaticMethods[$method] = $class;
700 700
             }
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
                 );
709 709
         }
710 710
         // object methods
711
-        if (class_exists('\\PhpQuery\\Plugin\\' . $class)) {
712
-            $realClass = '\\PhpQuery\\Plugin\\' . $class;
711
+        if (class_exists('\\PhpQuery\\Plugin\\'.$class)) {
712
+            $realClass = '\\PhpQuery\\Plugin\\'.$class;
713 713
             $vars      = get_class_vars($realClass);
714 714
             $loop      = isset($vars['PhpQueryMethods'])
715 715
             && !is_null($vars['PhpQueryMethods']) ? $vars['PhpQueryMethods']
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                     continue;
726 726
                 if (isset(self::$pluginsMethods[$method])) {
727 727
                     throw new \Exception("Duplicate method '{$method}' from plugin '{$class}' conflicts with same method from plugin '"
728
-                                         . self::$pluginsMethods[$method] . "'");
728
+                                         . self::$pluginsMethods[$method]."'");
729 729
                     continue;
730 730
                 }
731 731
                 self::$pluginsMethods[$method] = $class;
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
             $options['dataType'] = 'json';
870 870
         }
871 871
         if (isset($options['dataType']) && $options['dataType'] == 'json') {
872
-            $jsonpCallback = 'json_' . md5(microtime());
872
+            $jsonpCallback = 'json_'.md5(microtime());
873 873
             $jsonpData     = $jsonpUrl = false;
874 874
             if ($options['data']) {
875 875
                 foreach ($options['data'] as $n => $v) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
             );
955 955
         if (PhpQuery::$debug) {
956 956
             self::debug("{$options['type']}: {$options['url']}\n");
957
-            self::debug("Options: <pre>" . var_export($options, true) . "</pre>\n");
957
+            self::debug("Options: <pre>".var_export($options, true)."</pre>\n");
958 958
             //			if ($client->getCookieJar())
959 959
             //				self::debug("Cookies: <pre>".var_export($client->getCookieJar()->getMatchingCookies($options['url']), true)."</pre>\n");
960 960
         }
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         $response = $client->request();
963 963
         if (PhpQuery::$debug) {
964 964
             self::debug(
965
-                'Status: ' . $response->getStatus() . ' / '
965
+                'Status: '.$response->getStatus().' / '
966 966
                 . $response->getMessage()
967 967
             );
968 968
             self::debug($client->getLastRequest());
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
      */
1522 1522
     public static function code($type, $code)
1523 1523
     {
1524
-        return "<$type><!-- " . trim($code) . " --></$type>";
1524
+        return "<$type><!-- ".trim($code)." --></$type>";
1525 1525
     }
1526 1526
 
1527 1527
     public static function __callStatic($method, $params)
Please login to merge, or discard this patch.
src/PhpQueryEvents.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
             while ($node) {
58 58
                 // TODO whois
59 59
                 PhpQuery::debug(
60
-                    "Triggering " . ($i ? "bubbled " : '')
61
-                    . "event '{$type}' on " . "node \n"
60
+                    "Triggering ".($i ? "bubbled " : '')
61
+                    . "event '{$type}' on "."node \n"
62 62
                 );
63 63
                 //.PhpQueryObject::whois($node)."\n");
64 64
                 $event->currentTarget = $node;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                                 ),
87 87
                                 $data
88 88
                             );
89
-                            $return      = PhpQuery::callbackRun($handler['callback'], $params);
89
+                            $return = PhpQuery::callbackRun($handler['callback'], $params);
90 90
                             if ($return === false) {
91 91
                                 $event->bubbles = false;
92 92
                             }
Please login to merge, or discard this patch.
src/PhpQueryObject.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                     $tmp .= $query[$i];
444 444
                     $i++;
445 445
                 }
446
-                $return[] = '#' . $tmp;
446
+                $return[] = '#'.$tmp;
447 447
                 // SPECIAL CHARS
448 448
             } else if (in_array($c, $specialChars)) {
449 449
                 $return[] = $c;
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                 : $this->getNodeXpath($stackNode);
783 783
             // FIXME pseudoclasses-only query, support XML
784 784
             $query = $XQuery == '//' && $xpath == '/html[1]' ? '//*'
785
-                : $xpath . $XQuery;
785
+                : $xpath.$XQuery;
786 786
             $this->debug("XPATH: {$query}");
787 787
             // run query, get elements
788 788
             $nodes = $this->xpath->query($query);
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
                 $matched = false;
795 795
                 if ($compare) {
796 796
                     PhpQuery::$debug ? $this->debug(
797
-                        "Found: " . $this->whois($node)
797
+                        "Found: ".$this->whois($node)
798 798
                         . ", comparing with {$compare}()"
799 799
                     ) : null;
800 800
                     $PhpQueryDebug   = PhpQuery::$debug;
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                 }
824 824
             }
825 825
             if (PhpQuery::$debug) {
826
-                $this->debug("Matched " . count($debug) . ": " . implode(', ', $debug));
826
+                $this->debug("Matched ".count($debug).": ".implode(', ', $debug));
827 827
             }
828 828
             if ($detachAfter)
829 829
                 $this->root->removeChild($detachAfter);
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
                 } else if ($s[0] == '#') {
903 903
                     if ($delimiterBefore)
904 904
                         $XQuery .= '*';
905
-                    $XQuery .= "[@id='" . substr($s, 1) . "']";
905
+                    $XQuery .= "[@id='".substr($s, 1)."']";
906 906
                     // ATTRIBUTES
907 907
                 } else if ($s[0] == '[') {
908 908
                     if ($delimiterBefore)
@@ -1026,9 +1026,9 @@  discard block
 block discarded – undo
1026 1026
             case 'odd':
1027 1027
                 $stack = array();
1028 1028
                 foreach ($this->elements as $i => $node) {
1029
-                    if ($class == 'even' && ($i % 2) == 0)
1029
+                    if ($class == 'even' && ($i%2) == 0)
1030 1030
                         $stack[] = $node;
1031
-                    else if ($class == 'odd' && $i % 2)
1031
+                    else if ($class == 'odd' && $i%2)
1032 1032
                         $stack[] = $node;
1033 1033
                 }
1034 1034
                 $this->elements = $stack;
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
                     break;
1236 1236
                 // nth-child(n+b) to nth-child(1n+b)
1237 1237
                 if ($param{0} == 'n')
1238
-                    $param = '1' . $param;
1238
+                    $param = '1'.$param;
1239 1239
                 // :nth-child(index/even/odd/equation)
1240 1240
                 if ($param == 'even' || $param == 'odd')
1241 1241
                     $mapped = $this->map(
@@ -1480,13 +1480,13 @@  discard block
 block discarded – undo
1480 1480
                                         // quotemeta used insted of preg_quote
1481 1481
                                         // http://code.google.com/p/phpquery/issues/detail?id=76
1482 1482
                                         case '^':
1483
-                                            $pattern = '^' . $val;
1483
+                                            $pattern = '^'.$val;
1484 1484
                                             break;
1485 1485
                                         case '*':
1486
-                                            $pattern = '.*' . $val . '.*';
1486
+                                            $pattern = '.*'.$val.'.*';
1487 1487
                                             break;
1488 1488
                                         case '$':
1489
-                                            $pattern = '.*' . $val . '$';
1489
+                                            $pattern = '.*'.$val.'$';
1490 1490
                                             break;
1491 1491
                                     }
1492 1492
                                     // cut last character
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
         if ($_skipHistory) {
1549 1549
             return $this;
1550 1550
         } else {
1551
-            $this->debug("Stack length after filter(): " . count($finalStack));
1551
+            $this->debug("Stack length after filter(): ".count($finalStack));
1552 1552
             return $this->newInstance();
1553 1553
         }
1554 1554
     }
@@ -1671,14 +1671,14 @@  discard block
 block discarded – undo
1671 1671
             $styles = array();
1672 1672
             foreach ($this->data('phpquery_css') as $k => $v) {
1673 1673
                 if ($v['specificity'] >= 1000) {
1674
-                    $styles[$k] = trim($k) . ':' . trim($v['value']);
1674
+                    $styles[$k] = trim($k).':'.trim($v['value']);
1675 1675
                 }
1676 1676
             }
1677 1677
             ksort($styles);
1678 1678
             if (empty($styles)) {
1679 1679
                 $this->removeAttr('style');
1680 1680
             } elseif (PhpQuery::$enableCssShorthand) {
1681
-                $parser = new \Sabberworm\CSS\Parser('{' . join(';', $styles) . '}');
1681
+                $parser = new \Sabberworm\CSS\Parser('{'.join(';', $styles).'}');
1682 1682
                 $doc    = $parser->parse();
1683 1683
                 $doc->createShorthands();
1684 1684
                 $style = trim($doc->__toString(), "\n\r\t {}");
@@ -1735,11 +1735,11 @@  discard block
 block discarded – undo
1735 1735
             $style    = strlen($style) ? explode(';', $style) : array();
1736 1736
             foreach ($this->attribute_css_mapping as $map => $css_equivalent) {
1737 1737
                 if ($el->hasAttribute($map)) {
1738
-                    $style[] = $css_equivalent . ':' . pq($el)->attr($map);
1738
+                    $style[] = $css_equivalent.':'.pq($el)->attr($map);
1739 1739
                 }
1740 1740
             }
1741 1741
             if (count($style)) {
1742
-                $CssParser   = new CssParser('#ruleset {' . implode(';', $style) . '}');
1742
+                $CssParser   = new CssParser('#ruleset {'.implode(';', $style).'}');
1743 1743
                 $CssDocument = $CssParser->parse();
1744 1744
                 $ruleset     = $CssDocument->getAllRulesets();
1745 1745
                 $ruleset     = reset($ruleset);
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
                 break;
2740 2740
         }
2741 2741
         PhpQuery::debug(
2742
-            "From " . count($insertFrom) . "; To " . count($insertTo)
2742
+            "From ".count($insertFrom)."; To ".count($insertTo)
2743 2743
             . " nodes"
2744 2744
         );
2745 2745
         foreach ($insertTo as $insertNumber => $toNode) {
@@ -2965,7 +2965,7 @@  discard block
 block discarded – undo
2965 2965
             return call_user_func_array(
2966 2966
                 array(
2967 2967
                     $this,
2968
-                    '_' . $method
2968
+                    '_'.$method
2969 2969
                 ),
2970 2970
                 $args
2971 2971
             );
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
     public function attrPHP($attr, $code)
3379 3379
     {
3380 3380
         if (!is_null($code)) {
3381
-            $value = '<' . '?php ' . $code . ' ?' . '>';
3381
+            $value = '<'.'?php '.$code.' ?'.'>';
3382 3382
             // TODO tempolary solution
3383 3383
             // http://code.google.com/p/phpquery/issues/detail?id=17
3384 3384
             //			if (function_exists('mb_detect_encoding') && mb_detect_encoding($value) == 'ASCII')
@@ -3529,7 +3529,7 @@  discard block
 block discarded – undo
3529 3529
                 $node->setAttribute(
3530 3530
                     'class',
3531 3531
                     trim(
3532
-                        $node->getAttribute('class') . ' '
3532
+                        $node->getAttribute('class').' '
3533 3533
                         . $className
3534 3534
                     )
3535 3535
                 );
@@ -3547,8 +3547,8 @@  discard block
 block discarded – undo
3547 3547
     {
3548 3548
         foreach ($this->stack(1) as $node) {
3549 3549
             $classes  = $node->getAttribute('class');
3550
-            $newValue = $classes ? $classes . ' <' . '?php ' . $className . ' ?'
3551
-                . '>' : '<' . '?php ' . $className . ' ?' . '>';
3550
+            $newValue = $classes ? $classes.' <'.'?php '.$className.' ?'
3551
+                . '>' : '<'.'?php '.$className.' ?'.'>';
3552 3552
             $node->setAttribute('class', $newValue);
3553 3553
         }
3554 3554
         return $this;
@@ -3604,7 +3604,7 @@  discard block
 block discarded – undo
3604 3604
     public function toggleClass($className)
3605 3605
     {
3606 3606
         foreach ($this->stack(1) as $node) {
3607
-            if ($this->is($node, '.' . $className))
3607
+            if ($this->is($node, '.'.$className))
3608 3608
                 $this->removeClass($className);
3609 3609
             else
3610 3610
                 $this->addClass($className);
@@ -3892,7 +3892,7 @@  discard block
 block discarded – undo
3892 3892
                 $node    = $node->parentNode;
3893 3893
             }
3894 3894
             $xpath    = join('/', array_reverse($xpath));
3895
-            $return[] = '/' . $xpath;
3895
+            $return[] = '/'.$xpath;
3896 3896
         }
3897 3897
         return $oneNode ? $return[0] : $return;
3898 3898
     }
@@ -3906,7 +3906,7 @@  discard block
 block discarded – undo
3906 3906
         ) : $this->elements;
3907 3907
         foreach ($loop as $node) {
3908 3908
             if (isset($node->tagName)) {
3909
-                $tag      = in_array(
3909
+                $tag = in_array(
3910 3910
                     $node->tagName,
3911 3911
                     array(
3912 3912
                         'php',
@@ -3914,18 +3914,18 @@  discard block
 block discarded – undo
3914 3914
                     )
3915 3915
                 ) ? strtoupper($node->tagName) : $node->tagName;
3916 3916
                 $return[] = $tag
3917
-                    . ($node->getAttribute('id') ? '#' . $node->getAttribute('id') : '')
3917
+                    . ($node->getAttribute('id') ? '#'.$node->getAttribute('id') : '')
3918 3918
                     . ($node->getAttribute('class') ? '.'
3919 3919
                         . join('.', explode(' ', $node->getAttribute('class'))) : '')
3920 3920
                     . ($node->getAttribute('name') ? '[name="'
3921
-                        . $node->getAttribute('name') . '"]' : '')
3921
+                        . $node->getAttribute('name').'"]' : '')
3922 3922
                     . ($node->getAttribute('value')
3923
-                    && strpos($node->getAttribute('value'), '<' . '?php') === false ? '[value="'
3923
+                    && strpos($node->getAttribute('value'), '<'.'?php') === false ? '[value="'
3924 3924
                         . substr(str_replace("\n", '', $node->getAttribute('value')), 0, 15)
3925 3925
                         . '"]' : '')
3926 3926
                     . ($node->getAttribute('value')
3927
-                    && strpos($node->getAttribute('value'), '<' . '?php') !== false ? '[value=PHP]'
3928
-                        : '') . ($node->getAttribute('selected') ? '[selected]' : '')
3927
+                    && strpos($node->getAttribute('value'), '<'.'?php') !== false ? '[value=PHP]'
3928
+                        : '').($node->getAttribute('selected') ? '[selected]' : '')
3929 3929
                     . ($node->getAttribute('checked') ? '[checked]' : '');
3930 3930
             } else if ($node instanceof \DOMTEXT) {
3931 3931
                 if (trim($node->textContent))
@@ -3946,7 +3946,7 @@  discard block
 block discarded – undo
3946 3946
      */
3947 3947
     public function dump()
3948 3948
     {
3949
-        print 'DUMP #' . (PhpQuery::$dumpCount++) . ' ';
3949
+        print 'DUMP #'.(PhpQuery::$dumpCount++).' ';
3950 3950
         PhpQuery::$debug = false;
3951 3951
         //		print __FILE__.':'.__LINE__."\n";
3952 3952
         var_dump($this->htmlOuter());
@@ -3955,7 +3955,7 @@  discard block
 block discarded – undo
3955 3955
 
3956 3956
     public function dumpWhois()
3957 3957
     {
3958
-        print 'DUMP #' . (PhpQuery::$dumpCount++) . ' ';
3958
+        print 'DUMP #'.(PhpQuery::$dumpCount++).' ';
3959 3959
         $debug           = PhpQuery::$debug;
3960 3960
         PhpQuery::$debug = false;
3961 3961
         //		print __FILE__.':'.__LINE__."\n";
@@ -3966,7 +3966,7 @@  discard block
 block discarded – undo
3966 3966
 
3967 3967
     public function dumpLength()
3968 3968
     {
3969
-        print 'DUMP #' . (PhpQuery::$dumpCount++) . ' ';
3969
+        print 'DUMP #'.(PhpQuery::$dumpCount++).' ';
3970 3970
         $debug           = PhpQuery::$debug;
3971 3971
         PhpQuery::$debug = false;
3972 3972
         //		print __FILE__.':'.__LINE__."\n";
@@ -3977,7 +3977,7 @@  discard block
 block discarded – undo
3977 3977
 
3978 3978
     public function dumpTree($html = true, $title = true)
3979 3979
     {
3980
-        $output          = $title ? 'DUMP #' . (PhpQuery::$dumpCount++) . " \n" : '';
3980
+        $output          = $title ? 'DUMP #'.(PhpQuery::$dumpCount++)." \n" : '';
3981 3981
         $debug           = PhpQuery::$debug;
3982 3982
         PhpQuery::$debug = false;
3983 3983
         foreach ($this->stack() as $node)
@@ -3992,7 +3992,7 @@  discard block
 block discarded – undo
3992 3992
         $whois  = $this->whois($node);
3993 3993
         $return = '';
3994 3994
         if ($whois)
3995
-            $return .= str_repeat(' - ', $intend) . $whois . "\n";
3995
+            $return .= str_repeat(' - ', $intend).$whois."\n";
3996 3996
         if (isset($node->childNodes))
3997 3997
             foreach ($node->childNodes as $chNode)
3998 3998
                 $return .= $this->__dumpTree($chNode, $intend + 1);
@@ -4005,7 +4005,7 @@  discard block
 block discarded – undo
4005 4005
      */
4006 4006
     public function dumpDie()
4007 4007
     {
4008
-        print __FILE__ . ':' . __LINE__;
4008
+        print __FILE__.':'.__LINE__;
4009 4009
         var_dump($this->htmlOuter());
4010 4010
         die();
4011 4011
     }
Please login to merge, or discard this patch.
src/Plugin/Scripts/fix_webroot.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 		.':not([href^=http://])'
6 6
 		.':not([src^=http://])'
7 7
 		.':not([src^=/])';
8
-foreach($self[$selector]->filter($filter) as $el) {
8
+foreach ($self[$selector]->filter($filter) as $el) {
9 9
 	$el = pq($el, $self->getDocumentID());
10 10
 	// imgs and scripts
11
-	if ( $el->is('img') || $el->is('script') )
11
+	if ($el->is('img') || $el->is('script'))
12 12
 		$el->attr('src', $params[0].$el->attr('src'));
13 13
 	// css
14
-	if ( $el->is('link') )
14
+	if ($el->is('link'))
15 15
 		$el->attr('href', $params[0].$el->attr('href'));
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Plugin/Scripts/google_login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	'docs.google.com',
16 16
 	'reader.google.com'
17 17
 );
18
-if (! function_exists('ndfasui8923')) {
18
+if (!function_exists('ndfasui8923')) {
19 19
 	function ndfasui8923($browser, $scope) {
20 20
 		extract($scope);
21 21
 		$browser
Please login to merge, or discard this patch.
src/Plugin/WebBrowser.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			: $self->document->xhr->getUri(true);
32 32
 		// FIXME tmp
33 33
 		$self->document->WebBrowserCallback = $callback;
34
-		if (! $location)
34
+		if (!$location)
35 35
 			throw new \Exception('Location needed to activate WebBrowser plugin !');
36 36
 		else {
37 37
 			$self->bind('click', array($location, $callback), array('\PhpQuery\Plugin\UtilWebBrowser', 'hadleClick'));
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 			$url = $self->find('a')->attr('href');
50 50
 		if ($url) {
51 51
 			$url = resolve_url($self->document->location, $url);
52
-			if (! $dir)
52
+			if (!$dir)
53 53
 				$dir = getcwd();
54 54
 			// TODO resolv name from response headers
55
-			if (! $filename) {
55
+			if (!$filename) {
56 56
 				$matches = null;
57 57
 				preg_match('@/([^/]+)$@', $url, $matches);
58 58
 				$filename = $matches[1];
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			PhpQuery::debug("Meta redirect... '{$refresh->attr('content')}'\n");
255 255
 			// there is a refresh, so get the new url
256 256
 			$content = $refresh->attr('content');
257
-			$urlRefresh = substr($content, strpos($content, '=')+1);
257
+			$urlRefresh = substr($content, strpos($content, '=') + 1);
258 258
 			$urlRefresh = trim($urlRefresh, '\'"');
259 259
 			// XXX not secure ?!
260 260
 			PhpQuery::ajaxAllowURL($urlRefresh);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 				'url' => resolve_url($e->data[0], $node->attr('href')),
303 303
 				'referer' => $node->document->location,
304 304
 			), $xhr);
305
-			if ((! $callback || !($callback instanceof \Callback)) && $e->data[1])
305
+			if ((!$callback || !($callback instanceof \Callback)) && $e->data[1])
306 306
 				$callback = $e->data[1];
307 307
 			if ($xhr->getLastResponse()->isSuccessful() && $callback)
308 308
 				PhpQuery::callbackRun($callback, array(
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 //			: $node->find(':submit:first')->get(0);
334 334
 			: $node->find('*:submit:first')->get(0);
335 335
 		$data = array();
336
-		foreach($node->serializeArray($submit) as $r)
336
+		foreach ($node->serializeArray($submit) as $r)
337 337
 		// XXXt.c maybe $node->not(':submit')->add($sumit) would be better ?
338 338
 //		foreach($node->serializeArray($submit) as $r)
339
-			$data[ $r['name'] ] = $r['value'];
339
+			$data[$r['name']] = $r['value'];
340 340
 		$options = array(
341 341
 			'type' => $node->attr('method')
342 342
 				? $node->attr('method')
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		if ($node->attr('enctype'))
350 350
 			$options['contentType'] = $node->attr('enctype');
351 351
 		$xhr = PhpQuery::ajax($options, $xhr);
352
-		if ((! $callback || !($callback instanceof Callback)) && $e->data[1])
352
+		if ((!$callback || !($callback instanceof Callback)) && $e->data[1])
353 353
 			$callback = $e->data[1];
354 354
 		if ($xhr->getLastResponse()->isSuccessful() && $callback)
355 355
 			PhpQuery::callbackRun($callback, array(
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
  */
365 365
 function glue_url($parsed)
366 366
     {
367
-    if (! is_array($parsed)) return false;
368
-    $uri = isset($parsed['scheme']) ? $parsed['scheme'].':'.((strtolower($parsed['scheme']) == 'mailto') ? '':'//'): '';
369
-    $uri .= isset($parsed['user']) ? $parsed['user'].($parsed['pass']? ':'.$parsed['pass']:'').'@':'';
367
+    if (!is_array($parsed)) return false;
368
+    $uri = isset($parsed['scheme']) ? $parsed['scheme'].':'.((strtolower($parsed['scheme']) == 'mailto') ? '' : '//') : '';
369
+    $uri .= isset($parsed['user']) ? $parsed['user'].($parsed['pass'] ? ':'.$parsed['pass'] : '').'@' : '';
370 370
     $uri .= isset($parsed['host']) ? $parsed['host'] : '';
371 371
     $uri .= isset($parsed['port']) ? ':'.$parsed['port'] : '';
372
-    if(isset($parsed['path']))
372
+    if (isset($parsed['path']))
373 373
         {
374
-        $uri .= (substr($parsed['path'],0,1) == '/')?$parsed['path']:'/'.$parsed['path'];
374
+        $uri .= (substr($parsed['path'], 0, 1) == '/') ? $parsed['path'] : '/'.$parsed['path'];
375 375
         }
376 376
     $uri .= isset($parsed['query']) ? '?'.$parsed['query'] : '';
377 377
     $uri .= isset($parsed['fragment']) ? '#'.$parsed['fragment'] : '';
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                 // Step 4
401 401
                 return unparse_url(array(
402 402
                         'scheme'=>$base['scheme'],
403
-                        'path'=>substr($url,2),
403
+                        'path'=>substr($url, 2),
404 404
                 ));
405 405
         } else if ($url{0} == "/") {
406 406
                 // Step 5
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
                 foreach ($url_path as $segment) {
418 418
                         if ($segment == '.') {
419 419
                                 // skip
420
-                        } else if ($segment == '..' && $path && $path[sizeof($path)-1] != '..') {
420
+                        } else if ($segment == '..' && $path && $path[sizeof($path) - 1] != '..') {
421 421
                                 array_pop($path);
422 422
                         } else {
423 423
                                 $path[] = $segment;
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
                 // Step 6d, 6f: remove "." and ".." from file portion
427 427
                 if ($end == '.') {
428 428
                         $path[] = '';
429
-                } else if ($end == '..' && $path && $path[sizeof($path)-1] != '..') {
430
-                        $path[sizeof($path)-1] = '';
429
+                } else if ($end == '..' && $path && $path[sizeof($path) - 1] != '..') {
430
+                        $path[sizeof($path) - 1] = '';
431 431
                 } else {
432 432
                         $path[] = $end;
433 433
                 }
@@ -440,14 +440,14 @@  discard block
 block discarded – undo
440 440
 }
441 441
 
442 442
 function unparse_url($parsed_url) {
443
-    $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
443
+    $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : '';
444 444
     $host     = isset($parsed_url['host']) ? $parsed_url['host'] : '';
445
-    $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
445
+    $port     = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : '';
446 446
     $user     = isset($parsed_url['user']) ? $parsed_url['user'] : '';
447
-    $pass     = isset($parsed_url['pass']) ? ':' . $parsed_url['pass']  : '';
447
+    $pass     = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : '';
448 448
     $pass     = ($user || $pass) ? "$pass@" : '';
449 449
     $path     = isset($parsed_url['path']) ? $parsed_url['path'] : '';
450
-    $query    = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
451
-    $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
450
+    $query    = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : '';
451
+    $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : '';
452 452
     return "$scheme$user$pass$host$port$path$query$fragment";
453 453
 }
454 454
\ No newline at end of file
Please login to merge, or discard this patch.
src/Proxy/jQueryServer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
   public $allowedHosts = null;
31 31
   function __construct($data) {
32 32
     $pq = null;
33
-    include_once(dirname(__FILE__) . '/../PhpQuery/PhpQuery.php');
34
-    if (file_exists(dirname(__FILE__) . '/jQueryServer.config.php')) {
35
-      include_once(dirname(__FILE__) . '/jQueryServer.config.php');
33
+    include_once(dirname(__FILE__).'/../PhpQuery/PhpQuery.php');
34
+    if (file_exists(dirname(__FILE__).'/jQueryServer.config.php')) {
35
+      include_once(dirname(__FILE__).'/jQueryServer.config.php');
36 36
       if ($jQueryServerConfig)
37 37
         $this->config = array_merge_recursive($this->config, $jQueryServerConfig);
38 38
     }
Please login to merge, or discard this patch.
src/Callback/Callback.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 class CallbackReturnReference extends Callback
81 81
 	implements ICallbackNamed {
82 82
 	protected $reference;
83
-	public function __construct(&$reference, $name = null){
84
-		$this->reference =& $reference;
83
+	public function __construct(&$reference, $name = null) {
84
+		$this->reference = & $reference;
85 85
 		$this->callback = array($this, 'callback');
86 86
 	}
87 87
 	public function callback() {
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	implements ICallbackNamed {
104 104
 	protected $value;
105 105
 	protected $name;
106
-	public function __construct($value, $name = null){
107
-		$this->value =& $value;
106
+	public function __construct($value, $name = null) {
107
+		$this->value = & $value;
108 108
 		$this->name = $name;
109 109
 		$this->callback = array($this, 'callback');
110 110
 	}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @TODO implement $paramIndex; 
135 135
 	 * param index choose which callback param will be passed to reference
136 136
 	 */
137
-	public function __construct(&$reference){
138
-		$this->callback =& $reference;
137
+	public function __construct(&$reference) {
138
+		$this->callback = & $reference;
139 139
 	}
140 140
 }
141 141
 //class CallbackReference extends Callback {
Please login to merge, or discard this patch.
src/Dom/DOMDocumentWrapper.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     protected function loadMarkupHTML($markup, $requestedCharset = null)
154 154
     {
155 155
         if (PhpQuery::$debug) {
156
-            PhpQuery::debug('Full markup load (HTML): ' . substr($markup, 0, 250));
156
+            PhpQuery::debug('Full markup load (HTML): '.substr($markup, 0, 250));
157 157
         }
158 158
         $this->loadMarkupReset();
159 159
         $this->isHTML = true;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                     $requestedCharset,
198 198
                     'AUTO'
199 199
                 );
200
-                $docEncoding      = mb_detect_encoding($markup, implode(', ', $possibleCharsets));
200
+                $docEncoding = mb_detect_encoding($markup, implode(', ', $possibleCharsets));
201 201
                 if (!$docEncoding) {
202 202
                     $docEncoding = $documentCharset;
203 203
                 }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     protected function loadMarkupXML($markup, $requestedCharset = null)
244 244
     {
245 245
         if (PhpQuery::$debug) {
246
-            PhpQuery::debug('Full markup load (XML): ' . substr($markup, 0, 250));
246
+            PhpQuery::debug('Full markup load (XML): '.substr($markup, 0, 250));
247 247
         }
248 248
         $this->loadMarkupReset();
249 249
         $this->isXML = true;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                     | LIBXML_DTDATTR | LIBXML_NONET
321 321
                     : LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NONET | LIBXML_NOWARNING
322 322
                     | LIBXML_NOERROR;
323
-                $return       = $this->document->loadXML($markup, $libxmlStatic);
323
+                $return = $this->document->loadXML($markup, $libxmlStatic);
324 324
                 // 				if (! $return)
325 325
                 // 					$return = $this->document->loadHTML($markup);
326 326
             }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     protected function isXML($markup)
359 359
     {
360 360
         //		return strpos($markup, '<?xml') !== false && stripos($markup, 'xhtml') === false;
361
-        return strpos(substr($markup, 0, 100), '<' . '?xml') !== false;
361
+        return strpos(substr($markup, 0, 100), '<'.'?xml') !== false;
362 362
     }
363 363
 
364 364
     protected function contentTypeToArray($contentType)
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     {
414 414
         $matches;
415 415
         // find declaration
416
-        preg_match('@<' . '?xml[^>]+encoding\\s*=\\s*(["|\'])(.*?)\\1@i', $markup, $matches);
416
+        preg_match('@<'.'?xml[^>]+encoding\\s*=\\s*(["|\'])(.*?)\\1@i', $markup, $matches);
417 417
         return isset($matches[2]) ? strtolower($matches[2]) : null;
418 418
     }
419 419
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         $markup          = substr($markup, 0, $matches[0][1])
441 441
             . substr($markup, $matches[0][1] + strlen($metaContentType));
442 442
         $headStart       = stripos($markup, '<head>');
443
-        $markup          = substr($markup, 0, $headStart + 6) . $metaContentType
443
+        $markup          = substr($markup, 0, $headStart + 6).$metaContentType
444 444
             . substr($markup, $headStart + 6);
445 445
         return $markup;
446 446
     }
@@ -450,23 +450,23 @@  discard block
 block discarded – undo
450 450
         // remove existing meta[type=content-type]
451 451
         $html = preg_replace('@\s*<meta[^>]+http-equiv\\s*=\\s*(["|\'])Content-Type\\1([^>]+?)>@i', '', $html);
452 452
         $meta = '<meta http-equiv="Content-Type" content="text/html;charset='
453
-            . $charset . '" ' . ($xhtml ? '/' : '') . '>';
453
+            . $charset.'" '.($xhtml ? '/' : '').'>';
454 454
         if (strpos($html, '<head') === false) {
455 455
             if (strpos($html, '<html') === false) {
456
-                return $meta . $html;
456
+                return $meta.$html;
457 457
             } else {
458 458
                 return preg_replace('@<html(.*?)(?(?<!\?)>)@s', "<html\\1><head>{$meta}</head>", $html);
459 459
             }
460 460
         } else {
461
-            return preg_replace('@<head(.*?)(?(?<!\?)>)@s', '<head\\1>' . $meta, $html);
461
+            return preg_replace('@<head(.*?)(?(?<!\?)>)@s', '<head\\1>'.$meta, $html);
462 462
         }
463 463
     }
464 464
 
465 465
     protected function charsetAppendToXML($markup, $charset)
466 466
     {
467
-        $declaration = '<' . '?xml version="1.0" encoding="' . $charset . '"?'
467
+        $declaration = '<'.'?xml version="1.0" encoding="'.$charset.'"?'
468 468
             . '>';
469
-        return $declaration . $markup;
469
+        return $declaration.$markup;
470 470
     }
471 471
 
472 472
     public static function isDocumentFragmentHTML($markup)
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
     public static function isDocumentFragmentXML($markup)
479 479
     {
480
-        return stripos($markup, '<' . '?xml') === false;
480
+        return stripos($markup, '<'.'?xml') === false;
481 481
     }
482 482
 
483 483
     public static function isDocumentFragmentXHTML($markup)
@@ -604,24 +604,24 @@  discard block
 block discarded – undo
604 604
             if ($fragment->isXHTML) {
605 605
                 // add FAKE element to set default namespace
606 606
                 $fragment->loadMarkupXML(
607
-                    '<?xml version="1.0" encoding="' . $charset
607
+                    '<?xml version="1.0" encoding="'.$charset
608 608
                     . '"?>'
609 609
                     . '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" '
610 610
                     . '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
611
-                    . '<fake xmlns="http://www.w3.org/1999/xhtml">' . $markup . '</fake>'
611
+                    . '<fake xmlns="http://www.w3.org/1999/xhtml">'.$markup.'</fake>'
612 612
                 );
613 613
                 $fragment->root = $fragment->document->firstChild->nextSibling;
614 614
             } else {
615 615
                 $fragment->loadMarkupXML(
616
-                    '<?xml version="1.0" encoding="' . $charset
617
-                    . '"?><fake>' . $markup . '</fake>'
616
+                    '<?xml version="1.0" encoding="'.$charset
617
+                    . '"?><fake>'.$markup.'</fake>'
618 618
                 );
619 619
                 $fragment->root = $fragment->document->firstChild;
620 620
             }
621 621
         } else {
622 622
             $markup2 = PhpQuery::$defaultDoctype
623 623
                 . '<html><head><meta http-equiv="Content-Type" content="text/html;charset='
624
-                . $charset . '"></head>';
624
+                . $charset.'"></head>';
625 625
             $noBody  = strpos($markup, '<body') === false;
626 626
             if ($noBody) {
627 627
                 $markup2 .= '<body>';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         }
663 663
         $fragment->isDocumentFragment = $tmp;
664 664
         if (PhpQuery::$debug) {
665
-            PhpQuery::debug('documentFragmentToMarkup: ' . substr($markup, 0, 150));
665
+            PhpQuery::debug('documentFragmentToMarkup: '.substr($markup, 0, 150));
666 666
         }
667 667
         return $markup;
668 668
     }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
                     $loop = $nodes;
721 721
                 }
722 722
                 self::debug(
723
-                    "Getting markup, moving selected nodes (" . count($loop)
723
+                    "Getting markup, moving selected nodes (".count($loop)
724 724
                     . ") to new DocumentFragment"
725 725
                 );
726 726
                 $fake   = $this->documentFragmentCreate($loop);
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 self::debug("Fixing XHTML");
731 731
                 $markup = self::markupFixXHTML($markup);
732 732
             }
733
-            self::debug("Markup: " . substr($markup, 0, 250));
733
+            self::debug("Markup: ".substr($markup, 0, 250));
734 734
             return $markup;
735 735
         } else {
736 736
             if ($this->isDocumentFragment) {
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
                 return $markup;
746 746
             } else {
747 747
                 self::debug(
748
-                    "Getting markup (" . ($this->isXML ? 'XML' : 'HTML')
748
+                    "Getting markup (".($this->isXML ? 'XML' : 'HTML')
749 749
                     . "), final with charset '{$this->charset}'"
750 750
                 );
751 751
                 $markup = $this->isXML ? $this->document->saveXML()
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                     self::debug("Fixing XHTML");
755 755
                     $markup = self::markupFixXHTML($markup);
756 756
                 }
757
-                self::debug("Markup: " . substr($markup, 0, 250));
757
+                self::debug("Markup: ".substr($markup, 0, 250));
758 758
                 return $markup;
759 759
             }
760 760
         }
Please login to merge, or discard this patch.