PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-hooks.php +114 -1134 5.0.3.2 → 4.1 View file →
@@ -6,10 +6,8 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 -// phpcs:disable Generic.Metrics.CyclomaticComplexity -- complexity.
11 -
12 10 /**
13 11 * Class MainWP_Hooks
14 12 *
15 13 * @package MainWP\Dashboard
@@ -21,13 +19,8 @@
21 19 *
22 20 * Initialize MainWP_Hooks actions/filters upon creation of the object.
23 21 *
24 22 * @deprecated 4.0.7. Hook deprecation - Please use filter `mainwp_get_error_message` instead of `mainwp_getErrorMessage`.
25 - *
26 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_class_name()
27 - * @uses \MainWP\Dashboard\MainWP_UI::get_class_name()
28 - * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_class_name()
29 - * @uses \MainWP\Dashboard\MainWP_Install_Bulk::get_class_name()
30 23 */
31 24 public function __construct() {
32 25 add_filter( 'mainwp_getspecificdir', array( MainWP_System_Utility::get_class_name(), 'get_mainwp_specific_dir' ), 10, 1 );
33 26 add_filter( 'mainwp_getmainwpdir', array( &$this, 'hook_get_mainwp_dir' ), 10, 3 );
@@ -32,10 +25,9 @@
32 25 add_filter( 'mainwp_getspecificdir', array( MainWP_System_Utility::get_class_name(), 'get_mainwp_specific_dir' ), 10, 1 );
33 26 add_filter( 'mainwp_getmainwpdir', array( &$this, 'hook_get_mainwp_dir' ), 10, 3 );
34 27 add_filter( 'mainwp_is_multi_user', array( &$this, 'is_multi_user' ) );
35 28 add_filter( 'mainwp_qq2fileuploader', array( &$this, 'filter_qq2_file_uploader' ), 10, 2 );
36 - add_action( 'mainwp_select_sites_box', array( &$this, 'hook_select_sites_box' ), 10, 12 );
37 - add_action( 'mainwp_add_categories_box', array( &$this, 'hook_add_categories_box' ), 10, 1 );
29 + add_action( 'mainwp_select_sites_box', array( &$this, 'select_sites_box' ), 10, 8 );
38 30 add_action( 'mainwp_prepareinstallplugintheme', array( MainWP_Install_Bulk::get_class_name(), 'prepare_install' ) );
39 31 add_action( 'mainwp_performinstallplugintheme', array( MainWP_Install_Bulk::get_class_name(), 'perform_install' ) );
40 32 add_filter( 'mainwp_getwpfilesystem', array( MainWP_System_Utility::get_class_name(), 'get_wp_file_system' ) );
41 33 add_filter( 'mainwp_getspecificurl', array( MainWP_System_Utility::get_class_name(), 'get_mainwp_specific_url' ), 10, 1 );
@@ -43,41 +35,17 @@
43 35 add_action( 'mainwp_renderHeader', array( MainWP_UI::get_class_name(), 'render_header' ), 10, 2 );
44 36 add_action( 'mainwp_renderFooter', array( MainWP_UI::get_class_name(), 'render_footer' ), 10, 0 );
45 37
46 38 add_action( 'mainwp_notify_user', array( &$this, 'hook_notify_user' ), 10, 3 );
47 - add_filter( 'mainwp_is_mainwp_page', array( MainWP_System::class, 'is_mainwp_pages' ) );
48 -
49 - /**
50 - * The actions has been deprecated.
51 - *
52 - * @deprecated 4.3 Please use actions: mainwp_action_activeplugin, mainwp_action_deactiveplugin ....
53 - */
54 39 add_action( 'mainwp_activePlugin', array( &$this, 'active_plugin' ), 10, 0 );
55 40 add_action( 'mainwp_deactivePlugin', array( &$this, 'deactive_plugin' ), 10, 0 );
56 41 add_action( 'mainwp_upgradePluginTheme', array( &$this, 'upgrade_plugin_theme' ), 10, 0 );
57 42 add_action( 'mainwp_deletePlugin', array( &$this, 'delete_plugin' ), 10, 0 );
58 43 add_action( 'mainwp_deleteTheme', array( &$this, 'delete_theme' ), 10, 0 );
59 - // End.
60 44
61 - /**
62 - * Plugins/themes/core actions.
63 - *
64 - * @since 4.3
65 - */
66 - add_action( 'mainwp_action_activeplugin', array( &$this, 'active_plugin' ), 10, 0 );
67 - add_action( 'mainwp_action_deactiveplugin', array( &$this, 'deactive_plugin' ), 10, 0 );
68 - add_action( 'mainwp_action_upgradeplugintheme', array( &$this, 'upgrade_plugin_theme' ), 10, 0 );
69 - add_action( 'mainwp_action_deleteplugin', array( &$this, 'delete_plugin' ), 10, 0 );
70 - add_action( 'mainwp_action_deletetheme', array( &$this, 'delete_theme' ), 10, 0 );
71 - add_action( 'mainwp_upgrade_wp', array( &$this, 'upgrade_wp' ), 10, 0 );
72 - // End.
73 -
74 - add_filter( 'mainwp_get_user_extension', array( &$this, 'hook_get_user_extension' ), 10, 2 );
75 - add_filter( 'mainwp_update_user_extension', array( &$this, 'update_user_extension' ), 10, 3 );
45 + add_filter( 'mainwp_get_user_extension', array( &$this, 'get_user_extension' ) );
76 46 add_filter( 'mainwp_getwebsitesbyurl', array( &$this, 'get_websites_by_url' ) );
77 47 add_filter( 'mainwp_getWebsitesByUrl', array( &$this, 'get_websites_by_url' ) );
78 - add_action( 'mainwp_manage_posts_get_edit', array( &$this, 'hook_posts_get_edit' ), 10, 2 );
79 - add_action( 'mainwp_manage_posts_bulk_posting', array( &$this, 'hook_posts_bulk_posting' ), 10, 2 );
80 48
81 49 /**
82 50 * The mainwp_getErrorMessage filter has been deprecated.
83 51 *
@@ -94,24 +62,14 @@
94 62 add_action( 'mainwp_cache_add_context', array( &$this, 'cache_add_context' ), 10, 2 );
95 63 add_action( 'mainwp_cache_add_body', array( &$this, 'cache_add_body' ), 10, 2 );
96 64
97 65 add_filter( 'mainwp_get_metaboxes_post', array( &$this, 'get_metaboxes_post' ), 10, 0 );
98 - add_filter( 'mainwp_getnotificationemail', array( &$this, 'hook_notification_email' ), 10, 1 );
66 + add_filter( 'mainwp_getnotificationemail', array( MainWP_System_Utility::get_class_name(), 'get_notification_email' ), 10, 1 );
99 67 add_filter( 'mainwp_getformatemail', array( &$this, 'get_formated_email' ), 10, 3 );
100 68 add_filter( 'mainwp-extension-available-check', array( MainWP_Extensions_Handler::get_class_name(), 'is_extension_available' ) );
101 - add_filter( 'mainwp_extension_is_activated', array( &$this, 'is_extension_activated' ), 10, 2 );
102 - add_filter( 'mainwp_extension_is_pro_member', array( &$this, 'is_pro_member' ), 10, 1 );
103 -
104 - /**
105 - * Logging debug actions.
106 - */
107 - add_action( 'mainwp_log_debug', array( &$this, 'mainwp_log_debug' ), 10, 1 );
108 - add_action( 'mainwp_log_info', array( &$this, 'mainwp_log_info' ), 10, 1 );
109 - add_action( 'mainwp_log_warning', array( &$this, 'mainwp_log_warning' ), 10, 1 );
110 - add_action( 'mainwp_log_action', array( &$this, 'mainwp_log_action' ), 10, 4 );
111 - add_action( 'mainwp_log_execution_time', array( &$this, 'mainwp_log_execution_time' ), 10, 1 );
112 - // END.
113 -
69 + add_action( 'mainp_log_debug', array( &$this, 'mainwp_log_debug' ), 10, 1 );
70 + add_action( 'mainp_log_info', array( &$this, 'mainwp_log_info' ), 10, 1 );
71 + add_action( 'mainp_log_warning', array( &$this, 'mainwp_log_warning' ), 10, 1 );
114 72 add_filter( 'mainwp_getactivateextensionnotice', array( &$this, 'get_activate_extension_notice' ), 10, 1 );
115 73 add_action( 'mainwp_enqueue_meta_boxes_scripts', array( &$this, 'enqueue_meta_boxes_scripts' ), 10, 1 );
116 74 add_filter( 'mainwp_addsite', array( &$this, 'mainwp_add_site' ), 10, 1 );
117 75 add_filter( 'mainwp_deletesite', array( &$this, 'hook_delete_site' ), 10, 1 );
@@ -120,89 +78,16 @@
120 78 add_filter( 'mainwp_editsite', array( &$this, 'mainwp_edit_site' ), 10, 1 );
121 79 add_action( 'mainwp_add_sub_leftmenu', array( &$this, 'hook_add_sub_left_menu' ), 10, 6 );
122 80 add_filter( 'mainwp_getwebsiteoptions', array( &$this, 'hook_get_site_options' ), 10, 3 );
123 81 add_filter( 'mainwp_updatewebsiteoptions', array( &$this, 'hook_update_site_options' ), 10, 4 );
124 -
125 82 add_filter( 'mainwp_getwebsitesbyuserid', array( &$this, 'hook_get_websites_by_user_id' ), 10, 5 );
126 - add_filter( 'mainwp_getwebsite_by_id', array( &$this, 'hook_get_website_by_id' ), 10, 4 );
127 83
128 84 add_filter( 'mainwp_addgroup', array( MainWP_Extensions_Handler::get_class_name(), 'hook_add_group' ), 10, 3 );
129 85 add_filter( 'mainwp_getallposts', array( &$this, 'hook_get_all_posts' ), 10, 2 );
130 86 add_filter( 'mainwp_check_current_user_can', array( &$this, 'hook_current_user_can' ), 10, 3 );
131 87 add_filter( 'mainwp_escape_response_data', array( &$this, 'hook_escape_response' ), 10, 3 );
132 - add_filter( 'mainwp_escape_content', array( &$this, 'hook_escape_content' ), 10, 3 );
133 88
134 - add_filter( 'mainwp_db_query', array( &$this, 'hook_db_query' ), 10, 2 );
135 - add_filter( 'mainwp_db_fetch_object', array( &$this, 'db_fetch_object' ), 10, 2 );
136 - add_filter( 'mainwp_db_fetch_array', array( &$this, 'db_fetch_array' ), 10, 2 );
137 - add_action( 'mainwp_db_data_seek', array( &$this, 'hook_db_data_seek' ), 10, 2 );
138 - add_filter( 'mainwp_db_free_result', array( &$this, 'db_free_result' ), 10, 2 );
139 - add_filter( 'mainwp_db_num_rows', array( &$this, 'db_num_rows' ), 10, 2 );
140 - add_filter( 'mainwp_db_get_websites_for_current_user', array( &$this, 'db_get_websites_for_current_user' ), 10, 2 );
141 -
142 - // Sync website.
143 - add_filter( 'mainwp_sync_website', array( &$this, 'hook_sync_website' ), 10, 3 );
144 -
145 89 add_action( 'mainwp_secure_request', array( &$this, 'hook_secure_request' ), 10, 2 );
146 - add_filter( 'mainwp_check_security_request', array( &$this, 'hook_check_security_request' ), 10, 3 );
147 - add_filter( 'mainwp_notification_get_settings', array( &$this, 'get_notification_settings' ), 10, 2 );
148 -
149 - add_filter( 'mainwp_send_wp_mail', array( &$this, 'hook_send_wp_mail' ), 10, 5 );
150 - add_filter( 'mainwp_notification_get_template_content', array( &$this, 'hook_get_template_html' ), 10, 3 );
151 - add_filter( 'mainwp_sitestable_getcolumns', array( $this, 'hook_atarim_default_sitestable_column' ), 10, 1 );
152 - add_filter( 'mainwp_sitestable_item', array( $this, 'hook_atarim_manage_sites_default_item' ), 10, 1 );
153 - add_filter( 'mainwp_monitoring_sitestable_getcolumns', array( $this, 'hook_atarim_default_sitestable_column' ), 10, 1 );
154 - add_filter( 'mainwp_monitoring_sitestable_item', array( $this, 'hook_atarim_manage_sites_default_item' ), 10, 1 );
155 - add_filter( 'mainwp_clients_get_website_client_tokens', array( &$this, 'hook_get_website_client_tokens' ), 10, 2 );
156 - add_filter( 'mainwp_secure_get_download_sig', array( &$this, 'hook_get_download_sig' ), 10, 2 );
157 - add_action( 'mainwp_secure_download', array( &$this, 'hook_secure_download' ), 10, 3 );
158 - add_action( 'mainwp_ajax_add_action', array( &$this, 'hook_ajax_add_action' ), 10, 2 );
159 - add_filter( 'mainwp_get_plugin_icon', array( &$this, 'hook_get_plugin_icon' ), 10, 2 );
160 - add_filter( 'mainwp_get_theme_icon', array( &$this, 'hook_get_theme_icon' ), 10, 2 );
161 - add_filter( 'mainwp_get_dir_slug', array( &$this, 'hook_get_dir_slug' ), 10, 2 );
162 - add_action( 'mainwp_do_widget_boxes', array( &$this, 'hook_do_widget_boxes' ), 10, 3 );
163 - add_action( 'mainwp_add_widget_box', array( &$this, 'hook_add_widget_box' ), 10, 6 );
164 - add_action( 'mainwp_render_modal_upload_icon', array( &$this, 'hook_render_modal_upload_icon' ), 10, 2 );
165 - add_action( 'mainwp_render_plugin_details_modal', array( &$this, 'hook_render_plugin_details_modal' ), 10, 2 );
166 - add_action( 'mainwp_render_updates', array( &$this, 'hook_render_updates' ), 10, 2 );
167 - add_filter( 'mainwp_get_wp_client_by', array( &$this, 'hook_get_wp_client_by' ), 10, 4 );
168 -
169 - /**
170 - * Filter: mainwp_get_tokens_values
171 - *
172 - * Get tokens values for reports.
173 - *
174 - * @since 4.3.
175 - */
176 - add_filter( 'mainwp_get_reports_group_values_website', array( MainWP_Reports_Helper::get_instance(), 'hook_get_reports_group_values' ), 10, 6 );
177 -
178 - /**
179 - * MainWP API hooks.
180 - *
181 - * @since 4.5.
182 - */
183 - add_filter( 'mainwp_extension_get_activation_info', array( &$this, 'hook_get_activation_info' ), 10, 2 );
184 - add_filter( 'mainwp_get_api_url', array( &$this, 'hook_get_api_url' ), 10, 1 );
185 - add_filter( 'mainwp_hook_run_dashboard_action', array( &$this, 'hook_run_dashboard_action' ), 10, 2 );
186 -
187 - /**
188 - * Key encrypt hooks.
189 - *
190 - * @since 4.5.
191 - */
192 - add_filter( 'mainwp_get_key_value', array( &$this, 'hook_get_key_value' ), 10, 3 );
193 - add_filter( 'mainwp_update_key_value', array( &$this, 'hook_update_key_value' ), 10, 4 );
194 - add_action( 'mainwp_delete_key_value', array( &$this, 'hook_delete_key_value' ), 10, 1 );
195 -
196 - add_filter( 'mainwp_encrypt_key_value', array( &$this, 'hook_encrypt_key_value' ), 10, 4 );
197 - add_filter( 'mainwp_decrypt_key_value', array( &$this, 'hook_decrypt_key_value' ), 10, 3 );
198 - add_action( 'mainwp_delete_key_file', array( &$this, 'hook_delete_key_file' ), 10, 1 );
199 - add_filter( 'mainwp_verify_ping_nonce', array( MainWP_Utility::class, 'hook_verify_ping_nonce' ), 10, 3 );
200 - add_action( 'mainwp_fetch_url_authed', array( MainWP_Actions_Handler::instance(), 'hook_mainwp_fetch_url_authed' ), 10, 5 );
201 -
202 - add_filter( 'mainwp_get_lookup_items', array( &$this, 'hook_get_lookup_items' ), 10, 4 );
203 - add_filter( 'mainwp_insert_lookup_item', array( &$this, 'hook_insert_lookup_item' ), 10, 5 );
204 - add_filter( 'mainwp_delete_lookup_items', array( &$this, 'hook_delete_lookup_items' ), 10, 3 );
205 90 }
206 91
207 92 /**
208 93 * Method mainwp_log_debug()
@@ -209,10 +94,8 @@
209 94 *
210 95 * MainWP debug log.
211 96 *
212 97 * @param string $text Debug text.
213 - *
214 - * @uses \MainWP\Dashboard\MainWP_Logger::debug()
215 98 */
216 99 public function mainwp_log_debug( $text ) {
217 100 MainWP_Logger::instance()->debug( $text );
218 101 }
@@ -222,10 +105,8 @@
222 105 *
223 106 * MainWP log info.
224 107 *
225 108 * @param string $text Info Text.
226 - *
227 - * @uses \MainWP\Dashboard\MainWP_Logger::info()
228 109 */
229 110 public function mainwp_log_info( $text ) {
230 111 MainWP_Logger::instance()->info( $text );
231 112 }
@@ -235,10 +116,8 @@
235 116 *
236 117 * MainWP log warning.
237 118 *
238 119 * @param string $text Warning text.
239 - *
240 - * @uses \MainWP\Dashboard\MainWP_Logger::warning()
241 120 */
242 121 public function mainwp_log_warning( $text ) {
243 122 MainWP_Logger::instance()->warning( $text );
244 123 }
@@ -243,44 +122,11 @@
243 122 MainWP_Logger::instance()->warning( $text );
244 123 }
245 124
246 125 /**
247 - * Method mainwp_log_action()
248 - *
249 - * MainWP log action.
250 - *
251 - * @param string $text Debug text.
252 - * @param int $priority priority: -1 disabled, 0 - log, 1 - warning, 2 - info, 3 - debug.
253 - * @param int $log_color Set color: 0 - LOG, 1 - WARNING, 2 - INFO, 3- DEBUG.
254 - * @param bool $forced forced logging.
255 - *
256 - * @uses \MainWP\Dashboard\MainWP_Logger::debug()
257 - */
258 - public function mainwp_log_action( $text, $priority = 0, $log_color = 0, $forced = false ) {
259 - if ( ! empty( $priority ) ) {
260 - MainWP_Logger::instance()->log_action( $text, $priority, $log_color, $forced );
261 - }
262 - }
263 -
264 - /**
265 - * Method mainwp_log_execution_time()
266 - *
267 - * MainWP log execution time.
268 - *
269 - * @param string $text Debug text.
270 - *
271 - * @uses \MainWP\Dashboard\MainWP_Logger::debug()
272 - */
273 - public function mainwp_log_execution_time( $text = '' ) {
274 - MainWP_Logger::instance()->log_execution_time( $text );
275 - }
276 -
277 - /**
278 126 * Method enqueue_meta_boxes_scripts()
279 127 *
280 128 * Enqueue Scripts for all Meta boxes.
281 - *
282 - * @uses \MainWP\Dashboard\MainWP_System::enqueue_postbox_scripts()
283 129 */
284 130 public function enqueue_meta_boxes_scripts() {
285 131 MainWP_System::enqueue_postbox_scripts();
286 132 }
@@ -289,20 +135,12 @@
289 135 * Method mainwp_add_site()
290 136 *
291 137 * Hook to add Child Site.
292 138 *
293 - * @param array $params site data fields: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version,
294 - * http_user, http_pass, websiteid - if edit site.
139 + * @since 3.2.2
140 + * @param array $params site data fields: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version, http_user, http_pass, websiteid - if edit site.
295 141 *
296 142 * @return array $ret data fields: response, siteid.
297 - *
298 - * @throws \Exception Exception message.
299 - *
300 - * @since 3.2.2
301 - *
302 - * @uses \MainWP\Dashboard\MainWP_Manage_Sites_View::update_wp_site()
303 - * @uses \MainWP\Dashboard\MainWP_Manage_Sites_View::add_wp_site()
304 - * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
305 143 */
306 144 public function mainwp_add_site( $params ) {
307 145 $ret = array();
308 146
@@ -307,9 +145,9 @@
307 145 $ret = array();
308 146
309 147 if ( is_array( $params ) ) {
310 148 if ( isset( $params['websiteid'] ) && MainWP_Utility::ctype_digit( $params['websiteid'] ) ) {
311 - $ret['siteid'] = MainWP_Manage_Sites_View::update_wp_site( $params );
149 + $ret['siteid'] = self::update_wp_site( $params );
312 150 return $ret;
313 151 } elseif ( isset( $params['url'] ) && isset( $params['wpadmin'] ) ) {
314 152 $website = MainWP_DB::instance()->get_websites_by_url( $params['url'] );
315 153 list( $message, $error, $site_id ) = MainWP_Manage_Sites_View::add_wp_site( $website, $params );
@@ -325,31 +163,8 @@
325 163 return $ret;
326 164 }
327 165
328 166 /**
329 - * Method is_pro_member()
330 - *
331 - * Check for inactive MainWP Extensions.
332 - *
333 - * @param mixed $input Input value.
334 - *
335 - * @return bool Activation notice.
336 - */
337 - public static function is_pro_member( $input = false ) {
338 - $info = get_option( 'mainwp_extensions_plan_info' );
339 - if ( ! empty( $info ) ) {
340 - $info = json_decode( $info, true );
341 - if ( is_array( $info ) && isset( $info['plan_purchased'] ) && isset( $info['plan_status'] ) ) {
342 - if ( 'active' === $info['plan_status'] && in_array( $info['plan_purchased'], array( 'monthly', 'yearly', 'lifetime' ) ) ) {
343 - return true;
344 - }
345 - }
346 - }
347 - return $input;
348 - }
349 -
350 -
351 - /**
352 167 * Method hook_delete_site()
353 168 *
354 169 * Hook to delete Child Site.
355 170 *
@@ -354,12 +169,9 @@
354 169 * Hook to delete Child Site.
355 170 *
356 171 * @param bool $site_id Child site ID.
357 172 *
358 - * @return bool|array Return false if empty and return array error - Site not found | result - SUCCESS.
359 - *
360 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_wp_file_system()
361 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_icons_dir()
173 + * @return boolean|array Return false if empty and return array error - Site not found | result - SUCCESS.
362 174 */
363 175 public function hook_delete_site( $site_id = false ) {
364 176
365 177 if ( empty( $site_id ) ) {
@@ -370,9 +182,9 @@
370 182 $websites = MainWP_DB::instance()->query( $sql );
371 183 $site = MainWP_DB::fetch_object( $websites );
372 184
373 185 if ( empty( $site ) ) {
374 - return array( 'error' => esc_html__( 'Not found the website', 'mainwp' ) );
186 + return array( 'error' => __( 'Not found the website', 'mainwp' ) );
375 187 }
376 188 $hasWPFileSystem = MainWP_System_Utility::get_wp_file_system();
377 189
378 190 /**
@@ -412,10 +224,8 @@
412 224 * @param mixed $clone_url Clone site URL.
413 225 * @param bool $force_update Force the update, true|false, Default: false.
414 226 *
415 227 * @return array Site array to clone.
416 - *
417 - * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::hook_clone_site()
418 228 */
419 229 public function filter_clone_site( $pluginFile, $key, $websiteid, $cloneid, $clone_url, $force_update = false ) {
420 230 return MainWP_Extensions_Handler::hook_clone_site( $pluginFile, $key, $websiteid, $cloneid, $clone_url, $force_update );
421 231 }
@@ -430,10 +240,8 @@
430 240 * @param string $clone_url Clone site URL.
431 241 * @param bool $clone_site_id Clone site ID.
432 242 *
433 243 * @return array Site array to delete.
434 - *
435 - * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::hook_delete_clone_site()
436 244 */
437 245 public function filter_delete_clone_site( $pluginFile, $key, $clone_url = '', $clone_site_id = false ) {
438 246 return MainWP_Extensions_Handler::hook_delete_clone_site( $pluginFile, $key, $clone_url, $clone_site_id );
439 247 }
@@ -442,24 +250,18 @@
442 250 * Method mainwp_edit_site()
443 251 *
444 252 * Hook to edit Child Site.
445 253 *
254 + * @since 3.2.2
446 255 * @param array $params site data fields: websiteid, name, wpadmin, unique_id.
447 256 *
448 - * @return array $ret Child site ID.
449 - *
450 - * @throws \Exception Exception message.
451 - *
452 - * @since 3.2.2
453 - *
454 - * @uses \MainWP\Dashboard\MainWP_Manage_Sites_View::update_wp_site()
455 - * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
257 + * @return int $ret Child site ID.
456 258 */
457 259 public function mainwp_edit_site( $params ) {
458 260 $ret = array();
459 261 if ( is_array( $params ) ) {
460 262 if ( isset( $params['websiteid'] ) && MainWP_Utility::ctype_digit( $params['websiteid'] ) ) {
461 - $ret['siteid'] = MainWP_Manage_Sites_View::update_wp_site( $params );
263 + $ret['siteid'] = self::update_wp_site( $params );
462 264 return $ret;
463 265 }
464 266 }
465 267 return $ret;
@@ -474,10 +276,8 @@
474 276 * @param string $slug Menu slug.
475 277 * @param string $href Menu link.
476 278 * @param integer $level Menu level.
477 279 * @param string $parent_key Parent menu.
478 - *
479 - * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu()
480 280 */
481 281 public function hook_add_sub_left_menu( $title, $slug, $href, $level = 1, $parent_key = 'mainwp_tab' ) {
482 282 $item = array(
483 283 'title' => $title,
@@ -488,22 +288,77 @@
488 288 MainWP_Menu::add_left_menu( $item, $level );
489 289 }
490 290
491 291 /**
492 - * Method is_extension_activated()
292 + * Method update_wp_site()
493 293 *
494 - * Check for inactive MainWP Extensions.
294 + * Update Child Site.
495 295 *
496 - * @param mixed $input Input value.
497 - * @param mixed $slug MainWP Extension to check.
296 + * @param mixed $params Udate parameters.
498 297 *
499 - * @return bool Activation notice.
298 + * @return int Child Site ID on success and return 0 on failer.
500 299 */
501 - public function is_extension_activated( $input, $slug ) {
502 - return MainWP_Extensions_Handler::is_extension_activated( $slug );
300 + public static function update_wp_site( $params ) {
301 + if ( ! isset( $params['websiteid'] ) || ! MainWP_Utility::ctype_digit( $params['websiteid'] ) ) {
302 + return 0;
303 + }
304 +
305 + if ( isset( $params['is_staging'] ) ) {
306 + unset( $params['is_staging'] );
307 + }
308 +
309 + $website = MainWP_DB::instance()->get_website_by_id( $params['websiteid'] );
310 + if ( null == $website ) {
311 + return 0;
312 + }
313 +
314 + if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
315 + return 0;
316 + }
317 +
318 + $data = array();
319 + $uniqueId = null;
320 +
321 + if ( isset( $params['name'] ) && ! empty( $params['name'] ) ) {
322 + $data['name'] = htmlentities( $params['name'] );
323 + }
324 +
325 + if ( isset( $params['wpadmin'] ) && ! empty( $params['wpadmin'] ) ) {
326 + $data['adminname'] = $params['wpadmin'];
327 + }
328 +
329 + if ( isset( $params['unique_id'] ) ) {
330 + $data['uniqueId'] = $params['unique_id'];
331 + $uniqueId = $params['unique_id'];
332 + }
333 +
334 + if ( empty( $data ) ) {
335 + return 0;
336 + }
337 +
338 + MainWP_DB::instance()->update_website_values( $website->id, $data );
339 + if ( null !== $uniqueId ) {
340 + try {
341 + $information = MainWP_Connect::fetch_url_authed( $website, 'update_values', array( 'uniqueId' => $uniqueId ) );
342 + } catch ( MainWP_Exception $e ) {
343 + $error = $e->getMessage();
344 + }
345 + }
346 +
347 + /**
348 + * Action: mainwp_updated_site
349 + *
350 + * Fires after updatig the child site options.
351 + *
352 + * @param int $website->id Child site ID.
353 + * @param array $data Child site data.
354 + *
355 + * @since 3.5.1
356 + */
357 + do_action( 'mainwp_updated_site', $website->id, $data );
358 + return $website->id;
503 359 }
504 360
505 -
506 361 /**
507 362 * Method get_activate_extension_notice()
508 363 *
509 364 * Check for inactive MainWP Extensions &
@@ -511,10 +366,8 @@
511 366 *
512 367 * @param mixed $pluginFile MainWP Extension to check.
513 368 *
514 369 * @return string Activation notice.
515 - *
516 - * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::is_extension_activated()
517 370 */
518 371 public function get_activate_extension_notice( $pluginFile ) {
519 372 $active = MainWP_Extensions_Handler::is_extension_activated( $pluginFile );
520 373 if ( $active ) {
@@ -528,9 +381,9 @@
528 381 return false;
529 382 }
530 383 }
531 384
532 - return sprintf( esc_html__( 'You have a MainWP extension that does not have an active API entered. This means you will not receive updates or support. Please visit the %1$sExtensions%2$s page and enter your API key.', 'mainwp' ), '<a href="admin.php?page=Extensions">', '</a>' );
385 + return sprintf( __( 'You have a MainWP extension that does not have an active API entered. This means you will not receive updates or support. Please visit the %1$sExtensions%2$s page and enter your API key.', 'mainwp' ), '<a href="admin.php?page=Extensions">', '</a>' );
533 386 }
534 387
535 388 /**
536 389 * Method cache_getcontext()
@@ -591,9 +444,9 @@
591 444 MainWP_Cache::add_body( $page, $body );
592 445 }
593 446
594 447 /**
595 - * Method hook_select_sites_box()
448 + * Method select_sites_box()
596 449 *
597 450 * Hook to select sites box.
598 451 *
599 452 * @param string $title Input title.
@@ -599,46 +452,18 @@
599 452 * @param string $title Input title.
600 453 * @param string $type Input type, radio.
601 454 * @param bool $show_group Whether or not to show group, Default: true.
602 455 * @param bool $show_select_all Whether to show select all.
603 - * @param string $class_style Default = ''.
456 + * @param string $class Default = ''.
604 457 * @param string $style Default = ''.
605 458 * @param array $selected_websites Selected Child Sites.
606 459 * @param array $selected_groups Selected Groups.
607 - * @param bool $show_client Show Clients.
608 - * @param array $selected_clients Selected Clients.
609 - * @param mixed $post_id post ID.
610 - * @param bool $show_create_tag Show create tag button.
611 460 */
612 - public function hook_select_sites_box( $title = '', $type = 'checkbox', $show_group = true, $show_select_all = true, $class_style = '', $style = '', $selected_websites = array(), $selected_groups = array(), $show_client = false, $selected_clients = array(), $post_id = false, $show_create_tag = true ) {
613 - $sel_params = array(
614 - 'type' => $type,
615 - 'show_group' => $show_group,
616 - 'show_select_all' => $show_select_all,
617 - 'class' => $class_style,
618 - 'style' => $style,
619 - 'selected_sites' => $selected_websites,
620 - 'selected_groups' => $selected_groups,
621 - 'show_client' => $show_client,
622 - 'selected_clients' => $selected_clients,
623 - 'post_id' => $post_id,
624 - 'show_create_tag' => $show_create_tag,
625 - );
626 - MainWP_UI_Select_Sites::select_sites_box( $sel_params );
461 + public function select_sites_box( $title = '', $type = 'checkbox', $show_group = true, $show_select_all = true, $class = '', $style = '', $selected_websites = array(), $selected_groups = array() ) {
462 + MainWP_UI::select_sites_box( $type, $show_group, $show_select_all, $class, $style, $selected_websites, $selected_groups );
627 463 }
628 464
629 465 /**
630 - * Method hook_add_categories_box()
631 - *
632 - * General categories box.
633 - *
634 - * @param int $post_id Post ID.
635 - */
636 - public function hook_add_categories_box( $post_id = false ) {
637 - MainWP_System::instance()->metaboxes->add_categories( $post_id );
638 - }
639 -
640 - /**
641 466 * Method hook_notify_user()
642 467 *
643 468 * Hook to send user a notification.
644 469 *
@@ -644,10 +469,8 @@
644 469 *
645 470 * @param int $userId User ID.
646 471 * @param string $subject Email Subject.
647 472 * @param string $content Email Content.
648 - *
649 - * @uses \MainWP\Dashboard\MainWP_Notification::send_notify_user()
650 473 */
651 474 public function hook_notify_user( $userId, $subject, $content ) {
652 475 MainWP_Notification::send_notify_user( $userId, $subject, $content );
653 476 }
@@ -660,10 +483,8 @@
660 483 * @param object $msg Error message.
661 484 * @param object $extra HTTP error message.
662 485 *
663 486 * @return string Error message.
664 - *
665 - * @uses \MainWP\Dashboard\MainWP_Error_Helper::get_error_message()
666 487 */
667 488 public function get_error_message( $msg, $extra ) {
668 489 return MainWP_Error_Helper::get_error_message( new MainWP_Exception( $msg, $extra ) );
669 490 }
@@ -668,59 +489,42 @@
668 489 return MainWP_Error_Helper::get_error_message( new MainWP_Exception( $msg, $extra ) );
669 490 }
670 491
671 492 /**
672 - * Method hook_get_user_extension()
493 + * Method get_user_extension()
673 494 *
674 495 * Hook to get user extension.
675 496 *
676 497 * @return object $row User extension.
677 498 */
678 - public function hook_get_user_extension() {
499 + public function get_user_extension() {
679 500 return MainWP_DB_Common::instance()->get_user_extension();
680 501 }
681 502
682 503 /**
683 - * Method update_user_extension()
684 - *
685 - * Hook to update user extension.
686 - *
687 - * @param bool $input_value input filter value.
688 - * @param string $option_name option name.
689 - * @param mixed $option_value option value.
690 - *
691 - * @return bool true.
692 - */
693 - public function update_user_extension( $input_value, $option_name, $option_value ) {
694 - $userExtension = MainWP_DB_Common::instance()->get_user_extension();
695 - $userExtension->{$option_name} = wp_json_encode( $option_value );
696 - MainWP_DB_Common::instance()->update_user_extension( $userExtension );
697 - return true;
698 - }
699 -
700 - /**
701 504 * Method hook_get_site_options()
702 505 *
703 506 * Hook to get Child site options.
704 507 *
705 - * @param mixed $boolean Boolean check.
706 - * @param object $website Child site object.
707 - * @param string|array $options Option table name.
508 + * @param mixed $boolean Boolean check.
509 + * @param object $website Child site object.
510 + * @param string $name Option table name.
708 511 *
709 512 * @return string|null Database query result (as string), or null on failure
710 513 */
711 - public function hook_get_site_options( $boolean, $website, $options = '' ) {
514 + public function hook_get_site_options( $boolean, $website, $name = '' ) {
712 515
713 - if ( empty( $options ) ) {
516 + if ( empty( $name ) ) {
714 517 return $boolean;
715 518 }
716 519
717 - if ( is_string( $options ) ) {
718 - return MainWP_DB::instance()->get_website_option( $website, $options );
719 - } elseif ( is_array( $options ) ) {
720 - return MainWP_DB::instance()->get_website_options_array( $website, $options );
520 + if ( is_numeric( $website ) ) {
521 + $obj = new \stdClass();
522 + $obj->id = $website;
523 + $website = $obj;
721 524 }
722 - return $boolean;
525 +
526 + return MainWP_DB::instance()->get_website_option( $website, $name );
723 527 }
724 528
725 529 /**
726 530 * Method hook_update_site_options()
@@ -734,15 +538,8 @@
734 538 *
735 539 * @return string|null Database query result (as string), or null on failure
736 540 */
737 541 public function hook_update_site_options( $boolean, $website, $option, $value ) {
738 - if ( is_numeric( $website ) ) {
739 - $obj = new \stdClass();
740 - $obj->id = intval( $website );
741 - $website = $obj;
742 - } elseif ( ! is_object( $website ) || ! property_exists( $website, 'id' ) ) {
743 - return false;
744 - }
745 542 return MainWP_DB::instance()->update_website_option( $website, $option, $value );
746 543 }
747 544
748 545 /**
@@ -760,34 +557,8 @@
760 557 return MainWP_DB::instance()->get_websites_by_user_id( $userid, $selectgroups, $search_site, $orderBy );
761 558 }
762 559
763 560 /**
764 - * Get sites by website ID.
765 - *
766 - * @param mixed $boolean Boolean check.
767 - * @param int $website_id User ID.
768 - * @param bool $selectGroups Select groups.
769 - * @param array $extra_view get extra option fields.
770 - *
771 - * @return object|null Database query results or null on failure.
772 - */
773 - public function hook_get_website_by_id( $boolean, $website_id, $selectGroups = false, $extra_view = array() ) {
774 -
775 - if ( empty( $website_id ) ) {
776 - return false;
777 - }
778 -
779 - $website = MainWP_DB::instance()->get_website_by_id( $website_id, $selectGroups, $extra_view );
780 -
781 - if ( ! empty( $website ) && property_exists( $website, 'privkey' ) ) {
782 - unset( $website->privkey );
783 - }
784 -
785 - return $website;
786 - }
787 -
788 -
789 - /**
790 561 * Method get_websites_by_url()
791 562 *
792 563 * Hook to get Child Site by URL.
793 564 *
@@ -802,33 +573,24 @@
802 573 /**
803 574 * Method hook_get_all_posts()
804 575 * Hook to get posts from sites.
805 576 *
806 - * @param object $sites Child Sites object.
577 + * @since 3.4.4
578 + * @param object $sites Child Sites object.
807 579 * @param array $post_data with values: keyword, dtsstart, dtsstop, status, maxRecords, post_type.
808 580 *
809 - * @return \stdClass $output All posts data array.
810 - *
811 - * @since 3.4.4
812 - *
813 - * @uses \MainWP\Dashboard\MainWP_Post::get_class_name()
814 - * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
815 - * @uses \MainWP\Dashboard\MainWP_Utility::map_site()
581 + * @return array $output All posts data array.
816 582 */
817 583 public function hook_get_all_posts( $sites, $post_data = array() ) {
818 584
819 585 $dbwebsites = array();
586 + $data = array( 'id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey', 'verify_certificate', 'http_user', 'http_pass', 'ssl_version' );
820 587
821 - $data = MainWP_System_Utility::get_default_map_site_fields();
822 - $data[] = 'verify_certificate';
823 -
824 588 if ( '' !== $sites ) {
825 589 foreach ( $sites as $k => $v ) {
826 590 if ( MainWP_Utility::ctype_digit( $v ) ) {
827 - $website = MainWP_DB::instance()->get_website_by_id( $v );
828 - if ( empty( $website->sync_errors ) && ! MainWP_System_Utility::is_suspended_site( $website ) ) {
829 - $dbwebsites[ $website->id ] = MainWP_Utility::map_site( $website, $data );
830 - }
591 + $website = MainWP_DB::instance()->get_website_by_id( $v );
592 + $dbwebsites[ $website->id ] = MainWP_Utility::map_site( $website, $data );
831 593 }
832 594 }
833 595 }
834 596
@@ -850,9 +612,10 @@
850 612 array(
851 613 MainWP_Post::get_class_name(),
852 614 'hook_posts_search_handler',
853 615 ),
854 - $output
616 + $output,
617 + $is_external_hook = true
855 618 );
856 619 }
857 620 return $output;
858 621 }
@@ -881,17 +644,13 @@
881 644 * Method hook_escape_response()
882 645 *
883 646 * To escape response data.
884 647 *
885 - * @param mixed $response response data.
886 - * @param bool $fields fields of response data - option.
887 - * @param array $more_allowed input allowed tags - option.
648 + * @param mixed $response response data.
649 + * @param string $fields fields of response data - option.
650 + * @param string $more_allowed input allowed tags - option.
888 651 *
889 652 * @return mixed $response valid response data.
890 - * @throws \Exception Exception message.
891 - *
892 - * @uses \MainWP\Dashboard\MainWP_Utility::esc_content()
893 - * @uses \MainWP\Dashboard\MainWP_Utility::esc_mixed_content()
894 653 */
895 654 public function hook_escape_response( $response, $fields = false, $more_allowed = array() ) {
896 655
897 656 if ( false === $fields || is_string( $response ) ) {
@@ -920,212 +679,8 @@
920 679 return $response;
921 680 }
922 681
923 682 /**
924 - * Method hook_escape_content()
925 - *
926 - * To escape content.
927 - *
928 - * @param mixed $content response data.
929 - * @param string $type content type for escape.
930 - * @param array $more_allowed input allowed tags - option.
931 - *
932 - * @return mixed $response valid response data.
933 - * @throws \Exception Exception message.
934 - *
935 - * @uses \MainWP\Dashboard\MainWP_Utility::esc_content()
936 - */
937 - public function hook_escape_content( $content, $type = 'note', $more_allowed = array() ) {
938 - return MainWP_Utility::esc_content( $content, $type, $more_allowed );
939 - }
940 -
941 -
942 - /**
943 - * Method db_free_result()
944 - *
945 - * To escape response data.
946 - *
947 - * @param mixed $input_value input value.
948 - * @param mixed $result result data.
949 - *
950 - * @return bool true.
951 - */
952 - public function db_free_result( $input_value, $result ) {
953 - MainWP_DB::free_result( $result );
954 - return true;
955 - }
956 -
957 - /**
958 - * Method db_num_rows()
959 - *
960 - * To escape response data.
961 - *
962 - * @param mixed $input_value input value.
963 - * @param mixed $result result data.
964 - *
965 - * @return bool true.
966 - */
967 - public function db_num_rows( $input_value, $result ) {
968 - return MainWP_DB::num_rows( $result );
969 - }
970 -
971 -
972 - /**
973 - * Method db_get_websites_for_current_user()
974 - *
975 - * To escape response data.
976 - *
977 - * @param mixed $input_value input value.
978 - * @param array $params params data.
979 - *
980 - * @return mixed websites.
981 - */
982 - public function db_get_websites_for_current_user( $input_value = false, $params = array() ) {
983 - if ( ! is_array( $params ) ) {
984 - $params = array();
985 - }
986 -
987 - $orderBy = isset( $params['orderby'] ) ? MainWP_DB::instance()->escape( $params['orderby'] ) : 'wp.url';
988 - $extra_view = isset( $params['extra_view'] ) ? $params['extra_view'] : array( 'favi_icon' );
989 -
990 - if ( ! is_array( $extra_view ) ) {
991 - $extra_view = array( 'favi_icon' );
992 - }
993 - return MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, $orderBy, false, false, null, false, $extra_view ) );
994 - }
995 -
996 -
997 - /**
998 - * Method hook_sync_website()
999 - *
1000 - * To escape response data.
1001 - *
1002 - * @param mixed $input_value input value.
1003 - * @param int $website_id Website ID.
1004 - * @param bool $fire_end_session to run the ending session or not.
1005 - *
1006 - * @return mixed websites.
1007 - */
1008 - public function hook_sync_website( $input_value, $website_id, $fire_end_session = true ) {
1009 - if ( empty( $website_id ) ) {
1010 - return $input_value;
1011 - }
1012 - $website = MainWP_DB::instance()->get_website_by_id( $website_id );
1013 - if ( empty( $website ) ) {
1014 - return $input_value;
1015 - }
1016 - return MainWP_Sync::sync_website( $website, $fire_end_session );
1017 - }
1018 -
1019 -
1020 - /**
1021 - * Method hook_db_data_seek()
1022 - *
1023 - * To escape response data.
1024 - *
1025 - * @param mixed $result result data.
1026 - * @param int $offset offset of data.
1027 - */
1028 - public function hook_db_data_seek( $result, $offset = 0 ) {
1029 - MainWP_DB::data_seek( $result, $offset );
1030 - }
1031 -
1032 -
1033 - /**
1034 - * Method hook_db_query()
1035 - *
1036 - * To query db.
1037 - *
1038 - * @param mixed $input_value filter input value.
1039 - * @param string $sql result data.
1040 - *
1041 - * @return bool true.
1042 - */
1043 - public function hook_db_query( $input_value, $sql ) {
1044 - return MainWP_DB::instance()->query( $sql );
1045 - }
1046 -
1047 - /**
1048 - * Method db_fetch_object()
1049 - *
1050 - * To escape response data.
1051 - *
1052 - * @param mixed $input_value input value.
1053 - * @param mixed $result result data.
1054 - *
1055 - * @return bool true.
1056 - */
1057 - public function db_fetch_object( $input_value, $result ) {
1058 - return MainWP_DB::fetch_object( $result );
1059 - }
1060 -
1061 -
1062 - /**
1063 - * Method db_fetch_array()
1064 - *
1065 - * To escape response data.
1066 - *
1067 - * @param mixed $input_value input value.
1068 - * @param mixed $result result data.
1069 - *
1070 - * @return bool true.
1071 - */
1072 - public function db_fetch_array( $input_value, $result ) {
1073 - return MainWP_DB::fetch_array( $result );
1074 - }
1075 -
1076 -
1077 - /**
1078 - * Get notification email settings.
1079 - *
1080 - * @param string $settings hook settings input value.
1081 - * @param string $type Notification type.
1082 - *
1083 - * @return array $gen_email_settings email settings.
1084 - */
1085 - public function get_notification_settings( $settings, $type ) {
1086 - $gen_email_settings = MainWP_Notification_Settings::get_general_email_settings( $type );
1087 - return $gen_email_settings;
1088 - }
1089 -
1090 - /**
1091 - * Hook send_wp_mail().
1092 - *
1093 - * Send email via wp_mail().
1094 - *
1095 - * @param string $input hook input value.
1096 - * @param string $email send to email.
1097 - * @param string $subject email content.
1098 - * @param bool $formated_content email content.
1099 - * @param string $content_type Text format.
1100 - */
1101 - public function hook_send_wp_mail( $input, $email, $subject, $formated_content, $content_type = '' ) {
1102 - return MainWP_Notification::send_wp_mail(
1103 - $email,
1104 - $subject,
1105 - $formated_content,
1106 - $content_type
1107 - );
1108 - }
1109 -
1110 - /**
1111 - * Hook get template HTML content.
1112 - *
1113 - * @param string $input hooks input value.
1114 - * @param string $template_name Template name.
1115 - * @param array $args Arguments. (default: array).
1116 - *
1117 - * @return string
1118 - */
1119 - public function hook_get_template_html( $input, $template_name, $args = array() ) {
1120 - $mail_content = MainWP_Notification_Template::instance()->get_template_html(
1121 - $template_name,
1122 - $args
1123 - );
1124 - return $mail_content;
1125 - }
1126 -
1127 - /**
1128 683 * Method hook_secure_request()
1129 684 *
1130 685 * Security check to request parameter
1131 686 *
@@ -1130,10 +685,8 @@
1130 685 * Security check to request parameter
1131 686 *
1132 687 * @param string $action Action to perform.
1133 688 * @param string $query_arg Query argument.
1134 - *
1135 - * @uses \MainWP\Dashboard\MainWP_Post_Handler::secure_request()
1136 689 */
1137 690 public function hook_secure_request( $action = '', $query_arg = 'security' ) {
1138 691 MainWP_Post_Handler::instance()->secure_request( $action, $query_arg );
1139 692 }
@@ -1138,39 +691,19 @@
1138 691 MainWP_Post_Handler::instance()->secure_request( $action, $query_arg );
1139 692 }
1140 693
1141 694 /**
1142 - * Method hook_check_security_request()
1143 - *
1144 - * Security check to request parameter
1145 - *
1146 - * @param bool $input_value Input value.
1147 - * @param string $action Action to perform.
1148 - * @param string $query_arg Query argument.
1149 - */
1150 - public function hook_check_security_request( $input_value, $action = '', $query_arg = '' ) {
1151 - if ( empty( $query_arg ) ) {
1152 - //phpcs:ignore Squiz.PHP.CommentedOutCode.Found
1153 - // to do, $query_arg = 'security'.
1154 - $query_arg = $action; // to check wp_verify_nonce - sanitize_key( $_REQUEST[ $query_arg ] ) - $action.
1155 - }
1156 - return MainWP_Post_Handler::instance()->check_security( $action, $query_arg, false );
1157 - }
1158 -
1159 - /**
1160 695 * Method hook_get_mainwp_dir()
1161 696 *
1162 697 * Hook to get MainWP Directory.
1163 698 *
1164 - * @param bool $input_value False.
699 + * @param bool $false False.
1165 700 * @param null $dir WP files system diectories.
1166 701 * @param bool $direct_access Return true if Direct access file system. Default: false.
1167 702 *
1168 703 * @return array $newdir, $url.
1169 - *
1170 - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_mainwp_dir()
1171 704 */
1172 - public function hook_get_mainwp_dir( $input_value = false, $dir = null, $direct_access = false ) {
705 + public function hook_get_mainwp_dir( $false = false, $dir = null, $direct_access = false ) {
1173 706 return MainWP_System_Utility::get_mainwp_dir( $dir, $direct_access );
1174 707 }
1175 708
1176 709
@@ -1179,10 +712,8 @@
1179 712 *
1180 713 * Hook to check if multi user.
1181 714 *
1182 715 * @return bool true|false.
1183 - *
1184 - * @uses \MainWP\Dashboard\MainWP_System::is_multi_user()
1185 716 */
1186 717 public function is_multi_user() {
1187 718 return MainWP_System::instance()->is_multi_user();
1188 719 }
@@ -1192,13 +723,11 @@
1192 723 *
1193 724 * Hook to create new MainWP_QQ2_File_Uploader() class.
1194 725 *
1195 726 * @param mixed $allowedExtensions Allowed files extentions.
1196 - * @param mixed $sizeLimit Maximum file size allowed to be uploaded.
727 + * @param mixed $sizeLimit Maximum file size allowed to be uploaded.
1197 728 *
1198 - * @return MainWP_QQ2_File_Uploader Return instance of MainWP_QQ2_File_Uploader
1199 - *
1200 - * @uses \MainWP\Dashboard\MainWP_QQ2_File_Uploader
729 + * @return bool Return true on upload false on failer.
1201 730 */
1202 731 public function filter_qq2_file_uploader( $allowedExtensions, $sizeLimit ) {
1203 732 return new MainWP_QQ2_File_Uploader( $allowedExtensions, $sizeLimit );
1204 733 }
@@ -1208,10 +737,8 @@
1208 737 *
1209 738 * Hook to get meta boxes.
1210 739 *
1211 740 * @return string|bool Return error or true.
1212 - *
1213 - * @uses \MainWP\Dashboard\MainWP_System::$metaboxes
1214 741 */
1215 742 public function get_metaboxes_post() {
1216 743 return MainWP_System::instance()->metaboxes;
1217 744 }
@@ -1216,19 +743,8 @@
1216 743 return MainWP_System::instance()->metaboxes;
1217 744 }
1218 745
1219 746 /**
1220 - * Method hook_notification_email()
1221 - *
1222 - * Hook to get notification email.
1223 - *
1224 - * @return string Return email.
1225 - */
1226 - public function hook_notification_email() {
1227 - return MainWP_Notification_Settings::get_general_email();
1228 - }
1229 -
1230 - /**
1231 747 * Method get_formated_email()
1232 748 *
1233 749 * Hook to format email.
1234 750 *
@@ -1236,10 +752,8 @@
1236 752 * @param mixed $email Email address.
1237 753 * @param string $title Email title.
1238 754 *
1239 755 * @return string|bool Return error or true.
1240 - *
1241 - * @uses \MainWP\Dashboard\MainWP_Format::format_email()
1242 756 */
1243 757 public function get_formated_email( $body, $email, $title = '' ) {
1244 758 return MainWP_Format::format_email( $email, $body, $title );
1245 759 }
@@ -1247,10 +761,8 @@
1247 761 /**
1248 762 * Method active_plugin()
1249 763 *
1250 764 * Hook to activate plugins.
1251 - *
1252 - * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::activate_plugins()
1253 765 */
1254 766 public function active_plugin() {
1255 767 MainWP_Plugins_Handler::activate_plugins();
1256 768 die();
@@ -1259,10 +771,8 @@
1259 771 /**
1260 772 * Method deactive_plugin()
1261 773 *
1262 774 * Hook to deactivate plugins.
1263 - *
1264 - * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::deactivate_plugins()
1265 775 */
1266 776 public function deactive_plugin() {
1267 777 MainWP_Plugins_Handler::deactivate_plugins();
1268 778 die();
@@ -1271,10 +781,8 @@
1271 781 /**
1272 782 * Method delete_plugin()
1273 783 *
1274 784 * Hook to delete plugins.
1275 - *
1276 - * @uses \MainWP\Dashboard\MainWP_Plugins_Handler::delete_plugins()
1277 785 */
1278 786 public function delete_plugin() {
1279 787 MainWP_Plugins_Handler::delete_plugins();
1280 788 die();
@@ -1283,10 +791,8 @@
1283 791 /**
1284 792 * Method delete_theme()
1285 793 *
1286 794 * Hook to delete theme()
1287 - *
1288 - * @uses \MainWP\Dashboard\MainWP_Themes_Handler::delete_themes()
1289 795 */
1290 796 public function delete_theme() {
1291 797 MainWP_Themes_Handler::delete_themes();
1292 798 die();
@@ -1292,79 +798,30 @@
1292 798 die();
1293 799 }
1294 800
1295 801 /**
1296 - * Method upgrade_wp()
1297 - *
1298 - * Hook to upgrade WP.
1299 - */
1300 - public function upgrade_wp() {
1301 -
1302 - if ( ! mainwp_current_user_have_right( 'dashboard', 'update_wordpress' ) ) {
1303 - die( wp_json_encode( array( 'error' => mainwp_do_not_have_permissions( esc_html__( 'update WordPress', 'mainwp' ), $echo = false ) ) ) );
1304 - }
1305 -
1306 - try {
1307 - $id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : false; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1308 - die( wp_json_encode( array( 'result' => MainWP_Updates_Handler::upgrade_site( $id ) ) ) ); // ok.
1309 - } catch ( MainWP_Exception $e ) {
1310 - die(
1311 - wp_json_encode(
1312 - array(
1313 - 'error' => array(
1314 - 'message' => $e->getMessage(),
1315 - 'extra' => $e->get_message_extra(),
1316 - ),
1317 - )
1318 - )
1319 - );
1320 - }
1321 -
1322 - die();
1323 - }
1324 -
1325 - /**
1326 802 * Method upgrade_plugin_theme()
1327 803 *
1328 804 * Hook to update theme.
1329 - *
1330 - * @uses \MainWP\Dashboard\MainWP_Error_Helper::get_error_message()
1331 - * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
1332 - * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
1333 805 */
1334 806 public function upgrade_plugin_theme() {
1335 807 try {
1336 - // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1337 808 $websiteId = isset( $_POST['websiteId'] ) ? intval( $_POST['websiteId'] ) : null;
1338 809 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : null;
1339 810 $slugs = isset( $_POST['slugs'] ) && is_array( $_POST['slugs'] ) ? wp_unslash( $_POST['slugs'] ) : array();
1340 811 $error = '';
1341 - $erCode = '';
1342 - // phpcs:enable
1343 -
1344 812 if ( 'plugin' === $type && ! mainwp_current_user_have_right( 'dashboard', 'update_plugins' ) ) {
1345 - $error = mainwp_do_not_have_permissions( esc_html__( 'update plugins', 'mainwp' ), false );
813 + $error = mainwp_do_not_have_permissions( __( 'update plugins', 'mainwp' ), false );
1346 814 } elseif ( 'theme' === $type && ! mainwp_current_user_have_right( 'dashboard', 'update_themes' ) ) {
1347 - $error = mainwp_do_not_have_permissions( esc_html__( 'update themes', 'mainwp' ), false );
815 + $error = mainwp_do_not_have_permissions( __( 'update themes', 'mainwp' ), false );
1348 816 }
1349 817
1350 - $website = MainWP_DB::instance()->get_website_by_id( $websiteId );
1351 -
1352 - if ( MainWP_System_Utility::is_suspended_site( $website ) ) {
1353 - $error = esc_html__( 'Suspended site.', 'mainwp' );
1354 - $erCode = 'SUSPENDED_SITE';
1355 - }
1356 -
1357 818 if ( ! empty( $error ) ) {
1358 - wp_send_json(
1359 - array(
1360 - 'error' => $error,
1361 - 'errorCode' => $erCode,
1362 - )
1363 - );
819 + wp_send_json( array( 'error' => $error ) );
1364 820 }
1365 821
1366 822 if ( MainWP_Utility::ctype_digit( $websiteId ) ) {
823 + $website = MainWP_DB::instance()->get_website_by_id( $websiteId );
1367 824 if ( MainWP_System_Utility::can_edit_website( $website ) ) {
1368 825 /**
1369 826 * Action: mainwp_before_plugin_theme_translation_update
1370 827 *
@@ -1419,482 +876,5 @@
1419 876 public function hook_get_websites_by_group_ids( $ids, $userId = null ) {
1420 877 return MainWP_DB::instance()->get_websites_by_group_ids( $ids, $userId );
1421 878 }
1422 879
1423 - /**
1424 - * Method hook_posts_get_edit()
1425 - *
1426 - * Get and create post to edit.
1427 - *
1428 - * @uses \MainWP\Dashboard\MainWP_Post_Page_Handler::get_post()
1429 - */
1430 - public function hook_posts_get_edit() {
1431 - MainWP_Post_Page_Handler::get_post();
1432 - die();
1433 - }
1434 -
1435 - /**
1436 - * Method hook_posts_bulk_posting()
1437 - *
1438 - * Post Bulk posting.
1439 - *
1440 - * @uses \MainWP\Dashboard\MainWP_Post_Page_Handler::get_post()
1441 - */
1442 - public function hook_posts_bulk_posting() {
1443 - // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1444 - $post_id = isset( $_POST['post_id'] ) && ! empty( $_POST['post_id'] ) ? intval( wp_unslash( $_POST['post_id'] ) ) : false;
1445 - if ( $post_id ) {
1446 - MainWP_Post_Page_Handler::posting_posts( $post_id, 'ajax_posting' );
1447 - }
1448 - // phpcs:enable
1449 - die();
1450 - }
1451 -
1452 - /**
1453 - * Method hook_atarim_default_sitestable_column()
1454 - *
1455 - * @param mixed $columns columns data.
1456 - *
1457 - * Hook Atarim default column.
1458 - */
1459 - public function hook_atarim_default_sitestable_column( $columns ) {
1460 - if ( ! is_plugin_active( 'mainwp-atarim-extension/mainwp-atarim-extension.php' ) ) {
1461 - $columns['atarim_tasks'] = esc_html__( 'Atarim', 'mainwp-atarim-extension' );
1462 - }
1463 - return $columns;
1464 - }
1465 -
1466 - /**
1467 - * Method hook_atarim_manage_sites_default_item()
1468 - *
1469 - * @param mixed $item item row data.
1470 - *
1471 - * Hook Atarim manage sites default item.
1472 - */
1473 - public function hook_atarim_manage_sites_default_item( $item ) {
1474 - if ( ! is_plugin_active( 'mainwp-atarim-extension/mainwp-atarim-extension.php' ) ) {
1475 - if ( is_array( $item ) && isset( $item['url'] ) ) {
1476 - $collaborate_link = 'https://app.atarim.io/fetching/?_from=mainwp&url=' . $item['url'];
1477 - $item['atarim_tasks'] = '<a href="' . $collaborate_link . '" target="_balnk" data-tooltip="Collaborate on this website." data-inverted="" data-position="left center"><span class="ui blue icon label"><i class="comments icon"></i></span></a>';
1478 - }
1479 - }
1480 - return $item;
1481 - }
1482 -
1483 - /**
1484 - * Method hook_get_website_client_tokens()
1485 - *
1486 - * Hook get client tokens.
1487 - *
1488 - * @param mixed $input_value input filter value.
1489 - * @param int $websiteid Website ID.
1490 - *
1491 - * @return mixed $result Result of tokens.
1492 - */
1493 - public function hook_get_website_client_tokens( $input_value, $websiteid = false ) {
1494 - $client_tokens = MainWP_Client_Handler::instance()->get_website_client_tokens_data( $websiteid );
1495 -
1496 - if ( false === $client_tokens ) {
1497 - return $input_value;
1498 - }
1499 -
1500 - return $client_tokens;
1501 - }
1502 -
1503 - /**
1504 - * Method hook_get_download_sig()
1505 - *
1506 - * Hook get download sig.
1507 - *
1508 - * @param string $input_value Input value.
1509 - * @param string $fullfile Full file path.
1510 - *
1511 - * @return string
1512 - */
1513 - public function hook_get_download_sig( $input_value, $fullfile ) {
1514 - return MainWP_System_Utility::get_download_sig( $fullfile );
1515 - }
1516 -
1517 - /**
1518 - * Method hook_download_valid_sig().
1519 - *
1520 - * Hook get download sig.
1521 - *
1522 - * @param string $false_value false value.
1523 - * @param string $fullfile Full file path.
1524 - * @param string $sig sig value.
1525 - */
1526 - public function hook_secure_download( $false_value, $fullfile, $sig ) {
1527 - unset( $false_value );
1528 - return MainWP_System_Utility::valid_download_sig( $fullfile, $sig );
1529 - }
1530 -
1531 - /**
1532 - * Method hook_ajax_add_action().
1533 - *
1534 - * Hook add ajax action.
1535 - *
1536 - * @param string $action action name.
1537 - * @param string $callback callback function.
1538 - * @param int $priority priority action.
1539 - * @param int $accepted number args.
1540 - */
1541 - public function hook_ajax_add_action( $action, $callback, $priority = 10, $accepted = 2 ) {
1542 - MainWP_Post_Handler::instance()->add_action( $action, $callback, $priority, $accepted );
1543 - }
1544 -
1545 - /**
1546 - * Method hook_get_plugin_icon().
1547 - *
1548 - * Hook get plugin icon.
1549 - *
1550 - * @param mixed $icon input icon.
1551 - * @param string $slug Plugin slug.
1552 - */
1553 - public function hook_get_plugin_icon( $icon, $slug ) {
1554 - return MainWP_System_Utility::get_plugin_icon( $slug );
1555 - }
1556 -
1557 - /**
1558 - * Method hook_get_theme_icon().
1559 - *
1560 - * Hook get theme icon.
1561 - *
1562 - * @param mixed $icon input icon.
1563 - * @param string $slug Theme slug.
1564 - */
1565 - public function hook_get_theme_icon( $icon, $slug ) {
1566 - return MainWP_System_Utility::get_theme_icon( $slug );
1567 - }
1568 - /**
1569 - * Method hook_get_dir_slug().
1570 - *
1571 - * Hook get dir slug of plugin/theme.
1572 - *
1573 - * @param mixed $input input value.
1574 - * @param string $slug Plugin/Theme slug.
1575 - */
1576 - public function hook_get_dir_slug( $input, $slug ) {
1577 - return MainWP_Utility::get_dir_slug( $slug );
1578 - }
1579 -
1580 - /**
1581 - * Method hook_do_widget_boxes()
1582 - *
1583 - * Customize WordPress do_meta_boxes() function.
1584 - *
1585 - * @param mixed $screen_id Current page ID.
1586 - * @param string|null $context right|null. If 3 columns then = 'middle'.
1587 - * @param string $input_obj Empty string.
1588 - *
1589 - * @return void Renders widget container box.
1590 - */
1591 - public function hook_do_widget_boxes( $screen_id, $context = null, $input_obj = '' ) {
1592 - MainWP_UI::do_widget_boxes( $screen_id, $context, $input_obj );
1593 - }
1594 -
1595 -
1596 - /**
1597 - * Method hook_add_widget_box()
1598 - *
1599 - * Hook add MainWP meta box.
1600 - *
1601 - * @param mixed $id Widget ID parameter.
1602 - * @param mixed $callback Callback function.
1603 - * @param null $screen Current page.
1604 - * @param string|null $layout widget's layout .
1605 - *
1606 - * @return void Sets Global $mainwp_widget_boxes[ $page ][ $context ][ $priority ][ $id ].
1607 - */
1608 - public function hook_add_widget_box( $id, $callback, $screen = null, $layout = null ) {
1609 - if ( ! is_array( $layout ) ) {
1610 - $layout = array();
1611 - }
1612 - MainWP_UI::add_widget_box( $id, $callback, $screen, $layout );
1613 - }
1614 -
1615 - /**
1616 - * Method hook_render_modal_upload_icon()
1617 - *
1618 - * Render modal window for upload plugins & themes icon.
1619 - */
1620 - public function hook_render_modal_upload_icon() {
1621 - MainWP_UI::render_modal_upload_icon();
1622 - }
1623 -
1624 - /**
1625 - * Method hook_render_plugin_details_modal()
1626 - *
1627 - * Render modal window plugin details.
1628 - */
1629 - public function hook_render_plugin_details_modal() {
1630 - MainWP_Updates::render_plugin_details_modal();
1631 - }
1632 -
1633 - /**
1634 - * Method hook_render_updates()
1635 - *
1636 - * Render modal window updates details.
1637 - */
1638 - public function hook_render_updates() {
1639 - MainWP_Updates::render();
1640 - }
1641 -
1642 - /**
1643 - * Method hook_get_wp_client_by()
1644 - *
1645 - * Handle get wp client by.
1646 - *
1647 - * @param string $by by.
1648 - * @param mixed $value by value.
1649 - * @param mixed $obj Format data.
1650 - * @param bool $params Others params.
1651 - *
1652 - * @return mixed $result results.
1653 - */
1654 - public function hook_get_wp_client_by( $by = 'client_id', $value = null, $obj = OBJECT, $params = array() ) {
1655 - return MainWP_DB_Client::instance()->get_wp_client_by( $by, $value, $obj, $params );
1656 - }
1657 -
1658 - /**
1659 - * Method hook_get_activation_info()
1660 - *
1661 - * Get extension activation info.
1662 - *
1663 - * @param bool $boolean Input bool value.
1664 - * @param string $ext_slug extension api slug.
1665 - */
1666 - public function hook_get_activation_info( $boolean, $ext_slug ) {
1667 - $data = MainWP_Api_Manager::instance()->get_activation_info( $ext_slug );
1668 -
1669 - $info = array();
1670 -
1671 - if ( is_array( $data ) && ! empty( $data['api_key'] ) ) {
1672 - $info['api_key'] = $data['api_key'];
1673 - $info['product_id'] = isset( $data['product_id'] ) ? $data['product_id'] : '';
1674 - $info['instance'] = isset( $data['instance_id'] ) ? $data['instance_id'] : '';
1675 - $info['software_version'] = isset( $data['software_version'] ) ? $data['software_version'] : '';
1676 - $info['object'] = MainWP_Api_Manager::instance()->get_domain();
1677 - if ( isset( $data['product_item_id'] ) ) {
1678 - $info['product_item_id'] = $data['product_item_id'];
1679 - }
1680 - } else {
1681 - $info['activated_key'] = 'Deactivated';
1682 - }
1683 -
1684 - return $info;
1685 - }
1686 -
1687 - /**
1688 - * Method hook_get_api_url()
1689 - *
1690 - * Get MainWP API Url.
1691 - */
1692 - public function hook_get_api_url() {
1693 - return MainWP_Api_Manager::instance()->get_upgrade_url();
1694 - }
1695 -
1696 - /**
1697 - * Method hook_run_dashboard_action().
1698 - *
1699 - * Handle run dashboard action.
1700 - *
1701 - * @param bool $boolean Input bool value.
1702 - * @param string $action The action to run.
1703 - * @param bool $out_die The function die or return.
1704 - *
1705 - * @return mixed $return result.
1706 - */
1707 - public function hook_run_dashboard_action( $boolean, $action, $out_die = false ) {
1708 -
1709 - if ( ! isset( $action ) ) {
1710 - return false;
1711 - }
1712 -
1713 - if ( 'master_api_key_check' === $action ) {
1714 - $return = $this->hook_master_api_key_check();
1715 - } else {
1716 - return false;
1717 - }
1718 -
1719 - if ( $out_die ) {
1720 - wp_send_json( $return );
1721 - }
1722 -
1723 - return $return;
1724 - }
1725 -
1726 -
1727 -
1728 - /**
1729 - * Method hook_master_api_key_check().
1730 - *
1731 - * Handle to valid MainWP API key.
1732 - *
1733 - * @return array $return Data.
1734 - */
1735 - public function hook_master_api_key_check() {
1736 - $api_key = MainWP_Api_Manager_Key::instance()->get_decrypt_master_api_key();
1737 - $return = array();
1738 - $error = '';
1739 - if ( ! empty( $api_key ) ) {
1740 - $result = array();
1741 - try {
1742 - $test = MainWP_Api_Manager::instance()->verify_mainwp_api( $api_key );
1743 - $result = json_decode( $test, true );
1744 - if ( is_array( $result ) ) {
1745 - if ( isset( $result['success'] ) && $result['success'] ) {
1746 - $return['success'] = true;
1747 - } elseif ( isset( $result['error'] ) ) {
1748 - $error = $result['error'];
1749 - }
1750 - }
1751 - } catch ( \Exception $e ) {
1752 - $error = $e->getMessage();
1753 - }
1754 - } else {
1755 - $error = esc_html__( 'MainWP API key are required.', 'mainwp' );
1756 - }
1757 -
1758 - if ( ! empty( $error ) ) {
1759 - $return['error'] = $error;
1760 - }
1761 -
1762 - if ( ! isset( $return['success'] ) ) {
1763 - $return['success'] = false;
1764 - }
1765 -
1766 - return $return;
1767 - }
1768 -
1769 - /**
1770 - * Method hook_get_key_value().
1771 - *
1772 - * Handle get key value.
1773 - *
1774 - * @param bool $input_value Boolean value, it should always be FALSE.
1775 - * @param string $name Key option name.
1776 - * @param mixed $default_value default value.
1777 - *
1778 - * @return array $return Decrypted Key value.
1779 - */
1780 - public function hook_get_key_value( $input_value, $name, $default_value = false ) {
1781 - return MainWP_Keys_Manager::instance()->get_keys_value( $name, $default_value );
1782 - }
1783 -
1784 - /**
1785 - * Method hook_update_key_value().
1786 - *
1787 - * Handle update key value.
1788 - *
1789 - * @param bool $input_value Boolean value, it should always be FALSE.
1790 - * @param string $name Key option name.
1791 - * @param mixed $value Key value.
1792 - * @param string $prefix prefix of key file name.
1793 - *
1794 - * @return array $return Decrypted Key value.
1795 - */
1796 - public function hook_update_key_value( $input_value, $name, $value = false, $prefix = 'ext_' ) {
1797 - return MainWP_Keys_Manager::instance()->update_key_value( $name, $value, $prefix );
1798 - }
1799 -
1800 -
1801 - /**
1802 - * Method hook_delete_key_value().
1803 - *
1804 - * Handle delete key value.
1805 - *
1806 - * @param string $name Key option name.
1807 - *
1808 - * @return mixed Return Result.
1809 - */
1810 - public function hook_delete_key_value( $name ) {
1811 - return MainWP_Keys_Manager::instance()->update_key_value( $name, false ); // false: to delete.
1812 - }
1813 -
1814 - /**
1815 - * Method hook_encrypt_key_value().
1816 - *
1817 - * Handle get key value.
1818 - *
1819 - * @param bool $input_value Boolean value, it should always be FALSE.
1820 - * @param array $data Encrypted data.
1821 - * @param mixed $prefix prefix value.
1822 - * @param mixed $key_file Key file value.
1823 - *
1824 - * @return array $return Decrypted Key value.
1825 - */
1826 - public function hook_encrypt_key_value( $input_value, $data, $prefix = 'ext_', $key_file = false ) {
1827 - return MainWP_Keys_Manager::instance()->encrypt_keys_data( $data, $prefix, $key_file );
1828 - }
1829 -
1830 - /**
1831 - * Method hook_decrypt_key_value().
1832 - *
1833 - * Handle get key value.
1834 - *
1835 - * @param bool $input_value Boolean value, it should always be FALSE.
1836 - * @param array $encrypted_data Encrypted data.
1837 - * @param mixed $default_value default value.
1838 - *
1839 - * @return array $return Decrypted Key value.
1840 - */
1841 - public function hook_decrypt_key_value( $input_value, $encrypted_data, $default_value = false ) {
1842 - return MainWP_Keys_Manager::instance()->decrypt_keys_data( $encrypted_data, $default_value );
1843 - }
1844 -
1845 -
1846 - /**
1847 - * Method hook_delete_key_file().
1848 - *
1849 - * Handle delete key value.
1850 - *
1851 - * @param string $key_file Key file name.
1852 - *
1853 - * @return array $return Decrypted Key value.
1854 - */
1855 - public function hook_delete_key_file( $key_file ) {
1856 - return MainWP_Keys_Manager::instance()->delete_key_file( $key_file );
1857 - }
1858 -
1859 - /**
1860 - * Method hook_get_lookup_items().
1861 - *
1862 - * @param bool $false_val false value.
1863 - * @param string $item_name item name.
1864 - * @param int $item_id item id.
1865 - * @param string $obj_name object name.
1866 - *
1867 - * @return array Lookup items.
1868 - */
1869 - public function hook_get_lookup_items( $false_val, $item_name, $item_id, $obj_name ) {
1870 - return MainWP_DB::instance()->get_lookup_items( $item_name, $item_id, $obj_name );
1871 - }
1872 -
1873 - /**
1874 - * Method hook_insert_lookup_item().
1875 - *
1876 - * @param bool $false_val false value.
1877 - * @param string $item_name item name.
1878 - * @param int $item_id item id.
1879 - * @param string $obj_name object name.
1880 - * @param int $obj_id object id.
1881 - *
1882 - * @return array Lookup items.
1883 - */
1884 - public function hook_insert_lookup_item( $false_val, $item_name, $item_id, $obj_name, $obj_id ) {
1885 - return MainWP_DB::instance()->insert_lookup_item( $item_name, $item_id, $obj_name, $obj_id );
1886 - }
1887 -
1888 - /**
1889 - * Method hook_delete_lookup_items().
1890 - *
1891 - * @param bool $false_val false value.
1892 - * @param string $by Delete by.
1893 - * @param array $params params.
1894 - *
1895 - * @return mixed results.
1896 - */
1897 - public function hook_delete_lookup_items( $false_val, $by = 'lookup_id', $params = array() ) {
1898 - return MainWP_DB::instance()->delete_lookup_items( $by, $params );
1899 - }
1900 880 }