@@ -27,7 +27,7 @@ |
||
27 | 27 | public function render($sPath, array $aVars = array()) |
28 | 28 | { |
29 | 29 | // Make the template vars available as attributes |
30 | - foreach($aVars as $sName => $xValue) |
|
30 | + foreach ($aVars as $sName => $xValue) |
|
31 | 31 | { |
32 | 32 | $sName = (string)$sName; |
33 | 33 | $this->$sName = $xValue; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function addNamespace($sNamespace, $sDirectory, $sExtension = '') |
46 | 46 | { |
47 | 47 | // The 'jaxon' key cannot be overriden |
48 | - if($sNamespace == 'jaxon') |
|
48 | + if ($sNamespace == 'jaxon') |
|
49 | 49 | { |
50 | 50 | return; |
51 | 51 | } |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | // Get the namespace name |
83 | 83 | $sNamespace = ''; |
84 | 84 | $iSeparatorPosition = strrpos($sTemplate, '::'); |
85 | - if($iSeparatorPosition !== false) |
|
85 | + if ($iSeparatorPosition !== false) |
|
86 | 86 | { |
87 | 87 | $sNamespace = substr($sTemplate, 0, $iSeparatorPosition); |
88 | 88 | $sTemplate = substr($sTemplate, $iSeparatorPosition + 2); |
89 | 89 | } |
90 | 90 | // The default namespace is 'jaxon' |
91 | - if(!($sNamespace = trim($sNamespace))) |
|
91 | + if (!($sNamespace = trim($sNamespace))) |
|
92 | 92 | { |
93 | 93 | $sNamespace = 'jaxon'; |
94 | 94 | } |
95 | 95 | // Check if the namespace is defined |
96 | - if(!key_exists($sNamespace, $this->aNamespaces)) |
|
96 | + if (!key_exists($sNamespace, $this->aNamespaces)) |
|
97 | 97 | { |
98 | 98 | return false; |
99 | 99 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function getPrevLink() |
57 | 57 | { |
58 | - if(!($sCall = $this->xPaginator->getPrevCall())) |
|
58 | + if (!($sCall = $this->xPaginator->getPrevCall())) |
|
59 | 59 | { |
60 | 60 | return ''; |
61 | 61 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function getNextLink() |
71 | 71 | { |
72 | - if(!($sCall = $this->xPaginator->getNextCall())) |
|
72 | + if (!($sCall = $this->xPaginator->getNextCall())) |
|
73 | 73 | { |
74 | 74 | return ''; |
75 | 75 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | protected function getLinks() |
85 | 85 | { |
86 | 86 | $sLinks = ''; |
87 | - foreach($this->xPaginator->getPages() as $page) |
|
87 | + foreach ($this->xPaginator->getPages() as $page) |
|
88 | 88 | { |
89 | - if($page['call']) |
|
89 | + if ($page['call']) |
|
90 | 90 | { |
91 | 91 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
92 | 92 | $sLinks .= $this->_render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
@@ -90,8 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
92 | 92 | $sLinks .= $this->_render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
93 | - } |
|
94 | - else |
|
93 | + } else |
|
95 | 94 | { |
96 | 95 | $sLinks .= $this->_render('pagination::links/disabled', ['text' => $page['num']]); |
97 | 96 | } |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
30 | 30 | { |
31 | 31 | $sConfigFile = realpath($sConfigFile); |
32 | - if(!is_readable($sConfigFile)) |
|
32 | + if (!is_readable($sConfigFile)) |
|
33 | 33 | { |
34 | 34 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
35 | 35 | } |
36 | 36 | $aConfigOptions = include($sConfigFile); |
37 | - if(!is_array($aConfigOptions)) |
|
37 | + if (!is_array($aConfigOptions)) |
|
38 | 38 | { |
39 | 39 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // Setup the config options into the library. |
43 | 43 | $jaxon = jaxon(); |
44 | 44 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
45 | - if(!is_string($sAppKey)) |
|
45 | + if (!is_string($sAppKey)) |
|
46 | 46 | { |
47 | 47 | return null; |
48 | 48 | } |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
30 | 30 | { |
31 | 31 | $sConfigFile = realpath($sConfigFile); |
32 | - if(!extension_loaded('yaml')) |
|
32 | + if (!extension_loaded('yaml')) |
|
33 | 33 | { |
34 | 34 | throw new \Jaxon\Exception\Config\Yaml(jaxon_trans('config.errors.yaml.install')); |
35 | 35 | } |
36 | - if(!is_readable($sConfigFile)) |
|
36 | + if (!is_readable($sConfigFile)) |
|
37 | 37 | { |
38 | 38 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
39 | 39 | } |
40 | 40 | $aConfigOptions = yaml_parse_file($sConfigFile); |
41 | - if(!is_array($aConfigOptions)) |
|
41 | + if (!is_array($aConfigOptions)) |
|
42 | 42 | { |
43 | 43 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Setup the config options into the library. |
47 | 47 | $jaxon = jaxon(); |
48 | 48 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
49 | - if(!is_string($sAppKey)) |
|
49 | + if (!is_string($sAppKey)) |
|
50 | 50 | { |
51 | 51 | return null; |
52 | 52 | } |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | $sPrefix = trim((string)$sPrefix); |
51 | 51 | $nDepth = intval($nDepth); |
52 | 52 | // Check the max depth |
53 | - if($nDepth < 0 || $nDepth > 9) |
|
53 | + if ($nDepth < 0 || $nDepth > 9) |
|
54 | 54 | { |
55 | 55 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.depth', |
56 | 56 | array('key' => $sPrefix, 'depth' => $nDepth))); |
57 | 57 | } |
58 | 58 | $aValues = false; |
59 | - foreach($aOptions as $sName => $xOption) |
|
59 | + foreach ($aOptions as $sName => $xOption) |
|
60 | 60 | { |
61 | - if(is_int($sName)) |
|
61 | + if (is_int($sName)) |
|
62 | 62 | { |
63 | - if(is_array($aValues)) |
|
63 | + if (is_array($aValues)) |
|
64 | 64 | { |
65 | 65 | $aValues[] = $xOption; |
66 | 66 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | |
74 | 74 | $sName = trim($sName); |
75 | 75 | $sFullName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName; |
76 | - if(is_array($xOption)) |
|
76 | + if (is_array($xOption)) |
|
77 | 77 | { |
78 | 78 | // Recursively read the options in the array |
79 | 79 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
80 | 80 | } |
81 | - else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
81 | + else if (is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
82 | 82 | { |
83 | 83 | // Save the value of this option |
84 | 84 | $this->aOptions[$sFullName] = $xOption; |
85 | 85 | } |
86 | 86 | } |
87 | - if(is_array($aValues) && ($sPrefix)) |
|
87 | + if (is_array($aValues) && ($sPrefix)) |
|
88 | 88 | { |
89 | 89 | $this->aOptions[$sPrefix] = $aValues; |
90 | 90 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $aKeys = explode('.', (string)$sKeys); |
105 | 105 | foreach ($aKeys as $sKey) |
106 | 106 | { |
107 | - if(($sKey)) |
|
107 | + if (($sKey)) |
|
108 | 108 | { |
109 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
109 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
110 | 110 | { |
111 | 111 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.missing', array('key' => $sKeys))); |
112 | 112 | } |
@@ -154,13 +154,12 @@ discard block |
||
154 | 154 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
155 | 155 | $sPrefixLen = strlen($sPrefix); |
156 | 156 | $aOptions = array(); |
157 | - foreach($this->aOptions as $sName => $xValue) |
|
157 | + foreach ($this->aOptions as $sName => $xValue) |
|
158 | 158 | { |
159 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
159 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
160 | 160 | { |
161 | 161 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
162 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
163 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
162 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
164 | 163 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
165 | 164 | } |
166 | 165 | } |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | if(is_array($aValues)) |
64 | 64 | { |
65 | 65 | $aValues[] = $xOption; |
66 | - } |
|
67 | - else |
|
66 | + } else |
|
68 | 67 | { |
69 | 68 | $aValues = array($xOption); |
70 | 69 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | { |
78 | 77 | // Recursively read the options in the array |
79 | 78 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
80 | - } |
|
81 | - else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
79 | + } else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
82 | 80 | { |
83 | 81 | // Save the value of this option |
84 | 82 | $this->aOptions[$sFullName] = $xOption; |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
30 | 30 | { |
31 | 31 | $sConfigFile = realpath($sConfigFile); |
32 | - if(!is_readable($sConfigFile)) |
|
32 | + if (!is_readable($sConfigFile)) |
|
33 | 33 | { |
34 | 34 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
35 | 35 | } |
36 | 36 | $sFileContent = file_get_contents($sConfigFile); |
37 | 37 | $aConfigOptions = json_decode($sFileContent, true); |
38 | - if(!is_array($aConfigOptions)) |
|
38 | + if (!is_array($aConfigOptions)) |
|
39 | 39 | { |
40 | 40 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $jaxon = jaxon(); |
45 | 45 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
46 | 46 | $config = null; |
47 | - if(is_string($sAppKey)) |
|
47 | + if (is_string($sAppKey)) |
|
48 | 48 | { |
49 | 49 | $config = new Config(); |
50 | 50 | $config->setOptions($aConfigOptions, $sAppKey); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | $sSelector = trim($sSelector, " \t"); |
53 | 53 | $sContext = trim($sContext, " \t"); |
54 | 54 | $this->aCalls = array(); |
55 | - if(!$sSelector) |
|
55 | + if (!$sSelector) |
|
56 | 56 | { |
57 | 57 | $this->sSelector = "$(this)"; // If an empty selector is given, use javascript "this" instead |
58 | 58 | } |
59 | - else if(($sContext)) |
|
59 | + else if (($sContext)) |
|
60 | 60 | { |
61 | 61 | $this->sSelector = "$('" . $sSelector . "', $('" . $sContext . "'))"; |
62 | 62 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getScript() |
114 | 114 | { |
115 | - if(count($this->aCalls) == 0) |
|
115 | + if (count($this->aCalls) == 0) |
|
116 | 116 | { |
117 | 117 | return $this->sSelector; |
118 | 118 | } |
@@ -55,12 +55,10 @@ |
||
55 | 55 | if(!$sSelector) |
56 | 56 | { |
57 | 57 | $this->sSelector = "$(this)"; // If an empty selector is given, use javascript "this" instead |
58 | - } |
|
59 | - else if(($sContext)) |
|
58 | + } else if(($sContext)) |
|
60 | 59 | { |
61 | 60 | $this->sSelector = "$('" . $sSelector . "', $('" . $sContext . "'))"; |
62 | - } |
|
63 | - else |
|
61 | + } else |
|
64 | 62 | { |
65 | 63 | $this->sSelector = "$('" . $sSelector . "')"; |
66 | 64 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function append(Response $xResponse) |
73 | 73 | { |
74 | - if(!$this->xResponse) |
|
74 | + if (!$this->xResponse) |
|
75 | 75 | { |
76 | 76 | $this->xResponse = $xResponse; |
77 | 77 | } |
78 | - else if(get_class($this->xResponse) == get_class($xResponse)) |
|
78 | + else if (get_class($this->xResponse) == get_class($xResponse)) |
|
79 | 79 | { |
80 | - if($this->xResponse != $xResponse) |
|
80 | + if ($this->xResponse != $xResponse) |
|
81 | 81 | $this->xResponse->appendResponse($xResponse); |
82 | 82 | } |
83 | 83 | else |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function send() |
110 | 110 | { |
111 | - if(($this->xResponse)) |
|
111 | + if (($this->xResponse)) |
|
112 | 112 | { |
113 | - foreach($this->aDebugMessages as $sMessage) |
|
113 | + foreach ($this->aDebugMessages as $sMessage) |
|
114 | 114 | { |
115 | 115 | $this->xResponse->debug($sMessage); |
116 | 116 | } |
@@ -74,13 +74,12 @@ |
||
74 | 74 | if(!$this->xResponse) |
75 | 75 | { |
76 | 76 | $this->xResponse = $xResponse; |
77 | - } |
|
78 | - else if(get_class($this->xResponse) == get_class($xResponse)) |
|
77 | + } else if(get_class($this->xResponse) == get_class($xResponse)) |
|
79 | 78 | { |
80 | - if($this->xResponse != $xResponse) |
|
81 | - $this->xResponse->appendResponse($xResponse); |
|
82 | - } |
|
83 | - else |
|
79 | + if($this->xResponse != $xResponse) { |
|
80 | + $this->xResponse->appendResponse($xResponse); |
|
81 | + } |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | $this->debug($this->trans('errors.mismatch.types', array('class' => get_class($xResponse)))); |
86 | 85 | } |