| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* Enable automatic upgrades CJT Plugin |
| 11 |
* and all its installed extensions! |
| 12 |
* |
| 13 |
* Special type of access point that will do the job and |
| 14 |
* then it'll unload itself! |
| 15 |
* |
| 16 |
* @author Ahmed Hamed |
| 17 |
*/ |
| 18 |
class CJTAutoUpgradeAccessPoint extends CJTAccessPoint { |
| 19 |
|
| 20 |
/** |
| 21 |
* put your comment there... |
| 22 |
* |
| 23 |
*/ |
| 24 |
public function __construct() { |
| 25 |
// Initialize Access Point base! |
| 26 |
parent::__construct(); |
| 27 |
// Set access point name! |
| 28 |
$this->name = 'auto-upgrade'; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* put your comment there... |
| 33 |
* |
| 34 |
*/ |
| 35 |
protected function doListen() { |
| 36 |
// Only if permitted! |
| 37 |
if ($this->hasAccess()) { |
| 38 |
add_action('admin_init', array(&$this, 'route'), 10, 0); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* This access point is to do internal jobs without |
| 44 |
* taking the place of the activate controller that requested |
| 45 |
* by client! |
| 46 |
* |
| 47 |
* @return Boolean false |
| 48 |
*/ |
| 49 |
public function connected() { |
| 50 |
throw new Exception('I\'ll never be the connected object!'); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* put your comment there... |
| 55 |
* |
| 56 |
*/ |
| 57 |
public function route($loadView = false, $request = null) { |
| 58 |
// Load Auto Upgrade controller! |
| 59 |
$this->controllerName = 'auto-upgrade'; |
| 60 |
parent::route($loadView, $request) |
| 61 |
// Set action name to autoUpgrade |
| 62 |
->setAction('enable') |
| 63 |
// fire action to enable automatic upgrade! |
| 64 |
->_doAction(); |
| 65 |
} |
| 66 |
|
| 67 |
} // End class. |
| 68 |
|
| 69 |
// Hookable! |
| 70 |
CJTAutoUpgradeAccessPoint::define('CJTAutoUpgradeAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER)); |