| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* |
| 11 |
*/ |
| 12 |
class CJTInstallerAccessPoint extends CJTAccessPoint { |
| 13 |
|
| 14 |
/** |
| 15 |
* put your comment there... |
| 16 |
* |
| 17 |
* @var mixed |
| 18 |
*/ |
| 19 |
protected $stopNotices = false; |
| 20 |
|
| 21 |
/** |
| 22 |
* put your comment there... |
| 23 |
* |
| 24 |
*/ |
| 25 |
public function __construct() { |
| 26 |
// Initialize parent. |
| 27 |
parent::__construct(); |
| 28 |
// Set name! |
| 29 |
$this->name = 'installer'; |
| 30 |
} |
| 31 |
/** |
| 32 |
* put your comment there... |
| 33 |
* |
| 34 |
*/ |
| 35 |
protected function doListen() { |
| 36 |
// If not installed and not in manage page display admin notice! |
| 37 |
if (!CJTPlugin::getInstance()->isInstalled() && $this->hasAccess()) { |
| 38 |
add_action('admin_notices', array(&$this, 'notInstalledAdminNotice')); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* put your comment there... |
| 44 |
* |
| 45 |
*/ |
| 46 |
public function installationPage() { |
| 47 |
if ($this->hasAccess()) { |
| 48 |
// Set as connected object! |
| 49 |
$this->connected(); |
| 50 |
// Set controller internal parameters. |
| 51 |
$_REQUEST['view'] = 'installer/install'; |
| 52 |
// create controller. |
| 53 |
return $this->route() |
| 54 |
// Set Action |
| 55 |
->setAction('install'); |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* put your comment there... |
| 61 |
* |
| 62 |
*/ |
| 63 |
public function notInstalledAdminNotice() { |
| 64 |
// Show Not installed admin notice only |
| 65 |
// if there is no access point processed/connected the request |
| 66 |
if (!$this->stopNotices) { |
| 67 |
// Set MVC request parameters. |
| 68 |
$_REQUEST['view'] = 'installer/notice'; |
| 69 |
// Instantiate installer cotroller and fire notice action! |
| 70 |
$this->route() |
| 71 |
// Set action name. |
| 72 |
->setAction('notInstalledNotice') |
| 73 |
// Fire action! |
| 74 |
->_doAction(); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* put your comment there... |
| 80 |
* |
| 81 |
*/ |
| 82 |
public function stopNotices() { |
| 83 |
// Do not show admin notcies! |
| 84 |
$this->stopNotices = true; |
| 85 |
} |
| 86 |
|
| 87 |
} // End class. |
| 88 |
|
| 89 |
// Hookable! |
| 90 |
CJTInstallerAccessPoint::define('CJTInstallerAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER)); |