| @@ -27,21 +27,27 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | class Visualizer_Plugin { |
| 29 | 29 | |
| 30 | 30 | const NAME = 'visualizer'; |
| 31 | - const VERSION = '3.0.9'; | |
| 31 | + const VERSION = '4.0.8'; | |
| 32 | 32 | |
| 33 | 33 | // custom post types |
| 34 | 34 | const CPT_VISUALIZER = 'visualizer'; |
| 35 | 35 | |
| 36 | 36 | // custom meta fields |
| 37 | + const CF_CHART_IMAGE = 'visualizer-chart-image'; | |
| 37 | 38 | const CF_CHART_TYPE = 'visualizer-chart-type'; |
| 38 | 39 | const CF_SOURCE = 'visualizer-source'; |
| 39 | 40 | const CF_SERIES = 'visualizer-series'; |
| 40 | 41 | const CF_DEFAULT_DATA = 'visualizer-default-data'; |
| 41 | 42 | const CF_SETTINGS = 'visualizer-settings'; |
| 43 | + const CF_CHART_LIBRARY = 'visualizer-chart-library'; | |
| 44 | + const CF_ERROR = 'visualizer-error'; | |
| 45 | + const CF_REMOTE_DB_PARAMS = 'visualizer-remote-db-params'; | |
| 42 | 46 | |
| 43 | 47 | const CF_SOURCE_FILTER = 'visualizer-source-filter'; |
| 48 | + const CF_FILTER_CONFIG = 'visualizer-filter-config'; | |
| 49 | + const CF_EDITABLE_TABLE = 'visualizer-editable-table'; | |
| 44 | 50 | |
| 45 | 51 | // custom actions |
| 46 | 52 | const ACTION_GET_CHARTS = 'visualizer-get-charts'; |
| 47 | 53 | const ACTION_CREATE_CHART = 'visualizer-create-chart'; |
| @@ -48,16 +54,36 @@ | ||
| 48 | 54 | const ACTION_EDIT_CHART = 'visualizer-edit-chart'; |
| 49 | 55 | const ACTION_CLONE_CHART = 'visualizer-clone-chart'; |
| 50 | 56 | const ACTION_DELETE_CHART = 'visualizer-delete-chart'; |
| 51 | 57 | const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; |
| 52 | - // Added by Ash/Upwork | |
| 53 | 58 | const ACTION_EXPORT_DATA = 'visualizer-export-data'; |
| 54 | 59 | |
| 60 | + const STORE_URL = 'https://store.themeisle.com/'; | |
| 61 | + | |
| 55 | 62 | /** |
| 56 | 63 | *Action used for fetching specific users/roles for permissions. |
| 57 | 64 | */ |
| 58 | 65 | const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data'; |
| 59 | 66 | |
| 67 | + /** | |
| 68 | + *Action used for fetching db import data. | |
| 69 | + */ | |
| 70 | + const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data'; | |
| 71 | + const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query'; | |
| 72 | + | |
| 73 | + const ACTION_JSON_GET_ROOTS = 'visualizer-json-get-roots'; | |
| 74 | + const ACTION_JSON_GET_DATA = 'visualizer-json-get-data'; | |
| 75 | + const ACTION_JSON_SET_DATA = 'visualizer-json-set-data'; | |
| 76 | + const ACTION_JSON_SET_SCHEDULE = 'visualizer-json-set-schedule'; | |
| 77 | + const CF_JSON_URL = 'visualizer-json-url'; | |
| 78 | + const CF_JSON_ROOT = 'visualizer-json-root'; | |
| 79 | + const CF_JSON_SCHEDULE = 'visualizer-json-schedule'; | |
| 80 | + const CF_JSON_PAGING = 'visualizer-json-paging'; | |
| 81 | + const CF_JSON_HEADERS = 'visualizer-json-headers'; | |
| 82 | + const CF_EDITOR = 'visualizer-editor'; | |
| 83 | + | |
| 84 | + const ACTION_SAVE_FILTER_QUERY = 'visualizer-save-filter-query'; | |
| 85 | + | |
| 60 | 86 | // custom filters |
| 61 | 87 | const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; |
| 62 | 88 | const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; |
| 63 | 89 | const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; |
| @@ -63,14 +89,30 @@ | ||
| 63 | 89 | const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; |
| 64 | 90 | const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; |
| 65 | 91 | const FILTER_UNDO_REVISIONS = 'visualizer-undo-revisions'; |
| 66 | 92 | const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions'; |
| 93 | + const FILTER_GET_CHART_DATA_AS = 'visualizer-get-chart-data-as'; | |
| 94 | + const FILTER_HANDLE_CACHE_EXPIRATION_TIME = 'visualizer-handle-expiration-time'; | |
| 95 | + const FILTER_CHART_TITLE = 'the_title'; | |
| 67 | 96 | |
| 97 | + const CF_DB_SCHEDULE = 'visualizer-db-schedule'; | |
| 98 | + const CF_DB_QUERY = 'visualizer-db-query'; | |
| 99 | + | |
| 68 | 100 | const CF_CHART_URL = 'visualizer-chart-url'; |
| 69 | 101 | const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; |
| 70 | 102 | // Added by Ash/Upwork |
| 71 | - const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 103 | + const PRO_TEASER_URL = 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/'; | |
| 72 | 104 | const PRO_TEASER_TITLE = 'Check PRO version '; |
| 105 | + | |
| 106 | + const CF_CHART_CACHE = 'visualizer-chart-cache'; | |
| 107 | + const CF_JSON_WOOCOMMERCE_SOURCE = 'visualizer-woocommerce-source'; | |
| 108 | + const CF_IS_WOOCOMMERCE_SOURCE = 'visualizer-is-woocommerce-source'; | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Name of the option for WordPress DB. | |
| 112 | + */ | |
| 113 | + const WP_DB_NAME = 'WordPress DB'; | |
| 114 | + | |
| 73 | 115 | // Added by Ash/Upwork |
| 74 | 116 | /** |
| 75 | 117 | * Singletone instance of the plugin. |
| 76 | 118 | * |
| @@ -91,8 +133,15 @@ | ||
| 91 | 133 | */ |
| 92 | 134 | private $_modules = array(); |
| 93 | 135 | |
| 94 | 136 | /** |
| 137 | + * Returns the date queries supported in the library date filter. | |
| 138 | + */ | |
| 139 | + public static function getSupportedDateFilter() { | |
| 140 | + return apply_filters( 'visualizer_filter_by_date', array( '' => __( 'All dates', 'visualizer' ), 'yesterday' => __( 'Yesterday', 'visualizer' ), 'last week' => __( 'Last Week', 'visualizer' ), 'last month' => __( 'Last Month', 'visualizer' ), 'last year' => __( 'Last Year', 'visualizer' ) ) ); | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 95 | 144 | * Private constructor. |
| 96 | 145 | * |
| 97 | 146 | * @since 1.0.0 |
| 98 | 147 | * |
| @@ -172,12 +221,12 @@ | ||
| 172 | 221 | * @since 1.0.0 |
| 173 | 222 | * |
| 174 | 223 | * @access public |
| 175 | 224 | * |
| 176 | - * @param string $class The name of the module to use in the plugin. | |
| 225 | + * @param string $class_name The name of the module to use in the plugin. | |
| 177 | 226 | */ |
| 178 | - public function setModule( $class ) { | |
| 179 | - $this->_modules[ $class ] = new $class( $this ); | |
| 227 | + public function setModule( $class_name ) { | |
| 228 | + $this->_modules[ $class_name ] = new $class_name( $this ); | |
| 180 | 229 | } |
| 181 | 230 | |
| 182 | 231 | /** |
| 183 | 232 | * Private clone method. |
| @@ -191,12 +240,11 @@ | ||
| 191 | 240 | |
| 192 | 241 | /** |
| 193 | 242 | * For local testing, overrides the 'themeisle_log_event' hook and redirects to error.log. |
| 194 | 243 | */ |
| 195 | - final function themeisle_log_event_debug( $name, $message, $type, $file, $line ) { | |
| 244 | + final public function themeisle_log_event_debug( $name, $message, $type, $file, $line ) { | |
| 196 | 245 | if ( Visualizer_Plugin::NAME !== $name ) { |
| 197 | 246 | return; |
| 198 | 247 | } |
| 199 | 248 | error_log( sprintf( '%s (%s): %s in %s:%s', $name, $type, $message, $file, $line ) ); |
| 200 | 249 | } |
| 201 | - | |
| 202 | 250 | } |