[ 'button' => true, 'testimonial' => true, 'pricing-table' => true, 'image-box' => true, 'icon-list' => true, ], 'version' => AWKE_VERSION, ]; $settings = wp_parse_args(get_option('awke_settings', []), $defaults); if (!empty($key)) { return isset($settings[$key]) ? $settings[$key] : null; } return $settings; } /** * Update Plugin Settings * * Update plugin settings. * * @since 1.0.0 * @param array $new_settings New settings to save. * @return bool True if settings were updated, false otherwise. */ function awke_update_settings($new_settings) { $current_settings = awke_get_settings(); $updated_settings = wp_parse_args($new_settings, $current_settings); return update_option('awke_settings', $updated_settings); } /** * Check if Pro Plugin is Active * * Check if the Pro version of the plugin is active. * * @since 1.0.0 * @return bool True if Pro plugin is active, false otherwise. */ function awke_is_pro_active() { return defined('AWKE_PRO_VERSION') && class_exists('Advanced_Widget_Kit_Pro'); } /** * Get Widget List * * Get list of available widgets. * * @since 1.0.0 * @param string $type Widget type (free, pro, all). * @return array List of widgets. */ function awke_get_widget_list($type = 'all') { $free_widgets = [ 'button' => [ 'title' => esc_html__('Button Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced button with gradient, icon, and hover effects', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-button', 'type' => 'free', ], 'testimonial' => [ 'title' => esc_html__('Testimonial Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Display customer testimonials with photo, name, and rating', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-testimonial', 'type' => 'free', ], 'pricing-table' => [ 'title' => esc_html__('Pricing Table Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Beautiful pricing table for your services', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-price-table', 'type' => 'free', ], 'image-box' => [ 'title' => esc_html__('Image Box Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Image box with hover effects and overlay content', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-image-box', 'type' => 'free', ], 'icon-list' => [ 'title' => esc_html__('Icon List Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('List with custom icons and styling options', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-bullet-list', 'type' => 'free', ], 'header' => [ 'title' => esc_html__('Advanced Header Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced header with sticky navigation, transparent options, and modern design', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-header', 'type' => 'free', ], 'advanced-heading' => [ 'title' => esc_html__('Advanced Heading Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced heading with gradient text, animations, and modern effects', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-heading', 'type' => 'free', ], 'advanced-carousel' => [ 'title' => esc_html__('Advanced Carousel Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced carousel with multiple layouts, animations, and touch support', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-carousel', 'type' => 'free', ], 'advanced-image-gallery' => [ 'title' => esc_html__('Advanced Image Gallery Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced image gallery with masonry/grid layouts, lightbox, filtering, and hover effects', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-gallery-grid', 'type' => 'free', ], 'advanced-contact-form' => [ 'title' => esc_html__('Advanced Contact Form Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Advanced contact form with multiple layouts, animations, and touch support', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-form-horizontal', 'type' => 'free', ], 'advanced-social-icons' => [ 'title' => esc_html__('Advanced Social Icons Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Professional social media icons with multiple layouts, hover effects, and brand colors', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-social-icons', 'type' => 'free', ], 'advanced-posts' => [ 'title' => esc_html__('Advanced Posts Widget', 'advanced-widget-kit-for-elementor'), 'description' => esc_html__('Display posts from any post type including custom post types in beautiful grid, list, or masonry layouts', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-posts-grid', 'type' => 'free', ], ]; $pro_widgets = apply_filters('awke_pro_widgets', []); $all_widgets = array_merge($free_widgets, $pro_widgets); switch ($type) { case 'free': return $free_widgets; case 'pro': return $pro_widgets; default: return $all_widgets; } } /** * Check if Widget is Enabled * * Check if a specific widget is enabled. * * @since 1.0.0 * @param string $widget_key Widget key to check. * @return bool True if widget is enabled, false otherwise. */ function awke_is_widget_enabled($widget_key) { $enabled_widgets = awke_get_settings('enabled_widgets'); return isset($enabled_widgets[$widget_key]) && $enabled_widgets[$widget_key]; } /** * Sanitize Widget Key * * Sanitize widget key for safe usage. * * @since 1.0.0 * @param string $widget_key Widget key to sanitize. * @return string Sanitized widget key. */ function awke_sanitize_widget_key($widget_key) { return sanitize_key($widget_key); } /** * Get Template Directory * * Get the template directory path. * * @since 1.0.0 * @param string $type Template type (free, pro). * @return string Template directory path. */ function awke_get_template_dir($type = 'free') { return AWKE_PATH . 'templates/' . $type . '/'; } /** * Get Template URL * * Get the template directory URL. * * @since 1.0.0 * @param string $type Template type (free, pro). * @return string Template directory URL. */ function awke_get_template_url($type = 'free') { return AWKE_URL . 'templates/' . $type . '/'; } /** * Log Debug Message * * Log debug message if WP_DEBUG is enabled. * * @since 1.0.0 * @param mixed $message Message to log. * @param string $level Log level (info, warning, error). */ function awke_log($message, $level = 'info') { // Debug logging removed for production } /** * Get Pro Upgrade URL * * Get the URL for upgrading to Pro version. * * @since 1.0.0 * @param string $source Source of the upgrade link. * @return string Upgrade URL. */ function awke_get_pro_url($source = 'general') { $base_url = 'https://awk.ainixit.com/'; $utm_params = [ 'utm_source' => 'plugin', 'utm_medium' => 'upgrade-link', 'utm_campaign' => $source, ]; return add_query_arg($utm_params, $base_url); } /** * Render Pro Badge * * Render a Pro badge for locked features. * * @since 1.0.0 * @param bool $echo Whether to echo or return the badge. * @return string|void Pro badge HTML. */ function awke_pro_badge($echo = true) { $badge = '' . esc_html__('Pro', 'advanced-widget-kit-for-elementor') . ''; if ($echo) { echo wp_kses_post($badge); } else { return $badge; } } /** * Check Elementor Requirements * * Check if Elementor meets the minimum requirements. * * @since 1.0.0 * @return bool True if requirements are met, false otherwise. */ function awke_check_elementor_requirements() { if (!did_action('elementor/loaded')) { return false; } if (!version_compare(ELEMENTOR_VERSION, '3.0.0', '>=')) { return false; } return true; }