| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Classes; | |
| 3 | +namespace WPAdminify\Inc\Classes; | |
| 4 | 4 | |
| 5 | 5 | // no direct access allowed |
| 6 | 6 | if (!defined('ABSPATH')) { |
| 7 | 7 | exit; |
| @@ -10,13 +10,13 @@ | ||
| 10 | 10 | class Helper |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | // Admin Path |
| 14 | - public static function pxlbsadminify_admin_path($path) | |
| 14 | + public static function jltwp_adminify_admin_path($path) | |
| 15 | 15 | { |
| 16 | 16 | // Get custom filter path |
| 17 | - if (has_filter('pxlbsadminify_admin_path')) { | |
| 18 | - return apply_filters('pxlbsadminify_admin_path', $path); | |
| 17 | + if (has_filter('jltwp_adminify_admin_path')) { | |
| 18 | + return apply_filters('jltwp_adminify_admin_path', $path); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // Get plugin path |
| 22 | 22 | return plugins_url($path, __DIR__); |
| @@ -98,9 +98,8 @@ | ||
| 98 | 98 | * @return boolean |
| 99 | 99 | */ |
| 100 | 100 | public static function is_elementor_editor_page() |
| 101 | 101 | { |
| 102 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 103 | 102 | return !empty($_GET['elementor-preview']); |
| 104 | 103 | } |
| 105 | 104 | |
| 106 | 105 | /** |
| @@ -139,9 +138,9 @@ | ||
| 139 | 138 | ); |
| 140 | 139 | |
| 141 | 140 | // Allowed svg mime type in version 1.2.2. |
| 142 | 141 | $allowed_mime = get_allowed_mime_types(); |
| 143 | - $svg_mime_check = isset($allowed_mime['svg']); | |
| 142 | + $svg_mime_check = isset($allowed_mime['svg']) ? true : false; | |
| 144 | 143 | |
| 145 | 144 | if ($svg_mime_check) { |
| 146 | 145 | $allow_mime = array('svg' => 'image/svg+xml'); |
| 147 | 146 | $mimes = array_merge($mimes, $allow_mime); |
| @@ -206,9 +205,9 @@ | ||
| 206 | 205 | * @return void |
| 207 | 206 | */ |
| 208 | 207 | public static function allowed_host($url) |
| 209 | 208 | { |
| 210 | - $url_parsed = wp_parse_url($url); | |
| 209 | + $url_parsed = parse_url($url); | |
| 211 | 210 | if (isset($url_parsed['host'])) { |
| 212 | 211 | $allowed_hosts[] = $url_parsed['host']; |
| 213 | 212 | add_filter('allowed_redirect_hosts', function ($hosts) use ($allowed_hosts) { |
| 214 | 213 | return array_merge($hosts, $allowed_hosts); |
| @@ -235,9 +234,9 @@ | ||
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | $caps = array_unique($caps); |
| 238 | 237 | |
| 239 | - $caps = (array) apply_filters('pxlbsadminify_capabilities', $caps); | |
| 238 | + $caps = (array) apply_filters('adminify_capabilities', $caps); | |
| 240 | 239 | |
| 241 | 240 | sort($caps); |
| 242 | 241 | |
| 243 | 242 | return array_combine($caps, $caps); |
| @@ -262,11 +261,11 @@ | ||
| 262 | 261 | |
| 263 | 262 | /** |
| 264 | 263 | * Remove spaces from Plugin Slug |
| 265 | 264 | */ |
| 266 | - public static function slug_cleanup() | |
| 265 | + public static function jltwp_adminify_slug_cleanup() | |
| 267 | 266 | { |
| 268 | - return str_replace('-', '_', strtolower(PXLBSADMINIFY_SLUG)); | |
| 267 | + return str_replace('-', '_', strtolower(WP_ADMINIFY_SLUG)); | |
| 269 | 268 | } |
| 270 | 269 | |
| 271 | 270 | /** |
| 272 | 271 | * Function current_datetime() compability for wp version < 5.3 |
| @@ -272,45 +271,40 @@ | ||
| 272 | 271 | * Function current_datetime() compability for wp version < 5.3 |
| 273 | 272 | * |
| 274 | 273 | * @return DateTimeImmutable |
| 275 | 274 | */ |
| 276 | - public static function custom_current_datetime() | |
| 275 | + public static function jltwp_adminify_current_datetime() | |
| 277 | 276 | { |
| 278 | 277 | if (function_exists('current_datetime')) { |
| 279 | 278 | return current_datetime(); |
| 280 | 279 | } |
| 281 | 280 | |
| 282 | - return new \DateTimeImmutable('now', self::custom_wp_timezone()); | |
| 281 | + return new \DateTimeImmutable('now', self::jltwp_adminify_wp_timezone()); | |
| 283 | 282 | } |
| 284 | 283 | |
| 285 | 284 | /** |
| 286 | - * Function custom_wp_timezone() compability for wp version < 5.3 | |
| 285 | + * Function jltwp_adminify_wp_timezone() compability for wp version < 5.3 | |
| 287 | 286 | * |
| 288 | 287 | * @return DateTimeZone |
| 289 | 288 | */ |
| 290 | - public static function custom_wp_timezone() | |
| 289 | + public static function jltwp_adminify_wp_timezone() | |
| 291 | 290 | { |
| 292 | 291 | if (function_exists('wp_timezone')) { |
| 293 | 292 | return wp_timezone(); |
| 294 | 293 | } |
| 295 | 294 | |
| 296 | - return new \DateTimeZone(self::custom_wp_timezone_string()); | |
| 295 | + return new \DateTimeZone(self::jltwp_adminify_wp_timezone_string()); | |
| 297 | 296 | } |
| 298 | 297 | |
| 299 | 298 | /** |
| 300 | - * Public Jewel Theme API base URL. | |
| 299 | + * API Endpoint | |
| 301 | 300 | * |
| 302 | - * Single source of truth for the external host the plugin talks to; | |
| 303 | - * the subscribe / survey endpoints are derived from this base via | |
| 304 | - * crm_endpoint() and crm_survey_endpoint() so the host only ever | |
| 305 | - * appears in one place. | |
| 306 | - * | |
| 307 | 301 | * @return string |
| 308 | 302 | */ |
| 309 | 303 | public static function api_endpoint() |
| 310 | 304 | { |
| 311 | - $api_endpoint_url = 'https://pixarlabs.com'; | |
| 312 | - $api_endpoint = apply_filters('pxlbsadminify_endpoint', $api_endpoint_url); | |
| 305 | + $api_endpoint_url = 'https://bo.jeweltheme.com'; | |
| 306 | + $api_endpoint = apply_filters('jltwp_adminify_endpoint', $api_endpoint_url); | |
| 313 | 307 | |
| 314 | 308 | return trailingslashit($api_endpoint); |
| 315 | 309 | } |
| 316 | 310 | |
| @@ -320,21 +314,34 @@ | ||
| 320 | 314 | * @return string |
| 321 | 315 | */ |
| 322 | 316 | public static function crm_endpoint() |
| 323 | 317 | { |
| 324 | - $crm_endpoint_url = self::api_endpoint() . 'api/plugin/subscribe'; | |
| 325 | - $crm_endpoint = apply_filters('pxlbsadminify_subscribe_endpoint', $crm_endpoint_url); | |
| 318 | + $crm_endpoint_url = 'https://bo.jeweltheme.com/wp-json/jlt-api/v1/subscribe'; // Endpoint . | |
| 319 | + $crm_endpoint = apply_filters('jltwp_adminify_crm_crm_endpoint', $crm_endpoint_url); | |
| 326 | 320 | |
| 327 | 321 | return trailingslashit($crm_endpoint); |
| 328 | 322 | } |
| 329 | 323 | |
| 330 | 324 | /** |
| 331 | - * Function custom_wp_timezone_string() compability for wp version < 5.3 | |
| 325 | + * CRM Endpoint | |
| 332 | 326 | * |
| 333 | 327 | * @return string |
| 334 | 328 | */ |
| 335 | - public static function custom_wp_timezone_string() | |
| 329 | + public static function crm_survey_endpoint() | |
| 336 | 330 | { |
| 331 | + $crm_feedback_endpoint_url = 'https://bo.jeweltheme.com/wp-json/jlt-api/v1/survey'; // Endpoint . | |
| 332 | + $crm_feedback_endpoint = apply_filters('jltwp_adminify_crm_crm_endpoint', $crm_feedback_endpoint_url); | |
| 333 | + | |
| 334 | + return trailingslashit($crm_feedback_endpoint); | |
| 335 | + } | |
| 336 | + | |
| 337 | + /** | |
| 338 | + * Function jltwp_adminify_wp_timezone_string() compability for wp version < 5.3 | |
| 339 | + * | |
| 340 | + * @return string | |
| 341 | + */ | |
| 342 | + public static function jltwp_adminify_wp_timezone_string() | |
| 343 | + { | |
| 337 | 344 | $timezone_string = get_option('timezone_string'); |
| 338 | 345 | |
| 339 | 346 | if ($timezone_string) { |
| 340 | 347 | return $timezone_string; |
| @@ -364,25 +371,24 @@ | ||
| 364 | 371 | public static function get_merged_data($data, $start_date = '', $end_data = '') |
| 365 | 372 | { |
| 366 | 373 | $_data = shortcode_atts( |
| 367 | 374 | array( |
| 368 | - 'image_url' => PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png', | |
| 375 | + 'image_url' => WP_ADMINIFY_ASSETS_IMAGE . '/promo-image.png', | |
| 369 | 376 | 'start_date' => $start_date, |
| 370 | 377 | 'end_date' => $end_data, |
| 371 | 378 | 'counter_time' => '', |
| 372 | - 'is_live' => false, | |
| 379 | + 'is_campaign' => 'false', | |
| 373 | 380 | 'button_text' => 'Get Premium', |
| 374 | 381 | 'button_url' => 'https://wpadminify.com/pricing', |
| 375 | 382 | 'btn_color' => '#CC22FF', |
| 376 | 383 | 'notice' => '', |
| 377 | 384 | 'notice_timestamp' => '', |
| 378 | - 'show_for_premium' => 'false', | |
| 379 | 385 | ), |
| 380 | 386 | $data |
| 381 | 387 | ); |
| 382 | 388 | |
| 383 | 389 | if (empty($_data['image_url'])) { |
| 384 | - $_data['image_url'] = PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png'; | |
| 390 | + $_data['image_url'] = WP_ADMINIFY_ASSETS_IMAGE . '/promo-image.png'; | |
| 385 | 391 | } |
| 386 | 392 | |
| 387 | 393 | return $_data; |
| 388 | 394 | } |
| @@ -408,15 +414,9 @@ | ||
| 408 | 414 | * @author Jewel Theme <support@jeweltheme.com> |
| 409 | 415 | */ |
| 410 | 416 | public static function wp_kses_custom($content) |
| 411 | 417 | { |
| 412 | - /** | |
| 413 | - * the context can be different | |
| 414 | - * The context for which to retrieve tags. Allowed values are 'post', 'strip', 'data', 'entities', or the name of a field filter such as 'pre_user_description', or an array of allowed HTML elements and attributes. | |
| 415 | - * the post means here it will return all the tags that are allowed in post such as a, p, strong, em etc | |
| 416 | - */ | |
| 417 | - $allowed_tags = wp_kses_allowed_html('post'); // Details : https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/ | |
| 418 | - if( !is_array($allowed_tags) ) $allowed_tags = []; | |
| 418 | + $allowed_tags = wp_kses_allowed_html('post'); | |
| 419 | 419 | |
| 420 | 420 | $custom_tags = array( |
| 421 | 421 | 'select' => self::wp_kses_atts_map(array('class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size')), |
| 422 | 422 | 'input' => self::wp_kses_atts_map(array('class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'size', 'type', 'checked', 'readonly', 'placeholder', 'value', 'maxlength', 'min', 'max', 'multiple', 'pattern', 'step', 'autocomplete')), |
| @@ -569,7 +569,5 @@ | ||
| 569 | 569 | '; |
| 570 | 570 | } |
| 571 | 571 | return $icon; |
| 572 | 572 | } |
| 573 | - | |
| 574 | - | |
| 575 | 573 | } |