Abstract.php
9 years ago
Capability.php
9 years ago
Contact.php
9 years ago
Extension.php
9 years ago
LoginRedirect.php
9 years ago
Menu.php
9 years ago
Metabox.php
9 years ago
Post.php
9 years ago
Redirect.php
9 years ago
Role.php
9 years ago
Security.php
9 years ago
Teaser.php
9 years ago
User.php
9 years ago
Utility.php
9 years ago
Abstract.php
88 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * ====================================================================== |
| 5 | * LICENSE: This file is subject to the terms and conditions defined in * |
| 6 | * file 'license.txt', which is part of this source code package. * |
| 7 | * ====================================================================== |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Backend feature abstract |
| 12 | * |
| 13 | * @package AAM |
| 14 | * @author Vasyl Martyniuk <vasyl@vasyltech.com> |
| 15 | */ |
| 16 | abstract class AAM_Backend_Feature_Abstract { |
| 17 | |
| 18 | /** |
| 19 | * Constructor |
| 20 | * |
| 21 | * @return void |
| 22 | * |
| 23 | * @access public |
| 24 | * @throws Exception |
| 25 | */ |
| 26 | public function __construct() { |
| 27 | if (is_admin()) { |
| 28 | $cap = AAM_Core_Config::get($this->getAccessOption(), 'administrator'); |
| 29 | if (!AAM::getUser()->hasCapability($cap)) { |
| 30 | wp_die(__('Access Denied', AAM_KEY)); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Get HTML content |
| 37 | * |
| 38 | * @return string |
| 39 | * |
| 40 | * @access public |
| 41 | */ |
| 42 | public function getContent() { |
| 43 | ob_start(); |
| 44 | require_once(dirname(__FILE__) . '/../phtml/' . $this->getTemplate()); |
| 45 | $content = ob_get_contents(); |
| 46 | ob_end_clean(); |
| 47 | |
| 48 | return $content; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Get access option |
| 53 | * |
| 54 | * This function exists only to support implementation for PHP 5.2 cause later |
| 55 | * static binding has been introduced only in PHP 5.3.0 |
| 56 | * |
| 57 | * @return string |
| 58 | * |
| 59 | * @access public |
| 60 | */ |
| 61 | public static function getAccessOption() { |
| 62 | return ''; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Get template filename |
| 67 | * |
| 68 | * This function exists only to support implementation for PHP 5.2 cause later |
| 69 | * static binding has been introduced only in PHP 5.3.0 |
| 70 | * |
| 71 | * @return string |
| 72 | * |
| 73 | * @access public |
| 74 | */ |
| 75 | public static function getTemplate() { |
| 76 | return ''; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Register feature |
| 81 | * |
| 82 | * @return void |
| 83 | * |
| 84 | * @access public |
| 85 | */ |
| 86 | public static function register() { } |
| 87 | |
| 88 | } |