| @@ -1,74 +1,74 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | -* | |
| 3 | +* | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | -* | |
| 7 | +* | |
| 8 | 8 | */ |
| 9 | 9 | class CJT_Framework_Extensions_Package_State_Extension { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | */ |
| 14 | 14 | const INSTALLED = 3; |
| 15 | - | |
| 15 | + | |
| 16 | 16 | /** |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | */ |
| 19 | 19 | const NOT_INSTALLED = 1; |
| 20 | - | |
| 20 | + | |
| 21 | 21 | /** |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | */ |
| 24 | 24 | const UPGRADE = 2; |
| 25 | - | |
| 25 | + | |
| 26 | 26 | /** |
| 27 | 27 | * put your comment there... |
| 28 | - * | |
| 28 | + * | |
| 29 | 29 | * @var mixed |
| 30 | 30 | */ |
| 31 | 31 | protected $data; |
| 32 | - | |
| 32 | + | |
| 33 | 33 | /** |
| 34 | 34 | * put your comment there... |
| 35 | - * | |
| 35 | + * | |
| 36 | 36 | * @var mixed |
| 37 | 37 | */ |
| 38 | 38 | protected $dbOptionName; |
| 39 | - | |
| 39 | + | |
| 40 | 40 | /** |
| 41 | 41 | * put your comment there... |
| 42 | - * | |
| 42 | + * | |
| 43 | 43 | * @var mixed |
| 44 | 44 | */ |
| 45 | 45 | protected $extDefDoc; |
| 46 | - | |
| 46 | + | |
| 47 | 47 | /** |
| 48 | 48 | * put your comment there... |
| 49 | - * | |
| 49 | + * | |
| 50 | 50 | * @var mixed |
| 51 | 51 | */ |
| 52 | 52 | protected $name; |
| 53 | - | |
| 53 | + | |
| 54 | 54 | /** |
| 55 | 55 | * put your comment there... |
| 56 | - * | |
| 56 | + * | |
| 57 | 57 | * @var mixed |
| 58 | 58 | */ |
| 59 | 59 | protected $newVersion; |
| 60 | - | |
| 60 | + | |
| 61 | 61 | /** |
| 62 | 62 | * put your comment there... |
| 63 | - * | |
| 63 | + * | |
| 64 | 64 | * @var mixed |
| 65 | 65 | */ |
| 66 | 66 | protected $state; |
| 67 | - | |
| 67 | + | |
| 68 | 68 | /** |
| 69 | 69 | * put your comment there... |
| 70 | - * | |
| 70 | + * | |
| 71 | 71 | * @param mixed $name |
| 72 | 72 | * @return CJT_Framework_Extensions_Package_InfoStructure |
| 73 | 73 | */ |
| 74 | 74 | public function __construct(SimpleXMLElement & $extDeDoc) { |
| @@ -85,9 +85,9 @@ | ||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * put your comment there... |
| 89 | - * | |
| 89 | + * | |
| 90 | 90 | * @param mixed $extensionClass |
| 91 | 91 | */ |
| 92 | 92 | public static function create($extensionClass) { |
| 93 | 93 | # Option name |
| @@ -94,9 +94,9 @@ | ||
| 94 | 94 | $dbOptionName = self::getDbOptionName($extensionClass); |
| 95 | 95 | # Reading cached state |
| 96 | 96 | $state = get_option($dbOptionName); |
| 97 | 97 | # Getting extension defFile |
| 98 | - $defFile = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $state['defFile']; | |
| 98 | + $defFile = ABSPATH . PLUGINDIR . DIRECTORY_SEPARATOR . $state['defFile']; | |
| 99 | 99 | $deDoc = new SimpleXMLElement(file_get_contents($defFile)); |
| 100 | 100 | # Returns new instance |
| 101 | 101 | return new CJT_Framework_Extensions_Package_State_Extension($deDoc); |
| 102 | 102 | } |
| @@ -102,9 +102,9 @@ | ||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * put your comment there... |
| 106 | - * | |
| 106 | + * | |
| 107 | 107 | */ |
| 108 | 108 | public function clearInstallInfo() { |
| 109 | 109 | return delete_option($this->dbOptionName); |
| 110 | 110 | } |
| @@ -110,9 +110,9 @@ | ||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * put your comment there... |
| 114 | - * | |
| 114 | + * | |
| 115 | 115 | * @param mixed $name |
| 116 | 116 | */ |
| 117 | 117 | protected function getDBVar($name) { |
| 118 | 118 | return isset($this->data[$name]) ? $this->data[$name] : null; |
| @@ -119,9 +119,9 @@ | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * put your comment there... |
| 123 | - * | |
| 123 | + * | |
| 124 | 124 | * @param mixed $extensionClass |
| 125 | 125 | */ |
| 126 | 126 | protected static function getDbOptionName($extensionClass) { |
| 127 | 127 | return "{$extensionClass}.state"; |
| @@ -128,25 +128,25 @@ | ||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * put your comment there... |
| 132 | - * | |
| 132 | + * | |
| 133 | 133 | */ |
| 134 | 134 | public function & getExtensionDeDoc() { |
| 135 | 135 | return $this->extDefDoc; |
| 136 | 136 | } |
| 137 | - | |
| 137 | + | |
| 138 | 138 | /** |
| 139 | 139 | * put your comment there... |
| 140 | - * | |
| 140 | + * | |
| 141 | 141 | */ |
| 142 | 142 | protected function getInstalledVersion() { |
| 143 | 143 | return $this->getDBVar('version'); |
| 144 | 144 | } |
| 145 | - | |
| 145 | + | |
| 146 | 146 | /** |
| 147 | 147 | * put your comment there... |
| 148 | - * | |
| 148 | + * | |
| 149 | 149 | */ |
| 150 | 150 | public function getState() { |
| 151 | 151 | # Initialize |
| 152 | 152 | $deDoc =& $this->getExtensionDeDoc(); |
| @@ -175,9 +175,9 @@ | ||
| 175 | 175 | return !empty($state); |
| 176 | 176 | } |
| 177 | 177 | /** |
| 178 | 178 | * put your comment there... |
| 179 | - * | |
| 179 | + * | |
| 180 | 180 | * @param mixed $pluginFile |
| 181 | 181 | * @return bool |
| 182 | 182 | */ |
| 183 | 183 | public function upgrade($defFile) { |