| @@ -70,16 +70,10 @@ | ||
| 70 | 70 | * put your comment there... |
| 71 | 71 | * |
| 72 | 72 | * @var mixed |
| 73 | 73 | */ |
| 74 | - protected $onloadtemplate = array | |
| 75 | - ( | |
| 76 | - 'parameters' => array | |
| 77 | - ( | |
| 78 | - 'content', | |
| 79 | - 'file', | |
| 80 | - 'dir', | |
| 81 | - ), | |
| 74 | + protected $onloadtemplate = array( | |
| 75 | + 'parameters' => array('content', 'file'), | |
| 82 | 76 | ); |
| 83 | 77 | |
| 84 | 78 | /** |
| 85 | 79 | * put your comment there... |
| @@ -121,15 +115,8 @@ | ||
| 121 | 115 | * put your comment there... |
| 122 | 116 | * |
| 123 | 117 | * @var mixed |
| 124 | 118 | */ |
| 125 | - protected $params = null; | |
| 126 | - | |
| 127 | - /** | |
| 128 | - * put your comment there... | |
| 129 | - * | |
| 130 | - * @var mixed | |
| 131 | - */ | |
| 132 | 119 | protected $request; |
| 133 | 120 | |
| 134 | 121 | /** |
| 135 | 122 | * put your comment there... |
| @@ -147,16 +134,12 @@ | ||
| 147 | 134 | |
| 148 | 135 | /** |
| 149 | 136 | * put your comment there... |
| 150 | 137 | * |
| 151 | - * @param mixed $info | |
| 152 | - * @param mixed $params | |
| 153 | - * @return CJTView | |
| 154 | 138 | */ |
| 155 | - public function __construct($info, $params = null) { | |
| 139 | + public function __construct($info) { | |
| 156 | 140 | // Initialize vars! |
| 157 | 141 | $this->viewInfo = $info; |
| 158 | - $this->params = $params ? $params : array(); | |
| 159 | 142 | // Initialize events engine! |
| 160 | 143 | parent::__construct(); |
| 161 | 144 | // Fire created event! |
| 162 | 145 | $this->oncreated($info); |
| @@ -174,12 +157,11 @@ | ||
| 174 | 157 | /** |
| 175 | 158 | * put your comment there... |
| 176 | 159 | * |
| 177 | 160 | * @param mixed $view |
| 178 | - * @param mixed $params | |
| 179 | 161 | */ |
| 180 | - public static function getInstance($view, $params = null) { | |
| 181 | - return self::trigger('CJTView.createview', CJTController::getView($view, $params)); | |
| 162 | + public static function getInstance($view) { | |
| 163 | + return self::trigger('CJTView.createview', CJTController::getView($view)); | |
| 182 | 164 | } |
| 183 | 165 | |
| 184 | 166 | /** |
| 185 | 167 | * put your comment there... |
| @@ -196,21 +178,12 @@ | ||
| 196 | 178 | |
| 197 | 179 | /** |
| 198 | 180 | * put your comment there... |
| 199 | 181 | * |
| 200 | - * @param mixed $name | |
| 201 | - */ | |
| 202 | - public function getParam($name) { | |
| 203 | - return isset($this->params[$name]) ? $this->params[$name] : null; | |
| 204 | - } | |
| 205 | - | |
| 206 | - /** | |
| 207 | - * put your comment there... | |
| 208 | - * | |
| 209 | 182 | * @param mixed $destination |
| 210 | 183 | */ |
| 211 | 184 | public function getPath($destination) { |
| 212 | - return self::getViewPath($this->viewInfo['name'], $destination, $this->viewInfo['viewsPath']); | |
| 185 | + return self::getViewPath($this->viewInfo['name'], $destination); | |
| 213 | 186 | } |
| 214 | 187 | |
| 215 | 188 | /** |
| 216 | 189 | * put your comment there... |
| @@ -226,9 +199,9 @@ | ||
| 226 | 199 | * @param mixed $name |
| 227 | 200 | * @param mixed $value |
| 228 | 201 | */ |
| 229 | 202 | public function getRequestParameter($name) { |
| 230 | - return isset($this->request[$name]) ? $this->request[$name] : null; | |
| 203 | + return $this->request[$name]; | |
| 231 | 204 | } |
| 232 | 205 | |
| 233 | 206 | /** |
| 234 | 207 | * put your comment there... |
| @@ -241,16 +214,16 @@ | ||
| 241 | 214 | $extension = '.html.tmpl'; |
| 242 | 215 | } |
| 243 | 216 | // filter parameters. |
| 244 | 217 | $params = $this->ontemplateparameters($params, $name, $dir, $extension); |
| 218 | + // Get template content into variable. | |
| 219 | + ob_start(); | |
| 245 | 220 | // Push params into the local scope. |
| 246 | 221 | extract($params); |
| 247 | 222 | // Templates collected under the view/tmpl directory. |
| 248 | 223 | $templateFile = $this->getPath("{$dir}/{$name}{$extension}"); |
| 249 | - // Get template content into variable. | |
| 250 | - ob_start(); | |
| 251 | 224 | require $this->onimporttemplate($templateFile); |
| 252 | - $template = $this->onloadtemplate( ob_get_clean(), $name, "{$dir}/{$name}" ); | |
| 225 | + $template = $this->onloadtemplate(ob_get_clean(), $name); | |
| 253 | 226 | return $template; |
| 254 | 227 | } |
| 255 | 228 | |
| 256 | 229 | /** |
| @@ -257,9 +230,9 @@ | ||
| 257 | 230 | * put your comment there... |
| 258 | 231 | * |
| 259 | 232 | */ |
| 260 | 233 | public function getURI($destination) { |
| 261 | - return self::getViewURI($this->viewInfo['name'], $destination, $this->viewInfo['viewsUrl']); | |
| 234 | + return self::getViewURI($this->viewInfo['name'], $destination); | |
| 262 | 235 | } |
| 263 | 236 | |
| 264 | 237 | /** |
| 265 | 238 | * put your comment there... |
| @@ -266,14 +239,10 @@ | ||
| 266 | 239 | * |
| 267 | 240 | * @param mixed $view |
| 268 | 241 | * @param mixed $destination |
| 269 | 242 | */ |
| 270 | - public static function getViewPath($view, $destination, $overrideViewPath = null) { | |
| 271 | - # Use passed view path or use CJT constants if not passed | |
| 272 | - if (!$overrideViewPath) { | |
| 273 | - $overrideViewPath = CJTOOLBOX_VIEWS_PATH; | |
| 274 | - } | |
| 275 | - $viewPath = $overrideViewPath . DIRECTORY_SEPARATOR . $view; | |
| 243 | + public static function getViewPath($view, $destination) { | |
| 244 | + $viewPath = CJTOOLBOX_VIEWS_PATH . "/{$view}"; | |
| 276 | 245 | $destination = $destination ? "/{$destination}" : ''; |
| 277 | 246 | return "{$viewPath}{$destination}"; |
| 278 | 247 | } |
| 279 | 248 | |
| @@ -279,17 +248,12 @@ | ||
| 279 | 248 | |
| 280 | 249 | /** |
| 281 | 250 | * put your comment there... |
| 282 | 251 | * |
| 283 | - * @param mixed $view | |
| 284 | - * @param mixed $destination | |
| 285 | - * @param mixed $overrideViewUrl | |
| 252 | + * @param mixed $file | |
| 286 | 253 | */ |
| 287 | - public static function getViewURI($view, $destination, $overrideViewUrl = null) { | |
| 288 | - if (!$overrideViewUrl) { | |
| 289 | - $overrideViewUrl = CJTOOLBOX_VIEWS_URL; | |
| 290 | - } | |
| 291 | - $viewURI = "{$overrideViewUrl}/{$view}/public"; | |
| 254 | + public static function getViewURI($view, $destination) { | |
| 255 | + $viewURI = CJTOOLBOX_VIEWS_URL . "/{$view}/public"; | |
| 292 | 256 | return "{$viewURI}/{$destination}"; |
| 293 | 257 | } |
| 294 | 258 | |
| 295 | 259 | /** |
| @@ -356,20 +320,8 @@ | ||
| 356 | 320 | /** |
| 357 | 321 | * put your comment there... |
| 358 | 322 | * |
| 359 | 323 | */ |
| 360 | - protected function & suppressPrintScriptsHook() { | |
| 361 | - // Access Global. | |
| 362 | - global $wp_actions; | |
| 363 | - // Mark as triggered. | |
| 364 | - $wp_actions['wp_print_scripts'] = true; | |
| 365 | - // Chain. | |
| 366 | - return $this; | |
| 367 | - } | |
| 368 | - /** | |
| 369 | - * put your comment there... | |
| 370 | - * | |
| 371 | - */ | |
| 372 | 324 | protected static function useScripts($className, $scripts = null) { |
| 373 | 325 | wp_enqueue_script('Just Load Default Scripts, this works great!!!!'); |
| 374 | 326 | // Use current class name is $className is not provided! |
| 375 | 327 | if (!$className) { |
| @@ -393,10 +345,9 @@ | ||
| 393 | 345 | $location = isset($scriptObject[7]) ? $scriptObject[7] : null; |
| 394 | 346 | $scriptParameters = isset($scriptObject[5]) ? $scriptObject[5] : ''; |
| 395 | 347 | if (!isset($stack[$name])) { |
| 396 | 348 | // Any JS lib file should named the same as the parent folder with the extension added. |
| 397 | - // Except files with _ at the begning | |
| 398 | - $libPath = ':' . ((strpos($scriptObject[4], '_') === 0) ? substr($scriptObject[4], 1) : "{$scriptObject[4]}:{$scriptObject[4]}"); | |
| 349 | + $libPath = ":{$scriptObject[4]}:{$scriptObject[4]}"; | |
| 399 | 350 | // Pass virtual path to getURI and resolvePath to |
| 400 | 351 | // get JS file URI and localization file path. |
| 401 | 352 | $jsFile = cssJSToolbox::getURI(preg_replace($nameExp, "{$libPath}.js", $script)); |
| 402 | 353 | $localizationFile = cssJSToolbox::resolvePath(preg_replace($nameExp, "{$libPath}.localization.php", $script)); |
| @@ -412,8 +363,9 @@ | ||
| 412 | 363 | // This object caryy other informations so that the other |
| 413 | 364 | // Plugin parts/components can use it to know how script file work. |
| 414 | 365 | $stack[$name]->cjt = (object) $stack[$name]->cjt; |
| 415 | 366 | } |
| 367 | + | |
| 416 | 368 | // If localization file exists localize JS. |
| 417 | 369 | if (file_exists($localizationFile)) { |
| 418 | 370 | // Get localization text array. |
| 419 | 371 | $localization = require $localizationFile; |