| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 | -if (!defined('HC3_VERSION')) { | |
| 3 | - define( 'HC3_VERSION', 103 ); | |
| 4 | -} | |
| 2 | +define( 'HC3_VERSION', 102 ); | |
| 5 | 3 | |
| 6 | -if (!class_exists('HC3_Abstract_Plugin')) { | |
| 7 | 4 | abstract class HC3_Abstract_Plugin |
| 8 | 5 | { |
| 9 | 6 | public static $instance; |
| 10 | 7 | |
| @@ -103,22 +100,14 @@ | ||
| 103 | 100 | $moduleBootClass = $this->prefix . $moduleName . '_Boot'; |
| 104 | 101 | $module = $dic->make( $moduleBootClass ); |
| 105 | 102 | } |
| 106 | 103 | |
| 107 | - $uri = $dic->make('HC3_Uri'); | |
| 108 | - $currentUrl = parse_url( $uri->currentUrl() ); | |
| 109 | - $currentPort = isset( $currentUrl['port'] ) ? $currentUrl['port'] : null; | |
| 110 | - | |
| 111 | 104 | $url = parse_url( site_url('/') ); |
| 112 | -// _print_r( $url ); | |
| 113 | 105 | |
| 114 | 106 | $baseUrl = $url['scheme'] . '://'. $url['host']; |
| 115 | - $basePort = isset( $url['port'] ) ? $url['port'] : null; | |
| 116 | - | |
| 117 | - if( $basePort && (80 != $basePort) && ($basePort == $currentPort) ){ | |
| 118 | - $baseUrl .= ':' . $basePort; | |
| 107 | + if( isset($url['port']) && (80 != $url['port']) ){ | |
| 108 | + $baseUrl .= ':' . $url['port']; | |
| 119 | 109 | } |
| 120 | - | |
| 121 | 110 | $baseUrl .= $url['path']; |
| 122 | 111 | |
| 123 | 112 | $actionUrl = (isset($url['query']) && $url['query']) ? '?' . $url['query'] . '&' : '?'; |
| 124 | 113 | $actionUrl .= $this->hcs . '=' . $this->prfx; |
| @@ -349,14 +338,14 @@ | ||
| 349 | 338 | $requestMethod = $request->getMethod(); |
| 350 | 339 | $requestParams = $request->getParams(); |
| 351 | 340 | $slug = $request->getSlug(); |
| 352 | 341 | |
| 353 | - $ajax = false; | |
| 342 | + $ajax = FALSE; | |
| 354 | 343 | if( substr($slug, 0, strlen('ajax/')) == 'ajax/' ){ |
| 355 | - $ajax = true; | |
| 344 | + $ajax = TRUE; | |
| 356 | 345 | } |
| 357 | 346 | else { |
| 358 | - $ajax = $request->isAjax() ? true : false; | |
| 347 | + $ajax = $request->isAjax() ? TRUE : FALSE; | |
| 359 | 348 | } |
| 360 | 349 | |
| 361 | 350 | if( ! $slug ){ |
| 362 | 351 | $slug = $defaultSlug; |
| @@ -361,14 +350,9 @@ | ||
| 361 | 350 | if( ! $slug ){ |
| 362 | 351 | $slug = $defaultSlug; |
| 363 | 352 | } |
| 364 | 353 | |
| 365 | - $request->setRealSlug( $slug ); | |
| 366 | - | |
| 367 | 354 | $slug = $requestMethod . ':' . $slug; |
| 368 | - if( 'get:myschedule/dates' == $slug ){ | |
| 369 | - $slug = 'post:myschedule/dates'; | |
| 370 | - } | |
| 371 | 355 | |
| 372 | 356 | // first acl |
| 373 | 357 | $acl = $root->make('HC3_Acl'); |
| 374 | 358 | if( ! $acl->check($slug, $requestParams) ){ |
| @@ -377,28 +361,14 @@ | ||
| 377 | 361 | $returnTo = $uri->currentUrl(); |
| 378 | 362 | $to = wp_login_url( $returnTo ); |
| 379 | 363 | |
| 380 | 364 | if( ! headers_sent() ){ |
| 381 | - if( 0 && defined('HC3_PROFILER') && HC3_PROFILER ){ | |
| 382 | - $html = "REDIRECT<br><a href=\"$to\">$to</a>"; | |
| 383 | - echo $html; | |
| 384 | - exit; | |
| 385 | - } | |
| 386 | - else { | |
| 387 | - wp_redirect( $to ); | |
| 388 | - } | |
| 365 | + wp_redirect( $to ); | |
| 389 | 366 | } |
| 390 | 367 | else { |
| 391 | - if( defined('HC3_PROFILER') && HC3_PROFILER ){ | |
| 392 | - $html = "REDIRECT<br><a href=\"$to\">$to</a>"; | |
| 393 | - echo $html; | |
| 394 | - exit; | |
| 395 | - } | |
| 396 | - else { | |
| 397 | - $html = "<META http-equiv=\"refresh\" content=\"0;URL=$to\">"; | |
| 398 | - echo $html; | |
| 399 | - exit; | |
| 400 | - } | |
| 368 | + $html = "<META http-equiv=\"refresh\" content=\"0;URL=$to\">"; | |
| 369 | + echo $html; | |
| 370 | + exit; | |
| 401 | 371 | } |
| 402 | 372 | } |
| 403 | 373 | else { |
| 404 | 374 | $result = 'not allowed'; |
| @@ -425,15 +395,10 @@ | ||
| 425 | 395 | $result = esc_html( $result ); |
| 426 | 396 | } |
| 427 | 397 | } |
| 428 | 398 | catch( HC3_ExceptionArray $e ){ |
| 429 | - $errors = $e->getErrors(); | |
| 430 | - $session->setFlashdata('form_errors', $errors); | |
| 399 | + $session->setFlashdata('form_errors', $e->getErrors()); | |
| 431 | 400 | $result = array('-referrer-', NULL); |
| 432 | - $post = $root->make('HC3_Post') | |
| 433 | - ->get() | |
| 434 | - ; | |
| 435 | - $session->setFlashdata('post', $post); | |
| 436 | 401 | } |
| 437 | 402 | |
| 438 | 403 | // message and redirect |
| 439 | 404 | if( is_array($result) ){ |
| @@ -456,9 +421,9 @@ | ||
| 456 | 421 | else { |
| 457 | 422 | $session->setFlashdata('message', $msg); |
| 458 | 423 | } |
| 459 | 424 | |
| 460 | - // $session->setFlashdata('post', $post); | |
| 425 | + $session->setFlashdata('post', $post); | |
| 461 | 426 | |
| 462 | 427 | $to = $uri->makeUrl( $to ); |
| 463 | 428 | |
| 464 | 429 | $notificator = $root->make('HC3_Notificator'); |
| @@ -470,23 +435,13 @@ | ||
| 470 | 435 | echo $out; |
| 471 | 436 | } |
| 472 | 437 | else { |
| 473 | 438 | if( ! headers_sent() ){ |
| 474 | - if( defined('HC3_PROFILER') && HC3_PROFILER ){ | |
| 475 | - $html = "REDIRECT<br><a href=\"$to\">$to</a>"; | |
| 476 | - // echo $html; | |
| 477 | - return $html; | |
| 478 | - // exit; | |
| 479 | - } | |
| 480 | - else { | |
| 481 | - wp_redirect( $to ); | |
| 482 | - } | |
| 439 | + wp_redirect( $to ); | |
| 483 | 440 | } |
| 484 | 441 | else { |
| 485 | - if( 0 && defined('HC3_PROFILER') && HC3_PROFILER ){ | |
| 442 | + if( defined('HC3_DEV_INSTALL') ){ | |
| 486 | 443 | $html = "REDIRECT<br><a href=\"$to\">$to</a>"; |
| 487 | - echo $html; | |
| 488 | - exit; | |
| 489 | 444 | } |
| 490 | 445 | else { |
| 491 | 446 | $html = "<META http-equiv=\"refresh\" content=\"0;URL=$to\">"; |
| 492 | 447 | } |
| @@ -523,14 +478,14 @@ | ||
| 523 | 478 | $isPrintView = $request->isPrintView(); |
| 524 | 479 | |
| 525 | 480 | $slug = $request->getSlug(); |
| 526 | 481 | |
| 527 | - $ajax = false; | |
| 482 | + $ajax = FALSE; | |
| 528 | 483 | if( substr($slug, 0, strlen('ajax/')) == 'ajax/' ){ |
| 529 | - $ajax = true; | |
| 484 | + $ajax = TRUE; | |
| 530 | 485 | } |
| 531 | 486 | else { |
| 532 | - $ajax = $request->isAjax() ? true : false; | |
| 487 | + $ajax = $request->isAjax() ? TRUE : FALSE; | |
| 533 | 488 | } |
| 534 | 489 | |
| 535 | 490 | $profiler = $root->make('HC3_Profiler'); |
| 536 | 491 | $profiler->mark('render_start'); |
| @@ -722,9 +677,8 @@ | ||
| 722 | 677 | public function root() |
| 723 | 678 | { |
| 724 | 679 | return $this->dic; |
| 725 | 680 | } |
| 726 | -} | |
| 727 | 681 | } |
| 728 | 682 | |
| 729 | 683 | if( ! function_exists('_print_r') ){ |
| 730 | 684 | function _print_r( $thing ) |