Skip to content

Commit 042f42f

Browse files
committed
major SensioLabs bug fixed
1 parent b77ba22 commit 042f42f

File tree

11 files changed

+64
-95
lines changed

11 files changed

+64
-95
lines changed

Ajax/JsUtils.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class JsUtils{
5454
protected $config;
5555

5656
protected function _setDi($di) {
57-
if ($this->js!=null&&$di!=null)
57+
if ($this->js!==null && $di!==null)
5858
$this->js->setDi($di);
5959
}
6060

@@ -92,7 +92,7 @@ abstract public function fromDispatcher($dispatcher);
9292
public function ui($ui=NULL) {
9393
if ($ui!==NULL) {
9494
$this->_ui=$ui;
95-
if ($this->js!=null) {
95+
if ($this->js!==null) {
9696
$this->js->ui($ui);
9797
$ui->setJs($this);
9898
}
@@ -112,7 +112,7 @@ public function ui($ui=NULL) {
112112
public function bootstrap($bootstrap=NULL) {
113113
if ($bootstrap!==NULL) {
114114
$this->_bootstrap=$bootstrap;
115-
if ($this->js!=null) {
115+
if ($this->js!==null) {
116116
$this->js->bootstrap($bootstrap);
117117
$bootstrap->setJs($this);
118118
}
@@ -132,7 +132,7 @@ public function bootstrap($bootstrap=NULL) {
132132
public function semantic($semantic=NULL) {
133133
if ($semantic!==NULL) {
134134
$this->_semantic=$semantic;
135-
if ($this->js!=null) {
135+
if ($this->js!==null) {
136136
$this->js->semantic($semantic);
137137
$semantic->setJs($this);
138138
}

Ajax/bootstrap/html/HtmlButtontoolbar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getElement($index) {
8787
$element=$elements [$index];
8888
}
8989
} else {
90-
while ( $element==null&&$i<sizeof($this->elements) ) {
90+
while ( $element===null && $i<sizeof($this->elements) ) {
9191
$element=$this->elements [$i]->getElement($index);
9292
$i++;
9393
}

Ajax/bootstrap/html/HtmlCollapse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Ajax\JsUtils;
66
use Ajax\bootstrap\html\base\HtmlElementAsContent;
77
use Ajax\bootstrap\html\base\HtmlBsDoubleElement;
8+
use Ajax\common\html\HtmlDoubleElement;
89

910
/**
1011
* Twitter Bootstrap Collapse component

Ajax/bootstrap/html/HtmlForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Ajax\JsUtils;
77

88
use Ajax\common\html\html5\HtmlSelect;
9+
use Ajax\service\JString;
910

1011
class HtmlForm extends HtmlBsDoubleElement {
1112
protected $formElementsPrefix;
@@ -91,7 +92,7 @@ private function getId($str) {
9192
private function getPrefix($element) {
9293
$result="input_text";
9394
foreach ( $this->formElementsPrefix as $k => $v ) {
94-
if (Text::startsWith($element, $k)) {
95+
if (JString::startswith($element, $k)) {
9596
$result=$v;
9697
break;
9798
}
Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22
namespace Ajax\bootstrap\html\base;
33

4-
use Ajax\JsUtils;
4+
use Ajax\common\html\traits\NavElementTrait;
5+
56
/**
67
* Bs class for navigation elements : Breadcrumbs and Pagination
78
* @author jc
89
* @version 1.001
910
*/
1011
abstract class HtmlNavElement extends HtmlBsDoubleElement {
12+
use NavElementTrait;
1113
/**
1214
* @var string the root site
1315
*/
@@ -38,45 +40,4 @@ public function autoGetOnClick($targetSelector){
3840
public function contentAsString(){
3941
return implode("", $this->content);
4042
}
41-
42-
/**
43-
* Generate the jquery script to set the elements to the HtmlNavElement
44-
* @param JsUtils $jsUtils
45-
*/
46-
public function jsSetContent(JsUtils $jsUtils){
47-
$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
48-
}
49-
50-
public function getRoot() {
51-
return $this->root;
52-
}
53-
public function setRoot($root) {
54-
$this->root = $root;
55-
return $this;
56-
}
57-
public function getAttr() {
58-
return $this->attr;
59-
}
60-
61-
/**
62-
* Define the html attribute for each element url in ajax
63-
* @param string $attr html attribute
64-
* @return HtmlNavElement
65-
*/
66-
public function setAttr($attr) {
67-
$this->attr = $attr;
68-
return $this;
69-
}
70-
71-
public function __call($method, $args) {
72-
if(isset($this->$method) && is_callable($this->$method)) {
73-
return call_user_func_array(
74-
$this->$method,
75-
$args
76-
);
77-
}
78-
}
79-
80-
abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0);
81-
8243
}

Ajax/common/html/html5/HtmlSelect.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use Ajax\common\html\HtmlDoubleElement;
55
use Ajax\JsUtils;
6+
use Ajax\service\JArray;
67
/**
78
* HTML Select
89
* @author jc
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
namespace Ajax\common\html\traits;
3+
use Ajax\JsUtils;
4+
5+
trait NavElementTrait{
6+
/**
7+
* Generate the jquery script to set the elements to the HtmlNavElement
8+
* @param JsUtils $jsUtils
9+
*/
10+
public function jsSetContent(JsUtils $jsUtils){
11+
$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
12+
}
13+
14+
public function getRoot() {
15+
return $this->root;
16+
}
17+
public function setRoot($root) {
18+
$this->root = $root;
19+
return $this;
20+
}
21+
public function getAttr() {
22+
return $this->attr;
23+
}
24+
25+
/**
26+
* Define the html attribute for each element url in ajax
27+
* @param string $attr html attribute
28+
* @return HtmlNavElement
29+
*/
30+
public function setAttr($attr) {
31+
$this->attr = $attr;
32+
return $this;
33+
}
34+
35+
public function __call($method, $args) {
36+
if(isset($this->$method) && is_callable($this->$method)) {
37+
return call_user_func_array(
38+
$this->$method,
39+
$args
40+
);
41+
}
42+
}
43+
44+
abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0);
45+
}

Ajax/common/traits/JqueryAjaxTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function _getAjaxUrl($url,$attr){
7474
$retour.="url=url+'".$slash."'+$(this).val();\n";
7575
elseif ($attr==="html")
7676
$retour.="url=url+'".$slash."'+$(this).html();\n";
77-
elseif($attr!=null && $attr!=="")
77+
elseif($attr!==null && $attr!=="")
7878
$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
7979
}
8080
return $retour;

Ajax/php/yii/URI.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function _fetch_uri_string() {
7777
$uri="";
7878
if ($this->uri_protocol == 'AUTO') {
7979
// Is the request coming from the command line?
80-
if (php_sapi_name() == 'cli' or defined('STDIN')) {
80+
if (php_sapi_name() == 'cli' || defined('STDIN')) {
8181
$this->_set_uri_string($this->_parse_cli_args());
8282
return;
8383
}
@@ -154,7 +154,7 @@ function _set_uri_string($str) {
154154
*
155155
*/
156156
private function _detect_uri() {
157-
if (!isset($_SERVER['REQUEST_URI']) or !isset($_SERVER['SCRIPT_NAME'])) {
157+
if (!isset($_SERVER['REQUEST_URI']) || !isset($_SERVER['SCRIPT_NAME'])) {
158158
return '';
159159
}
160160

@@ -575,4 +575,4 @@ function ruri_string() {
575575
return '/' . implode('/', $this->rsegment_array());
576576
}
577577
}
578-
// END URI Class
578+
// END URI Class

Ajax/semantic/html/base/HtmlSemNavElement.php

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22
namespace Ajax\semantic\html\base;
33

4-
use Ajax\JsUtils;
54
use Ajax\service\JArray;
5+
use Ajax\common\html\traits\NavElementTrait;
66
/**
77
* Sem class for navigation elements : Breadcrumbs and Pagination
88
* @author jc
99
* @version 1.001
1010
*/
1111
abstract class HtmlSemNavElement extends HtmlSemCollection {
12+
use NavElementTrait;
1213
/**
1314
* @var string the root site
1415
*/
@@ -44,47 +45,6 @@ public function contentAsString(){
4445
return JArray::implode($this->_contentSeparator, $this->content);
4546
}
4647

47-
/**
48-
* Generate the jquery script to set the elements to the HtmlNavElement
49-
* @param JsUtils $jsUtils
50-
*/
51-
public function jsSetContent(JsUtils $jsUtils){
52-
$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
53-
}
54-
55-
public function getRoot() {
56-
return $this->root;
57-
}
58-
public function setRoot($root) {
59-
$this->root = $root;
60-
return $this;
61-
}
62-
public function getAttr() {
63-
return $this->attr;
64-
}
65-
66-
/**
67-
* Define the html attribute for each element url in ajax
68-
* @param string $attr html attribute
69-
* @return HtmlNavElement
70-
*/
71-
public function setAttr($attr) {
72-
$this->attr = $attr;
73-
return $this;
74-
}
75-
76-
public function __call($method, $args) {
77-
if(isset($this->$method) && is_callable($this->$method)) {
78-
return call_user_func_array(
79-
$this->$method,
80-
$args
81-
);
82-
}
83-
}
84-
85-
abstract public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0);
86-
87-
8848
public function setContentDivider($divider,$index=NULL) {
8949
$divider="<div class='divider'> {$divider} </div>";
9050
return $this->setDivider($divider, $index);

0 commit comments

Comments
 (0)