| @@ -27,21 +27,27 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | class Visualizer_Plugin { |
| 29 | 29 | |
| 30 | 30 | const NAME = 'visualizer'; |
| 31 | - const VERSION = '3.0.6'; | |
| 31 | + const VERSION = '3.7.12'; | |
| 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,9 +54,8 @@ | ||
| 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 | |
| 55 | 60 | /** |
| 56 | 61 | *Action used for fetching specific users/roles for permissions. |
| @@ -56,19 +61,54 @@ | ||
| 56 | 61 | *Action used for fetching specific users/roles for permissions. |
| 57 | 62 | */ |
| 58 | 63 | const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data'; |
| 59 | 64 | |
| 65 | + /** | |
| 66 | + *Action used for fetching db import data. | |
| 67 | + */ | |
| 68 | + const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data'; | |
| 69 | + const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query'; | |
| 70 | + | |
| 71 | + const ACTION_JSON_GET_ROOTS = 'visualizer-json-get-roots'; | |
| 72 | + const ACTION_JSON_GET_DATA = 'visualizer-json-get-data'; | |
| 73 | + const ACTION_JSON_SET_DATA = 'visualizer-json-set-data'; | |
| 74 | + const ACTION_JSON_SET_SCHEDULE = 'visualizer-json-set-schedule'; | |
| 75 | + const CF_JSON_URL = 'visualizer-json-url'; | |
| 76 | + const CF_JSON_ROOT = 'visualizer-json-root'; | |
| 77 | + const CF_JSON_SCHEDULE = 'visualizer-json-schedule'; | |
| 78 | + const CF_JSON_PAGING = 'visualizer-json-paging'; | |
| 79 | + const CF_JSON_HEADERS = 'visualizer-json-headers'; | |
| 80 | + const CF_EDITOR = 'visualizer-editor'; | |
| 81 | + | |
| 82 | + const ACTION_SAVE_FILTER_QUERY = 'visualizer-save-filter-query'; | |
| 83 | + | |
| 60 | 84 | // custom filters |
| 61 | 85 | const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; |
| 62 | 86 | const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; |
| 63 | 87 | const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; |
| 64 | 88 | const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; |
| 89 | + const FILTER_UNDO_REVISIONS = 'visualizer-undo-revisions'; | |
| 90 | + const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions'; | |
| 91 | + const FILTER_GET_CHART_DATA_AS = 'visualizer-get-chart-data-as'; | |
| 92 | + const FILTER_HANDLE_CACHE_EXPIRATION_TIME = 'visualizer-handle-expiration-time'; | |
| 93 | + const FILTER_CHART_TITLE = 'the_title'; | |
| 65 | 94 | |
| 95 | + const CF_DB_SCHEDULE = 'visualizer-db-schedule'; | |
| 96 | + const CF_DB_QUERY = 'visualizer-db-query'; | |
| 97 | + | |
| 66 | 98 | const CF_CHART_URL = 'visualizer-chart-url'; |
| 67 | 99 | const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; |
| 68 | 100 | // Added by Ash/Upwork |
| 69 | - const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 101 | + const PRO_TEASER_URL = 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/#pricing'; | |
| 70 | 102 | const PRO_TEASER_TITLE = 'Check PRO version '; |
| 103 | + | |
| 104 | + const CF_CHART_CACHE = 'visualizer-chart-cache'; | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Name of the option for WordPress DB. | |
| 108 | + */ | |
| 109 | + const WP_DB_NAME = 'WordPress DB'; | |
| 110 | + | |
| 71 | 111 | // Added by Ash/Upwork |
| 72 | 112 | /** |
| 73 | 113 | * Singletone instance of the plugin. |
| 74 | 114 | * |
| @@ -89,8 +129,15 @@ | ||
| 89 | 129 | */ |
| 90 | 130 | private $_modules = array(); |
| 91 | 131 | |
| 92 | 132 | /** |
| 133 | + * Returns the date queries supported in the library date filter. | |
| 134 | + */ | |
| 135 | + public static function getSupportedDateFilter() { | |
| 136 | + 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' ) ) ); | |
| 137 | + } | |
| 138 | + | |
| 139 | + /** | |
| 93 | 140 | * Private constructor. |
| 94 | 141 | * |
| 95 | 142 | * @since 1.0.0 |
| 96 | 143 | * |
| @@ -96,8 +143,11 @@ | ||
| 96 | 143 | * |
| 97 | 144 | * @access private |
| 98 | 145 | */ |
| 99 | 146 | private function __construct() { |
| 147 | + if ( VISUALIZER_DEBUG ) { | |
| 148 | + add_action( 'themeisle_log_event', array( $this, 'themeisle_log_event_debug' ), 10, 5 ); | |
| 149 | + } | |
| 100 | 150 | } |
| 101 | 151 | |
| 102 | 152 | /** |
| 103 | 153 | * Returns singletone instance of the plugin. |
| @@ -181,7 +231,17 @@ | ||
| 181 | 231 | * |
| 182 | 232 | * @access private |
| 183 | 233 | */ |
| 184 | 234 | private function __clone() { |
| 235 | + } | |
| 236 | + | |
| 237 | + /** | |
| 238 | + * For local testing, overrides the 'themeisle_log_event' hook and redirects to error.log. | |
| 239 | + */ | |
| 240 | + final function themeisle_log_event_debug( $name, $message, $type, $file, $line ) { | |
| 241 | + if ( Visualizer_Plugin::NAME !== $name ) { | |
| 242 | + return; | |
| 243 | + } | |
| 244 | + error_log( sprintf( '%s (%s): %s in %s:%s', $name, $type, $message, $file, $line ) ); | |
| 185 | 245 | } |
| 186 | 246 | |
| 187 | 247 | } |