| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | // +----------------------------------------------------------------------+ |
| 4 | 3 | // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) | |
| 5 | 4 | // +----------------------------------------------------------------------+ |
| 6 | 5 | // | This program is free software; you can redistribute it and/or modify | |
| @@ -27,40 +26,43 @@ | ||
| 27 | 26 | * @since 1.0.0 |
| 28 | 27 | */ |
| 29 | 28 | class Visualizer_Plugin { |
| 30 | 29 | |
| 31 | - const NAME = 'visualizer'; | |
| 32 | - const VERSION = '1.7.6'; | |
| 30 | + const NAME = 'visualizer'; | |
| 31 | + const VERSION = '2.0.0'; | |
| 33 | 32 | |
| 34 | 33 | // custom post types |
| 35 | 34 | const CPT_VISUALIZER = 'visualizer'; |
| 36 | 35 | |
| 37 | 36 | // custom meta fields |
| 38 | - const CF_CHART_TYPE = 'visualizer-chart-type'; | |
| 39 | - const CF_SOURCE = 'visualizer-source'; | |
| 40 | - const CF_SERIES = 'visualizer-series'; | |
| 37 | + const CF_CHART_TYPE = 'visualizer-chart-type'; | |
| 38 | + const CF_SOURCE = 'visualizer-source'; | |
| 39 | + const CF_SERIES = 'visualizer-series'; | |
| 41 | 40 | const CF_DEFAULT_DATA = 'visualizer-default-data'; |
| 42 | - const CF_SETTINGS = 'visualizer-settings'; | |
| 41 | + const CF_SETTINGS = 'visualizer-settings'; | |
| 43 | 42 | |
| 44 | 43 | // custom actions |
| 45 | - const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 44 | + const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 45 | + const ACTION_TRACK = 'visualizer-track'; | |
| 46 | 46 | const ACTION_CREATE_CHART = 'visualizer-create-chart'; |
| 47 | - const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 48 | - const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 47 | + const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 48 | + const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 49 | 49 | const ACTION_DELETE_CHART = 'visualizer-delete-chart'; |
| 50 | - const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 50 | + const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 51 | 51 | // Added by Ash/Upwork |
| 52 | - const ACTION_EXPORT_DATA = 'visualizer-export-data'; | |
| 52 | + const ACTION_EXPORT_DATA = 'visualizer-export-data'; | |
| 53 | 53 | |
| 54 | 54 | // custom filters |
| 55 | 55 | const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; |
| 56 | - const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; | |
| 57 | - const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; | |
| 58 | - const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; | |
| 56 | + const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; | |
| 57 | + const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; | |
| 58 | + const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; | |
| 59 | 59 | |
| 60 | + const CF_CHART_URL = 'visualizer-chart-url'; | |
| 61 | + const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; | |
| 60 | 62 | // Added by Ash/Upwork |
| 61 | - const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 62 | - const PRO_TEASER_TITLE = 'Check PRO version '; | |
| 63 | + const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 64 | + const PRO_TEASER_TITLE = 'Check PRO version '; | |
| 63 | 65 | // Added by Ash/Upwork |
| 64 | 66 | /** |
| 65 | 67 | * Singletone instance of the plugin. |
| 66 | 68 | * |
| @@ -87,20 +89,12 @@ | ||
| 87 | 89 | * @since 1.0.0 |
| 88 | 90 | * |
| 89 | 91 | * @access private |
| 90 | 92 | */ |
| 91 | - private function __construct() {} | |
| 93 | + private function __construct() { | |
| 94 | + } | |
| 92 | 95 | |
| 93 | 96 | /** |
| 94 | - * Private clone method. | |
| 95 | - * | |
| 96 | - * @since 1.0.0 | |
| 97 | - * | |
| 98 | - * @access private | |
| 99 | - */ | |
| 100 | - private function __clone() {} | |
| 101 | - | |
| 102 | - /** | |
| 103 | 97 | * Returns singletone instance of the plugin. |
| 104 | 98 | * |
| 105 | 99 | * @since 1.0.0 |
| 106 | 100 | * |
| @@ -116,14 +110,31 @@ | ||
| 116 | 110 | return self::$_instance; |
| 117 | 111 | } |
| 118 | 112 | |
| 119 | 113 | /** |
| 114 | + * Returns chart types. | |
| 115 | + * | |
| 116 | + * @since 1.0.0 | |
| 117 | + * | |
| 118 | + * @static | |
| 119 | + * @access public | |
| 120 | + * @return array | |
| 121 | + */ | |
| 122 | + public static function getChartTypes() { | |
| 123 | + $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() ); | |
| 124 | + | |
| 125 | + return $array; | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 120 | 129 | * Returns a module if it was registered before. Otherwise NULL. |
| 121 | 130 | * |
| 122 | 131 | * @since 1.0.0 |
| 123 | 132 | * |
| 124 | 133 | * @access public |
| 134 | + * | |
| 125 | 135 | * @param string $name The name of the module to return. |
| 136 | + * | |
| 126 | 137 | * @return Visualizer_Module|null Returns a module if it was registered or NULL. |
| 127 | 138 | */ |
| 128 | 139 | public function getModule( $name ) { |
| 129 | 140 | return isset( $this->_modules[ $name ] ) ? $this->_modules[ $name ] : null; |
| @@ -134,9 +145,11 @@ | ||
| 134 | 145 | * |
| 135 | 146 | * @since 1.0.0 |
| 136 | 147 | * |
| 137 | 148 | * @access public |
| 149 | + * | |
| 138 | 150 | * @param string $name The name of a module to check. |
| 151 | + * | |
| 139 | 152 | * @return boolean TRUE if the module has been registered. Otherwise FALSE. |
| 140 | 153 | */ |
| 141 | 154 | public function hasModule( $name ) { |
| 142 | 155 | return isset( $this->_modules[ $name ] ); |
| @@ -147,8 +160,9 @@ | ||
| 147 | 160 | * |
| 148 | 161 | * @since 1.0.0 |
| 149 | 162 | * |
| 150 | 163 | * @access public |
| 164 | + * | |
| 151 | 165 | * @param string $class The name of the module to use in the plugin. |
| 152 | 166 | */ |
| 153 | 167 | public function setModule( $class ) { |
| 154 | 168 | $this->_modules[ $class ] = new $class( $this ); |
| @@ -154,18 +168,14 @@ | ||
| 154 | 168 | $this->_modules[ $class ] = new $class( $this ); |
| 155 | 169 | } |
| 156 | 170 | |
| 157 | 171 | /** |
| 158 | - * Returns chart types. | |
| 172 | + * Private clone method. | |
| 159 | 173 | * |
| 160 | 174 | * @since 1.0.0 |
| 161 | 175 | * |
| 162 | - * @static | |
| 163 | - * @access public | |
| 164 | - * @return array | |
| 176 | + * @access private | |
| 165 | 177 | */ |
| 166 | - public static function getChartTypes() { | |
| 167 | - $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() ); | |
| 168 | - return $array; | |
| 178 | + private function __clone() { | |
| 169 | 179 | } |
| 170 | 180 | |
| 171 | 181 | } |