@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | private static function containsElement($input) { |
| 27 | 27 | foreach ( $input as $v ) { |
| 28 | - if (\is_object($v) || \is_array($v)) |
|
| 29 | - return true; |
|
| 28 | + if (\is_object($v) || \is_array($v)) { |
|
| 29 | + return true; |
|
| 30 | + } |
|
| 30 | 31 | } |
| 31 | 32 | return false; |
| 32 | 33 | } |
@@ -44,12 +45,13 @@ discard block |
||
| 44 | 45 | |
| 45 | 46 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
| 46 | 47 | return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
| 47 | - if (is_object($v)) |
|
| 48 | - return $v->compile($js); |
|
| 49 | - elseif (\is_array($v)) { |
|
| 48 | + if (is_object($v)) { |
|
| 49 | + return $v->compile($js); |
|
| 50 | + } elseif (\is_array($v)) { |
|
| 50 | 51 | return self::wrap($v, $js, $separator, $valueQuote); |
| 51 | - } else |
|
| 52 | - return $v; |
|
| 52 | + } else { |
|
| 53 | + return $v; |
|
| 54 | + } |
|
| 53 | 55 | }, $input)); |
| 54 | 56 | } |
| 55 | 57 | } |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | $output=$input; |
| 13 | 13 | } |
| 14 | 14 | if (\is_array($input)) { |
| 15 | - if (sizeof($input) > 0) { |
|
| 16 | - if (self::containsElement($input) === false) { |
|
| 15 | + if (sizeof($input)>0) { |
|
| 16 | + if (self::containsElement($input)===false) { |
|
| 17 | 17 | $output=self::wrapStrings($input, $separator=' ', $valueQuote='"'); |
| 18 | 18 | } else { |
| 19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | private static function containsElement($input) { |
| 27 | - foreach ( $input as $v ) { |
|
| 27 | + foreach ($input as $v) { |
|
| 28 | 28 | if (\is_object($v) || \is_array($v)) |
| 29 | 29 | return true; |
| 30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public static function wrapStrings($input, $separator=' ', $valueQuote='"') { |
| 35 | - if (JArray::isAssociative($input) === true) { |
|
| 36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
| 37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
| 35 | + if (JArray::isAssociative($input)===true) { |
|
| 36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
| 37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
| 38 | 38 | }, $input, array_keys($input))); |
| 39 | 39 | } else { |
| 40 | 40 | $result=implode($separator, array_values($input)); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
| 46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
| 46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
| 47 | 47 | if (is_object($v)) |
| 48 | 48 | return $v->compile($js); |
| 49 | 49 | elseif (\is_array($v)) { |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | protected $attr; |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function __construct($identifier,$tagName){ |
|
| 25 | - parent::__construct($identifier,$tagName); |
|
| 24 | + public function __construct($identifier, $tagName) { |
|
| 25 | + parent::__construct($identifier, $tagName); |
|
| 26 | 26 | $this->root=""; |
| 27 | 27 | $this->attr="data-ajax"; |
| 28 | 28 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @param string $targetSelector the target of the get |
| 34 | 34 | * @return HtmlNavElement |
| 35 | 35 | */ |
| 36 | - public function autoGetOnClick($targetSelector){ |
|
| 37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 36 | + public function autoGetOnClick($targetSelector) { |
|
| 37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function contentAsString(){ |
|
| 40 | + public function contentAsString() { |
|
| 41 | 41 | return implode("", $this->content); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addGlyph($glyphicon,$before=true){ |
|
| 26 | + public function addGlyph($glyphicon, $before=true) { |
|
| 27 | 27 | $glyph=new HtmlGlyphicon(""); |
| 28 | 28 | $glyph->setGlyphicon($glyphicon); |
| 29 | - $this->addContent($glyph,$before); |
|
| 29 | + $this->addContent($glyph, $before); |
|
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
| 33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
| 34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
| 35 | 35 | $after=""; |
| 36 | - if($glyphAfter!==""){ |
|
| 36 | + if ($glyphAfter!=="") { |
|
| 37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
| 38 | 38 | } |
| 39 | - return $this->wrapContent($before,$after); |
|
| 39 | + return $this->wrapContent($before, $after); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -89,8 +89,9 @@ discard block |
||
| 89 | 89 | * @return \Ajax\bootstrap\html\HtmlPanel default : "panel-default" |
| 90 | 90 | */ |
| 91 | 91 | public function setStyle($cssStyle) { |
| 92 | - if (!PhalconUtils::startsWith($cssStyle, "panel")) |
|
| 93 | - $cssStyle="panel".$cssStyle; |
|
| 92 | + if (!PhalconUtils::startsWith($cssStyle, "panel")) { |
|
| 93 | + $cssStyle="panel".$cssStyle; |
|
| 94 | + } |
|
| 94 | 95 | return $this->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("panel")); |
| 95 | 96 | } |
| 96 | 97 | |
@@ -132,7 +133,8 @@ discard block |
||
| 132 | 133 | * @return $this default : false |
| 133 | 134 | */ |
| 134 | 135 | public function show($value) { |
| 135 | - if ($this->_collapsable) |
|
| 136 | - $this->_showOnStartup=$value; |
|
| 136 | + if ($this->_collapsable) { |
|
| 137 | + $this->_showOnStartup=$value; |
|
| 138 | + } |
|
| 137 | 139 | } |
| 138 | 140 | } |
@@ -62,15 +62,15 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function setIdentifier($identifier) { |
| 64 | 64 | parent::setIdentifier($identifier); |
| 65 | - if($this->content instanceof HtmlLink){ |
|
| 65 | + if ($this->content instanceof HtmlLink) { |
|
| 66 | 66 | $this->content->setIdentifier("link-".$identifier); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | - public function setActive($value=true){ |
|
| 70 | - $this->setProperty("class", ($value)?"active":""); |
|
| 69 | + public function setActive($value=true) { |
|
| 70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function disable(){ |
|
| 73 | + public function disable() { |
|
| 74 | 74 | $this->setProperty("class", "disabled"); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -4,34 +4,34 @@ |
||
| 4 | 4 | |
| 5 | 5 | use micro\controllers\Startup; |
| 6 | 6 | use micro\utils\RequestUtils; |
| 7 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 7 | +class JsUtils extends \Ajax\JsUtils { |
|
| 8 | 8 | |
| 9 | - public function getUrl($url){ |
|
| 9 | + public function getUrl($url) { |
|
| 10 | 10 | return RequestUtils::getUrl($url); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - public function addViewElement($identifier,$content,&$view){ |
|
| 13 | + public function addViewElement($identifier, $content, &$view) { |
|
| 14 | 14 | $controls=$view->getVar("q"); |
| 15 | - if (isset($controls) === false) { |
|
| 16 | - $controls=array (); |
|
| 15 | + if (isset($controls)===false) { |
|
| 16 | + $controls=array(); |
|
| 17 | 17 | } |
| 18 | 18 | $controls[$identifier]=$content; |
| 19 | 19 | $view->setVar("q", $controls); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 23 | - $view->setVar($view_var,$output); |
|
| 22 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 23 | + $view->setVar($view_var, $output); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function forward($initialController,$controller,$action,$params=array()){ |
|
| 27 | - return $initialController->forward($controller,$action,$params,true,true,true); |
|
| 26 | + public function forward($initialController, $controller, $action, $params=array()) { |
|
| 27 | + return $initialController->forward($controller, $action, $params, true, true, true); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 31 | - return $initialControllerInstance->loadView($viewName,$params,true); |
|
| 30 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 31 | + return $initialControllerInstance->loadView($viewName, $params, true); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function fromDispatcher($dispatcher){ |
|
| 34 | + public function fromDispatcher($dispatcher) { |
|
| 35 | 35 | return Startup::$urlParts; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -4,24 +4,24 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\Facades\App; |
| 6 | 6 | |
| 7 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 8 | - public function getUrl($url){ |
|
| 7 | +class JsUtils extends \Ajax\JsUtils { |
|
| 8 | + public function getUrl($url) { |
|
| 9 | 9 | return \url($url); |
| 10 | 10 | } |
| 11 | - public function addViewElement($identifier,$content,&$view){ |
|
| 11 | + public function addViewElement($identifier, $content, &$view) { |
|
| 12 | 12 | $controls=$view->__get("q"); |
| 13 | - if (isset($controls) === false) { |
|
| 14 | - $controls=array (); |
|
| 13 | + if (isset($controls)===false) { |
|
| 14 | + $controls=array(); |
|
| 15 | 15 | } |
| 16 | 16 | $controls[$identifier]=$content; |
| 17 | 17 | $view->__set("q", $controls); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 21 | - $view->__set($view_var,$output); |
|
| 20 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 21 | + $view->__set($view_var, $output); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 24 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 25 | 25 | \ob_start(); |
| 26 | 26 | App::make($controllerName)->{$actionName}($params); |
| 27 | 27 | $result=\ob_get_contents(); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | return $result; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 33 | - return \view()->make($viewName,$params)->render(); |
|
| 32 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 33 | + return \view()->make($viewName, $params)->render(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function fromDispatcher($dispatcher){ |
|
| 36 | + public function fromDispatcher($dispatcher) { |
|
| 37 | 37 | return $dispatcher->segments(); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\service; |
| 3 | 3 | class JQueryAjaxEffect { |
| 4 | - public static function none($responseElement,$jqueryDone="html"){ |
|
| 4 | + public static function none($responseElement, $jqueryDone="html") { |
|
| 5 | 5 | return "\t$({$responseElement}).{$jqueryDone}( data );\n"; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - public static function fade($responseElement,$jqueryDone="html"){ |
|
| 8 | + public static function fade($responseElement, $jqueryDone="html") { |
|
| 9 | 9 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn();\n"; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | - public static function slide($responseElement,$jqueryDone="html"){ |
|
| 12 | + public static function slide($responseElement, $jqueryDone="html") { |
|
| 13 | 13 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).slideDown();\n"; |
| 14 | 14 | } |
| 15 | 15 | } |
@@ -8,22 +8,22 @@ discard block |
||
| 8 | 8 | * @property string $root |
| 9 | 9 | * @property string $attr |
| 10 | 10 | */ |
| 11 | -trait NavElementTrait{ |
|
| 11 | +trait NavElementTrait { |
|
| 12 | 12 | |
| 13 | 13 | abstract public function contentAsString(); |
| 14 | 14 | /** |
| 15 | 15 | * Generate the jquery script to set the elements to the HtmlNavElement |
| 16 | 16 | * @param JsUtils $jsUtils |
| 17 | 17 | */ |
| 18 | - public function jsSetContent(JsUtils $jsUtils){ |
|
| 19 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
| 18 | + public function jsSetContent(JsUtils $jsUtils) { |
|
| 19 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getRoot() { |
| 23 | 23 | return $this->root; |
| 24 | 24 | } |
| 25 | 25 | public function setRoot($root) { |
| 26 | - $this->root = $root; |
|
| 26 | + $this->root=$root; |
|
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | public function getAttr() { |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | * @return HtmlNavElement |
| 37 | 37 | */ |
| 38 | 38 | public function setAttr($attr) { |
| 39 | - $this->attr = $attr; |
|
| 39 | + $this->attr=$attr; |
|
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function __call($method, $args) { |
| 44 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
| 44 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
| 45 | 45 | return call_user_func_array( |
| 46 | 46 | $this->$method, |
| 47 | 47 | $args |
@@ -49,5 +49,5 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0); |
|
| 52 | + abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
| 53 | 53 | } |