| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Classes; | |
| 3 | +namespace WPAdminify\Inc\Classes; | |
| 4 | +use WPAdminify\Inc\Utils; | |
| 4 | 5 | |
| 5 | 6 | // no direct access allowed |
| 6 | 7 | if (!defined('ABSPATH')) { |
| 7 | 8 | exit; |
| @@ -10,13 +11,13 @@ | ||
| 10 | 11 | class Helper |
| 11 | 12 | { |
| 12 | 13 | |
| 13 | 14 | // Admin Path |
| 14 | - public static function pxlbsadminify_admin_path($path) | |
| 15 | + public static function jltwp_adminify_admin_path($path) | |
| 15 | 16 | { |
| 16 | 17 | // Get custom filter path |
| 17 | - if (has_filter('pxlbsadminify_admin_path')) { | |
| 18 | - return apply_filters('pxlbsadminify_admin_path', $path); | |
| 18 | + if (has_filter('jltwp_adminify_admin_path')) { | |
| 19 | + return apply_filters('jltwp_adminify_admin_path', $path); | |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | // Get plugin path |
| 22 | 23 | return plugins_url($path, __DIR__); |
| @@ -98,9 +99,8 @@ | ||
| 98 | 99 | * @return boolean |
| 99 | 100 | */ |
| 100 | 101 | public static function is_elementor_editor_page() |
| 101 | 102 | { |
| 102 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 103 | 103 | return !empty($_GET['elementor-preview']); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| @@ -206,9 +206,9 @@ | ||
| 206 | 206 | * @return void |
| 207 | 207 | */ |
| 208 | 208 | public static function allowed_host($url) |
| 209 | 209 | { |
| 210 | - $url_parsed = wp_parse_url($url); | |
| 210 | + $url_parsed = parse_url($url); | |
| 211 | 211 | if (isset($url_parsed['host'])) { |
| 212 | 212 | $allowed_hosts[] = $url_parsed['host']; |
| 213 | 213 | add_filter('allowed_redirect_hosts', function ($hosts) use ($allowed_hosts) { |
| 214 | 214 | return array_merge($hosts, $allowed_hosts); |
| @@ -235,9 +235,9 @@ | ||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $caps = array_unique($caps); |
| 238 | 238 | |
| 239 | - $caps = (array) apply_filters('pxlbsadminify_capabilities', $caps); | |
| 239 | + $caps = (array) apply_filters('adminify_capabilities', $caps); | |
| 240 | 240 | |
| 241 | 241 | sort($caps); |
| 242 | 242 | |
| 243 | 243 | return array_combine($caps, $caps); |
| @@ -262,11 +262,11 @@ | ||
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | 264 | * Remove spaces from Plugin Slug |
| 265 | 265 | */ |
| 266 | - public static function slug_cleanup() | |
| 266 | + public static function jltwp_adminify_slug_cleanup() | |
| 267 | 267 | { |
| 268 | - return str_replace('-', '_', strtolower(PXLBSADMINIFY_SLUG)); | |
| 268 | + return str_replace('-', '_', strtolower(WP_ADMINIFY_SLUG)); | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * Function current_datetime() compability for wp version < 5.3 |
| @@ -272,45 +272,40 @@ | ||
| 272 | 272 | * Function current_datetime() compability for wp version < 5.3 |
| 273 | 273 | * |
| 274 | 274 | * @return DateTimeImmutable |
| 275 | 275 | */ |
| 276 | - public static function custom_current_datetime() | |
| 276 | + public static function jltwp_adminify_current_datetime() | |
| 277 | 277 | { |
| 278 | 278 | if (function_exists('current_datetime')) { |
| 279 | 279 | return current_datetime(); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - return new \DateTimeImmutable('now', self::custom_wp_timezone()); | |
| 282 | + return new \DateTimeImmutable('now', self::jltwp_adminify_wp_timezone()); | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
| 286 | - * Function custom_wp_timezone() compability for wp version < 5.3 | |
| 286 | + * Function jltwp_adminify_wp_timezone() compability for wp version < 5.3 | |
| 287 | 287 | * |
| 288 | 288 | * @return DateTimeZone |
| 289 | 289 | */ |
| 290 | - public static function custom_wp_timezone() | |
| 290 | + public static function jltwp_adminify_wp_timezone() | |
| 291 | 291 | { |
| 292 | 292 | if (function_exists('wp_timezone')) { |
| 293 | 293 | return wp_timezone(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - return new \DateTimeZone(self::custom_wp_timezone_string()); | |
| 296 | + return new \DateTimeZone(self::jltwp_adminify_wp_timezone_string()); | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | - * Public Jewel Theme API base URL. | |
| 300 | + * API Endpoint | |
| 301 | 301 | * |
| 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 | 302 | * @return string |
| 308 | 303 | */ |
| 309 | 304 | public static function api_endpoint() |
| 310 | 305 | { |
| 311 | - $api_endpoint_url = 'https://pixarlabs.com'; | |
| 312 | - $api_endpoint = apply_filters('pxlbsadminify_endpoint', $api_endpoint_url); | |
| 306 | + $api_endpoint_url = 'https://bo.jeweltheme.com'; | |
| 307 | + $api_endpoint = apply_filters('jltwp_adminify_endpoint', $api_endpoint_url); | |
| 313 | 308 | |
| 314 | 309 | return trailingslashit($api_endpoint); |
| 315 | 310 | } |
| 316 | 311 | |
| @@ -320,21 +315,34 @@ | ||
| 320 | 315 | * @return string |
| 321 | 316 | */ |
| 322 | 317 | public static function crm_endpoint() |
| 323 | 318 | { |
| 324 | - $crm_endpoint_url = self::api_endpoint() . 'api/plugin/subscribe'; | |
| 325 | - $crm_endpoint = apply_filters('pxlbsadminify_subscribe_endpoint', $crm_endpoint_url); | |
| 319 | + $crm_endpoint_url = 'https://bo.jeweltheme.com/wp-json/jlt-api/v1/subscribe'; // Endpoint . | |
| 320 | + $crm_endpoint = apply_filters('jltwp_adminify_crm_crm_endpoint', $crm_endpoint_url); | |
| 326 | 321 | |
| 327 | 322 | return trailingslashit($crm_endpoint); |
| 328 | 323 | } |
| 329 | 324 | |
| 330 | 325 | /** |
| 331 | - * Function custom_wp_timezone_string() compability for wp version < 5.3 | |
| 326 | + * CRM Endpoint | |
| 332 | 327 | * |
| 333 | 328 | * @return string |
| 334 | 329 | */ |
| 335 | - public static function custom_wp_timezone_string() | |
| 330 | + public static function crm_survey_endpoint() | |
| 336 | 331 | { |
| 332 | + $crm_feedback_endpoint_url = 'https://bo.jeweltheme.com/wp-json/jlt-api/v1/survey'; // Endpoint . | |
| 333 | + $crm_feedback_endpoint = apply_filters('jltwp_adminify_crm_crm_endpoint', $crm_feedback_endpoint_url); | |
| 334 | + | |
| 335 | + return trailingslashit($crm_feedback_endpoint); | |
| 336 | + } | |
| 337 | + | |
| 338 | + /** | |
| 339 | + * Function jltwp_adminify_wp_timezone_string() compability for wp version < 5.3 | |
| 340 | + * | |
| 341 | + * @return string | |
| 342 | + */ | |
| 343 | + public static function jltwp_adminify_wp_timezone_string() | |
| 344 | + { | |
| 337 | 345 | $timezone_string = get_option('timezone_string'); |
| 338 | 346 | |
| 339 | 347 | if ($timezone_string) { |
| 340 | 348 | return $timezone_string; |
| @@ -364,25 +372,24 @@ | ||
| 364 | 372 | public static function get_merged_data($data, $start_date = '', $end_data = '') |
| 365 | 373 | { |
| 366 | 374 | $_data = shortcode_atts( |
| 367 | 375 | array( |
| 368 | - 'image_url' => PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png', | |
| 376 | + 'image_url' => WP_ADMINIFY_ASSETS_IMAGE . '/promo-image.png', | |
| 369 | 377 | 'start_date' => $start_date, |
| 370 | 378 | 'end_date' => $end_data, |
| 371 | 379 | 'counter_time' => '', |
| 372 | - 'is_live' => false, | |
| 380 | + 'is_campaign' => 'false', | |
| 373 | 381 | 'button_text' => 'Get Premium', |
| 374 | 382 | 'button_url' => 'https://wpadminify.com/pricing', |
| 375 | 383 | 'btn_color' => '#CC22FF', |
| 376 | 384 | 'notice' => '', |
| 377 | 385 | 'notice_timestamp' => '', |
| 378 | - 'show_for_premium' => 'false', | |
| 379 | 386 | ), |
| 380 | 387 | $data |
| 381 | 388 | ); |
| 382 | 389 | |
| 383 | 390 | if (empty($_data['image_url'])) { |
| 384 | - $_data['image_url'] = PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png'; | |
| 391 | + $_data['image_url'] = WP_ADMINIFY_ASSETS_IMAGE . '/promo-image.png'; | |
| 385 | 392 | } |
| 386 | 393 | |
| 387 | 394 | return $_data; |
| 388 | 395 | } |