File manager - Edit - /home/verseaumee/middletvnew/wp-content/plugins/armember-membership/autoload.php
Back
<?php if ( ! defined( 'MEMBERSHIPLITE_CORE_DIR' ) ) { if ( is_ssl() ) { define( 'MEMBERSHIPLITE_URL', str_replace( 'http://', 'https://', WP_PLUGIN_URL . '/' . MEMBERSHIPLITE_DIR_NAME ) ); define( 'ARMLITE_HOME_URL', home_url( '', 'https' ) ); } else { define( 'MEMBERSHIPLITE_URL', WP_PLUGIN_URL . '/' . MEMBERSHIPLITE_DIR_NAME ); define( 'ARMLITE_HOME_URL', home_url() ); } define( 'MEMBERSHIPLITE_CORE_DIR', MEMBERSHIPLITE_DIR . '/core' ); define( 'MEMBERSHIPLITE_CLASSES_DIR', MEMBERSHIPLITE_DIR . '/core/classes' ); define( 'MEMBERSHIPLITE_CLASSES_URL', MEMBERSHIPLITE_URL . '/core/classes' ); define( 'MEMBERSHIPLITE_WIDGET_DIR', MEMBERSHIPLITE_DIR . '/core/widgets' ); define( 'MEMBERSHIPLITE_WIDGET_URL', MEMBERSHIPLITE_URL . '/core/widgets' ); define( 'MEMBERSHIPLITE_IMAGES_DIR', MEMBERSHIPLITE_DIR . '/images' ); define( 'MEMBERSHIPLITE_IMAGES_URL', MEMBERSHIPLITE_URL . '/images' ); define( 'MEMBERSHIPLITE_LIBRARY_DIR', MEMBERSHIPLITE_DIR . '/lib' ); define( 'MEMBERSHIPLITE_LIBRARY_URL', MEMBERSHIPLITE_URL . '/lib' ); define( 'MEMBERSHIPLITE_INC_DIR', MEMBERSHIPLITE_DIR . '/inc' ); define( 'MEMBERSHIPLITE_VIEWS_DIR', MEMBERSHIPLITE_DIR . '/core/views' ); define( 'MEMBERSHIPLITE_VIEWS_URL', MEMBERSHIPLITE_URL . '/core/views' ); define( 'MEMBERSHIPLITE_VIDEO_URL', 'https://www.youtube.com/embed/WhKgS2jv2xM' ); define( 'MEMBERSHIPLITE_DOCUMENTATION_URL', 'https://www.armemberplugin.com/documentation' ); } if ( ! defined( 'FS_METHOD' ) ) { define( 'FS_METHOD', 'direct' ); } /* Cornerstone */ /* DEBUG LOG CONSTANTS */ define( 'MEMBERSHIPLITE_DEBUG_LOG', false ); /* true - enable debug log (Default) & false - disable debug log */ define( 'MEMBERSHIPLITE_DEBUG_LOG_TYPE', 'ARM_ALL' ); /* Possible Values ARM_ALL - Enable Debug Log for All types for restriction & redirection rules (Default). ARM_ADMIN_PANEL - Enable Debug Log for WordPress admin panel restriction & redirection rules. ARM_POSTS - Enable Debug Log for WordPress default posts for restriction & redirection rules. ARM_PAGES - Enable Debug Log for WordPress default pages for restriction & redirection rules. ARM_TAXONOMY - Enable Debug Log for all taxonomies for restriction & redirection rules. ARM_MENU - Enable Debug Log for WordPress Menu for restriction & redirection rules. ARM_CUSTOM - Enable Debug Log for all types of custom posts for restriction & redirection rules. ARM_SPECIAL_PAGE - Enable Debug Log for all types of special pages like Archive Page, Author Page, Category Page, etc. ARM_SHORTCODE - Enable Debug Log for all types of restriction & redirection rules applied using shortcodes ARM_MAIL - Enable Debug Log for all content before mail sent. */ global $arm_lite_datepicker_loaded, $arm_lite_avatar_loaded, $arm_lite_file_upload_field, $arm_lite_bpopup_loaded, $arm_lite_load_tipso, $arm_lite_popup_modal_elements, $arm_lite_is_access_rule_applied, $arm_lite_load_icheck, $arm_lite_font_awesome_loaded, $arm_lite_inner_form_modal,$arm_lite_forms_page_arr, $ARMemberLiteAllowedHTMLTagsArray,$arm_ajax_pattern_start,$arm_ajax_pattern_end; $arm_ajax_pattern_start= "<---ARM-AJAX-RESPONSE-START--->"; $arm_ajax_pattern_end = '<---ARM-AJAX-RESPONSE-END--->'; $arm_lite_is_access_rule_applied = 0; $arm_lite_datepicker_loaded = $arm_lite_avatar_loaded = $arm_lite_file_upload_field = $arm_lite_bpopup_loaded = $arm_lite_load_tipso = $arm_lite_font_awesome_loaded = 0; $arm_lite_popup_modal_elements = array(); $arm_lite_inner_form_modal = array(); $arm_lite_forms_page_arr = array(); global $arm_case_types; $arm_case_types = array( 'admin_panel' => array( 'protected' => false, 'type' => 'redirect', ), 'page' => array( 'protected' => false, 'type' => 'redirect', ), 'post' => array( 'protected' => false, 'type' => 'redirect', ), 'taxonomy' => array( 'protected' => false, 'type' => 'redirect', ), 'menu' => array( 'protected' => false, 'type' => 'redirect', ), 'custom' => array( 'protected' => false, 'type' => 'redirect', ), 'special' => array( 'protected' => false, 'type' => 'redirect', ), 'shortcode' => array( 'protected' => false, 'type' => 'redirect', ), 'mail' => array( 'protected' => false, 'type' => 'redirect', ), ); $arm_lite_wpupload_dir = wp_upload_dir(); $arm_lite_upload_dir = $arm_lite_wpupload_dir['basedir'] . '/armember'; $arm_lite_upload_url = $arm_lite_wpupload_dir['baseurl'] . '/armember'; if ( ! is_dir( $arm_lite_upload_dir ) ) { wp_mkdir_p( $arm_lite_upload_dir ); } define( 'MEMBERSHIPLITE_UPLOAD_DIR', $arm_lite_upload_dir ); define( 'MEMBERSHIPLITE_UPLOAD_URL', $arm_lite_upload_url ); /* Defining Membership Plugin Version */ global $arm_lite_version,$armember_website_url; $arm_lite_version = '5.5'; define( 'MEMBERSHIPLITE_VERSION', $arm_lite_version ); $armember_website_url = "https://armemberplugin.com/"; global $arm_lite_ajaxurl; $arm_lite_ajaxurl = admin_url( 'admin-ajax.php' ); global $arm_lite_errors; $arm_lite_errors = new WP_Error(); global $arm_lite_widget_effects; global $armlite_default_user_details_text; /** * Plugin Main Class */ global $ARMemberLite, $arm_lite_debug_payment_log_id, $arm_lite_debug_general_log_id, $arm_lite_bf_sale_start_time, $arm_lite_bf_sale_end_time; $ARMemberLite = new ARMemberlite(); $arm_lite_debug_payment_log_id =0; $arm_lite_debug_general_log_id = 0; $arm_lite_bf_sale_start_time = "1776427200"; //black friday sale start time $arm_lite_bf_sale_end_time = "1777568400"; //black friday sale end time if(!$ARMemberLite->is_arm_pro_active){ if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members.php'; } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/class.arm_setup_wizard.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/class.arm_setup_wizard.php"); } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_modal_view_in_menu.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_modal_view_in_menu.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_restriction.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_restriction.php'; } if (file_exists(MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_manage_subscription.php')) { include( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_manage_subscription.php'); } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_payment_gateways.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_payment_gateways.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_shortcodes.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_shortcodes.php'; } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/class.arm_updates_cron.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/class.arm_updates_cron.php"); } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_gateways_paypal.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_gateways_paypal.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_global_settings.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_global_settings.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_membership_setup.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_membership_setup.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_member_forms.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_member_forms.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members_directory.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members_directory.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_subscription_plans.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_subscription_plans.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_transaction.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_transaction.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_crons.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_crons.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_manage_communication.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_manage_communication.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members_activity.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_members_activity.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_social_feature.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_social_feature.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_access_rules.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_access_rules.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_email_settings.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_email_settings.php'; } if ( file_exists( MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_spam_filter.php' ) ) { require_once MEMBERSHIPLITE_CLASSES_DIR . '/class.arm_spam_filter.php'; } if ( file_exists( MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_dashboard_widgets.php' ) ) { require_once MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_dashboard_widgets.php'; } if ( file_exists( MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetForm.php' ) ) { require_once MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetForm.php'; } if ( file_exists( MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetlatestMembers.php' ) ) { require_once MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetlatestMembers.php'; } if ( file_exists( MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetloginwidget.php' ) ) { require_once MEMBERSHIPLITE_WIDGET_DIR . '/class.arm_widgetloginwidget.php'; } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_gutenberg_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_gutenberg_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_beaver_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_beaver_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_divi_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_divi_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_wpbakery_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_wpbakery_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_fusion_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_fusion_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_oxygen_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_oxygen_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_siteorigin_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_siteorigin_builder_restriction.php"); } if(file_exists(MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_bricks_builder_restriction.php")){ require_once( MEMBERSHIPLITE_CLASSES_DIR . "/arm_builder/class.arm_bricks_builder_restriction.php"); } if(is_plugin_active('elementor/elementor.php')) { require_once(MEMBERSHIPLITE_CORE_DIR . '/classes/arm_builder/class.arm_elementor_membership_shortcode.php'); global $ARMelementor; $ARMelementor = new arm_lite_membership_elementcontroller(); } } if( file_exists(MEMBERSHIPLITE_CLASSES_DIR.'/class.armemberlite.php')){ require_once MEMBERSHIPLITE_CLASSES_DIR.'/class.armemberlite.php'; } if( file_exists(MEMBERSHIPLITE_CLASSES_DIR.'/class.arm_growth_plugin.php')){ require_once MEMBERSHIPLITE_CLASSES_DIR.'/class.arm_growth_plugin.php'; } global $arm_lite_api_url, $arm_lite_plugin_slug, $wp_version; // Query monitor register_uninstall_hook( MEMBERSHIPLITE_DIR . '/armember-membership.php', array( 'ARMemberlite', 'uninstall' ) ); class ARMemberlite { var $arm_slugs; var $tbl_arm_activity; var $tbl_arm_auto_message; var $tbl_arm_email_templates; var $tbl_arm_entries; var $tbl_arm_fail_attempts; var $tbl_arm_forms; var $tbl_arm_form_field; var $tbl_arm_lockdown; var $tbl_arm_members; var $tbl_arm_membership_setup; var $tbl_arm_payment_log; var $tbl_arm_bank_transfer_log; var $tbl_arm_subscription_plans; var $tbl_arm_termmeta; var $tbl_arm_member_templates; var $is_arm_pro_active; var $tbl_arm_debug_payment_log; var $tbl_arm_debug_general_log; var $tbl_arm_login_history; function __construct() { global $wp, $wpdb, $arm_db_tables, $arm_access_rules, $arm_capabilities_global, $ARMemberLiteAllowedHTMLTagsArray; $this->is_arm_pro_active = $this->arm_is_pro_active(); $arm_db_tables = array( 'tbl_arm_activity' => $wpdb->prefix . 'arm_activity', 'tbl_arm_auto_message' => $wpdb->prefix . 'arm_auto_message', 'tbl_arm_email_templates' => $wpdb->prefix . 'arm_email_templates', 'tbl_arm_entries' => $wpdb->prefix . 'arm_entries', 'tbl_arm_fail_attempts' => $wpdb->prefix . 'arm_fail_attempts', 'tbl_arm_forms' => $wpdb->prefix . 'arm_forms', 'tbl_arm_form_field' => $wpdb->prefix . 'arm_form_field', 'tbl_arm_lockdown' => $wpdb->prefix . 'arm_lockdown', 'tbl_arm_members' => $wpdb->prefix . 'arm_members', 'tbl_arm_membership_setup' => $wpdb->prefix . 'arm_membership_setup', 'tbl_arm_payment_log' => $wpdb->prefix . 'arm_payment_log', 'tbl_arm_bank_transfer_log' => $wpdb->prefix . 'arm_bank_transfer_log', 'tbl_arm_subscription_plans' => $wpdb->prefix . 'arm_subscription_plans', 'tbl_arm_termmeta' => $wpdb->prefix . 'arm_termmeta', 'tbl_arm_member_templates' => $wpdb->prefix . 'arm_member_templates', 'tbl_arm_login_history' => $wpdb->prefix . 'arm_login_history', 'tbl_arm_debug_payment_log' => $wpdb->prefix . 'arm_debug_payment_log', 'tbl_arm_debug_general_log' => $wpdb->prefix . 'arm_debug_general_log' ); /* Set Database Table Variables. */ foreach ( $arm_db_tables as $key => $table ) { $this->$key = $table; } /* Set Page Slugs Global */ $this->arm_slugs = $this->arm_page_slugs(); /* Set Page Capabilities Global */ $arm_capabilities_global = array( 'arm_manage_members' => 'arm_manage_members', 'arm_manage_plans' => 'arm_manage_plans', 'arm_manage_setups' => 'arm_manage_setups', 'arm_manage_forms' => 'arm_manage_forms', 'arm_manage_access_rules' => 'arm_manage_access_rules', 'arm_manage_subscriptions' => 'arm_manage_subscriptions', 'arm_manage_transactions' => 'arm_manage_transactions', 'arm_manage_email_notifications' => 'arm_manage_email_notifications', 'arm_manage_communication' => 'arm_manage_communication', 'arm_manage_member_templates' => 'arm_manage_member_templates', 'arm_manage_general_settings' => 'arm_manage_general_settings', 'arm_manage_feature_settings' => 'arm_manage_feature_settings', 'arm_manage_block_settings' => 'arm_manage_block_settings', 'arm_manage_payment_gateways' => 'arm_manage_payment_gateways', 'arm_import_export' => 'arm_import_export', 'arm_growth_plugins' => 'arm_growth_plugins', ); register_activation_hook( MEMBERSHIPLITE_DIR . '/armember-membership.php', array( 'ARMemberlite', 'install' ) ); register_activation_hook( MEMBERSHIPLITE_DIR . '/armember-membership.php', array( 'ARMemberlite', 'armember_check_network_activation' ) ); register_deactivation_hook(MEMBERSHIPLITE_DIR . '/armember-membership.php', array( 'ARMemberlite', 'deactivate__armember_lite_version' )); add_filter( 'arm_admin_notice', array( $this, 'arm_display_news_notices' ), 1 ); add_action( 'wp_ajax_arm_dismiss_news', array( $this, 'arm_dismiss_news_notice' ) ); /* Load Language TextDomain */ add_action( 'init', array( $this, 'arm_load_textdomain' ) ); /* Add 'Addon' link in plugin list */ add_filter( 'plugin_action_links', array( $this, 'armPluginActionLinks' ), 10, 2 ); /* Hide Update Notification */ /* Init Hook */ add_action( 'init', array( $this, 'arm_init_action' ) ); add_action( 'init', array( $this, 'wpdbfix' ) ); add_action( 'switch_blog', array( $this, 'wpdbfix' ) ); // Query monitor add_action( 'admin_init', array( $this, 'arm_install_plugin_data' ), 1000 ); add_action( 'admin_body_class', array( $this, 'arm_admin_body_class' ) ); if (!is_plugin_active( 'armember/armember.php' ) ) { add_action( 'admin_menu', array( $this, 'arm_menu' ), 27 ); add_action( 'admin_menu', array( $this, 'arm_set_last_menu' ), 50 ); add_action( 'admin_init', array( $this, 'arm_hide_update_notice' ), 1 ); add_action( 'admin_enqueue_scripts', array( $this, 'set_css' ), 11 ); add_action( 'admin_enqueue_scripts', array( $this, 'set_js' ), 11 ); // add_action( 'admin_enqueue_scripts', array( $this, 'set_global_javascript_variables' ), 10 ); add_action( 'wp_head', array( $this, 'set_front_css' ), 1 ); add_action( 'wp_head', array( $this, 'set_front_js' ), 1 ); // add_action( 'wp_head', array( $this, 'set_global_javascript_variables' ) ); add_action( 'admin_footer', array( $this, 'arm_add_document_video' ), 1 ); add_action( 'admin_footer', array( $this, 'arm_add_new_version_release_note' ), 1 ); add_action( 'arm_admin_messages', array( $this, 'arm_admin_messages_init' ) ); add_action( 'admin_bar_menu', array( $this, 'arm_add_debug_bar_menu' ), 999 ); /* Add Document Video For First Time */ add_action( 'wp_ajax_arm_do_not_show_video', array( $this, 'arm_do_not_show_video' ), 1 ); /* Add what's new popup */ add_action( 'wp_ajax_arm_dont_show_upgrade_notice', array( $this, 'arm_dont_show_upgrade_notice' ), 1 ); /* For Admin Menus. */ add_action( 'adminmenu', array( $this, 'arm_set_adminmenu' ) ); add_action( 'wp_logout', array( $this, 'ARM_EndSession' ) ); add_action( 'wp_login', array( $this, 'ARM_EndSession' ) ); add_action('wp_ajax_arm_get_need_help_content', array( $this, 'arm_get_need_help_content_func' ), 10, 1); /* Include All Class Files. */ // Query Monitor if ( ! function_exists( 'is_plugin_active' ) ) { require ABSPATH . '/wp-admin/includes/plugin.php'; } if ( is_plugin_active( 'js_composer/js_composer.php' ) && file_exists( MEMBERSHIPLITE_CORE_DIR . '/vc/class_vc_extend.php' ) ) { require_once MEMBERSHIPLITE_CORE_DIR . '/vc/class_vc_extend.php'; global $armlite_vcextend; $armlite_vcextend = new ARMLITE_VCExtend(); } if ( is_plugin_active( 'wp-rocket/wp-rocket.php' ) && ! is_admin() ) { add_filter( 'script_loader_tag', array( $this, 'arm_prevent_rocket_loader_script' ), 10, 2 ); } /* Register Element for Cornerstone */ /* add_action('wp_enqueue_scripts',array($this,'armember_cs_enqueue')); add_action('cornerstone_register_elements',array($this,'armember_cs_register_element')); add_filter('cornerstone_icon_map',array($this,'armember_cs_icon_map')); */ /* Register Element for Cornerstone */ add_action( 'wp_footer', array( $this, 'arm_set_js_css_conditionally' ), 11 ); if ( ! empty( $GLOBALS['wp_version'] ) && version_compare( $GLOBALS['wp_version'], '5.7.2', '>' ) ) { add_filter( 'block_categories_all', array( $this, 'arm_gutenberg_category' ), 10, 2 ); } else { add_filter( 'block_categories', array( $this, 'arm_gutenberg_category' ), 10, 2 ); } add_action( 'enqueue_block_editor_assets', array( $this, 'arm_enqueue_gutenberg_assets' ) ); add_action('arm_payment_log_entry', array($this, 'arm_write_payment_log'), 10, 6); add_action('arm_general_log_entry', array( $this, 'arm_write_general_log'), 10, 4); } add_action( 'admin_enqueue_scripts', array( $this, 'armlite_enqueue_notice_assets' ), 10 ); add_action( 'admin_notices', array( $this, 'armlite_display_notice_for_rating' ) ); add_action( 'wp_ajax_armlite_dismiss_rate_notice', array( $this, 'armlite_reset_ratenow_notice' ) ); add_action( 'wp_ajax_armlite_dismiss_rate_notice_no_display', array( $this, 'armlite_reset_ratenow_notice_never' ) ); add_action('wp_ajax_arm_reinit_nonce_var',array($this,'arm_reinit_nonce_var_func')); add_action( 'wp_ajax_nopriv_arm_reinit_nonce_var', array($this,'arm_reinit_nonce_var_func')); $ARMemberLiteAllowedHTMLTagsArray = $this->armember_allowed_html_tags(); } function arm_reinit_nonce_var_func(){ global $ARMemberLite,$arm_capabilities_global; $ARMemberLite->arm_session_start(); $form_key = sanitize_text_field( $_POST['form_key'] ); //phpcs:ignore if ( ! empty( $form_key ) ) { if( !empty($_SESSION['ARM_FILTER_INPUT']) && !empty($_SESSION['ARM_FILTER_INPUT'][ $form_key ]) ) { if(isset($_POST['action']) && $_POST['action'] == 'arm_reinit_nonce_var'){//phpcs:ignore echo wp_json_encode(array( 'nonce' => wp_create_nonce('arm_wp_nonce'))); } } } die(); } function arm_write_payment_log($arm_log_payment_gateway, $arm_log_event, $arm_log_event_from = 'armember-membership', $arm_payment_log_raw_data = '', $arm_ref_id = 0, $arm_log_status = 1) { global $wpdb, $ARMemberLite, $arm_payment_gateways, $arm_lite_debug_payment_log_id, $arm_capabilities_global, $arm_payment_gateways_data_logs, $arm_payment_gateways_data_logs_flag; if(empty($arm_payment_gateways_data_logs) && empty($arm_payment_gateways_data_logs_flag) ) { $arm_payment_gateways_data_logs = $arm_payment_gateways->arm_get_all_payment_gateways_for_setup(); $arm_payment_gateways_data_logs_flag = 1; } $inserted_id = 0; if( !empty($arm_payment_gateways_data_logs[$arm_log_payment_gateway]['payment_debug_logs']) ) { $tbl_arm_debug_payment_log = $ARMemberLite->tbl_arm_debug_payment_log; if($arm_ref_id==NULL) { $arm_ref_id = 0; } $arm_database_log_data = array( 'arm_payment_log_ref_id' => $arm_ref_id, 'arm_payment_log_gateway' => $arm_log_payment_gateway, 'arm_payment_log_event' => $arm_log_event, 'arm_payment_log_event_from' => $arm_log_event_from, 'arm_payment_log_status' => $arm_log_status, 'arm_payment_log_raw_data' => maybe_serialize(stripslashes_deep($arm_payment_log_raw_data)), 'arm_payment_log_added_date' => current_time('mysql'), ); //If reference id empty then insert log. $wpdb->insert($tbl_arm_debug_payment_log, $arm_database_log_data); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $inserted_id = $wpdb->insert_id; if(empty($arm_ref_id)) { $arm_ref_id = $inserted_id; } } $arm_lite_debug_payment_log_id = $arm_ref_id; return $inserted_id; } function arm_write_general_log($arm_log_event, $arm_log_event_name, $arm_log_event_from = 'armember', $arm_payment_log_raw_data = '') { global $wpdb, $ARMemberLite, $arm_lite_debug_general_log_id, $arm_capabilities_global, $arm_email_settings, $arm_is_cron_log_enabled,$arm_is_email_log_enabled ,$arm_is_cron_log_check_flag, $arm_is_opt_ins_log_enabled, $arm_is_opt_ins_log_check_flag,$arm_is_email_log_check_flag; if ($arm_log_event == 'cron') { if ( empty($arm_is_cron_log_enabled) && empty($arm_is_cron_log_check_flag) ) { $arm_is_cron_log_enabled = get_option('arm_cron_debug_log'); $arm_is_cron_log_check_flag = 1; } $arm_is_log_enabled = $arm_is_cron_log_enabled; } else if ($arm_log_event == 'email') { if ( empty($arm_is_email_log_enabled) && empty($arm_is_email_log_check_flag) ) { $arm_is_email_log_enabled = get_option('arm_email_debug_log'); $arm_is_email_log_check_flag = 1; } $arm_is_log_enabled = $arm_is_email_log_enabled; } else { if ($arm_email_settings->isOptInsFeature && empty($arm_is_opt_ins_log_enabled) && empty($arm_is_opt_ins_log_check_flag)) { $arm_is_opt_ins_log_enabled = get_option('arm_optins_debug_log'); $arm_is_opt_ins_log_check_flag = 1; } $arm_is_log_enabled = $arm_is_opt_ins_log_enabled; } $inserted_id = 0; if($arm_log_event != 'email') { $arm_payment_log_raw_data = maybe_serialize(stripslashes_deep($arm_payment_log_raw_data)); } if ( !empty($arm_is_log_enabled) ) { $tbl_arm_debug_general_log = $ARMemberLite->tbl_arm_debug_general_log; $arm_database_log_data = array( 'arm_general_log_event' => $arm_log_event, 'arm_general_log_event_name' => $arm_log_event_name, 'arm_general_log_event_from' => $arm_log_event_from, 'arm_general_log_raw_data' => $arm_payment_log_raw_data, 'arm_general_log_added_date' => current_time('mysql'), ); $wpdb->insert($tbl_arm_debug_general_log, $arm_database_log_data); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $inserted_id = $wpdb->insert_id; } return $inserted_id; } function armlite_enqueue_notice_assets() { global $arm_lite_version, $ARMemberLite; wp_register_script( 'armlite-admin-notice-script-js', MEMBERSHIPLITE_URL . '/js/armlite-admin-notice.js', array(), $arm_lite_version ); //phpcs:ignore wp_enqueue_script( 'armlite-admin-notice-script-js' ); if($ARMemberLite->is_arm_pro_active){ global $ARMember; $ARMember->set_global_javascript_variables(); } else { $this->set_global_javascript_variables(); } } function armlite_reset_ratenow_notice_never() { global $ARMemberLite; $ARMemberLite->arm_check_user_cap('',1); //phpcs:ignore --Reason:Verifying nonce update_option( 'armlite_display_rating_notice', 'no' ); update_option( 'armlite_never_display_rating_notice', 'true' ); die; } function armlite_reset_ratenow_notice() { global $ARMemberLite; $ARMemberLite->arm_check_user_cap('',1); //phpcs:ignore --Reason:Verifying nonce $nextEvent = strtotime( '+60 days' ); wp_schedule_single_event( $nextEvent, 'armlite_display_ratenow_popup' ); update_option( 'armlite_display_rating_notice', 'no' ); die; } function armlite_display_notice_for_rating() { global $arm_version; $display_notice = get_option( 'armlite_display_rating_notice' ); $display_notice_never = get_option( 'armlite_never_display_rating_notice' ); // echo "<br>Reputelog : display_notice : ".$display_notice." || display_notice_never : ".$display_notice_never;die; if ( '' != $display_notice && 'yes' == $display_notice && ( '' == $display_notice_never || 'yes' != $display_notice_never ) ) { $wpnonce = wp_create_nonce( 'arm_wp_nonce' ); $nonce = '<input type="hidden" name="arm_wp_nonce" value="'.esc_attr($wpnonce).'"/>'; $class = 'notice notice-warning armlite-rate-notice is-dismissible'; $message = sprintf( addslashes( esc_html__( "Hey, you've been using %1\$sARMember Lite%2\$s for a long time. %3\$sCould you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation. %4\$sYour help is much appreciated. Thank you very much - %5\$sRepute InfoSystems%6\$s", 'armember-membership' ) ), '<strong>', '</strong>', '<br/>', '<br/><br/>', '<strong>', '</strong>' ); $rate_link = 'https://wordpress.org/support/plugin/armember-membership/reviews/'; $rate_link_text = esc_html__( 'OK, you deserve it', 'armember-membership' ); $close_btn_text = esc_html__( 'No, Maybe later', 'armember-membership' ); $rated_link_text = esc_html__( 'I already did', 'armember-membership' ); printf( '<div class="%1$s"><p>%2$s</p><br/><br/><a href="%3$s" class="armlite_rate_link" target="_blank">%4$s</a><br/><a class="armlite_maybe_later_link" href="javascript:void(0);">%5$s</a><br/><a class="armlite_already_rated_link" href="javascript:void(0)">%6$s</a><br/> </div>', esc_attr( $class ), $message, esc_url( $rate_link ), esc_html( $rate_link_text ), esc_attr( $close_btn_text ), esc_html( $rated_link_text ), $nonce ); //phpcs:ignore } if ( !empty($arm_version) && version_compare( $arm_version, '7.2', '<' ) ) { $class = 'armember_notice_warning'; $wp_plugin_update_notification_lite = sprintf( esc_html__( 'To ensure full compatibility with the ARMember Lite version, please update the ARMember Pro to the latest version. For manual update instructions, please refer to %s', 'armember-membership'), '<a href="https://www.armemberplugin.com/documents/getting-started-with-armember/#armember-manual-update" target="_blank">'.esc_html__('our documentation', 'armember-membership').'</a>'); //phpcs:ignore // show admin notice $arm_license_notice = "<div class='" . esc_attr( $class ) . " red arm_dismiss_arm_lite_update_force_notice' style='display:block;'>" . $wp_plugin_update_notification_lite . "</div>"; //phpcs:ignore printf($arm_license_notice); //phpcs:ignore } } function arm_gutenberg_category( $category, $post ) { $new_category = array( array( 'slug' => 'armember', 'title' => 'ARMember Blocks', ), ); $final_categories = array_merge( $category, $new_category ); return $final_categories; } function arm_enqueue_gutenberg_assets(){ global $arm_lite_version,$arm_subscription_plans, $arm_gutenberg_block_restriction; $server_php_self = isset($_SERVER['PHP_SELF']) ? basename(sanitize_text_field($_SERVER['PHP_SELF'])) : ''; //phpcs:ignore if( !in_array( $server_php_self, array( 'site-editor.php', 'widgets.php' ) ) ) { $all_membership_plans = $arm_subscription_plans->arm_get_all_subscription_plans('arm_subscription_plan_id, arm_subscription_plan_name'); $all_plan_values_and_labels = array( array('value' => 'any_plan' , 'label' => esc_html__('Any Plan', 'armember-membership')), array('value' => 'unregistered' , 'label' => esc_html__('Non Loggedin Users', 'armember-membership')), array('value' => 'registered' , 'label' => esc_html__('Loggedin Users', 'armember-membership')) ); foreach( $all_membership_plans as $plan ) { $all_plan_values_and_labels[] = array( 'value' => $plan['arm_subscription_plan_id'], 'label' => $plan['arm_subscription_plan_name'] ); } wp_register_script( 'armlite_gutenberg_script', MEMBERSHIPLITE_URL . '/js/arm_gutenberg_script.js', array( 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-components','wp-editor','wp-block-editor' ), $arm_lite_version ); //phpcs:ignore wp_enqueue_script( 'armlite_gutenberg_script' ); $is_gutenberg_block_restriction_feature = $arm_gutenberg_block_restriction->isGutenbergBlockRestrictionFeature; $arm_block_esc_html = array(); $arm_block_esc_html['membership_shortcodes'] = array( 'block_title' => esc_html__('Membership Shortcodes', 'armember-membership'), 'keywords' => array(esc_html__('Membership', 'armember-membership'),esc_html__('ARMember', 'armember-membership'),esc_html__('Shortcode', 'armember-membership')), ); $arm_block_esc_html['restrict_content_shortcode'] = array( 'block_title' => esc_html__('Restrict Content Shortcode', 'armember-membership'), 'keywords' => array(esc_html__('Membership', 'armember-membership'),esc_html__('ARMember', 'armember-membership'),esc_html__('Restriction', 'armember-membership')), ); $arm_block_esc_html['armember_block_restriction'] = array( 'block_title' => esc_html__('ARMember Block Restriction', 'armember-membership'), 'keywords' => array(esc_html__('Membership', 'armember-membership'),esc_html__('ARMember', 'armember-membership'),esc_html__('Block', 'armember-membership'),esc_html__('Restriction', 'armember-membership')), 'description' => esc_html__('Nest blocks within this wrapper to control the inner block visibility by membership plans or for free membership only.', 'armember-membership'), 'restriction_type' => array( 'type' => esc_html__( "Restriction Type", 'armember-membership' ), 'show' => esc_html__("Show content only for", 'armember-membership' ), 'hide' => esc_html__("Hide content only for", 'armember-membership' ), ), 'membership_plan' => esc_html__( "Membership Plans", 'armember-membership' ), 'membership_plan_help' => esc_html__("If any of the following conditions will true then restrictions will apply on content", 'armember-membership' ), ); wp_localize_script( 'armlite_gutenberg_script', 'armember_block_admin', array( 'all_membership_plans' => $all_plan_values_and_labels, 'arm_gutenberg_block_restriction_feature' => $is_gutenberg_block_restriction_feature, 'arm_block_esc_html' => $arm_block_esc_html, )); wp_register_style( 'armlite_gutenberg_style', MEMBERSHIPLITE_URL . '/css/arm_gutenberg_style.css', array(), $arm_lite_version ); wp_enqueue_style( 'armlite_gutenberg_style' ); } } function arm_sample_admin_notice__success() { $is_arm_admin_notice_shown = 'block !important'; global $ARMemberLite; $arm_check_is_gutenberg_page = $ARMemberLite->arm_check_is_gutenberg_page(); if ( $arm_check_is_gutenberg_page ) { return true; } $arm_belt_margin = "24px 64px 0px"; if ( ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'arm_manage_forms' && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'edit_form' ) || (isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'arm_growth_plugins') ) { //phpcs:ignore $is_arm_admin_notice_shown = 'none !important'; } else if( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'arm_general_settings' ) //phpcs:ignore { $arm_belt_margin = "24px 24px"; } else if( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'arm_profiles_directories' ) //phpcs:ignore { $arm_belt_margin = "24px 32px 10px"; } ?> <div class="notice arm_admin_notice_shown" style="display: <?php echo esc_html($is_arm_admin_notice_shown); ?>;;color: #fff; padding: 0; border: none; margin-bottom: 0; background: linear-gradient(to right, #0F2027, #2C5364, #009F84); border-radius:8px;margin: <?php echo $arm_belt_margin; //phpcs:ignore ?>;"> <p class="arm_admin_notice_shown_icn" style="padding: 13px 2px 12px 19px;display: table-cell;width: 18px;text-align: center;vertical-align: middle;line-height: 24px;margin: 0 15px 0 0;"> <img src="<?php echo MEMBERSHIPLITE_IMAGES_URL; //phpcs:ignore ?>/arm_upgrade_to_premium.svg" width="18" height="18"/> </p> <p class="arm_admin_notice_shown_msg" style="display: table-cell; padding: 10px 0 0 15px; font-weight: 600; font-size: 15px;color:#ffffff;">Upgrade to <a href="https://www.armemberplugin.com/product.php?rdt=t11" style="color: #00EFC6;font-size: 18px;text-decoration: none;border-bottom: 1px solid;" target="_blank">ARMember Premium</a> to get access of all premium features and frequent updates.</p> </div> <?php } function arm_display_news_notices($arm_license_notice = '') { $arm_news = get_transient( 'arm_news' ); if ( false == $arm_news ) { $url = 'https://www.armemberplugin.com/armember_addons/armemberlite_notices.php'; $raw_response = wp_remote_post( $url, array( 'timeout' => 5000, ) ); if ( ! is_wp_error( $raw_response ) && 200 == $raw_response['response']['code'] ) { $news = json_decode( $raw_response['body'], true ); } else { $news = array(); } set_transient( 'arm_news', wp_json_encode( $news ), DAY_IN_SECONDS ); } else { $news = json_decode( $arm_news, true ); } $current_time_date = current_time('timestamp'); $current_date = date( 'Y-m-d',$current_time_date); //phpcs:ignore foreach ( $news as $news_id => $news_data ) { $isAlreadyDismissed = get_option( 'arm_' . $news_id . '_is_dismissed' ); if ( '' == $isAlreadyDismissed ) { $class = 'armember_notice_warning arm-news-notice'; $message = $news_data['description']; $start_date = strtotime( $news_data['start_date'] ); $end_date = strtotime( $news_data['end_date'] ); $wpnonce = wp_create_nonce( 'arm_wp_nonce' ); $current_timestamp = strtotime( $current_date ); if ( $current_timestamp >= $start_date && $current_timestamp <= $end_date ) { $background_color = ( isset( $news_data['background'] ) && '' != $news_data['background'] ) ? 'background:' . $news_data['background'] . ';' : ''; $font_color = ( isset( $news_data['color'] ) && '' != $news_data['color'] ) ? 'color:' . $news_data['color'] . ';' : ''; $border_color = ( isset( $news_data['border'] ) && '' != $news_data['border'] ) ? 'border-color:' . $news_data['border'] . ';' : ''; $arm_license_notice .= sprintf( '<div class="%1$s armember%5$s_close_licence_notice" style="%2$s%3$s%4$s" id="%5$s">%6$s<span class="armember_close_licence_notice_icon" id="armember%5$s_close_licence_notice_icon" data-nonce="'.esc_attr($wpnonce).'" title="' . esc_html__('Dismiss','armember-membership') . '"></span></div>', esc_attr( $class ), esc_attr( $background_color ), esc_attr( $font_color ), esc_attr( $border_color ), esc_attr( $news_id ), wp_kses( $message, $this->armember_allowed_html_tags() ) ); } } } return $arm_license_notice; } function arm_dismiss_news_notice() { global $ARMemberLite; if( current_user_can( 'administrator') ) { $ARMemberLite->arm_check_user_cap('',1); //phpcs:ignore --Reason:Verifying nonce $noticeId = isset( $_POST['notice_id'] ) ? sanitize_text_field($_POST['notice_id']) : ''; //phpcs:ignore if ( '' != $noticeId ) { update_option( 'arm_' . $noticeId . '_is_dismissed', true ); } } } function arm_is_gutenberg_active() { // Check Gutenberg plugin is installed and activated. $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) ); // Version Check Block editor since 5.0. $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ); if ( ! $gutenberg && ! $block_editor ) { return false; } if ( ! function_exists( 'is_plugin_active' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) { return true; } $use_block_editor = get_option( 'classic-editor-replace' ) === 'no-replace'; return $use_block_editor; } /** * Check is gutenberg active or not function end */ function arm_check_is_gutenberg_page() { $return = false; global $ARMemberLite, $arm_doing_save_flag; if( $ARMemberLite->arm_check_is_elementor_page() ) { $return = false; } if( function_exists('is_gutenberg_page') ) { if( is_gutenberg_page() ) { $return = true; } } else { if ( function_exists( 'get_current_screen' ) ) { $arm_get_current_screen = get_current_screen(); if( is_object( $arm_get_current_screen ) ) { if ( isset($arm_get_current_screen->base) && $arm_get_current_screen->base==='post' && $this->arm_is_gutenberg_active() ) { $return = true; } } } if( doing_action( 'save_post' ) || ( defined("DOING_AUTOSAVE") && DOING_AUTOSAVE ) || !empty($arm_doing_save_flag) ) { $arm_doing_save_flag = 1; $return = true; } } return $return; } function arm_check_is_elementor_page() { /* if(is_admin() && ( ( !empty($_REQUEST['action']) && $_REQUEST['action']!='elementor_ajax' ) || !empty($_REQUEST['elementor-preview']) ) ) { return true; } */ if( (!empty($_REQUEST['action']) && $_REQUEST['action']!='elementor_ajax' ) || !empty($_REQUEST['elementor-preview']) ) //phpcs:ignore { return true; } return false; } function wpdbfix() { global $wpdb, $arm_db_tables, $ARMemberLite; $wpdb->arm_termmeta = $ARMemberLite->tbl_arm_termmeta; } function arm_init_action() { global $wp, $wpdb, $arm_db_tables; $this->arm_slugs = $this->arm_page_slugs(); /** * Start Session */ ob_start(); /** * Plugin Hook for `Init` Actions */ do_action( 'arm_init', $this ); } /** * Hide WordPress Update Notifications In Plugin's Pages */ function arm_hide_update_notice() { global $wp, $wpdb, $arm_lite_errors, $current_user, $ARMemberLite, $pagenow, $arm_slugs; if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) && !in_array( $_REQUEST['page'], array( $arm_slugs->arm_setup_wizard ) )) { //phpcs:ignore remove_action( 'admin_notices', 'update_nag', 3 ); remove_action( 'network_admin_notices', 'update_nag', 3 ); remove_action( 'admin_notices', 'maintenance_nag' ); remove_action( 'network_admin_notices', 'maintenance_nag' ); remove_action( 'admin_notices', 'site_admin_notice' ); remove_action( 'network_admin_notices', 'site_admin_notice' ); remove_action( 'load-update-core.php', 'wp_update_plugins' ); add_filter( 'pre_site_transient_update_core', array( $this, 'arm_remove_core_updates' ) ); add_filter( 'pre_site_transient_update_plugins', array( $this, 'arm_remove_core_updates' ) ); add_filter( 'pre_site_transient_update_themes', array( $this, 'arm_remove_core_updates' ) ); add_action( 'admin_notices', array( $this, 'arm_sample_admin_notice__success' ), 1 ); /* Remove BuddyPress Admin Notices */ remove_action( 'bp_admin_init', 'bp_core_activation_notice', 1010 ); if ( ! in_array( $_REQUEST['page'], array( $arm_slugs->manage_forms ) ) ) { //phpcs:ignore add_filter( 'arm_admin_notice', array( $this, 'arm_admin_notices' ), 10, 1 ); } global $arm_social_feature; if ( in_array( $_REQUEST['page'], array( $arm_slugs->profiles_directories ) ) && ! $arm_social_feature->isSocialFeature ) { //phpcs:ignore $armAddonsLink = admin_url( 'admin.php?page=' . $arm_slugs->feature_settings . '&arm_activate_social_feature=1' ); wp_safe_redirect( $armAddonsLink ); exit; } } } function arm_admin_notices($notice_html = '') { global $wp, $wpdb, $arm_lite_errors, $ARMemberLite, $pagenow, $arm_global_settings; $notices = array(); $notices = apply_filters( 'arm_display_admin_notices', $notices ); if ( ! empty( $notices ) ) { foreach ( $notices as $notice ) { $notice_html .= '<li class="armember_notice_warning red arm_notice_' . esc_attr($notice['type']) . '">' . $notice['message'] . '</li>'; } } $arm_get_php_version = ( function_exists( 'phpversion' ) ) ? phpversion() : 0; if ( version_compare( $arm_get_php_version, '5.6', '<' )) { $notice_html .= '<div class="armember_notice_warning yellow">'; $notice_html .= esc_html__( 'ARMember Lite recommend to use Minimum PHP version 5.6 or greater.', 'armember-membership' ); $notice_html .= '</div>'; } if ( ! empty( $arm_global_settings->global_settings['enable_crop'] ) ) { if ( ! function_exists( 'gd_info' ) ) { $notice_html .= '<div class="armember_notice_warning red">'; $notice_html .= esc_html__( "ARMember Lite requires PHP GD Extension module at the server. And it seems that it's not installed or activated. Please contact your hosting provider for the same.", 'armember-membership' ); $notice_html .= '</div>'; } } return $notice_html; //phpcs:ignore } function arm_set_message( $type = 'error', $message = '' ) { global $wp, $wpdb, $arm_lite_errors, $ARMemberLite, $pagenow; if ( ! empty( $message ) ) { $ARMemberLite->arm_session_start(); $_SESSION['arm_message'][] = array( 'type' => $type, 'message' => $message, ); } return; } function arm_remove_core_updates() { global $wp_version; return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, ); } function arm_set_adminmenu() { global $menu, $submenu, $parent_file, $ARMemberLite; $ARMemberLite->arm_session_start(); if ( isset( $_SESSION['arm_admin_menus'] ) ) { unset( $_SESSION['arm_admin_menus'] ); } $_SESSION['arm_admin_menus'] = array( 'main_menu' => $menu, 'submenu' => $submenu, ); if ( isset( $submenu['arm_manage_members'] ) && ! empty( $submenu['arm_manage_members'] ) ) { $armAdminMenuScript = '<script type="text/javascript">'; $armAdminMenuScript .= 'jQuery(document).ready(function ($) {'; $armAdminMenuScript .= 'jQuery("#toplevel_page_arm_manage_members").find("ul li").each(function(){ var thisLI = jQuery(this); thisLI.addClass("arm-submenu-item"); var thisLinkHref = thisLI.find("a").attr("href"); if(thisLinkHref != "" && thisLinkHref != undefined){ var thisLinkClass = thisLinkHref.replace("admin.php?page=",""); thisLI.addClass(thisLinkClass); } }); jQuery(".arm_documentation a, .arm-submenu-item a[href=\"admin.php?page=arm_documentation\"]").attr("target", "_blank");'; $docLink = MEMBERSHIPLITE_DOCUMENTATION_URL; $armAdminMenuScript .= 'jQuery(".arm_documentation a, .arm-submenu-item a[href=\"admin.php?page=arm_documentation\"]").attr("href", "' . $docLink . '");'; $armAdminMenuScript .= '});'; $armAdminMenuScript .= '</script>'; $armAdminMenuScript .= '<style type="text/css">'; global $arm_social_feature; if ( ! $arm_social_feature->isSocialFeature ) { $armAdminMenuScript .= '.arm-submenu-item.arm_profiles_directories{display:none;}'; } $armAdminMenuScript .= '.arm-submenu-item.arm_feature_settings a{color:#ffff00 !important;}'; $armAdminMenuScript .= '</style>'; echo $armAdminMenuScript; //phpcs:ignore } } function ARM_EndSession() { //@session_destroy(); $arm_action = isset($_POST['arm_action']) ? sanitize_text_field($_POST['arm_action']) : ''; //phpcs:ignore if(isset($_SESSION['arm_site_permalink_is_changed'])) { unset($_SESSION['arm_site_permalink_is_changed']); } if(isset($_SESSION['arm_restricted_page_url'])) { unset($_SESSION['arm_restricted_page_url']); } if(isset($_SESSION['imported_users'])) { unset($_SESSION['imported_users']); } if(isset($_SESSION['arm_member_addon'])) { unset($_SESSION['arm_member_addon']); } if(isset($_SESSION['arm_message'])) { unset($_SESSION['arm_message']); } if(isset($_SESSION['arm_admin_menus'])) { unset($_SESSION['arm_admin_menus']); } if($arm_action!="change-password") { if(isset($_SESSION['ARM_FILTER_INPUT'])) { unset($_SESSION['ARM_FILTER_INPUT']); }; if(isset($_SESSION['ARM_VALIDATE_SCRIPT'])) { unset($_SESSION['ARM_VALIDATE_SCRIPT']); } } } /** * Loading plugin text domain */ function arm_load_textdomain() { load_plugin_textdomain( 'armember-membership', false, dirname( plugin_basename( MEMBERSHIPLITE_DIR_NAME.'/armember-membership.php' ) ) . '/languages/' ); //phpcs:ignore global $armPrimaryStatus, $armSecondaryStatus, $arm_lite_widget_effects, $armlite_default_user_details_text; $armPrimaryStatus = array( '1' => esc_html__( 'Active', 'armember-membership' ), '2' => esc_html__( 'Inactive', 'armember-membership' ), '3' => esc_html__( 'Pending', 'armember-membership' ), '4' => esc_html__( 'Terminated', 'armember-membership' ), ); $armSecondaryStatus = array( '0' => esc_html__( 'by admin', 'armember-membership' ), '1' => esc_html__( 'Account Closed', 'armember-membership' ), '2' => esc_html__( 'Suspended', 'armember-membership' ), '3' => esc_html__( 'Expired', 'armember-membership' ), '4' => esc_html__( 'User Cancelled', 'armember-membership' ), '5' => esc_html__( 'Payment Failed', 'armember-membership' ), '6' => esc_html__( 'Cancelled', 'armember-membership' ), ); $arm_lite_widget_effects = array( 'slide' => esc_html__( 'Slide', 'armember-membership' ), 'crossfade' => esc_html__( 'Fade', 'armember-membership' ), 'directscroll' => esc_html__( 'Direct Scroll', 'armember-membership' ), 'cover' => esc_html__( 'Cover', 'armember-membership' ), 'uncover' => esc_html__( 'Uncover', 'armember-membership' ), ); $armlite_default_user_details_text = esc_html__( 'Unknown', 'armember-membership' ); } /* Setting Capabilities for user */ function arm_capabilities() { $cap = array( 'arm_manage_subscriptions' => esc_html__('Manage Subscriptions', 'armember-membership'), 'arm_manage_members' => esc_html__( 'Manage Members', 'armember-membership' ), 'arm_manage_plans' => esc_html__( 'Manage Plans', 'armember-membership' ), 'arm_manage_setups' => esc_html__( 'Manage Setups', 'armember-membership' ), 'arm_manage_forms' => esc_html__( 'Manage Form Settings', 'armember-membership' ), 'arm_manage_access_rules' => esc_html__( 'Manage Access Rules', 'armember-membership' ), 'arm_manage_transactions' => esc_html__( 'Manage Transactions', 'armember-membership' ), 'arm_manage_email_notifications' => esc_html__( 'Manage Email Notifications', 'armember-membership' ), 'arm_manage_communication' => esc_html__( 'Manage Communication', 'armember-membership' ), 'arm_manage_member_templates' => esc_html__( 'Manage Member Templates', 'armember-membership' ), 'arm_manage_general_settings' => esc_html__( 'Manage General Settings', 'armember-membership' ), 'arm_manage_feature_settings' => esc_html__( 'Manage Feature Settings', 'armember-membership' ), 'arm_manage_block_settings' => esc_html__( 'Manage Block Settings', 'armember-membership' ), 'arm_manage_payment_gateways' => esc_html__( 'Manage Payment Gateways', 'armember-membership' ), 'arm_import_export' => esc_html__( 'Manage Import/Export', 'armember-membership' ), 'arm_growth_plugins' => esc_html__( 'Growth Plugins', 'armember-membership' ), ); return $cap; } function arm_page_slugs() { global $ARMemberLite, $arm_slugs; $arm_slugs = new stdClass(); $arm_current_date_for_bf_popup = current_time('timestamp',true); //GMT-0 Timezone $arm_bf_start_time = "1700483400"; $arm_bf_end_time = "1701541800"; $arm_black_friday_slug = 'arm_upgrade_to_premium'; /* Admin-Pages-Slug */ $arm_slugs->main = 'arm_manage_members'; $arm_slugs->manage_members = 'arm_manage_members'; $arm_slugs->manage_plans = 'arm_manage_plans'; $arm_slugs->membership_setup = 'arm_membership_setup'; $arm_slugs->manage_forms = 'arm_manage_forms'; $arm_slugs->access_rules = 'arm_access_rules'; $arm_slugs->manage_subscriptions = 'arm_manage_subscriptions'; $arm_slugs->transactions = 'arm_transactions'; $arm_slugs->email_notifications = 'arm_email_notifications'; $arm_slugs->general_settings = 'arm_general_settings'; $arm_slugs->feature_settings = 'arm_feature_settings'; $arm_slugs->documentation = 'arm_documentation'; $arm_slugs->arm_upgrade_to_premium = $arm_black_friday_slug; $arm_slugs->profiles_directories = 'arm_profiles_directories'; $arm_slugs->arm_setup_wizard = 'arm_setup_wizard'; $arm_slugs->arm_growth_plugins = 'arm_growth_plugins'; return $arm_slugs; } /** * Setting Menu Position */ function get_free_menu_position( $start, $increment = 0.1 ) { foreach ( $GLOBALS['menu'] as $key => $menu ) { $menus_positions[] = floatval( $key ); } if ( ! in_array( $start, $menus_positions ) ) { $start = strval( $start ); return $start; } else { $start += $increment; } /* the position is already reserved find the closet one */ while ( in_array( $start, $menus_positions ) ) { $start += $increment; } $start = strval( $start ); return $start; } public static function arm_is_pro_active(){ if( !function_exists('is_plugin_active') ){ include ABSPATH . '/wp-admin/includes/plugin.php'; } $plugin_slug = 'armember/armember.php'; return is_plugin_active( $plugin_slug ); } function armPluginActionLinks( $links, $file ) { global $wp, $wpdb, $ARMemberLite, $arm_slugs; if ( $file == plugin_basename( MEMBERSHIPLITE_DIR_NAME.'/armember-membership.php' ) ) { if ( isset( $links['deactivate'] ) ) { $deactivation_link = $links['deactivate']; // Insert an onClick action to allow form before deactivating $deactivation_link = str_replace( '<a ', '<div class="armlite-deactivate-form-wrapper"> <span class="armlite-deactivate-form " id="armlite-deactivate-form-armember-membership"></span> </div><a id="armlite-deactivate-link-armember-membership" ', $deactivation_link ); $links['deactivate'] = $deactivation_link; } if(!$this->is_arm_pro_active) { $armAddonsLink = admin_url( 'admin.php?page=' . $arm_slugs->feature_settings ); $link = '<a title="' . esc_attr__( 'Add-ons', 'armember-membership' ) . '" href="' . esc_url( $armAddonsLink ) . '">' . esc_html__( 'Add-ons', 'armember-membership' ) . '</a>'; $link = '<a title="' . esc_attr__( 'Upgrade To Pro', 'armember-membership' ) . '" href="https://www.armemberplugin.com/pricing/" style="font-weight:bold;">' . esc_html__( 'Upgrade To Pro', 'armember-membership' ) . '</a>'; array_unshift( $links, $link ); } } return $links; } function arm_admin_body_class( $classes ) { global $pagenow, $arm_slugs; if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) ) { //phpcs:ignore $classes .= ' arm_wpadmin_page '; } return $classes; } /** * Adding Membership Admin Menu(s) */ function arm_menu() { global $wp, $wpdb, $current_user, $arm_lite_errors, $ARMemberLite, $arm_slugs, $arm_global_settings, $arm_social_feature, $arm_membership_setup; $armlite_is_wizard_complete = get_option('arm_lite_is_wizard_complete'); $place = $this->get_free_menu_position( 26.1, 0.3 ); if ( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) { echo "<style type='text/css'>.toplevel_page_arm_manage_members .wp-menu-image img{margin-top:-4px !important;}.toplevel_page_arm_manage_members .wp-menu-image .wp-menu-name{padding-left:30px !important;;}</style>"; } if(empty($armlite_is_wizard_complete) || $armlite_is_wizard_complete == 0) { $arm_menu_hook = add_menu_page('ARMember', esc_html__('ARMember Lite', 'armember-membership'), 'arm_manage_members', $arm_slugs->arm_setup_wizard, array($this, 'route'), MEMBERSHIPLITE_IMAGES_URL . '/armember_menu_icon.png', $place); } else{ $arm_menu_hook = add_menu_page( 'ARMember Lite', esc_html__( 'ARMember Lite', 'armember-membership' ), 'arm_manage_members', $arm_slugs->main, array( $this, 'route' ), MEMBERSHIPLITE_IMAGES_URL . '/armember_menu_icon.png', $place ); } $admin_menu_items = array( $arm_slugs->manage_members => array( 'name' => esc_html__( 'Manage Members', 'armember-membership' ), 'title' => esc_html__( 'Manage Members', 'armember-membership' ), 'capability' => 'arm_manage_members', ), $arm_slugs->manage_plans => array( 'name' => esc_html__( 'Manage Plans', 'armember-membership' ), 'title' => esc_html__( 'Manage Plans', 'armember-membership' ), 'capability' => 'arm_manage_plans', ), $arm_slugs->membership_setup => array( 'name' => esc_html__( 'Configure Plan + Signup Page', 'armember-membership' ), 'title' => esc_html__( 'Configure Plan + Signup Page', 'armember-membership' ), 'capability' => 'arm_manage_setups', ), $arm_slugs->manage_forms => array( 'name' => esc_html__( 'Manage Forms', 'armember-membership' ), 'title' => esc_html__( 'Manage Forms', 'armember-membership' ), 'capability' => 'arm_manage_forms', ), $arm_slugs->access_rules => array( 'name' => esc_html__( 'Content Access Rules', 'armember-membership' ), 'title' => esc_html__( 'Content Access Rules', 'armember-membership' ), 'capability' => 'arm_manage_access_rules', ), $arm_slugs->manage_subscriptions => array( 'name' => esc_html__('Manage Subscriptions', 'armember-membership'), 'title' => esc_html__('Manage Subscriptions', 'armember-membership'), 'capability' => 'arm_manage_subscriptions' ), $arm_slugs->transactions => array( 'name' => esc_html__( 'Payment History', 'armember-membership' ), 'title' => esc_html__( 'Payment History', 'armember-membership' ), 'capability' => 'arm_manage_transactions', ), $arm_slugs->email_notifications => array( 'name' => esc_html__( 'Email Notifications', 'armember-membership' ), 'title' => esc_html__( 'Email Notifications', 'armember-membership' ), 'capability' => 'arm_manage_email_notifications', ), $arm_slugs->profiles_directories => array( 'name' => esc_html__( 'Profiles & Directories', 'armember-membership' ), 'title' => esc_html__( 'Profiles & Directories', 'armember-membership' ), 'capability' => 'arm_manage_member_templates', ), $arm_slugs->general_settings => array( 'name' => esc_html__( 'General Settings', 'armember-membership' ), 'title' => esc_html__( 'General Settings', 'armember-membership' ), 'capability' => 'arm_manage_general_settings', ), ); foreach ( $admin_menu_items as $slug => $menu ) { if ( $slug == $arm_slugs->membership_setup ) { $total_setups = $arm_membership_setup->arm_total_setups(); if ( $total_setups < 1 ) { $menu['title'] = '<span style="color: #53E2F3">' . $menu['title'] . '</span>'; } } $armSubMenuHook = add_submenu_page( $arm_slugs->main, $menu['name'], $menu['title'], $menu['capability'], $slug, array( $this, 'route' ) ); } do_action( 'arm_before_last_menu' ); } function arm_set_last_menu() { global $wp, $wpdb, $ARMemberLite, $arm_slugs, $arm_membership_setup; $admin_menu_items = array( $arm_slugs->feature_settings => array( 'name' => esc_html__( 'Add-ons', 'armember-membership' ), 'title' => esc_html__( 'Add-ons', 'armember-membership' ), 'capability' => 'arm_manage_feature_settings', ), $arm_slugs->documentation => array( 'name' => esc_html__( 'Documentation', 'armember-membership' ), 'title' => esc_html__( 'Documentation', 'armember-membership' ), 'capability' => 'arm_manage_members', ), $arm_slugs->arm_growth_plugins => array( 'name' => esc_html__( 'Growth Plugins', 'armember-membership' ), 'title' => esc_html__( 'Growth Plugins', 'armember-membership' ), 'capability' => 'arm_growth_plugins', ), ); foreach ( $admin_menu_items as $slug => $menu ) { if ( $slug == $arm_slugs->membership_setup ) { $total_setups = $arm_membership_setup->arm_total_setups(); if ( $total_setups < 1 ) { $menu['title'] = '<span style="color: #53E2F3">' . $menu['title'] . '</span>'; } } $armSubMenuHook = add_submenu_page( $arm_slugs->main, $menu['name'], $menu['title'], $menu['capability'], $slug, array( $this, 'route' ) ); } $this->arm_set_premium_link(); } function arm_set_premium_link(){ if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_upgrade_to_premium.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_upgrade_to_premium.php'; } } function arm_add_debug_bar_menu( $wp_admin_bar ) { /* Admin Bar Menu */ if ( ! current_user_can( 'administrator' ) || MEMBERSHIPLITE_DEBUG_LOG == false ) { return; } $args = array( 'id' => 'arm_debug_menu', 'title' => esc_html__( 'ARMember Debug', 'armember-membership' ), 'parent' => 'top-secondary', 'href' => '#', 'meta' => array( 'class' => 'armember_admin_bar_debug_menu', ), ); echo "<style type='text/css'>"; echo '.armember_admin_bar_debug_menu{ background:#ff9a8d !Important; }'; echo '</style>'; $wp_admin_bar->add_menu( $args ); } /** * Display Admin Page View */ function route() { global $wp, $wpdb, $arm_lite_errors, $ARMemberLite, $arm_slugs, $arm_members_class, $arm_member_forms, $arm_global_settings; if ( isset( $_REQUEST['page'] ) ) { //phpcs:ignore $pageWrapperClass = ''; if ( is_rtl() ) { $pageWrapperClass = 'arm_page_rtl'; } echo '<div class="arm_page_wrapper ' . esc_html($pageWrapperClass) . '" id="arm_page_wrapper">'; if($_REQUEST['page']!='arm_general_settings' && $_REQUEST['page']!='arm_manage_license'){ //phpcs:ignore $arm_admin_notice = ''; $arm_admin_notice = apply_filters('arm_admin_notice',$arm_admin_notice); //phpcs:ignore if(!empty($arm_admin_notice)){ echo '<div class="arm_admin_notice_container">'.$arm_admin_notice.'</div>'; //phpcs:ignore } } $requested_page = sanitize_text_field( $_REQUEST['page'] ); //phpcs:ignore do_action( 'arm_admin_messages', $requested_page ); $GET_ACTION = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; //phpcs:ignore $GET_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : ''; //phpcs:ignore switch ( $requested_page ) { case $arm_slugs->main: case $arm_slugs->manage_members: if ( isset( $GET_ACTION ) && in_array( $GET_ACTION, array( 'view_member' ) ) ) { if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_view_member.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_view_member.php'; } } if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_member_add.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_member_add.php'; } if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_members_list.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_members_list.php'; } break; case $arm_slugs->arm_setup_wizard: if(file_exists(MEMBERSHIPLITE_VIEWS_DIR . '/arm_setup_wizard.php')) { include( MEMBERSHIPLITE_VIEWS_DIR . '/arm_setup_wizard.php'); } break; case $arm_slugs->manage_plans: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_subscription_plans_add.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_subscription_plans_add.php'; } if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_subscription_plans_list.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_subscription_plans_list.php'; } break; case $arm_slugs->membership_setup: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_membership_setup_list.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_membership_setup_list.php'; } if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_membership_setup_add.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_membership_setup_add.php'; } break; case $arm_slugs->manage_forms: if ( isset( $GET_ACTION ) && ( $GET_ACTION == 'edit_form' ) && !empty( $_GET['form_id'] ) && is_numeric( $_GET['form_id'] ) && file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_form_editor.php' ) ) { //phpcs:ignore include MEMBERSHIPLITE_VIEWS_DIR . '/arm_form_editor.php'; } else { if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_manage_forms.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_manage_forms.php'; } } break; case $arm_slugs->access_rules: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_access_rules.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_access_rules.php'; } break; case $arm_slugs->manage_subscriptions: if (file_exists(MEMBERSHIPLITE_VIEWS_DIR . '/arm_manage_subscription_list.php')) { include( MEMBERSHIPLITE_VIEWS_DIR . '/arm_manage_subscription_list.php'); } break; case $arm_slugs->transactions: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_transactions_add.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_transactions_add.php'; } if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_transactions.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_transactions.php'; } break; case $arm_slugs->email_notifications: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_email_notification.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_email_notification.php'; } break; case $arm_slugs->general_settings: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_general_settings.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_general_settings.php'; } break; case $arm_slugs->feature_settings: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_feature_settings.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_feature_settings.php'; } break; case $arm_slugs->documentation: wp_redirect( MEMBERSHIPLITE_DOCUMENTATION_URL ); die(); break; case $arm_slugs->arm_growth_plugins: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_growth_plugins.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_growth_plugins.php'; } break; case $arm_slugs->profiles_directories: if ( isset( $GET_ACTION ) && ( $GET_ACTION == 'add_profile' || $GET_ACTION == 'edit_profile' ) && file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_profile_editor.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_profile_editor.php'; } else { if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_profiles_directories.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_profiles_directories.php'; } } break; case $arm_slugs->arm_upgrade_to_premium: if ( file_exists( MEMBERSHIPLITE_VIEWS_DIR . '/arm_upgrade_to_premium.php' ) ) { include MEMBERSHIPLITE_VIEWS_DIR . '/arm_upgrade_to_premium.php'; } break; default: break; } echo '</div>'; } else { /* No Action */ } } /* Setting Admin CSS */ function set_css() { global $arm_slugs,$arm_lite_version; /* Plugin Style */ wp_register_style( 'arm_admin_wp_css', MEMBERSHIPLITE_URL . '/css/arm_admin_wp_css.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_admin_css', MEMBERSHIPLITE_URL . '/css/arm_admin.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_form_style_css', MEMBERSHIPLITE_URL . '/css/arm_form_style.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style('arm_admin_setup_css', MEMBERSHIPLITE_URL . '/css/arm_lite_admin_setup_wizard.css', array(), MEMBERSHIPLITE_VERSION); wp_register_style( 'arm-font-awesome-css', MEMBERSHIPLITE_URL . '/css/arm-font-awesome.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm-font-awesome-mini-css', MEMBERSHIPLITE_URL . '/css/arm-font-awesome-mini.css', array(), MEMBERSHIPLITE_VERSION ); /* For chosen select box */ wp_register_style( 'arm_chosen_selectbox', MEMBERSHIPLITE_URL . '/css/chosen.css', array(), MEMBERSHIPLITE_VERSION ); /* For bootstrap datetime picker */ wp_register_style( 'arm_admin_growth_plugins_css', MEMBERSHIPLITE_URL . '/css/arm_admin_growth_plugins.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_bootstrap_all_css', MEMBERSHIPLITE_URL . '/bootstrap/css/bootstrap_all.css', array(), MEMBERSHIPLITE_VERSION ); // version compare need to insert /*Admin view Template Popup*/ wp_register_style( 'arm_directory_popup', MEMBERSHIPLITE_VIEWS_URL . '/templates/arm_directory_popup.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_base-controls', MEMBERSHIPLITE_URL . '/assets/css/front/components/_base-controls.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style_base', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_base.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-default', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-default.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-material', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-material.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-outline-material', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-outline-material.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-rounded', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-rounded.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_component_css', MEMBERSHIPLITE_URL . '/assets/css/front/arm_front.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_admin_model_css', MEMBERSHIPLITE_URL . '/css/arm_admin_model_css.css', array(), MEMBERSHIPLITE_VERSION ); $arm_admin_page_name = ! empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; //phpcs:ignore if ( ! empty( $arm_admin_page_name ) && ( preg_match( '/arm_*/', $arm_admin_page_name ) || $arm_admin_page_name == 'badges_achievements' ) ) { wp_deregister_style( 'datatables' ); wp_dequeue_style( 'datatables' ); wp_register_style( 'datatables', MEMBERSHIPLITE_URL . '/datatables/media/css/datatables.css', array(), MEMBERSHIPLITE_VERSION ); } /* Add Style for menu icon image. */ //echo '<style type="text/css"> .toplevel_page_armember .wp-menu-image img,.toplevel_page_arm_setup_wizard .wp-menu-image img, .toplevel_page_arm_manage_members .wp-menu-image img{padding: 5px !important;} .arm_vc_icon{background-image:url(' . MEMBERSHIPLITE_IMAGES_URL . '/armember_menu_icon.png) !important;}</style>'; //phpcs:ignore wp_enqueue_style( 'arm_admin_wp_css'); /* Add CSS file only for plugin pages. */ if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) ) { //phpcs:ignore wp_enqueue_style( 'arm_admin_css' ); wp_enqueue_style( 'arm_form_style_css' ); if ( in_array( $_REQUEST['page'], array( $arm_slugs->manage_members, $arm_slugs->manage_forms,$arm_slugs->manage_plans ) ) ) { //phpcs:ignore wp_enqueue_style( 'arm-font-awesome-css' ); if ( $_REQUEST['page'] == $arm_slugs->manage_forms ) { //phpcs:ignore wp_enqueue_style( 'arm_admin_model_css' ); wp_enqueue_style( 'arm_front_components_base-controls' ); wp_enqueue_style( 'arm_front_components_form-style_base' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-default' ); // wp_enqueue_style('arm-font-awesome'); wp_enqueue_style( 'arm_front_components_form-style__arm-style-material' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-outline-material' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-rounded' ); wp_enqueue_style( 'arm_front_component_css' ); wp_enqueue_style( 'arm_custom_component_css' ); } } else { wp_enqueue_style( 'arm-font-awesome-mini-css' ); } if($_REQUEST['page'] == $arm_slugs->general_settings) //phpcs:ignore { wp_enqueue_style( 'arm_chosen_selectbox' ); wp_enqueue_style( 'datatables' ); wp_enqueue_style( 'arm_admin_model_css' ); } if($_REQUEST['page'] == $arm_slugs->membership_setup || ($_REQUEST['page'] == $arm_slugs->general_settings && !empty($_REQUEST['action']) && $_REQUEST['action']=='debug_logs')){ //phpcs:ignore wp_enqueue_style( 'arm_admin_model_css' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->manage_members, $arm_slugs->manage_plans,$arm_slugs->membership_setup, $arm_slugs->arm_setup_wizard,$arm_slugs->email_notifications, $arm_slugs->manage_subscriptions,$arm_slugs->membership_setup,$arm_slugs->profiles_directories, $arm_slugs->access_rules, $arm_slugs->transactions ) ) ) { //phpcs:ignore wp_enqueue_style( 'arm_chosen_selectbox' ); wp_enqueue_style( 'datatables' ); wp_enqueue_style( 'arm_admin_model_css' ); } if(in_array($_REQUEST['page'],array($arm_slugs->arm_setup_wizard))) //phpcs:ignore { wp_enqueue_style('arm_admin_setup_css'); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->manage_plans, $arm_slugs->manage_subscriptions,$arm_slugs->manage_members, $arm_slugs->transactions,$arm_slugs->arm_setup_wizard ) ) ) { //phpcs:ignore wp_enqueue_style( 'arm_bootstrap_all_css' ); } if ( $_REQUEST['page'] == $arm_slugs->manage_members && ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'view_member' ) && ( isset( $_REQUEST['view_type'] ) && $_REQUEST['view_type'] == 'popup' ) ) { //phpcs:ignore $inline_style = 'html.wp-toolbar { padding-top: 0px !important; } #wpcontent{ margin-left: 0 !important; } #wpadminbar { display: none !important; } #adminmenumain { display: none !important; } .arm_view_member_wrapper { max-width: inherit !important; }'; wp_add_inline_style( 'arm_admin_css', $inline_style ); } if(in_array($_REQUEST['page'],array($arm_slugs->arm_growth_plugins))) //phpcs:ignore { wp_enqueue_style( 'arm_admin_growth_plugins_css' ); } } if ( is_rtl() ) { wp_register_style( 'arm_admin_css-rtl', MEMBERSHIPLITE_URL . '/css/arm_admin_rtl.css', array(), MEMBERSHIPLITE_VERSION ); wp_enqueue_style( 'arm_admin_css-rtl' ); } } /* Setting Admin JavaScript */ function set_js() { global $wp, $wpdb, $ARMemberLite, $arm_slugs, $arm_global_settings, $arm_lite_ajaxurl; /* Plugin JS */ wp_register_script('arm_admin_setup_js', MEMBERSHIPLITE_URL . '/js/arm_lite_admin_setup.js', array(), MEMBERSHIPLITE_VERSION); //phpcs:ignore wp_register_script( 'arm_admin_js', MEMBERSHIPLITE_URL . '/js/arm_admin.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_common_js', MEMBERSHIPLITE_URL . '/js/arm_common.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_bpopup', MEMBERSHIPLITE_URL . '/js/jquery.bpopup.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_jeditable', MEMBERSHIPLITE_URL . '/js/jquery.jeditable.mini.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore // wp_register_script('arm_icheck-js', MEMBERSHIPLITE_URL . '/js/icheck.js', array('jquery'), MEMBERSHIPLITE_VERSION); //phpcs:ignore wp_register_script( 'arm_colpick-js', MEMBERSHIPLITE_URL . '/js/colpick.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_codemirror-js', MEMBERSHIPLITE_URL . '/js/arm_codemirror.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* Tooltip JS */ wp_register_script( 'arm_tipso', MEMBERSHIPLITE_URL . '/js/tipso.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* Form Validation */ wp_register_script( 'arm_validate', MEMBERSHIPLITE_URL . '/js/jquery.validate.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_tojson', MEMBERSHIPLITE_URL . '/js/jquery.json.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* For chosen select box */ wp_register_script( 'arm_chosen_jq_min', MEMBERSHIPLITE_URL . '/js/chosen.jquery.min.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* File Upload JS */ wp_register_script( 'arm_filedrag_import_user_js', MEMBERSHIPLITE_URL . '/js/filedrag/filedrag_import_user.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_file_upload_js', MEMBERSHIPLITE_URL . '/js/arm_file_upload_js.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_admin_file_upload_js', MEMBERSHIPLITE_URL . '/js/arm_admin_file_upload_js.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* For bootstrap datetime picker js */ wp_register_script( 'arm_bootstrap_js', MEMBERSHIPLITE_URL . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_bootstrap_datepicker_with_locale', MEMBERSHIPLITE_URL . '/bootstrap/js/bootstrap-datetimepicker-with-locale.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_admin_chart', MEMBERSHIPLITE_URL . '/js/arm_admin_chart.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_admin_model_js', MEMBERSHIPLITE_URL . '/js/arm_admin_model_js.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore $arm_admin_page_name = ! empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; //phpcs:ignore if ( ! empty( $arm_admin_page_name ) && ( preg_match( '/arm_*/', $arm_admin_page_name ) || $arm_admin_page_name == 'badges_achievements' ) ) { wp_deregister_script( 'datatables' ); wp_dequeue_script( 'datatables' ); wp_deregister_script( 'buttons-colvis' ); wp_dequeue_script( 'buttons-colvis' ); wp_deregister_script( 'fixedcolumns' ); wp_dequeue_script( 'fixedcolumns' ); wp_deregister_script( 'fourbutton' ); wp_dequeue_script( 'fourbutton' ); wp_register_script( 'datatables', MEMBERSHIPLITE_URL . '/datatables/media/js/datatables.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'buttons-colvis', MEMBERSHIPLITE_URL . '/datatables/media/js/buttons.colVis.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'fixedcolumns', MEMBERSHIPLITE_URL . '/datatables/media/js/FixedColumns.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'fourbutton', MEMBERSHIPLITE_URL . '/datatables/media/js/four_button.js', array(), MEMBERSHIPLITE_VERSION ); //phpcs:ignore } if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) ) { //phpcs:ignore wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_script( 'arm_tojson' ); wp_enqueue_script( 'arm_icheck-js' ); wp_enqueue_script( 'arm_validate' ); /* Main Plugin Back-End JS */ wp_enqueue_script( 'arm_bpopup' ); wp_enqueue_script( 'arm_tipso' ); wp_enqueue_script( 'arm_admin_js' ); wp_enqueue_script( 'arm_common_js' ); wp_enqueue_script( 'arm_admin_model_js' ); wp_enqueue_script( 'wp-hooks' ); /* For the Datatable Design. */ $dataTablePages = array( $arm_slugs->main, $arm_slugs->manage_members, $arm_slugs->manage_plans, $arm_slugs->membership_setup, $arm_slugs->access_rules, $arm_slugs->manage_subscriptions, $arm_slugs->transactions, $arm_slugs->email_notifications, ); if ( in_array( $_REQUEST['page'], $dataTablePages ) ) { //phpcs:ignore wp_enqueue_script( 'datatables' ); wp_enqueue_script( 'buttons-colvis' ); wp_enqueue_script( 'fixedcolumns' ); wp_enqueue_script( 'fourbutton' ); } if(in_array($_REQUEST['page'],array($arm_slugs->arm_setup_wizard))){ //phpcs:ignore wp_enqueue_script('arm_admin_setup_js'); wp_enqueue_script('jquery-ui-autocomplete'); wp_enqueue_style( 'arm_colpick-css', MEMBERSHIPLITE_URL . '/css/colpick.css', array(), MEMBERSHIPLITE_VERSION ); wp_enqueue_script( 'arm_colpick-js', MEMBERSHIPLITE_URL . '/js/colpick.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION,false ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->manage_plans, $arm_slugs->manage_subscriptions,$arm_slugs->membership_setup, $arm_slugs->manage_forms, $arm_slugs->profiles_directories,$arm_slugs->manage_members ) ) ) { //phpcs:ignore wp_enqueue_script( 'jquery-ui-sortable' ); wp_enqueue_script( 'jquery-ui-draggable' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->manage_forms, $arm_slugs->profiles_directories ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_jeditable' ); wp_enqueue_script( 'arm_colpick-js' ); wp_enqueue_style( 'arm_colpick-css', MEMBERSHIPLITE_URL . '/css/colpick.css', array(), MEMBERSHIPLITE_VERSION ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->membership_setup, $arm_slugs->profiles_directories ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_colpick-js' ); wp_enqueue_style( 'arm_colpick-css', MEMBERSHIPLITE_URL . '/css/colpick.css', array(), MEMBERSHIPLITE_VERSION ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->manage_members, $arm_slugs->manage_forms, $arm_slugs->profiles_directories,$arm_slugs->arm_setup_wizard ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_admin_file_upload_js' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->manage_members, $arm_slugs->manage_plans,$arm_slugs->membership_setup, $arm_slugs->email_notifications, $arm_slugs->profiles_directories,$arm_slugs->manage_subscriptions,$arm_slugs->arm_setup_wizard ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_chosen_jq_min' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings, $arm_slugs->manage_plans,$arm_slugs->membership_setup, $arm_slugs->manage_subscriptions,$arm_slugs->manage_members, $arm_slugs->transactions,$arm_slugs->arm_setup_wizard ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_bootstrap_js' ); wp_enqueue_script( 'arm_bootstrap_datepicker_with_locale' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->general_settings ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_filedrag_import_user_js' ); wp_enqueue_script( 'sack' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->manage_members ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_admin_file_upload_js' ); } if ( in_array( $_REQUEST['page'], array( $arm_slugs->access_rules ) ) ) { //phpcs:ignore wp_enqueue_script( 'arm_common_js' ); } if (in_array($_REQUEST['page'], array($arm_slugs->transactions,$arm_slugs->manage_subscriptions))) { //phpcs:ignore wp_enqueue_script('jquery-ui-autocomplete'); } if (in_array($_REQUEST['page'], array($arm_slugs->profiles_directories))) { //phpcs:ignore wp_enqueue_script('jquery-effects-core'); wp_enqueue_script('jquery-effects-slide'); } } } /* Setting global javascript variables */ function set_global_javascript_variables() { global $arm_lite_ajaxurl,$ARMemberLite,$arm_version; $arm_global_css = '__ARMAJAXURL = "' . $arm_lite_ajaxurl . '";'; //phpcs:ignore $arm_global_css .= '__ARMURL = "' . MEMBERSHIPLITE_URL . '";'; //phpcs:ignore $arm_global_css .= '__ARMVIEWURL = "' . MEMBERSHIPLITE_VIEWS_URL . '";'; //phpcs:ignore $arm_global_css .= '__ARMLITEIMAGEURL = "' . MEMBERSHIPLITE_IMAGES_URL . '";'; //phpcs:ignore $arm_global_css .= '__ARMISADMIN = [' . is_admin() . '];'; //phpcs:ignore $arm_global_css .= 'loadActivityError = "' . esc_html__( 'There is an error while loading activities, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'pinterestPermissionError = "' . esc_html__( 'The user chose not to grant permissions or closed the pop-up', 'armember-membership' ) . '";'; $arm_global_css .= 'pinterestError = "' . esc_html__( 'Oops, there was a problem getting your information', 'armember-membership' ) . '";'; $arm_global_css .= 'clickToCopyError = "' . esc_html__( 'There is a error while copying, please try again', 'armember-membership' ) . '";'; $arm_global_css .= 'fbUserLoginError = "' . esc_html__( 'User cancelled login or did not fully authorize.', 'armember-membership' ) . '";'; $arm_global_css .= 'closeAccountError = "' . esc_html__( 'There is a error while closing account, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'invalidFileTypeError = "' . esc_html__( 'Sorry, this file type is not permitted for security reasons.', 'armember-membership' ) . '";'; $arm_global_css .= 'fileSizeError = "' . esc_html__( 'File is not allowed bigger than {SIZE}.', 'armember-membership' ) . '";'; $arm_global_css .= 'fileUploadError = "' . esc_html__( 'There is an error in uploading file, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'coverRemoveConfirm = "' . esc_html__( 'Are you sure you want to remove cover photo?', 'armember-membership' ) . '";'; $arm_global_css .= 'profileRemoveConfirm = "' . esc_html__( 'Are you sure you want to remove profile photo?', 'armember-membership' ) . '";'; $arm_global_css .= 'errorPerformingAction = "' . esc_html__( 'There is an error while performing this action, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'userSubscriptionCancel = "' . esc_html__( "User's subscription has been canceled", 'armember-membership' ) . '";'; $arm_global_css .= 'ARM_Loding = "' . esc_html__( 'Loading..', 'armember-membership' ) . '";'; $arm_global_css .= 'Post_Publish ="' . esc_html__( 'After certain time of post is published', 'armember-membership' ) . '";'; $arm_global_css .= 'Post_Modify ="' . esc_html__( 'After certain time of post is modified', 'armember-membership' ) . '";'; $arm_global_css .= 'wentwrong ="' . esc_html__( 'Sorry, Something went wrong. Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'bulkActionError = "' . esc_html__( 'Please select valid action.', 'armember-membership' ) . '";'; $arm_global_css .= 'bulkRecordsError ="' . esc_html__( 'Please select one or more records.', 'armember-membership' ) . '";'; $arm_global_css .= 'clearLoginAttempts ="' . esc_html__( 'Login attempts cleared successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'clearLoginHistory ="' . esc_html__( 'Login History cleared successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'nopasswordforimport ="' . esc_html__( 'Password can not be left blank.', 'armember-membership' ) . '";'; $arm_global_css .= 'delPlansSuccess ="' . esc_html__( 'Plan(s) has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delPlansError ="' . esc_html__( 'There is a error while deleting Plan(s), please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delPlanError ="' . esc_html__( 'There is a error while deleting Plan, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delSetupsSuccess ="' . esc_html__( 'Setup(s) has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delSetupsError ="' . esc_html__( 'There is a error while deleting Setup(s), please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delSetupSuccess ="' . esc_html__( 'Setup has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delSetupError ="' . esc_html__( 'There is a error while deleting Setup, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delFormSetSuccess ="' . esc_html__( 'Form Set Deleted Successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delFormSetError ="' . esc_html__( 'There is a error while deleting form set, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delFormSuccess ="' . esc_html__( 'Form deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delFormError ="' . esc_html__( 'There is a error while deleting form, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delRuleSuccess ="' . esc_html__( 'Rule has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delRuleError ="' . esc_html__( 'There is a error while deleting Rule, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delRulesSuccess ="' . esc_html__( 'Rule(s) has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delRulesError ="' . esc_html__( 'There is a error while deleting Rule(s), please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevTransactionError ="' . esc_html__( 'There is a error while generating preview of transaction detail, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'invoiceTransactionError ="' . esc_html__( 'There is a error while generating invoice of transaction detail, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevMemberDetailError ="' . esc_html__( 'There is a error while generating preview of members detail, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevMemberActivityError ="' . esc_html__( 'There is a error while displaying members activities detail, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevCustomCssError ="' . esc_html__( 'There is a error while displaying ARMember CSS Class Information, Please Try Again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevImportMemberDetailError ="' . esc_html__( 'Please upload appropriate file to import users.', 'armember-membership' ) . '";'; $arm_global_css .= 'delTransactionSuccess ="' . esc_html__( 'Transaction has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delTransactionsSuccess ="' . esc_html__( 'Transaction(s) has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delAutoMessageSuccess ="' . esc_html__( 'Message has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delAutoMessageError ="' . esc_html__( 'There is a error while deleting Message, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delAutoMessagesSuccess ="' . esc_html__( 'Message(s) has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delAutoMessagesError ="' . esc_html__( 'There is a error while deleting Message(s), please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveSettingsSuccess ="' . esc_html__( 'Settings has been saved successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveSettingsError ="' . esc_html__( 'There is a error while updating settings, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveDefaultRuleSuccess ="' . esc_html__( 'Default Rules Saved Successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveDefaultRuleError ="' . esc_html__( 'There is a error while updating rules, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveOptInsSuccess ="' . esc_html__( 'Opt-ins Settings Saved Successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveOptInsError ="' . esc_html__( 'There is a error while updating opt-ins settings, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delOptInsConfirm ="' . esc_html__( 'Are you sure to delete configuration?', 'armember-membership' ) . '";'; $arm_global_css .= 'delMemberActivityError ="' . esc_html__( 'There is a error while deleting member activities, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'noTemplateError ="' . esc_html__( 'Template not found.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveTemplateSuccess ="' . esc_html__( 'Template options has been saved successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveTemplateError ="' . esc_html__( 'There is a error while updating template options, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'prevTemplateError ="' . esc_html__( 'There is a error while generating preview of template, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'addTemplateSuccess ="' . esc_html__( 'Template has been added successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'addTemplateError ="' . esc_html__( 'There is a error while adding template, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'delTemplateSuccess ="' . esc_html__( 'Template has been deleted successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'delTemplateError ="' . esc_html__( 'There is a error while deleting template, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveEmailTemplateSuccess ="' . esc_html__( 'Email Template Updated Successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'saveAutoMessageSuccess ="' . esc_html__( 'Message Updated Successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'pastDateError ="' . esc_html__( 'Cannot Set Past Dates.', 'armember-membership' ) . '";'; $arm_global_css .= 'pastStartDateError ="' . esc_html__( 'Start date can not be earlier than current date.', 'armember-membership' ) . '";'; $arm_global_css .= 'pastExpireDateError ="' . esc_html__( 'Expire date can not be earlier than current date.', 'armember-membership' ) . '";'; $arm_global_css .= 'uniqueformsetname ="' . esc_html__( 'This Set Name is already exist.', 'armember-membership' ) . '";'; $arm_global_css .= 'uniquesignupformname ="' . esc_html__( 'This Form Name is already exist.', 'armember-membership' ) . '";'; $arm_global_css .= 'installAddonError ="' . esc_html__( 'There is an error while installing addon, Please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'installAddonSuccess ="' . esc_html__( 'Addon installed successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'activeAddonError ="' . esc_html__( 'There is an error while activating addon, Please try agina.', 'armember-membership' ) . '";'; $arm_global_css .= 'activeAddonSuccess ="' . esc_html__( 'Addon activated successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'deactiveAddonSuccess ="' . esc_html__( 'Addon deactivated successfully.', 'armember-membership' ) . '";'; $arm_global_css .= 'confirmCancelSubscription ="' . esc_html__( 'Are you sure you want to cancel subscription?', 'armember-membership' ) . '";'; $arm_global_css .= 'errorPerformingAction ="' . esc_html__( 'There is an error while performing this action, please try again.', 'armember-membership' ) . '";'; $arm_global_css .= 'arm_nothing_found ="' . esc_html__( 'Oops, nothing found.', 'armember-membership' ) . '";'; $arm_global_css .= 'armEditCurrency ="' . esc_html__( 'Edit', 'armember-membership' ) . '";'; $arm_global_css .= 'armCustomCurrency ="'.esc_html__('Custom Currency', 'armember-membership').'";'; wp_add_inline_script( 'armlite-admin-notice-script-js', $arm_global_css); if(!$this->is_arm_pro_active) { wp_add_inline_script( 'arm_common_js', $arm_global_css); } } /* Setting Frond CSS */ function set_front_css( $isFrontSection = false, $form_style = '' ) { global $wp, $wpdb, $wp_query, $ARMemberLite, $arm_slugs, $arm_global_settings, $arm_members_directory,$arm_global_load_js_css_forms; /* Main Plugin CSS */ wp_register_style( 'arm_lite_front_css', MEMBERSHIPLITE_URL . '/css/arm_front.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_form_style_css', MEMBERSHIPLITE_URL . '/css/arm_form_style.css', array(), MEMBERSHIPLITE_VERSION ); /* Font Awesome CSS */ wp_register_style( 'arm_fontawesome_css', MEMBERSHIPLITE_URL . '/css/arm-font-awesome.css', array(), MEMBERSHIPLITE_VERSION ); /* For bootstrap datetime picker */ wp_register_style( 'arm_bootstrap_all_css', MEMBERSHIPLITE_URL . '/bootstrap/css/bootstrap_all.css', array(), MEMBERSHIPLITE_VERSION ); // version compare need to insert wp_register_style( 'arm_front_components_base-controls', MEMBERSHIPLITE_URL . '/assets/css/front/components/_base-controls.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style_base', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_base.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-default', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-default.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-material', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-material.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-outline-material', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-outline-material.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style( 'arm_front_components_form-style__arm-style-rounded', MEMBERSHIPLITE_URL . '/assets/css/front/components/form-style/_arm-style-rounded.css', array(), MEMBERSHIPLITE_VERSION ); // wp_register_style('arm-font-awesome', MEMBERSHIPLITE_URL . '/assets/css/front/libs/fontawesome/arm-font-awesome.css', array(), MEMBERSHIPLITE_VERSION); wp_register_style( 'arm_front_component_css', MEMBERSHIPLITE_URL . '/assets/css/front/arm_front.css', array(), MEMBERSHIPLITE_VERSION ); wp_register_style('armlite_front_user_dashboard_css', MEMBERSHIPLITE_URL . '/css/arm_front_dashboard.css', array(), MEMBERSHIPLITE_VERSION); /* Check Current Front-Page is Membership Page. */ $is_arm_front_page = $this->is_arm_front_page(); $isEnqueueAll = $arm_global_settings->arm_get_single_global_settings( 'enqueue_all_js_css', 0 ); $is_arm_form_in_page = $this->is_arm_form_page(); if ( ( $is_arm_front_page === true || $isEnqueueAll == '1' || $isFrontSection || $form_style != '' ) && ! is_admin() ) { wp_enqueue_style( 'arm_lite_front_css' ); if ( $is_arm_form_in_page || $isFrontSection || $isEnqueueAll == '1' || $form_style != '' ) { wp_enqueue_style( 'arm_form_style_css' ); wp_enqueue_style( 'arm_fontawesome_css' ); wp_enqueue_style( 'arm_front_components_base-controls' ); wp_enqueue_style( 'arm_front_components_form-style_base' ); // wp_enqueue_style('arm-font-awesome'); $include_materia_outline_style = $include_material_style = $include_rounded_style = $include_standard_style = ''; if ( $isEnqueueAll != '1' ) { if ( ! empty( $is_arm_form_in_page ) && is_array( $is_arm_form_in_page ) ) { $is_arm_form_in_page_0_0_arr = isset( $is_arm_form_in_page[0][0] ) ? $is_arm_form_in_page[0][0] : array(); if ( ! empty( $is_arm_form_in_page_0_0_arr ) && is_array( $is_arm_form_in_page_0_0_arr ) ) { foreach ( $is_arm_form_in_page_0_0_arr as $is_arm_form_in_page_0_0_shortcode ) { $is_arm_form_in_page_0_0_shortcode = strtolower( $is_arm_form_in_page_0_0_shortcode ); $array_check_parameter_arr = array( 'id', 'set_id' ); foreach ( $array_check_parameter_arr as $array_check_parameter ) { $form_id_pattern = '/' . $array_check_parameter . '\=(\'|\")(\d+)(\'|\")/'; preg_match_all( $form_id_pattern, $is_arm_form_in_page_0_0_shortcode, $found_form_id_arr ); $check_is_setup_form = strpos( $is_arm_form_in_page_0_0_shortcode, 'arm_setup' ); if ( is_array( $found_form_id_arr ) && isset( $found_form_id_arr[2] ) ) { $form_id_arr = $found_form_id_arr[2]; foreach ( $form_id_arr as $form_id ) { $get_form_style_layout = ''; if ( ! isset( $arm_global_load_js_css_forms[ $form_id ] ) ) { $setup_form_id = 0; if ( $check_is_setup_form ) { $setup_form_id = $form_id; $get_arm_setup_form_settings = $wpdb->get_var( $wpdb->prepare('SELECT `arm_setup_modules` FROM `' . $ARMemberLite->tbl_arm_membership_setup . "` WHERE `arm_setup_id`= %d", $setup_form_id) );// phpcs:ignore --Reason: $ARMemberLite->tbl_arm_membership_setup is table name defined globally. False Positive alarm $arm_setup_form_settings = maybe_unserialize( $get_arm_setup_form_settings ); $form_id = isset( $arm_setup_form_settings['modules']['forms'] ) ? $arm_setup_form_settings['modules']['forms'] : 101; } $get_arm_form_settings = $wpdb->get_var( $wpdb->prepare("SELECT `arm_form_settings` FROM `". $ARMemberLite->tbl_arm_forms."` WHERE `arm_form_id`= %d",$form_id ) ); //phpcs:ignore $arm_form_settings = maybe_unserialize( $get_arm_form_settings ); if ( ! empty( $arm_form_settings['style'] ) ) { $get_form_style_layout = ! empty( $arm_form_settings['style']['form_layout'] ) ? $arm_form_settings['style']['form_layout'] : 'writer_border'; } $arm_global_load_js_css_forms = ! empty( $arm_global_load_js_css_forms ) ? $arm_global_load_js_css_forms : array(); $arm_global_load_js_css_forms[ $form_id ] = $get_form_style_layout; if ( ! empty( $setup_form_id ) ) { $arm_global_load_js_css_forms[ $setup_form_id ] = $get_form_style_layout; } } else { $get_form_style_layout = $arm_global_load_js_css_forms[ $form_id ]; } if ( $get_form_style_layout == 'writer_border' ) { $include_materia_outline_style = '1'; } elseif ( $get_form_style_layout == 'writer' ) { $include_material_style = '1'; } elseif ( $get_form_style_layout == 'rounded' ) { $include_rounded_style = '1'; } if ( $get_form_style_layout == 'iconic' ) { $include_standard_style = '1'; } } } } } } } } wp_enqueue_style( 'arm_front_components_form-style__arm-style-default' ); if ( ! empty( $include_material_style ) || $form_style == 'writer' || ( $isFrontSection == true && $form_style == '' ) ) { wp_enqueue_style( 'arm_front_components_form-style__arm-style-material' ); } if ( ! empty( $include_materia_outline_style ) || $form_style == 'writer_border' || ( $isFrontSection == true && $form_style == '' ) ) { wp_enqueue_style( 'arm_front_components_form-style__arm-style-outline-material' ); } if ( ! empty( $include_rounded_style ) || $form_style == 'rounded' || ( $isFrontSection == true && $form_style == '' ) ) { wp_enqueue_style( 'arm_front_components_form-style__arm-style-rounded' ); } wp_enqueue_style( 'arm_front_component_css' ); // wp_enqueue_style('arm_custom_component_css'); } wp_enqueue_style( 'arm_bootstrap_all_css' ); /* Print Custom CSS in Front-End Pages (Required `arm_lite_front_css` handle to add inline css) */ $arm_add_custom_css_flag = ''; if ( isset( $_GET['_locale'] ) && $_GET['_locale'] == 'user' && $this->arm_is_gutenberg_active() ) { //phpcs:ignore $arm_add_custom_css_flag = '1'; } /** * Directory & Profile Templates Style */ if ( $isEnqueueAll == '1' || $isFrontSection === 2 ) { wp_enqueue_style( 'arm_form_style_css' ); wp_enqueue_style( 'arm_front_components_base-controls' ); wp_enqueue_style( 'arm_front_components_form-style_base' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-default' ); // wp_enqueue_style('arm-font-awesome'); wp_enqueue_style( 'arm_front_components_form-style__arm-style-material' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-outline-material' ); wp_enqueue_style( 'arm_front_components_form-style__arm-style-rounded' ); wp_enqueue_style( 'arm_front_component_css' ); wp_enqueue_style( 'arm_custom_component_css' ); if($isEnqueueAll == '1') { if(!wp_style_is('armlite_front_user_dashboard_css', 'enqueued')){ wp_enqueue_style('armlite_front_user_dashboard_css'); } } $templates = $arm_members_directory->arm_default_member_templates(); if ( ! empty( $templates ) ) { foreach ( $templates as $tmp ) { if ( is_file( MEMBERSHIPLITE_VIEWS_DIR . '/templates/' . $tmp['arm_slug'] . '.css' ) ) { wp_enqueue_style( 'arm_template_style_' . $tmp['arm_slug'], MEMBERSHIPLITE_VIEWS_URL . '/templates/' . $tmp['arm_slug'] . '.css', array(), MEMBERSHIPLITE_VERSION ); } } } } else { $found_matches = array(); $pattern = '\[(\[?)(arm_template)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)'; $posts = $wp_query->posts; if ( is_array( $posts ) ) { foreach ( $posts as $post ) { if ( preg_match_all( '/' . $pattern . '/s', $post->post_content, $matches ) > 0 ) { $found_matches[] = $matches; } } $tempids = array(); if ( is_array( $found_matches ) && count( $found_matches ) > 0 ) { foreach ( $found_matches as $mat ) { if ( is_array( $mat ) and count( $mat ) > 0 ) { foreach ( $mat as $k => $v ) { foreach ( $v as $key => $val ) { $parts = explode( 'id=', $val ); if ( $parts > 0 && isset( $parts[1] ) ) { if ( stripos( @$parts[1], ']' ) !== false ) { $partsnew = explode( ']', $parts[1] ); $tempids[] = str_replace( "'", '', str_replace( '"', '', $partsnew[0] ) ); } elseif ( stripos( @$parts[1], ' ' ) !== false ) { $partsnew = explode( ' ', $parts[1] ); $tempids[] = str_replace( "'", '', str_replace( '"', '', $partsnew[0] ) ); } } } } } } } } if ( ! empty( $tempids ) && count( $tempids ) > 0 ) { $tempids = $this->arm_array_unique( $tempids ); foreach ( $tempids as $tid ) { $tid = trim( $tid ); /* Query Monitor Change */ if ( isset( $GLOBALS['arm_profile_template'] ) && isset( $GLOBALS['arm_profile_template'][ $tid ] ) ) { $tempSlug = $GLOBALS['arm_profile_template'][ $tid ]; } else { $tempSlug = $wpdb->get_var($wpdb->prepare( "SELECT `arm_slug` FROM ".$this->tbl_arm_member_templates." WHERE `arm_id`= %d AND `arm_type` != %s", $tid, 'profile' ));//phpcs:ignore --Reason $tbl_arm_member_template is table name if ( ! isset( $GLOBALS['arm_profile_template'] ) ) { $GLOBALS['arm_profile_template'] = array(); } $GLOBALS['arm_profile_template'][ $tid ] = $tempSlug; } if ( is_file( MEMBERSHIPLITE_VIEWS_DIR . '/templates/' . $tempSlug . '.css' ) ) { wp_enqueue_style( 'arm_template_style_' . $tempSlug, MEMBERSHIPLITE_VIEWS_URL . '/templates/' . $tempSlug . '.css', array(), MEMBERSHIPLITE_VERSION ); } } } } } } /* Setting Front Side JavaScript */ function set_front_js( $isFrontSection = false ) { global $wp, $wpdb, $post, $wp_scripts, $ARMemberLite, $arm_lite_ajaxurl, $arm_slugs, $arm_global_settings; /* Check Current Front-Page is Membership Page. */ $is_arm_front_page = $this->is_arm_front_page(); $isEnqueueAll = $arm_global_settings->arm_get_single_global_settings( 'enqueue_all_js_css', 0 ); if ( ( $is_arm_front_page === true || $isEnqueueAll == '1' || $isFrontSection ) && ! is_admin() ) { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'wp-hooks' ); /* Main Plugin Front-End JS */ wp_register_script( 'arm_common_js', MEMBERSHIPLITE_URL . '/js/arm_common.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_bpopup', MEMBERSHIPLITE_URL . '/js/jquery.bpopup.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* Tooltip JS */ wp_register_script( 'arm_tipso_front', MEMBERSHIPLITE_URL . '/js/tipso.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* File Upload JS */ wp_register_script( 'arm_file_upload_js', MEMBERSHIPLITE_URL . '/js/arm_file_upload_js.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore /* For bootstrap datetime picker js */ wp_register_script( 'arm_bootstrap_js', MEMBERSHIPLITE_URL . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script( 'arm_bootstrap_datepicker_with_locale_js', MEMBERSHIPLITE_URL . '/bootstrap/js/bootstrap-datetimepicker-with-locale.js', array( 'jquery' ), MEMBERSHIPLITE_VERSION ); //phpcs:ignore wp_register_script('armlite_front_dashboard_js', MEMBERSHIPLITE_URL . '/js/arm_front_dashboard.js', array('jquery'), MEMBERSHIPLITE_VERSION,false); /* Enqueue Javascripts */ wp_enqueue_script( 'jquery-ui-core' ); if ( ! wp_script_is( 'arm_bpopup', 'enqueued' ) ) { wp_enqueue_script( 'arm_bpopup' ); } if ( ! wp_script_is( 'arm_bootstrap_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_bootstrap_js' ); } if ( $isEnqueueAll == '1' ) { if ( ! wp_script_is( 'arm_bootstrap_datepicker_with_locale_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_bootstrap_datepicker_with_locale_js' ); } if ( ! wp_script_is( 'arm_bpopup', 'enqueued' ) ) { wp_enqueue_script( 'arm_bpopup' ); } if ( ! wp_script_is( 'arm_file_upload_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_file_upload_js' ); } if ( ! wp_script_is( 'arm_tipso_front', 'enqueued' ) ) { wp_enqueue_script( 'arm_tipso_front' ); } if(!wp_script_is('armlite_front_dashboard_js', 'enqueued')){ wp_enqueue_script('armlite_front_dashboard_js'); } } if ( !wp_script_is( 'arm_common_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_common_js' ); } /* Load Angular Assets */ if ( $isEnqueueAll == '1' ) { $this->enqueue_angular_script(); } } if(!$this->is_arm_pro_active) { $this->set_global_javascript_variables(); } } function enqueue_angular_script( $include_card_validation = false ) { global $wp, $wpdb, $post, $arm_lite_errors, $ARMemberLite, $arm_lite_ajaxurl,$arm_lite_version; /* Design CSS */ wp_register_style( 'arm_angular_material_css', MEMBERSHIPLITE_URL . '/materialize/arm_materialize.css', array(), MEMBERSHIPLITE_VERSION ); wp_enqueue_style( 'arm_angular_material_css' ); $angularJSFiles = array( 'arm_angular_with_material' => MEMBERSHIPLITE_URL . '/materialize/arm_materialize.js', 'arm_jquery_validation' => MEMBERSHIPLITE_URL . '/bootstrap/js/jqBootstrapValidation.js', 'arm_form_validation' => MEMBERSHIPLITE_URL . '/bootstrap/js/arm_form_validation.js', ); foreach ( $angularJSFiles as $handle => $src ) { if ( ! wp_script_is( $handle, 'registered' ) ) { wp_register_script( $handle, $src, array(), MEMBERSHIPLITE_VERSION, true ); } if ( ! wp_script_is( $handle, 'enqueued' ) ) { wp_enqueue_script( $handle ); } } } /** * Check front page has plugin content. */ function is_arm_front_page() { global $wp, $wpdb, $wp_query, $post, $arm_lite_errors, $ARMemberLite, $arm_global_settings; if ( ! is_admin() ) { $found_matches = array(); $pattern = '\[(\[?)(arm.*)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)'; $posts = $wp_query->posts; if ( is_array( $posts ) ) { foreach ( $posts as $post ) { if ( preg_match_all( '/' . $pattern . '/s', $post->post_content, $matches ) > 0 ) { $found_matches[] = $matches; } } } /* Remove empty array values. */ $found_matches = $this->arm_array_trim( $found_matches ); if ( ! empty( $found_matches ) && count( $found_matches ) > 0 ) { return true; } } return false; } function is_arm_setup_page() { global $wp, $wpdb, $wp_query, $post, $arm_lite_errors, $ARMemberLite, $arm_global_settings; if ( ! is_admin() ) { $found_matches = array(); $pattern = '\[(\[?)(arm_setup)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)'; $posts = $wp_query->posts; if ( is_array( $posts ) ) { foreach ( $posts as $post ) { if ( preg_match_all( '/' . $pattern . '/s', $post->post_content, $matches ) > 0 ) { $found_matches[] = $matches; } } } /* Remove empty array values. */ $found_matches = $this->arm_array_trim( $found_matches ); if ( ! empty( $found_matches ) && count( $found_matches ) > 0 ) { return true; } } return false; } /** * Check if front page content has plugin shortcode and has form. */ function is_arm_form_page() { global $wp, $wpdb, $wp_query, $post, $ARMemberLite, $arm_global_settings; if ( ! is_admin() ) { $found_matches = array(); $pattern = '\[(\[?)(arm_form|arm_edit_profile|arm_close_account|arm_setup|arm_template)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)'; $posts = $wp_query->posts; if ( is_array( $posts ) && ! empty( $posts ) ) { foreach ( $posts as $key => $post ) { if ( preg_match_all( '/' . $pattern . '/s', $post->post_content, $matches ) > 0 ) { $found_matches[] = $matches; } } } $found_matches = $this->arm_array_trim( $found_matches ); if ( ! empty( $found_matches ) && count( $found_matches ) > 0 ) { return $found_matches; } } return false; } /* * Trim Array Values. */ function arm_array_trim( $array ) { if ( is_array( $array ) ) { foreach ( $array as $key => $value ) { if ( is_array( $value ) ) { $array[ $key ] = $this->arm_array_trim( $value ); } else { $array[ $key ] = trim( $value ); } if ( empty( $array[ $key ] ) ) { unset( $array[ $key ] ); } } } else { $array = trim( $array ); } return $array; } /** * Removes duplicate values from multidimensional array */ function arm_array_unique( $array ) { $result = array_map( 'unserialize', array_unique( array_map( 'serialize', $array ) ) ); if ( is_array( $result ) ) { foreach ( $result as $key => $value ) { if ( is_array( $value ) ) { $result[ $key ] = $this->arm_array_unique( $value ); } } } return $result; } /** * Restrict Network Activation */ public static function armember_check_network_activation( $network_wide ) { if ( ! $network_wide ) { return; } deactivate_plugins( plugin_basename( MEMBERSHIPLITE_DIR_NAME.'/armember-membership.php' ), true, true ); header( 'Location: ' . network_admin_url( 'plugins.php?deactivate=true' ) ); exit; } public static function deactivate__armember_lite_version(){ $dependent = 'armember/armember.php'; if (is_plugin_active($dependent) ) { add_action('update_option_active_plugins', array( 'ARMemberLite', 'deactivate_armember_pro_version' )); } } public static function deactivate_armember_pro_version() { $dependent = 'armember/armember.php'; deactivate_plugins($dependent); } public static function install() { global $ARMemberLite, $arm_lite_version; $armember_exists = 0; if ( file_exists( WP_PLUGIN_DIR . '/armember/armember.php' ) ) { $armember_exists = 1; } $armember_version = get_option( 'arm_version', '' ); if ( $armember_version != '' && $armember_exists == 1 ) { $_version = get_option( 'armlite_version' ); if ( empty( $_version ) || $_version == '' ) { update_option( 'armlite_version', $arm_lite_version ); } else { $ARMemberLite->wpdbfix(); do_action( 'arm_reactivate_plugin' ); } } else { $_version = get_option( 'armlite_version' ); if ( empty( $_version ) || $_version == '' ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; @set_time_limit( 0 ); //phpcs:ignore global $wpdb, $arm_lite_version, $arm_global_settings; $arm_global_settings->arm_set_ini_for_access_rules(); $charset_collate = ''; if ( $wpdb->has_cap( 'collation' ) ) { if ( ! empty( $wpdb->charset ) ) { $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; } if ( ! empty( $wpdb->collate ) ) { $charset_collate .= " COLLATE $wpdb->collate"; } } update_option( 'armlite_version', $arm_lite_version ); update_option( 'arm_plugin_activated', 1 ); update_option( 'arm_show_document_video', 1 ); update_option( 'arm_is_social_feature', 0 ); update_option( 'arm_is_gutenberg_block_restriction_feature', 0 ); update_option( 'arm_is_beaver_builder_restriction_feature', 0 ); update_option( 'arm_is_divi_builder_restriction_feature', 0 ); update_option( 'arm_is_wpbakery_page_builder_restriction_feature', 0 ); update_option( 'arm_is_fusion_builder_restriction_feature', 0 ); update_option( 'arm_is_oxygen_builder_restriction_feature', 0 ); update_option( 'arm_is_siteorigin_builder_restriction_feature', 0 ); update_option( 'arm_is_bricks_builder_restriction_feature', 0 ); $arm_dbtbl_create = array(); /* Table structure for `Members activity` */ $tbl_arm_members_activity = $wpdb->prefix . 'arm_activity'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_members_activity}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_members_activity}`( `arm_activity_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_user_id` bigint(20) NOT NULL DEFAULT '0', `arm_type` VARCHAR(50) NOT NULL, `arm_action` VARCHAR(50) NOT NULL, `arm_content` LONGTEXT NOT NULL, `arm_item_id` bigint(20) NOT NULL DEFAULT '0', `arm_paid_post_id` bigint(20) NOT NULL DEFAULT '0', `arm_gift_plan_id` bigint(20) NOT NULL DEFAULT '0', `arm_link` VARCHAR(255) DEFAULT NULL, `arm_activity_plan_name` VARCHAR(255) NOT NULL, `arm_activity_plan_type` VARCHAR(255) NOT NULL, `arm_activity_payment_gateway` VARCHAR(255) NOT NULL, `arm_activity_plan_amount` DOUBLE NOT NULL DEFAULT '0', `arm_activity_plan_start_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_activity_plan_end_date` datetime NULL DEFAULT '1970-01-01 00:00:00', `arm_activity_plan_next_cycle_date` datetime NULL DEFAULT '1970-01-01 00:00:00', `arm_ip_address` VARCHAR(50) NOT NULL, `arm_date_recorded` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_activity_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_members_activity ] = dbDelta( $sql_table ); /* Table structure for `email settings` */ $tbl_arm_email_settings = $wpdb->prefix . 'arm_email_templates'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_email_settings}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_email_settings}`( `arm_template_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_template_name` VARCHAR(255) NOT NULL, `arm_template_slug` VARCHAR(255) NOT NULL , `arm_template_subject` VARCHAR(255) NOT NULL, `arm_template_content` longtext NOT NULL, `arm_template_status` INT(1) NOT NULL DEFAULT '1', PRIMARY KEY (`arm_template_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_email_settings ] = dbDelta( $sql_table ); /* Table structure for `Entries` */ $tbl_arm_entries = $wpdb->prefix . 'arm_entries'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_entries}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_entries}` ( `arm_entry_id` bigint(20) NOT NULL AUTO_INCREMENT, `arm_entry_email` varchar(255) DEFAULT NULL, `arm_name` varchar(255) DEFAULT NULL, `arm_description` LONGTEXT, `arm_ip_address` text, `arm_browser_info` text, `arm_entry_value` LONGTEXT, `arm_form_id` int(11) DEFAULT NULL, `arm_user_id` bigint(20) DEFAULT NULL, `arm_plan_id` int(11) DEFAULT NULL, `arm_is_post_entry` TINYINT(1) NOT NULL DEFAULT '0', `arm_paid_post_id` BIGINT(20) NOT NULL DEFAULT '0', `arm_is_gift_entry` TINYINT(1) NOT NULL DEFAULT '0', `arm_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_entry_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_entries ] = dbDelta( $sql_table ); /* Table structure for `failed login` */ $tbl_arm_fail_attempts = $wpdb->prefix . 'arm_fail_attempts'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_fail_attempts}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_fail_attempts}`( `arm_fail_attempts_id` bigint(20) NOT NULL AUTO_INCREMENT, `arm_user_id` bigint(20) NOT NULL, `arm_fail_attempts_detail` text, `arm_fail_attempts_ip` varchar(200) DEFAULT NULL, `arm_is_block` int(1) NOT NULL DEFAULT '0', `arm_fail_attempts_datetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_fail_attempts_release_datetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_fail_attempts_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_fail_attempts ] = dbDelta( $sql_table ); /* Table structure for `arm_forms` */ $tbl_arm_forms = $wpdb->prefix . 'arm_forms'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_forms}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_forms}` ( `arm_form_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_form_label` VARCHAR(255) DEFAULT NULL, `arm_form_title` VARCHAR(255) DEFAULT NULL, `arm_form_type` VARCHAR(100) DEFAULT NULL, `arm_form_slug` VARCHAR(255) DEFAULT NULL, `arm_is_default` INT(1) NOT NULL DEFAULT '0', `arm_set_name` VARCHAR(255) DEFAULT NULL, `arm_set_id` INT(11) NOT NULL DEFAULT '0', `arm_is_template` INT(11) NOT NULL DEFAULT '0', `arm_ref_template` INT(11) NOT NULL DEFAULT '0', `arm_form_settings` LONGTEXT, `arm_form_updated_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_form_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_form_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_forms ] = dbDelta( $sql_table ); /* Table structure for `arm_form_field` */ $tbl_arm_form_field = $wpdb->prefix . 'arm_form_field'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_form_field}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_form_field}`( `arm_form_field_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_form_field_form_id` INT(11) NOT NULL, `arm_form_field_order` INT(11) NOT NULL DEFAULT '0', `arm_form_field_slug` VARCHAR(255) DEFAULT NULL, `arm_form_field_option` LONGTEXT, `arm_form_field_bp_field_id` INT(11) NOT NULL DEFAULT '0', `arm_form_field_status` INT(1) NOT NULL DEFAULT '1', `arm_form_field_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_form_field_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_form_field ] = dbDelta( $sql_table ); /* Table structure for `lockdown` */ $tbl_arm_lockdown = $wpdb->prefix . 'arm_lockdown'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_lockdown}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_lockdown}`( `arm_lockdown_ID` bigint(20) NOT NULL AUTO_INCREMENT, `arm_user_id` bigint(20) NOT NULL, `arm_lockdown_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_release_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_lockdown_IP` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`arm_lockdown_ID`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_lockdown ] = dbDelta( $sql_table ); /* Table structure for `arm_members` */ $tbl_arm_members = $wpdb->prefix . 'arm_members'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_members}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_members}` ( `arm_member_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `arm_user_id` bigint(20) unsigned NOT NULL, `arm_user_login` VARCHAR(60) NOT NULL DEFAULT '', `arm_user_nicename` VARCHAR(50) NOT NULL DEFAULT '', `arm_user_email` VARCHAR(100) NOT NULL DEFAULT '', `arm_user_url` VARCHAR(100) NOT NULL DEFAULT '', `arm_user_registered` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_user_activation_key` VARCHAR(60) NOT NULL DEFAULT '', `arm_user_status` INT(11) NOT NULL DEFAULT '0', `arm_display_name` VARCHAR(250) NOT NULL DEFAULT '', `arm_user_type` int(1) NOT NULL DEFAULT '0', `arm_primary_status` int(1) NOT NULL DEFAULT '1', `arm_secondary_status` int(1) NOT NULL DEFAULT '0', `arm_user_plan_ids` TEXT NULL, `arm_user_suspended_plan_ids` TEXT NULL, PRIMARY KEY (`arm_member_id`), KEY `arm_user_login_key` (`arm_user_login`), KEY `arm_user_nicename` (`arm_user_nicename`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_members ] = dbDelta( $sql_table ); /* Table structure for `Membership Setup Wizard` */ $tbl_arm_membership_setup = $wpdb->prefix . 'arm_membership_setup'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_membership_setup}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_membership_setup}`( `arm_setup_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_setup_name` VARCHAR(255) NOT NULL, `arm_setup_type` TINYINT(1) NOT NULL DEFAULT '0', `arm_setup_modules` LONGTEXT, `arm_setup_labels` LONGTEXT, `arm_status` INT(1) NOT NULL DEFAULT '1', `arm_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_setup_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_membership_setup ] = dbDelta( $sql_table ); /* Table structure for `Payment Log` */ $tbl_arm_payment_log = $wpdb->prefix . 'arm_payment_log'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_payment_log}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_payment_log}`( `arm_log_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_invoice_id` INT(11) NOT NULL DEFAULT '0', `arm_user_id` bigint(20) NOT NULL DEFAULT '0', `arm_first_name` VARCHAR(255) DEFAULT NULL, `arm_last_name` VARCHAR(255) DEFAULT NULL, `arm_plan_id` bigint(20) NOT NULL DEFAULT '0', `arm_old_plan_id` bigint(20) NOT NULL DEFAULT '0', `arm_payment_gateway` VARCHAR(50) NOT NULL, `arm_payment_type` VARCHAR(50) NOT NULL, `arm_token` TEXT, `arm_payer_email` VARCHAR(255) DEFAULT NULL, `arm_receiver_email` VARCHAR(255) DEFAULT NULL, `arm_transaction_id` TEXT, `arm_transaction_payment_type` VARCHAR(100) DEFAULT NULL, `arm_transaction_status` TEXT, `arm_payment_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', `arm_payment_mode` VARCHAR(255), `arm_payment_cycle` INT(11) NOT NULL DEFAULT '0', `arm_bank_name` VARCHAR(255) DEFAULT NULL, `arm_account_name` VARCHAR(255) DEFAULT NULL, `arm_additional_info` LONGTEXT, `arm_payment_transfer_mode` VARCHAR(255) DEFAULT NULL, `arm_amount` double NOT NULL DEFAULT '0', `arm_currency` VARCHAR(50) DEFAULT NULL, `arm_extra_vars` LONGTEXT, `arm_coupon_code` VARCHAR(255) DEFAULT NULL, `arm_coupon_discount` double NOT NULL DEFAULT '0', `arm_coupon_discount_type` VARCHAR(50) DEFAULT NULL, `arm_coupon_on_each_subscriptions` TINYINT(1) NULL DEFAULT '0', `arm_is_post_payment` TINYINT(1) NOT NULL DEFAULT '0', `arm_paid_post_id` BIGINT(20) NOT NULL DEFAULT '0', `arm_is_gift_payment` TINYINT(1) NOT NULL DEFAULT '0', `arm_is_trial` INT(1) NOT NULL DEFAULT '0', `arm_display_log` INT(1) NOT NULL DEFAULT '1', `arm_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_log_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_payment_log ] = dbDelta( $sql_table ); /* Table structure for `arm_subscription_plans` */ $tbl_arm_subscription_plans = $wpdb->prefix . 'arm_subscription_plans'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_subscription_plans}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_subscription_plans}`( `arm_subscription_plan_id` INT(11) NOT NULL AUTO_INCREMENT, `arm_subscription_plan_name` VARCHAR(255) NOT NULL, `arm_subscription_plan_description` TEXT, `arm_subscription_plan_type` VARCHAR(50) NOT NULL, `arm_subscription_plan_options` LONGTEXT, `arm_subscription_plan_amount` double NOT NULL DEFAULT '0', `arm_subscription_plan_status` INT(1) NOT NULL DEFAULT '1', `arm_subscription_plan_role` VARCHAR(100) DEFAULT NULL, `arm_subscription_plan_post_id` BIGINT(20) NOT NULL DEFAULT '0', `arm_subscription_plan_gift_status` INT(1) NOT NULL DEFAULT '0', `arm_subscription_plan_is_delete` INT(1) NOT NULL DEFAULT '0', `arm_subscription_plan_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_subscription_plan_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_subscription_plans ] = dbDelta( $sql_table ); /* Table structure for `Taxonomy Term Meta` */ $tbl_arm_termmeta = $wpdb->prefix . 'arm_termmeta'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_termmeta}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_termmeta}`( `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `arm_term_id` bigint(20) unsigned NOT NULL DEFAULT '0', `meta_key` VARCHAR(255) DEFAULT NULL, `meta_value` longtext, PRIMARY KEY (`meta_id`), KEY `arm_term_id` (`arm_term_id`), KEY `meta_key` (`meta_key`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_termmeta ] = dbDelta( $sql_table ); /* Table structure for `Member Templates` */ $tbl_arm_member_templates = $wpdb->prefix . 'arm_member_templates'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_member_templates}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_member_templates}`( `arm_id` int(11) NOT NULL AUTO_INCREMENT, `arm_title` text, `arm_slug` varchar(255) DEFAULT NULL, `arm_type` varchar(50) DEFAULT NULL, `arm_default` int(1) NOT NULL DEFAULT '0', `arm_subscription_plan` text NULL, `arm_core` int(1) NOT NULL DEFAULT '0', `arm_template_html` longtext, `arm_ref_template` int(11) NOT NULL DEFAULT '0', `arm_options` longtext, `arm_html_before_fields` longtext, `arm_html_after_fields` longtext, `arm_enable_admin_profile` int(1) NOT NULL DEFAULT '0', `arm_created_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_id`) ) {$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_member_templates ] = dbDelta( $sql_table ); $tbl_arm_login_history = $wpdb->prefix . 'arm_login_history'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_login_history}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_login_history}`( `arm_history_id` int(11) NOT NULL AUTO_INCREMENT, `arm_user_id` int(11) NOT NULL, `arm_logged_in_ip` varchar(255) NOT NULL, `arm_logged_in_date` DATETIME NOT NULL, `arm_logout_date` DATETIME NOT NULL, `arm_login_duration` TIME NOT NULL, `arm_history_browser` VARCHAR(255) NOT NULL, `arm_history_session` VARCHAR(255) NOT NULL, `arm_login_country` VARCHAR(255) NOT NULL, `arm_user_current_status` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`arm_history_id`) ){$charset_collate};"; $arm_dbtbl_create[ $tbl_arm_login_history ] = dbDelta( $sql_table ); $tbl_arm_debug_payment_log = $wpdb->prefix . 'arm_debug_payment_log'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_debug_payment_log}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_debug_payment_log}`( `arm_payment_log_id` int(11) NOT NULL AUTO_INCREMENT, `arm_payment_log_ref_id` int(11) NOT NULL DEFAULT '0', `arm_payment_log_gateway` varchar(255) DEFAULT NULL, `arm_payment_log_event` varchar(255) DEFAULT NULL, `arm_payment_log_event_from` varchar(255) DEFAULT NULL, `arm_payment_log_status` TINYINT(1) DEFAULT '1', `arm_payment_log_raw_data` TEXT, `arm_payment_log_added_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_payment_log_id`) ) {$charset_collate};"; $arm_dbtbl_create[$tbl_arm_debug_payment_log] = dbDelta($sql_table); $tbl_arm_debug_general_log = $wpdb->prefix . 'arm_debug_general_log'; $sql_table = "DROP TABLE IF EXISTS `{$tbl_arm_debug_general_log}`; CREATE TABLE IF NOT EXISTS `{$tbl_arm_debug_general_log}`( `arm_general_log_id` int(11) NOT NULL AUTO_INCREMENT, `arm_general_log_event` varchar(255) DEFAULT NULL, `arm_general_log_event_name` varchar(255) DEFAULT NULL, `arm_general_log_event_from` varchar(255) DEFAULT NULL, `arm_general_log_raw_data` TEXT, `arm_general_log_added_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00', PRIMARY KEY (`arm_general_log_id`) ) {$charset_collate};"; $arm_dbtbl_create[$tbl_arm_debug_general_log] = dbDelta($sql_table); /* Install Default Template Forms & Fields */ $ARMemberLite->install_default_templates(); $wpdb->query( "ALTER TABLE `".$tbl_arm_forms."` AUTO_INCREMENT=101" ); // phpcs:ignore --Reason: $tbl_arm_forms is a table name. /* Install Default Member Forms & Fields. */ $ARMemberLite->install_member_form_fields(); /* Install Default Pages. */ $ARMemberLite->install_default_pages(); /* Update Page in default template */ $ARMemberLite->update_default_pages_for_templates(); /* Create Custom User Role & Capabilities. */ $ARMemberLite->add_user_role_and_capabilities(); /* Create default member panel tab */ $ARMemberLite->add_default_member_panel_tab(); $armember_check_db_permission = $ARMemberLite->armember_check_db_permission(); if(!empty($armember_check_db_permission)) { $arm_members_table = $ARMemberLite->tbl_arm_members; $arm_tbl_arm_payment_log = $ARMemberLite->tbl_arm_payment_log; //Add the arm-user-id INDEX for the Members table $arm_members_add_index_arm_user_id = $wpdb->get_results( $wpdb->prepare("SHOW INDEX FROM ".$arm_members_table." where Key_name=%s",'arm-user-id')); //phpcs:ignore --Reason: $arm_members_table is a table name if(empty($arm_members_add_index_arm_user_id)) { $wpdb->query("ALTER TABLE `{$arm_members_table}` ADD INDEX `arm-user-id` (`arm_user_id`)"); //phpcs:ignore --Reason $arm_members_table is a table name } //Add the arm-user-id INDEX for the Payment table $arm_payment_log_add_index_arm_user_id = $wpdb->get_results($wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_payment_log." where Key_name=%s",'arm-user-id')); //phpcs:ignore --Reason: $arm_tbl_arm_payment_log is a table name if(empty($arm_payment_log_add_index_arm_user_id)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_payment_log}` ADD INDEX `arm-user-id` (`arm_user_id`)"); //phpcs:ignore --Reason: $arm_tbl_arm_payment_log is a table name } //Add the arm-plan-id INDEX for the Payment table $arm_payment_log_add_index_arm_plan_id = $wpdb->get_results($wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_payment_log." where Key_name=%s",'arm-plan-id')); //phpcs:ignore --Reason: $arm_tbl_arm_payment_log is a table name if(empty($arm_payment_log_add_index_arm_plan_id)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_payment_log}` ADD INDEX `arm-plan-id` (`arm_plan_id`)"); //phpcs:ignore --Reason $arm_tbl_arm_payment_log } //Add the arm-display-log INDEX for the Payment table $arm_payment_log_add_index_arm_display_log = $wpdb->get_results($wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_payment_log." where Key_name=%s ",'arm-display-log')); //phpcs:ignore --Reason: $arm_tbl_arm_payment_log is a table name if(empty($arm_payment_log_add_index_arm_display_log)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_payment_log}` ADD INDEX `arm-display-log` (`arm_display_log`)"); //phpcs:ignore --Reason $arm_tbl_arm_payment_log is a table name } $arm_tbl_arm_payment_log = $ARMemberLite->tbl_arm_payment_log; $arm_tbl_arm_debug_payment_log = $ARMemberLite->tbl_arm_debug_payment_log; $arm_tbl_arm_debug_general_log = $ARMemberLite->tbl_arm_debug_general_log; //Add the arm-debug-payment-log-gateway INDEX for the Payment table $arm_debug_payment_log_add_index_arm_gateway = $wpdb->get_results( $wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_debug_payment_log." where Key_name=%s ",'arm-debug-payment-log-gateway') );//phpcs:ignore --Reason $arm_tbl_arm_debug_payment_log is a table name if(empty($arm_debug_payment_log_add_index_arm_gateway)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_debug_payment_log}` ADD INDEX `arm-debug-payment-log-gateway` (`arm_payment_log_gateway`)");//phpcs:ignore --Reason $arm_tbl_arm_debug_payment_log is a table name } //Add the arm-debug-payment-log-status INDEX for the Payment table $arm_debug_payment_log_add_index_arm_status = $wpdb->get_results( $wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_debug_payment_log." where Key_name=%s ",'arm-debug-payment-log-status') ); //phpcs:ignore --Reason $arm_tbl_arm_debug_payment_log is a table name if(empty($arm_debug_payment_log_add_index_arm_status)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_debug_payment_log}` ADD INDEX `arm-debug-payment-log-status` (`arm_payment_log_status`)");//phpcs:ignore --Reason $arm_tbl_arm_debug_payment_log is a table name } //Add the arm-debug-general-log-event INDEX for the general table $arm_debug_general_log_add_index_arm_event = $wpdb->get_results( $wpdb->prepare("SHOW INDEX FROM ".$arm_tbl_arm_debug_general_log." where Key_name=%s ",'arm-debug-general-log-event') );//phpcs:ignore --Reason $arm_tbl_arm_debug_general_log is a table name if(empty($arm_debug_general_log_add_index_arm_event)) { $wpdb->query("ALTER TABLE `{$arm_tbl_arm_debug_general_log}` ADD INDEX `arm-debug-general-log-event` (`arm_general_log_event`)");//phpcs:ignore --Reason $arm_tbl_arm_debug_general_log is a table name } } /* Plugin Action Hook After Install Process */ do_action( 'arm_after_activation_hook' ); do_action( 'arm_after_install' ); add_option('armember_lite_install_date', current_time('mysql') ); } else { $ARMemberLite->wpdbfix(); do_action( 'arm_reactivate_plugin' ); } } $args = array( 'role' => 'administrator', 'fields' => 'id', ); $users = get_users( $args ); if ( count( $users ) > 0 ) { foreach ( $users as $key => $user_id ) { $armroles = $ARMemberLite->arm_capabilities(); $userObj = new WP_User( $user_id ); foreach ( $armroles as $armrole => $armroledescription ) { $userObj->add_cap( $armrole ); } unset( $armrole ); unset( $armroles ); unset( $armroledescription ); } } } function armember_check_db_permission() { global $wpdb; $results = $wpdb->get_results("SHOW GRANTS FOR CURRENT_USER;"); //phpcs:ignore --Reason $wpdb is a global variable. $allowed_index = 0; foreach($results as $result) { if(is_object($result)) { foreach($result as $res) { $result_data = stripslashes_deep($res); } } else { $result_data = stripslashes_deep($result); } if( (strpos($result_data, "ALL PRIVILEGES") !== false || strpos($result_data, "INDEX") !== false) && (strpos($result_data, "ON *.*") || strpos($result_data, "`".DB_NAME."`") ) ) { $allowed_index = 1; break; } } return $allowed_index; } function install_default_templates() { include MEMBERSHIPLITE_CLASSES_DIR . '/templates.arm_member_forms_templates.php'; } function update_default_pages_for_templates() { global $wpdb, $ARMemberLite; $global_settings = get_option( 'arm_global_settings' ); $arm_settings = maybe_unserialize( $global_settings ); $page_settings = $arm_settings['page_settings']; $forms = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$ARMemberLite->tbl_arm_forms." WHERE (`arm_form_slug` LIKE %s OR `arm_form_slug` LIKE %s OR `arm_form_slug` LIKE %s OR `arm_form_slug` LIKE %s) AND arm_is_template = %d",'template-login%', 'template-registration%', 'template-forgot%','template-change%',1) ); //phpcs:ignore --Reason $tbl_arm_forms is table name if ( count( $forms ) > 0 ) { foreach ( $forms as $key => $value ) { $form_id = $value->arm_form_id; $form_settings = maybe_unserialize( $value->arm_form_settings ); $form_settings['redirect_page'] = $page_settings['edit_profile_page_id']; $form_settings['registration_link_type_page'] = $page_settings['register_page_id']; $form_settings['forgot_password_link_type_page'] = $page_settings['forgot_password_page_id']; $form_settings = maybe_serialize( $form_settings ); $formData = array( 'arm_form_settings' => $form_settings ); $form_update = $wpdb->update( $ARMemberLite->tbl_arm_forms, $formData, array( 'arm_form_id' => $form_id ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery } } } function arm_install_plugin_data() { global $wp, $wpdb, $arm_members_directory, $arm_access_rules, $arm_email_settings, $arm_subscription_plans; $is_activate = get_option( 'arm_plugin_activated', 0 ); if ( $is_activate == '1' ) { delete_option( 'arm_plugin_activated' ); /** * Install Plugin Default Data For The First Time. */ /* Create Free Plan. */ $arm_subscription_plans->arm_insert_sample_subscription_plan(); /* Install default templates */ $arm_email_settings->arm_insert_default_email_templates(); /* Install Default Profile Template */ $arm_members_directory->arm_insert_default_member_templates(); /* Install Default Rules */ $arm_access_rules->install_rule_data(); $arm_access_rules->install_redirection_settings(); } } /** * Add Custom User Role & Capabilities */ function add_user_role_and_capabilities() { global $wp, $wpdb, $wp_roles, $ARMemberLite, $arm_members_class, $arm_global_settings; $role_name = 'ARMember'; $role_slug = sanitize_title( $role_name ); $basic_caps = array( $role_slug => true, 'read' => true, 'level_0' => true, ); $wp_roles->add_role( $role_slug, $role_name, $basic_caps ); $arm_user_role = $wp_roles->get_role( $role_slug ); $wpdb->query( "DELETE FROM ".$ARMemberLite->tbl_arm_members ); //phpcs:ignore --Reason: $tbl_arm_members is table name $user_table = $wpdb->users; $usermeta_table = $wpdb->usermeta; if ( is_multisite() ) { $capability_column = $wpdb->get_blog_prefix( $GLOBALS['blog_id'] ) . 'capabilities'; $allMembers = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$user_table." u INNER JOIN ".$usermeta_table." um ON u.ID = um.user_id WHERE 1=1 AND um.meta_key = %s",$capability_column) );//phpcs:ignore --Reason $user_table and $usermeta_table is a table name } else { $allMembers = $wpdb->get_results("SELECT * FROM ".$wpdb->users);//phpcs:ignore --Reason: $user_table and $wpdb->users is a table name. False Positive Alarm } $chunk_size = 100; if ( ! empty( $allMembers ) ) { $arm_total_users = count( $allMembers ); if ( $arm_total_users <= 15000 ) { $chunk_size = 100; } elseif ( $arm_total_users > 15000 && $arm_total_users <= 25000 ) { $chunk_size = 200; } elseif ( $arm_total_users > 25000 && $arm_total_users <= 50000 ) { $chunk_size = 300; } elseif ( $arm_total_users > 50000 && $arm_total_users <= 100000 ) { $chunk_size = 400; } else { $chunk_size = 500; } $i = 0; $chunked_values = ''; foreach ( $allMembers as $member ) { $i++; $user_id = $member->ID; $arm_user_id = $user_id; $arm_user_login = $member->user_login; $arm_user_nicename = $member->user_nicename; $arm_user_email = $member->user_email; $arm_user_url = $member->user_url; $arm_user_registered = $member->user_registered; $arm_user_activation_key = $member->user_activation_key; $arm_user_status = $member->user_status; $arm_display_name = $member->display_name; $arm_user_type = 0; $arm_primary_status = 1; $arm_secondary_status = 0; if ( $i == 1 ) { $chunked_values .= '(' . $arm_user_id . ',"' . $arm_user_login . '","' . $arm_user_nicename . '","' . $arm_user_email . '","","' . $arm_user_registered . '","' . $arm_user_activation_key . '",' . $arm_user_status . ',"' . $arm_display_name . '",0,1,0)'; } else { $chunked_values .= ',(' . $arm_user_id . ',"' . $arm_user_login . '","' . $arm_user_nicename . '","' . $arm_user_email . '","","' . $arm_user_registered . '","' . $arm_user_activation_key . '",' . $arm_user_status . ',"' . $arm_display_name . '",0,1,0)'; } if ( $i == $chunk_size && ( ! empty( $chunked_values ) || $chunked_values != '' ) ) { $wpdb->query( 'INSERT INTO `' . $ARMemberLite->tbl_arm_members . '` (arm_user_id, arm_user_login, arm_user_nicename, arm_user_email, arm_user_url,arm_user_registered, arm_user_activation_key, arm_user_status,arm_display_name, arm_user_type, arm_primary_status,arm_secondary_status) VALUES ' . $chunked_values );//phpcs:ignore -- Reason $ARMemberLite->tbl_arm_members is a table name $i = 0; $chunked_values = ''; } } if ( ! empty( $chunked_values ) || $chunked_values != '' ) { $wpdb->query( 'INSERT INTO `' . $ARMemberLite->tbl_arm_members . '` (arm_user_id, arm_user_login, arm_user_nicename, arm_user_email, arm_user_url,arm_user_registered, arm_user_activation_key, arm_user_status,arm_display_name, arm_user_type, arm_primary_status,arm_secondary_status) VALUES ' . $chunked_values );//phpcs:ignore --Reason $ARMemberLite->tbl_arm_members is a table name } } } /** * Check and Add Custom User Role & Capabilities for new users - after plugin reactivation */ function check_new_users_after_plugin_reactivation() { global $wpdb, $ARMemberLite; $user_table = $wpdb->users; $usermeta_table = $wpdb->usermeta; $get_all_armembers = $wpdb->get_results( "select * from $ARMemberLite->tbl_arm_members", ARRAY_A );//phpcs:ignore --Reason: $ARMemberLite->tbl_arm_members is a table name $push_user_ids = array(); $where = "WHERE 1=1"; $where1 = ''; foreach ( $get_all_armembers as $new_user_id ) { $push_user_ids[] = $new_user_id['arm_user_id']; } if (!empty($push_user_ids)) { if (is_multisite()) { $where1 = " AND u.ID NOT IN (" . implode(", ", $push_user_ids) . ") "; //phpcs:ignore } else { $where .= " AND `ID` NOT IN (" . implode(", ", $push_user_ids) . ") "; //phpcs:ignore } } $list_to_include_new_users=array(); if ( is_multisite() ) { $capability_column = $wpdb->get_blog_prefix( $GLOBALS['blog_id'] ) . 'capabilities'; $where1 .= $wpdb->prepare(" AND um.meta_key = %s ",$capability_column); $list_to_include_new_users = $wpdb->get_results("SELECT * FROM `".$user_table."` u INNER JOIN `".$usermeta_table."` um ON u.ID = um.user_id WHERE 1=1 ".$where1, ARRAY_A);//phpcs:ignore --Reason $user and $wpdb->usermeta_table is table name } else { $list_to_include_new_users = $wpdb->get_results("SELECT * FROM $wpdb->users ".$where, ARRAY_A);//phpcs:ignore --Reason: $wpdb->users is a table name. False Positive alarm } if ( ! empty( $list_to_include_new_users ) ) { $arm_total_users = count( $list_to_include_new_users ); if ( $arm_total_users <= 15000 ) { $chunk_size = 100; } elseif ( $arm_total_users > 15000 && $arm_total_users <= 25000 ) { $chunk_size = 200; } elseif ( $arm_total_users > 25000 && $arm_total_users <= 50000 ) { $chunk_size = 300; } elseif ( $arm_total_users > 50000 && $arm_total_users <= 100000 ) { $chunk_size = 400; } else { $chunk_size = 500; } $chunked_values = ''; $i = 0; foreach ( $list_to_include_new_users as $key => $new_users_data ) { $i++; $arm_user_id = $new_users_data['ID']; $arm_user_login = $new_users_data['user_login']; $arm_user_nicename = $new_users_data['user_nicename']; $arm_user_email = $new_users_data['user_email']; $arm_user_url = $new_users_data['user_url']; $arm_user_registered = $new_users_data['user_registered']; $arm_user_activation_key = $new_users_data['user_activation_key']; $arm_user_status = $new_users_data['user_status']; $arm_display_name = $new_users_data['display_name']; $arm_user_type = 0; $arm_primary_status = 1; $arm_secondary_status = 0; if ( $i == 1 ) { $chunked_values .= "(" . $arm_user_id . ",\"" . $arm_user_login . "\",\"" . $arm_user_nicename . "\",\"" . $arm_user_email . "\",\"\",\"" . $arm_user_registered . "\",\"" . $arm_user_activation_key . "\"," . $arm_user_status . ",\"" . $arm_display_name . "\",0,1,0)"; } else { $chunked_values .= ",(" . $arm_user_id . ",\"" . $arm_user_login . "\",\"" . $arm_user_nicename . "\",\"" . $arm_user_email . "\",\"\",\"" . $arm_user_registered . "\",\"" . $arm_user_activation_key . "\"," . $arm_user_status . ",\"" . $arm_display_name . "\",0,1,0)"; } if ( $i == $chunk_size && $chunked_values != '' ) { $wpdb->query( 'INSERT INTO `' . $ARMemberLite->tbl_arm_members . '` (arm_user_id, arm_user_login, arm_user_nicename, arm_user_email, arm_user_url,arm_user_registered, arm_user_activation_key, arm_user_status,arm_display_name, arm_user_type, arm_primary_status,arm_secondary_status) VALUES ' . $chunked_values);//phpcs:ignore --Reason $ARMemberLite->tbl_arm_members is a table name $i = 0; $chunked_values = ''; } } if ( ! empty( $chunked_values ) || $chunked_values != '' ) { $wpdb->query( 'INSERT INTO `' . $ARMemberLite->tbl_arm_members . '` (arm_user_id, arm_user_login, arm_user_nicename, arm_user_email, arm_user_url,arm_user_registered, arm_user_activation_key, arm_user_status,arm_display_name, arm_user_type, arm_primary_status,arm_secondary_status) VALUES ' . $chunked_values);//phpcs:ignore --Reason $ARMemberLite->tbl_arm_members is a table name } } } /** * Install Default Member Forms & thier fields into Database */ function install_member_form_fields() { global $wp, $wpdb, $arm_lite_errors, $ARMemberLite, $arm_members_class, $arm_member_forms, $arm_global_settings; /* Add Default Preset Fields */ $defaultFields = $arm_member_forms->arm_default_preset_user_fields(); unset( $defaultFields['social_fields'] ); $defaultPresetFields = array( 'default' => $defaultFields ); update_option( 'arm_preset_form_fields', $defaultPresetFields ); /* Add Default Forms */ $tbl_arm_forms = $wpdb->prefix . 'arm_forms'; $tbl_arm_form_field = $wpdb->prefix . 'arm_form_field'; $default_member_forms_data = $arm_member_forms->arm_default_member_forms_data(); $insertedFields = array(); foreach ( $default_member_forms_data as $key => $val ) { $arm_set_id = 0; $arm_set_name = ''; if ( in_array( $key, array( 'login', 'forgot_password', 'change_password' ) ) ) { $arm_set_name = esc_html__( 'Default Set', 'armember-membership' ); $arm_set_id = 1; } $form_data = array( 'arm_form_label' => $val['name'], 'arm_form_title' => $val['name'], 'arm_form_type' => $key, 'arm_form_slug' => $val['form_slug'], 'arm_is_default' => '1', 'arm_set_name' => $arm_set_name, 'arm_set_id' => $arm_set_id, 'arm_ref_template' => '1', 'arm_form_updated_date' => current_time( 'mysql' ), 'arm_form_created_date' => current_time( 'mysql' ), 'arm_form_settings' => maybe_serialize( $val['settings'] ), ); /* Insert Form Data */ $wpdb->insert( $tbl_arm_forms, $form_data ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $form_id = $wpdb->insert_id; if ( ! empty( $val['fields'] ) ) { $i = 1; foreach ( $val['fields'] as $field ) { $fid = isset( $field['id'] ) ? $field['id'] : $field['meta_key']; if ( $fid == 'repeat_pass' ) { $field['ref_field_id'] = $insertedFields[ $key ]['user_pass']; } $form_field_data = array( 'arm_form_field_form_id' => $form_id, 'arm_form_field_order' => $i, 'arm_form_field_slug' => isset( $field['meta_key'] ) ? $field['meta_key'] : '', 'arm_form_field_created_date' => current_time( 'mysql' ), 'arm_form_field_option' => maybe_serialize( $field ), ); /* Insert Form Fields. */ $wpdb->insert( $tbl_arm_form_field, $form_field_data ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $insert_field_id = $wpdb->insert_id; $insertedFields[ $key ][ $fid ] = $insert_field_id; $i++; } } } } /** * Install Default Plugin Pages into Database */ function install_default_pages() { global $wp, $wpdb, $ARMemberLite, $arm_members_class, $arm_member_forms, $arm_global_settings; /* Default Global Settings */ $arm_settings = $arm_global_settings->arm_default_global_settings(); /* Default Pages */ $arm_pages = $arm_global_settings->arm_default_pages_content(); if ( ! empty( $arm_pages ) ) { foreach ( $arm_pages as $pageIDKey => $page ) { $page_id = wp_insert_post( $page ); if ( $page_id != 0 ) { $arm_settings['page_settings'][ $pageIDKey ] = $page_id; } } } /* Store Global Setting into DB */ if ( ! empty( $arm_settings ) ) { $new_global_settings = $arm_settings; update_option( 'arm_global_settings', $new_global_settings ); /** * Update Redirection pages in member forms */ $allForms = $arm_member_forms->arm_get_all_member_forms( '`arm_form_id`, `arm_form_type`, `arm_form_settings`' ); if ( ! empty( $allForms ) ) { foreach ( $allForms as $form ) { $form_id = $form['arm_form_id']; $form_settings = $form['arm_form_settings']; $isFormUpdate = false; switch ( $form['arm_form_type'] ) { case 'registration': $isFormUpdate = true; $form_settings['redirect_type'] = 'page'; $form_settings['redirect_page'] = $arm_settings['page_settings']['edit_profile_page_id']; break; case 'login': $isFormUpdate = true; $form_settings['redirect_type'] = 'page'; $form_settings['redirect_page'] = $arm_settings['page_settings']['edit_profile_page_id']; $form_settings['registration_link_type'] = 'page'; $form_settings['registration_link_type_page'] = $arm_settings['page_settings']['register_page_id']; $form_settings['forgot_password_link_type_page'] = $arm_settings['page_settings']['forgot_password_page_id']; break; } if ( $isFormUpdate ) { $formData = array( 'arm_form_settings' => maybe_serialize( $form_settings ) ); $form_update = $wpdb->update( $ARMemberLite->tbl_arm_forms, $formData, array( 'arm_form_id' => $form_id ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery } } } } /* Update Security Settings */ $securitySettings = $arm_global_settings->arm_get_all_block_settings(); update_option( 'arm_block_settings', $securitySettings ); } /** * Add Default Page in the database */ function add_default_member_panel_tab(){ global $arm_global_settings; $arm_existing_member_panel_settings = $arm_global_settings->arm_get_member_panel_settings(); $arm_new_member_panel_settings = $arm_global_settings->arm_default_member_panel_settings(); if (!is_array($arm_existing_member_panel_settings)) { $arm_existing_member_panel_settings = array(); } if (!isset($arm_existing_member_panel_settings['tab_settings']) || !is_array($arm_existing_member_panel_settings['tab_settings'])) { $arm_existing_member_panel_settings['tab_settings'] = array(); } if (!empty($arm_new_member_panel_settings['tab_settings'])) { foreach ($arm_new_member_panel_settings['tab_settings'] as $new_tab) { $exists = false; foreach ($arm_existing_member_panel_settings['tab_settings'] as $existing_tab) { if (isset($existing_tab['id']) && $existing_tab['id'] === $new_tab['id']) { $exists = true; break; } } if (!$exists) { $arm_existing_member_panel_settings['tab_settings'][] = $new_tab; } } } if (!isset($arm_existing_member_panel_settings['appearance_settings']) || (isset($arm_existing_member_panel_settings['appearance_settings']) && empty($arm_existing_member_panel_settings['appearance_settings']))) { $arm_existing_member_panel_settings['appearance_settings'] = $arm_new_member_panel_settings['appearance_settings']; } update_option('arm_member_panel_settings', $arm_existing_member_panel_settings); } public static function uninstall() { global $wpdb; $arm_uninstall = false; if ( !is_plugin_active( 'armember/armember.php' ) && !file_exists( WP_PLUGIN_DIR . '/armember/armember.php' ) ) { $arm_uninstall = true; } if ( is_multisite() ) { $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery if ( $blogs ) { foreach ( $blogs as $blog ) { switch_to_blog( $blog['blog_id'] ); delete_option( 'armlite_version' ); if ( $arm_uninstall ) { self::arm_uninstall(); } } restore_current_blog(); } } else { if ( $arm_uninstall ) { self::arm_uninstall(); } } /* Plugin Action Hook After Uninstall Process */ do_action( 'arm_after_uninstall' ); } public static function arm_uninstall() { global $wpdb, $arm_members_class; /** * To Cancel User's Recurring Subscription from Payment Gateway */ $query_member_users = $wpdb->get_results( 'SELECT arm_user_id FROM '.$wpdb->prefix . 'arm_members' );//phpcs:ignore --Reason: $wpdb->prefix.arm_members is a table name. False Positive Alarm if ( ! empty( $query_member_users ) ) { foreach ( $query_member_users as $query_member_user ) { $chk_subscription_arm_user_id = $query_member_user->arm_user_id; $arm_members_class->arm_before_delete_user_action( $chk_subscription_arm_user_id ); } } /** * Delete Meta Values */ $wpdb->query( $wpdb->prepare('DELETE FROM `' . $wpdb->options . "` WHERE `option_name` LIKE %s",'%arm\_%') ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( $wpdb->prepare('DELETE FROM `' . $wpdb->postmeta . "` WHERE `meta_key` LIKE %s",'%arm\_%')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( $wpdb->prepare('DELETE FROM `' . $wpdb->usermeta . "` WHERE `meta_key` LIKE %s",'%arm\_%') ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery delete_option( 'armlite_version' ); delete_option( 'armIsSorted' ); delete_option( 'armSortOrder' ); delete_option( 'armSortId' ); delete_option( 'armSortInfo' ); delete_option( 'arm_lite_new_version_installed' ); delete_site_option( 'armIsSorted' ); delete_site_option( 'armSortOrder' ); delete_site_option( 'armSortId' ); delete_site_option( 'armSortInfo' ); delete_site_option( 'arm_version_1_7_installed' ); /** * Delete Plugin DB Tables */ $blog_tables = array( $wpdb->prefix . 'arm_activity', $wpdb->prefix . 'arm_auto_message', $wpdb->prefix . 'arm_coupons', $wpdb->prefix . 'arm_email_templates', $wpdb->prefix . 'arm_entries', $wpdb->prefix . 'arm_fail_attempts', $wpdb->prefix . 'arm_forms', $wpdb->prefix . 'arm_form_field', $wpdb->prefix . 'arm_lockdown', $wpdb->prefix . 'arm_members', $wpdb->prefix . 'arm_membership_setup', $wpdb->prefix . 'arm_payment_log', $wpdb->prefix . 'arm_payment_log_temp', $wpdb->prefix . 'arm_bank_transfer_log', $wpdb->prefix . 'arm_subscription_plans', $wpdb->prefix . 'arm_termmeta', $wpdb->prefix . 'arm_member_templates', $wpdb->prefix . 'arm_drip_rules', $wpdb->prefix . 'arm_badges_achievements', $wpdb->prefix . 'arm_login_history', $wpdb->prefix . 'arm_debug_general_log', $wpdb->prefix . 'arm_debug_payment_log', $wpdb->prefix . 'arm_dripped_contents' ); foreach ( $blog_tables as $table ) { $wpdb->query( "DROP TABLE IF EXISTS ".$table );//phpcs:ignore --Reason: $table is a table name. False Positive Alarm } return true; } /** * Get Current Browser Info */ function getBrowser( $user_agent ) { $u_agent = $user_agent; $bname = 'Unknown'; $platform = 'Unknown'; $version = ''; $ub = ''; /* First get the platform? */ if ( @preg_match( '/linux/i', $u_agent ) ) { $platform = 'linux'; } elseif ( @preg_match( '/macintosh|mac os x/i', $u_agent ) ) { $platform = 'mac'; } elseif ( @preg_match( '/windows|win32/i', $u_agent ) ) { $platform = 'windows'; } /* Next get the name of the useragent yes seperately and for good reason */ if ( @preg_match( '/MSIE/i', $u_agent ) && ! @preg_match( '/Opera/i', $u_agent ) ) { $bname = 'Internet Explorer'; $ub = 'MSIE'; } elseif ( @preg_match( '/Firefox/i', $u_agent ) ) { $bname = 'Mozilla Firefox'; $ub = 'Firefox'; } elseif ( @preg_match( '/OPR/i', $u_agent ) ) { $bname = 'Opera'; $ub = 'OPR'; } elseif ( @preg_match( '/Edge/i', $u_agent ) ) { $bname = 'Edge'; $ub = 'Edge'; } elseif ( @preg_match( '/Chrome/i', $u_agent ) ) { $bname = 'Google Chrome'; $ub = 'Chrome'; } elseif ( @preg_match( '/Safari/i', $u_agent ) ) { $bname = 'Apple Safari'; $ub = 'Safari'; } elseif ( @preg_match( '/Opera/i', $u_agent ) ) { $bname = 'Opera'; $ub = 'Opera'; } elseif ( @preg_match( '/Netscape/i', $u_agent ) ) { $bname = 'Netscape'; $ub = 'Netscape'; } elseif ( @preg_match( '/Trident/', $u_agent ) ) { $bname = 'Internet Explorer'; $ub = 'rv'; } /* finally get the correct version number */ $known = array( 'Version', $ub, 'other' ); $pattern = '#(?<browser>' . join( '|', $known ) . ')[/ |:]+(?<version>[0-9.|a-zA-Z.]*)#'; if ( ! @preg_match_all( $pattern, $u_agent, $matches ) ) { /* we have no matching number just continue */ } /* see how many we have */ $i = count( $matches['browser'] ); if ( $i != 1 ) { /* we will have two since we are not using 'other' argument yet */ /* see if version is before or after the name */ if ( strripos( $u_agent, 'Version' ) < strripos( $u_agent, $ub ) ) { $version = $matches['version'][0]; } else { $version = $matches['version'][1]; } } else { $version = $matches['version'][0]; } /* check if we have a number */ if ( $version == null || $version == '' ) { $version = '?'; } return array( 'userAgent' => $u_agent, 'name' => $bname, 'version' => $version, 'platform' => $platform, 'pattern' => $pattern, ); } /** * Get Current IP Address of User/Guest */ function arm_get_ip_address() { $ipaddress = ''; if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) && ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['HTTP_CLIENT_IP'] ); //phpcs:ignore } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_FOR'] ); //phpcs:ignore } elseif ( isset( $_SERVER['HTTP_X_FORWARDED'] ) && ! empty( $_SERVER['HTTP_X_FORWARDED'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['HTTP_X_FORWARDED'] ); //phpcs:ignore } elseif ( isset( $_SERVER['HTTP_FORWARDED_FOR'] ) && ! empty( $_SERVER['HTTP_FORWARDED_FOR'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['HTTP_FORWARDED_FOR'] ); //phpcs:ignore } elseif ( isset( $_SERVER['HTTP_FORWARDED'] ) && ! empty( $_SERVER['HTTP_FORWARDED'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['HTTP_FORWARDED'] ); //phpcs:ignore } elseif ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ) { $ipaddress = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); //phpcs:ignore } else { $ipaddress = 'UNKNOWN'; } /* For Public IP Address. */ /* $publicIP = trim(shell_exec("dig +short myip.opendns.com @resolver1.opendns.com")); */ return $ipaddress; } function arm_write_response( $response_data, $file_name = '' ) { global $wp, $wpdb, $wp_filesystem; if ( ! empty( $file_name ) ) { $file_path = MEMBERSHIPLITE_DIR . '/log/' . $file_name; } else { $file_path = MEMBERSHIPLITE_DIR . '/log/response.txt'; } if ( file_exists( ABSPATH . 'wp-admin/includes/file.php' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; if ( false === ( $creds = request_filesystem_credentials( $file_path, '', false, false ) ) ) { /** * if we get here, then we don't have credentials yet, * but have just produced a form for the user to fill in, * so stop processing for now */ return true; /* stop the normal page form from displaying */ } /* now we have some credentials, try to get the wp_filesystem running */ if ( ! WP_Filesystem( $creds ) ) { /* our credentials were no good, ask the user for them again */ request_filesystem_credentials( $file_path, $method, true, false ); return true; } @$file_data = $wp_filesystem->get_contents( $file_path ); $file_data .= $response_data; $file_data .= "\r\n===========================================================================\r\n"; $breaks = array( '<br />', '<br>', '<br/>' ); $file_data = str_ireplace( $breaks, "\r\n", $file_data ); @$write_file = $wp_filesystem->put_contents( $file_path, $file_data, 0755 ); if ( ! $write_file ) { /* esc_html_e('Error Saving Log.', 'armember-membership'); */ } } return; } /** * Function for Write Degug Log */ function arm_debug_response_log( $callback = '', $arm_restricted_cases = array(), $query_obj = array(), $executed_query = '', $is_mail_log = false ) { global $wp, $wpdb, $wp_filesystem; if ( ! defined( 'MEMBERSHIPLITE_DEBUG_LOG' ) || MEMBERSHIPLITE_DEBUG_LOG == false ) { return; } $arm_restricted_cases_filtered = ''; if ( $executed_query == '' ) { $executed_query = $wpdb->last_query; } $arm_restriction_type = 'redirect'; if ( ! empty( $arm_restricted_cases ) ) { foreach ( $arm_restricted_cases as $key => $restricted_case ) { if ( $restricted_case['protected'] == true ) { $arm_restricted_cases_filtered = $arm_restricted_cases[ $key ]['message']; $arm_restriction_type = $arm_restricted_cases[ $key ]['type']; } } } $arm_debug_file_path = MEMBERSHIPLITE_DIR . '/log/restriction_response.txt'; $date = '[ ' . date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) . ' ]'; //phpcs:ignore if ( file_exists( ABSPATH . 'wp-admin/includes/file.php' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; if ( false === ( $creds = request_filesystem_credentials( $arm_debug_file_path, '', false, false ) ) ) { return true; } if ( ! WP_Filesystem( $creds ) ) { request_filesystem_credentials( $arm_debug_file_path, $method, true, false ); return true; } $debug_log_type = MEMBERSHIPLITE_DEBUG_LOG_TYPE; $content = ' Date: ' . $date . "\r\n"; $content .= "\r\n Function :" . $callback . "\r\n"; if ( $is_mail_log == true ) { $content .= "\r\n Log Type : Mail Notification Log \r\n"; $content .= "\r\n Mail Content : " . $arm_restricted_cases_filtered . " \r\n"; } else { $content .= "\r\n Log Type : " . $debug_log_type . "\r\n"; $content .= "\r\n Content : " . $arm_restricted_cases_filtered . "\r\n"; } $content .= "\r\n Last Executed Query:" . $executed_query . "\r\n"; $arm_debug_file_data = $wp_filesystem->get_contents( $arm_debug_file_path ); $arm_debug_file_data .= $content; $arm_debug_file_data .= "\r\n===========================================================================\r\n"; $breaks = array( '<br />', '<br>', '<br/>' ); $arm_debug_file_data = str_ireplace( $breaks, "\r\n", $arm_debug_file_data ); @$write_file = $wp_filesystem->put_contents( $arm_debug_file_path, $arm_debug_file_data, 0755 ); if ( ! $write_file ) { /* esc_html_e('Error Saving Log.', 'armember-membership'); */ } } } function arm_admin_messages_init( $page = '' ) { global $wp, $wpdb, $arm_lite_errors, $ARMemberLite, $pagenow, $arm_slugs,$arm_common_lite; $success_msgs = ''; $error_msgs = ''; $ARMemberLite->arm_session_start(); if ( isset( $_SESSION['arm_message'] ) && ! empty( $_SESSION['arm_message'] ) ) { $arm_admin_message = $_SESSION['arm_message']; //phpcs:ignore foreach ( $arm_admin_message as $snotice ) { if ( $snotice['type'] == 'success' ) { $success_msgs .= $snotice['message']; } else { $error_msgs .= $snotice['message']; } } if ( ! empty( $success_msgs ) ) { ?> <script type="text/javascript">jQuery(window).on("load", function () { armToast('<?php echo esc_html($snotice['message']); ?>', 'success'); });</script> <?php } elseif ( ! empty( $error_msgs ) ) { ?> <script type="text/javascript">jQuery(window).on("load", function () { armToast('<?php echo esc_html($snotice['message']); ?>', 'error'); });</script> <?php } unset( $_SESSION['arm_message'] ); } ?> <div class="armclear"></div> <div class="arm_message arm_success_message" id="arm_success_message"> <div class="arm_message_text"><?php echo esc_html($success_msgs); ?></div> </div> <div class="arm_message arm_error_message" id="arm_error_message"> <div class="arm_message_text"><?php echo esc_html($error_msgs); ?></div> </div> <div class="armclear"></div> <div class="arm_toast_container" id="arm_toast_container"></div> <div class="arm_loading" style="display: none;"><?php $arm_loader = $arm_common_lite->arm_loader_img_func(); echo $arm_loader; //phpcs:ignore ?></div> <?php } function arm_do_not_show_video() { global $wp, $wpdb, $ARMemberLite, $pagenow, $arm_capabilities_global; $ARMemberLite->arm_check_user_cap( $arm_capabilities_global['arm_manage_general_settings'], '1' ); //phpcs:ignore --Reason:Verifying nonce $isShow = ( isset( $_POST['isShow'] ) && $_POST['isShow'] == '0' ) ? 0 : 1; //phpcs:ignore $now = strtotime( current_time( 'mysql' ) ); $time = strtotime( '+10 day', $now ); update_option( 'arm_show_document_video', $isShow ); update_option( 'arm_show_document_video_on', $time ); exit; } function arm_add_document_video() { global $wp, $wpdb, $ARMemberLite, $pagenow, $arm_slugs; $popupData = ''; $arm_slugs_arm_setup_wizard = isset( $arm_slugs->arm_setup_wizard ) ? $arm_slugs->arm_setup_wizard : ''; if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) && $arm_slugs_arm_setup_wizard != $_REQUEST['page'] ) { //phpcs:ignore $now = strtotime( current_time( 'mysql' ) ); $show_document_video = get_option( 'arm_show_document_video', 0 ); $show_document_video_on = get_option( 'arm_show_document_video_on', strtotime( current_time( 'mysql' ) ) ); if ( $show_document_video == '0' ) { return; } if ( $show_document_video_on > $now ) { return; } /* Document Video Popup */ $popupData = '<div id="arm_document_video_popup" class="popup_wrapper arm_document_video_popup"><div class="popup_wrapper_inner">'; $popupData .= '<div class="popup_header">'; $popupData .= '<span class="popup_close_btn arm_popup_close_btn" onclick="armHideDocumentVideo();"></span>'; $popupData .= '<span class="popup_header_text">' . esc_html__( 'Help Tutorial', 'armember-membership' ) . '</span>'; $popupData .= '</div>'; $popupData .= '<div class="popup_content_text">'; $popupData .= '<iframe src="' . esc_attr(MEMBERSHIPLITE_VIDEO_URL) . '" allowfullscreen="" frameborder="0"> </iframe> '; $popupData .= '</div>'; $popupData .= '<div class="armclear"></div>'; $popupData .= '<div class="popup_content_btn popup_footer">'; $popupData .= '<label><input type="checkbox" id="arm_do_not_show_video" class="arm_do_not_show_video arm_icheckbox"><span>' . esc_html__( 'Do not show again.', 'armember-membership' ) . '</span></label>'; $popupData .= '<div class="popup_content_btn_wrapper">'; $popupData .= '<button class="arm_cancel_btn popup_close_btn" onclick="armHideDocumentVideo();" type="button">' . esc_html__( 'Close', 'armember-membership' ) . '</button>'; $popupData .= '</div>'; $popupData .= '<div class="armclear"></div>'; $popupData .= '</div>'; $popupData .= '<div class="armclear"></div>'; $popupData .= '</div></div>'; $wpnonce = wp_create_nonce( 'arm_wp_nonce' ); $popupData .= '<input type="hidden" name="arm_wp_nonce" value="'.esc_attr($wpnonce).'"/>'; $popupData .= '<script type="text/javascript">jQuery(window).on("load", function(){ var v_width = jQuery( window ).width(); if(v_width <= "1350") { var poup_width = "100%"; var poup_height = "400"; jQuery("#arm_document_video_popup").css("width","760"); jQuery(".popup_content_text iframe").css("width",poup_width); jQuery(".popup_content_text iframe").css("height",poup_height); } if(v_width > "1350" && v_width <= "1600") { var poup_width = "100%"; var poup_height = "430"; jQuery("#arm_document_video_popup").css("width","790"); jQuery(".popup_content_text iframe").css("width",poup_width); jQuery(".popup_content_text iframe").css("height",poup_height); } if(v_width > "1600") { var poup_width = "100%"; var poup_height = "450"; jQuery("#arm_document_video_popup").css("width","840"); jQuery(".popup_content_text iframe").css("width",poup_width); jQuery(".popup_content_text iframe").css("height",poup_height); } jQuery("#arm_document_video_popup").bPopup({ modalClose: false, closeClass: "popup_close_btn", onClose: function(){ jQuery(this).find(".popup_wrapper_inner .popup_content_text").html(""); }, }); });</script>'; echo $popupData; //phpcs:ignore } } function arm_add_new_version_release_note() { global $wp, $wpdb, $ARMemberLite, $pagenow, $arm_slugs, $arm_lite_version; $popupData = ''; if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], (array) $arm_slugs ) ) { //phpcs:ignore $show_document_video = get_option( 'arm_lite_new_version_installed', 0 ); if ( $show_document_video == '0' ) { return; } $urltopost = 'https://www.armemberplugin.com/armember_addons/addon_whatsnew_list.php?arm_version=' . $arm_lite_version . '&arm_list_type=whatsnew_list'; $raw_response = wp_remote_post( $urltopost, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), // 'body' => array('plugins' => urlencode(serialize($installed_plugins)), 'wpversion' => $encodedval), 'cookies' => array(), ) ); $addon_list_html = ''; if ( is_wp_error( $raw_response ) || $raw_response['response']['code'] != 200 ) { $addon_list_html .= "<div class='error_message' style='margin-top:100px; padding:20px;'>" . esc_html__( 'Add-On listing is currently unavailable. Please try again later.', 'armember-membership' ) . '</div>'; } else { $addon_list = json_decode( $raw_response['body'] ); $addon_count = count( $addon_list ); $arm_whtsnew_wrapper_width = $addon_count * 141; foreach ( $addon_list as $list ) { $addon_list_html .= '<div class="arm_add_on">'; $addon_list_html .= '<a href="' . esc_url($list->addon_url) . '" target="_blank"><img src="' . esc_attr($list->addon_icon_url) . '" /></a>';//phpcs:ignore $addon_list_html .= '<div class="arm_add_on_text">'; $addon_list_html .= '<a href="' . esc_url($list->addon_url) . '" target="_blank">' . $list->addon_name . '</a>'; $addon_list_html .= '</div>'; $addon_list_html .= '</div>'; } } $popupData = '<div id="arm_update_note" class="popup_wrapper arm_update_note">'; $popupData .= '<span class="arm_top_bg_ellipse_1112">'; $popupData .= '<span class="arm_top_bg_ellipse_1"></span>'; $popupData .= '<span class="arm_top_bg_ellipse_2"></span>'; $popupData .= '<div class="popup_wrapper_inner">'; $popupData .= '<span id="arm_hide_update_notice" class="popup_close_btn arm_popup_close_btn" onclick="arm_hide_update_notice()"></span>'; $popupData .= '<div class="popup_content_text">'; $i = 1; $major_changes = false; $change_log = $this->arm_new_version_changelog(); if ( isset( $change_log ) && ! empty( $change_log ) ) { $arm_show_critical_change_title = isset( $change_log['show_critical_title'] ) ? $change_log['show_critical_title'] : 0; $arm_critical_title = isset( $change_log['critical_title'] ) ? $change_log['critical_title'] : ''; $arm_update_version = isset($change_log['update_version']) ? $change_log['update_version'] : ''; $arm_critical_changes = ( isset( $change_log['critical'] ) && ! empty( $change_log['critical'] ) ) ? $change_log['critical'] : array(); $arm_show_major_change_title = isset( $change_log['show_major_title'] ) ? $change_log['show_major_title'] : 0; $arm_major_title = isset( $change_log['major_title'] ) ? $change_log['major_title'] : ''; $arm_major_changes = ( isset( $change_log['major'] ) && ! empty( $change_log['major'] ) ) ? $change_log['major'] : array(); $arm_show_other_change_title = isset( $change_log['show_other_title'] ) ? $change_log['show_other_title'] : 0; $arm_other_title = isset( $change_log['other_title'] ) ? $change_log['other_title'] : ''; $arm_other_changes = ( isset( $change_log['other'] ) && ! empty( $change_log['other'] ) ) ? $change_log['other'] : array(); if ( ! empty( $arm_critical_changes ) ) { if ( $arm_show_critical_change_title == 1 ) { $arm_uc_version_parts = explode('.', $arm_update_version); $arm_uc_version_main = ''; if (count($arm_uc_version_parts) >= 2) { $arm_uc_version_main = $arm_uc_version_parts[0] . '<span class="arm_font_size_80">.</span>' . $arm_uc_version_parts[1]; } $arm_uc_version_patch = ''; for ($i = 2; $i < count($arm_uc_version_parts); $i++) { $arm_uc_version_patch .= '<span class="arm_font_size_80">.</span>'; $arm_uc_version_patch .= $arm_uc_version_parts[$i]; } $popupData .= '<div class="arm_critical_change_title">' . $arm_critical_title . '</div>';//phpcs:ignore $popupData .= '<span class="arm_uc_update_version_main">' . $arm_uc_version_main . '</span>'; $popupData .= '<span class="arm_uc_update_version_patch">' . $arm_uc_version_patch . '</span>'; $popupData .= '<span class="arm_uc_update_text">' . esc_html__("Updates", "armember-membership") . '</span>'; } $popupData .= '<div class="arm_critical_change_list"><ul>'; foreach ( $arm_critical_changes as $value ) { $popupData .= '<li>' . esc_html( $value ) . '</li>'; } $popupData .= '</ul></div>'; } if ( ! empty( $arm_major_changes ) ) { if ( $arm_show_major_change_title == 1 ) { $popupData .= '<div class="arm_major_change_title">' . esc_html( $arm_major_title ) . '</div>'; } $popupData .= '<div class="arm_major_change_list"><ul>'; foreach ( $arm_major_changes as $value ) { $popupData .= '<li>' . esc_html( $value ) . '</li>'; } $popupData .= '</ul></div>'; } if ( ! empty( $arm_other_changes ) ) { if ( $arm_show_other_change_title == 1 ) { $popupData .= '<div class="arm_other_change_title">' . esc_html( $arm_other_title ) . '</div>'; } $popupData .= '<div class="arm_other_change_list"><ul>'; foreach ( $arm_other_changes as $value ) { $popupData .= '<li>' . esc_html( $value ) . '</li>'; } $popupData .= '</ul></div>'; } } $popupData .= "<a class='arm_view_document' href='https://www.armemberplugin.com/documents/changelog/#free-version' target='_blank'>" . esc_html__('View Changelog', 'armember-membership') . "</a>"; $popupData .= '</div>'; $popupData .= '</div>'; $popupData .= '<span class="arm_bottom_bg_ellipse_1"></span>'; $popupData .= '<span class="arm_bottom_bg_ellipse_2"></span>'; $popupData .= '<span class="arm_bottom_bg_ellipse_3"></span>'; $popupData .= '</span>'; $popupData .= '</div>'; $popupData .= '<script type="text/javascript">jQuery(window).on("load", function(){ jQuery("#arm_update_note").bPopup({ modalClose: false, escClose : false }); }); function arm_hide_update_notice(){ jQuery("#arm_update_note").bPopup().close(); var ishide = 1; var _arm_wpnonce = jQuery( \'input[name="arm_wp_nonce"]\' ).val(); jQuery.ajax({ type: "POST", url: __ARMAJAXURL, data: "action=arm_dont_show_upgrade_notice&is_hide=" + ishide + "&_wpnonce=" + _arm_wpnonce, }); return false; } </script>'; echo $popupData; //phpcs:ignore } } /* * for red color note `|^|Use coupon for invitation link` * Add important note to `major` * Add normal changelog to `other` */ function arm_new_version_changelog() { $arm_change_log = array(); global $arm_payment_gateways, $arm_global_settings, $arm_slugs; $active_gateways = $arm_payment_gateways->arm_get_active_payment_gateways(); $arm_change_log = array( 'show_critical_title' => 1, 'update_version' => '5.5', 'critical_title' => 'Version', 'critical' => array( 'Minor bug fixes.', ), 'show_major_title' => 0, 'major_title' => 'Major Changes', 'major' => array(), 'show_other_title' => 0, 'other_title' => 'Other Changes', 'other' => array(), ); return $arm_change_log; } function arm_get_need_help_html_content($page_name) { global $arm_common_lite; $return_html = ''; if(!empty($page_name)) { $return_html .= '<div class="arm_need_help_main_wrapper arm_need_help_main_wrapper_active">'; $return_html .= '<span class="arm_need_help_wrapper arm_need_help_icon arm_need_help_btn arm_help_question_icon armhelptip" data-param="'.esc_attr($page_name).'" title="' . esc_attr__('Documentation', 'armember-membership') . '"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_7133_10519)"><path d="M14 2C7.37423 2 2 7.37423 2 14C2 20.6258 7.37423 26 14 26C20.6258 26 26 20.6258 26 14C26 7.37423 20.6258 2 14 2ZM15.3006 20.7975C15.3006 21.2147 14.9571 21.5583 14.5399 21.5583H12.6012C12.184 21.5583 11.8405 21.2147 11.8405 20.7975V19.546C11.8405 19.1288 12.184 18.7853 12.6012 18.7853H14.5399C14.9571 18.7853 15.3006 19.1288 15.3006 19.546V20.7975ZM18.3681 13.3374C17.8528 14.0491 17.2147 14.6135 16.4294 15.0307C15.9877 15.3252 15.6933 15.6196 15.546 15.9632C15.4479 16.184 15.3742 16.4785 15.3252 16.8221C15.3006 17.092 15.0552 17.2883 14.7853 17.2883H12.4049C12.0859 17.2883 11.8405 17.0184 11.865 16.7239C11.9141 16.0613 12.0859 15.546 12.3558 15.1534C12.6994 14.6871 13.3129 14.1227 14.1963 13.5092C14.6626 13.2147 15.0061 12.8712 15.2761 12.454C15.546 12.0368 15.6687 11.546 15.6687 10.9816C15.6687 10.4172 15.5215 9.95092 15.2025 9.60736C14.8834 9.2638 14.4663 9.09202 13.9018 9.09202C13.4356 9.09202 13.0675 9.23926 12.7485 9.5092C12.5521 9.68098 12.4294 9.90184 12.3558 10.1963C12.2577 10.5399 11.9386 10.7607 11.5706 10.7607L9.36196 10.7117C9.09202 10.7117 8.87117 10.4663 8.89571 10.1963C8.96932 9.01841 9.43558 8.13497 10.2454 7.49693C11.1779 6.78528 12.3804 6.41718 13.9018 6.41718C15.5215 6.41718 16.7975 6.83436 17.7301 7.64417C18.6626 8.45399 19.1288 9.55828 19.1288 10.9571C19.1288 11.8405 18.8589 12.6258 18.3681 13.3374Z" fill="white"/></g><defs><clipPath id="clip0_7133_10519"><rect width="28" height="28" fill="white"/></clipPath></defs></svg></span>'; $return_html .= '<a href="https://ideas.armemberplugin.com" target="_blank" class="arm_need_help_icon arm_help_ideas_icon armhelptip" title="' . esc_attr__('Feature Request', 'armember-membership') . '"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.67775 18.6953C8.60767 18.5296 8.49445 18.384 8.34619 18.2721C8.34214 18.2694 8.33946 18.2667 8.33541 18.264C6.20452 16.617 4.84998 14.0306 4.84998 11.1301C4.84998 6.09061 8.94056 2 13.98 2C19.0195 2 23.1101 6.09061 23.1101 11.1301C23.1101 14.0252 21.7596 16.6076 19.6557 18.2816C19.6476 18.2869 19.6408 18.2923 19.6327 18.2977C19.4939 18.4029 19.3861 18.5403 19.3173 18.6953H8.67775ZM10.1118 12.6504L12.1982 14.7368C12.4085 14.9471 12.6983 15.0576 12.9948 15.0414C13.29 15.0252 13.5662 14.8837 13.7509 14.6519L17.9251 9.43452C18.2849 8.98435 18.2122 8.32662 17.762 7.96811C17.3132 7.60824 16.6554 7.68102 16.2955 8.12984L12.8505 12.4374L11.5877 11.1745C11.1806 10.7675 10.5189 10.7675 10.1118 11.1745C9.70478 11.5816 9.70478 12.2434 10.1118 12.6504Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.2028 20.7825C19.1974 21.4766 19.1974 22.2125 19.1974 22.8702C19.1974 23.7005 18.8672 24.4957 18.2809 25.0833C17.6933 25.671 16.8967 25.9998 16.0665 25.9998H11.8937C11.0634 25.9998 10.2668 25.671 9.6792 25.0833C9.0929 24.4957 8.7627 23.7005 8.7627 22.8702V20.7825H19.2028Z" fill="white"/></svg></a>'; $return_html .= '<a href="https://www.facebook.com/groups/arplugins" target="_blank" class="arm_need_help_icon arm_help_join_icon armhelptip" title="' . esc_attr__('Join Community', 'armember-membership') . '"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.19987 20.0756C1.36902 20.3154 2.2102 21.2997 4.66321 21.7078L5.15799 18.3684C5.4438 16.4918 6.41702 14.7708 7.89966 13.5277C8.0665 13.3878 8.23854 13.2549 8.41531 13.1292C8.0526 13.0443 7.68103 12.9931 7.30561 12.977C6.37252 12.9369 5.4432 13.1149 4.59643 13.4957C3.74965 13.8766 3.01041 14.4492 2.44137 15.1649C1.87233 15.8806 1.49027 16.7183 1.3276 17.6071L1.01537 19.3076C0.991467 19.4411 0.995478 19.5778 1.02717 19.7097C1.05886 19.8416 1.11758 19.966 1.19987 20.0756Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M26.9728 19.7097C27.0045 19.5778 27.0085 19.4411 26.9846 19.3076L26.6724 17.6071C26.5097 16.7183 26.1277 15.8806 25.5586 15.1649C24.9896 14.4492 24.2503 13.8766 23.4036 13.4957C22.5568 13.1149 21.6275 12.9369 20.6944 12.977C20.3197 12.9931 19.9489 13.0441 19.5869 13.1287C19.764 13.2545 19.9363 13.3876 20.1033 13.5277C21.4932 14.693 22.4347 16.2732 22.7825 18.0123L22.8441 18.363L23.3412 21.7071C25.7908 21.2986 26.6311 20.3152 26.8001 20.0756C26.8824 19.966 26.9411 19.8416 26.9728 19.7097Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8.81519 11.8716C8.9297 11.8145 9.0409 11.7521 9.14842 11.6845C7.97019 10.5096 7.24499 8.90798 7.24499 7.14265C7.245 6.31593 7.40407 5.5251 7.69422 4.79719C7.08485 4.69594 6.4593 4.73604 5.86911 4.91419C5.27882 5.09237 4.7408 5.40355 4.29939 5.82208C3.85797 6.24061 3.5258 6.75452 3.33023 7.32144C3.13467 7.88836 3.08133 8.49208 3.17459 9.08283C3.26785 9.67359 3.50505 10.2345 3.86665 10.7193C4.22824 11.2041 4.70388 11.5989 5.25436 11.8712C5.80484 12.1435 6.4144 12.2855 7.03282 12.2855C7.65276 12.2881 8.2642 12.1461 8.81519 11.8716Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24.87 8.51407C24.8704 9.00944 24.7697 9.50003 24.5737 9.95776C24.3777 10.4155 24.0902 10.8314 23.7277 11.1817C23.3652 11.532 22.9348 11.8097 22.4611 11.9992C21.9874 12.1886 21.4798 12.2859 20.9671 12.2855C20.3472 12.2881 19.7357 12.1461 19.1848 11.8716C19.0702 11.8145 18.9589 11.752 18.8514 11.6845C20.0295 10.5095 20.7547 8.90794 20.7547 7.14265C20.7546 6.31594 20.5956 5.52513 20.3055 4.79723C20.4083 4.78013 20.5121 4.76698 20.6166 4.75788C21.3385 4.69498 22.0642 4.82757 22.7125 5.1408C23.3608 5.45403 23.906 5.93552 24.2871 6.53131C24.6682 7.12711 24.87 7.81367 24.87 8.51407Z" fill="white"/><path d="M21.4268 18.5641C21.1909 17.0151 20.3882 15.5991 19.1644 14.573C17.9406 13.5469 16.3767 12.9787 14.7565 12.9714H13.2464C11.6262 12.9787 10.0623 13.5469 8.83845 14.573C7.61463 15.5991 6.81196 17.0151 6.57605 18.5641L5.85224 23.4546C5.82912 23.6127 5.8444 23.7738 5.89687 23.9252C5.94933 24.0766 6.03755 24.2141 6.15454 24.3269C6.43838 24.6011 8.17977 26 14.0029 26C19.8259 26 21.5631 24.6066 21.8512 24.3269C21.9682 24.2141 22.0564 24.0766 22.1088 23.9252C22.1613 23.7738 22.1766 23.6127 22.1535 23.4546L21.4268 18.5641Z" fill="white"/><path d="M14 12.2857C15.4968 12.2857 16.8492 11.6886 17.8162 10.7275C18.7482 9.80119 19.3221 8.53679 19.3221 7.14286C19.3221 6.48536 19.1944 5.85668 18.9617 5.27871C18.1891 3.35991 16.2589 2 14 2C11.7411 2 9.81087 3.3599 9.03828 5.27869C8.80556 5.85667 8.67787 6.48535 8.67787 7.14286C8.67787 8.5368 9.25177 9.80121 10.1837 10.7275C11.1507 11.6886 12.5032 12.2857 14 12.2857Z" fill="white"/></svg></a>'; $return_html .= '<a href="https://www.youtube.com/@armember/videos?sub_confirmation=1" target="_blank" class="arm_need_help_icon arm_need_help_btn arm_help_video_icon armhelptip" title="' . esc_attr__('Video Tutorials', 'armember-membership') . '"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 2C7.37262 2 2 7.37264 2 14C2 20.6274 7.37262 26 14 26C20.6274 26 26 20.6274 26 14C26 7.37264 20.6274 2 14 2ZM10.6483 8.87973L19.8181 13.7826L10.6483 18.685V8.87973Z" fill="white"/></svg></a>'; $return_html .= '<span class="arm_need_help_icon arm_need_help_btn arm_help_close_icon armhelptip" title="' . esc_attr__('Close', 'armember-membership') . '"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_7133_10536)"><path d="M7.07107 21.0711L14.1421 14M21.2132 6.92893L14.1421 14M14.1421 14L7.07107 6.92893M14.1421 14L21.2132 21.0711" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_7133_10536"><rect width="28" height="28" fill="white"/></clipPath></defs></svg></span>'; $return_html .= '</div>'; $return_html .= '<div class="arm_need_help_main_wrapper_inactive armhelptip" title="' . esc_attr__('Need Help?', 'armember-membership') . '">'; $return_html .= '<a class="arm_need_help_icon arm_need_help_btn"><svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_7124_10156)"><path d="M24.6142 23.1292C26.7244 20.6781 28 17.488 28 13.9999C28 10.5119 26.7244 7.32174 24.6142 4.87061L18.6324 10.8524C19.243 11.7494 19.6 12.833 19.6 13.9999C19.6 15.1668 19.243 16.2504 18.6324 17.1474L24.6142 23.1292Z" fill="white"/><path d="M23.1293 24.6143C20.6782 26.7246 17.4881 28.0001 14 28.0001C10.512 28.0001 7.32186 26.7246 4.87073 24.6143L10.8525 18.6326C11.7495 19.2431 12.8331 19.6001 14 19.6001C15.1669 19.6001 16.2505 19.2431 17.1475 18.6326L23.1293 24.6143Z" fill="white"/><path d="M3.38576 23.1292L9.36757 17.1474C8.75693 16.2504 8.4 15.1668 8.4 13.9999C8.4 12.833 8.75693 11.7494 9.36757 10.8524L3.38576 4.87061C1.2756 7.32174 0 10.5119 0 13.9999C0 17.488 1.2756 20.6781 3.38576 23.1292Z" fill="white"/><path d="M14 8.4C12.8331 8.4 11.7495 8.75693 10.8525 9.36757L4.87073 3.38576C7.32186 1.2756 10.512 0 14 0C17.4881 0 20.6782 1.2756 23.1293 3.38576L17.1475 9.36757C16.2505 8.75693 15.1669 8.4 14 8.4Z" fill="white"/></g><defs><clipPath id="clip0_7124_10156"><rect width="28" height="28" fill="white"/></clipPath></defs></svg></a>'; $return_html .= '</div>'; $return_html .= '<div class="arm_sidebar_drawer_main_wrapper">'; $return_html .= '<div class="arm_sidebar_drawer_inner_wrapper">'; $return_html .= '<div class="arm_sidebar_drawer_content">'; $return_html .= '<div class="arm_sidebar_drawer_close_container">'; $return_html .= '<div class="arm_sidebar_drawer_close_btn"></div>'; $return_html .= '</div>'; $return_html .= '<div class="arm_sidebar_drawer_body">'; $return_html .= '<div class="arm_sidebar_content_wrapper">'; $return_html .= '<div class="arm_sidebar_content_header">'; $return_html .= '<h1 class="arm_sidebar_content_heading"></h1>'; $return_html .= '</div>'; $return_html .= '<div class="arm_sidebar_content_body">'; $return_html .= '</div>'; $return_html .= '<div class="arm_sidebar_content_footer"><a href="https://www.armemberplugin.com/documentation/" target="_blank" class="arm_readmore_link arm_cancel_btn">Read More</a></div>'; $return_html .= '</div>'; $return_html .= '</div>'; $return_html .= '<div class="arm_loading">'. $arm_common_lite->arm_loader_img_func().'</div>';//phpcs:ignore $return_html .= '</div>'; $return_html .= '</div>'; $return_html .= '</div>'; } return $return_html; } function arm_get_need_help_content_func($param) { $wpnonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; //phpcs:ignore $arm_verify_nonce_flag = wp_verify_nonce( $wpnonce, 'arm_wp_nonce' );//phpcs:ignore --Reason:Verifying nonce if ( ! $arm_verify_nonce_flag ) { $response['status'] = 'error'; $response['title'] = esc_html__( 'Error', 'armember-membership' ); $response['msg'] = esc_html__( 'Sorry, Your request can not process due to security reason.', 'armember-membership' ); wp_send_json( $response ); die(); } $arm_doc_content = ""; if ( !empty($_POST['action']) && $_POST['action'] == 'arm_get_need_help_content' && !empty($_POST['page']) ) { //phpcs:ignore $help_page = sanitize_text_field( $_POST['page'] ); //phpcs:ignore $arm_get_data_url = 'https://www.armemberplugin.com/'; $arm_get_data_params = array( 'method' => 'POST', 'body' => array( 'action' => 'get_documentation', 'page' => $help_page, ), 'timeout' => 45, ); $arm_doc_res = wp_remote_post( $arm_get_data_url, $arm_get_data_params ); if(!is_wp_error($arm_doc_res)){ $arm_doc_content = ! empty( $arm_doc_res['body'] ) ? $arm_doc_res['body'] : esc_html__('No data found', 'armember-membership'); $arm_json_paresed_data = json_decode($arm_doc_content); $arm_doc_url = !empty($arm_json_paresed_data->data->url) ? $arm_json_paresed_data->data->url : ARMLITE_HOME_URL; $arm_json_paresed_data = !empty($arm_json_paresed_data->data->content) ? urldecode($arm_json_paresed_data->data->content) : esc_html__('No data found', 'armember-membership'); //Replace the anchor tag if anchor tag has any image url $arm_json_paresed_data = preg_replace(array('"<a href=(.*(png|jpg|gif|jpeg|webp))(.*?)>"', '"</a>"'), array('',''), $arm_json_paresed_data); //Add target='_blank' to anchor tag. if(preg_match('/<a.*?target=[^>]*?>/', $arm_json_paresed_data)){ preg_replace('/<a.*?target="([^"]?)"[^>]*?>/', 'blank', $arm_json_paresed_data); }else{ $arm_json_paresed_data = str_replace('<a', '<a target="_blank"', $arm_json_paresed_data); } //Replace the URL if it not strats with 'https' or 'http'. if(extension_loaded('xml')){ $arm_xml_obj = new DOMDocument(); $arm_xml_obj->loadHTML($arm_json_paresed_data); foreach($arm_xml_obj->getElementsByTagName('a') as $arm_anchor_tag_data){ $arm_anchor_href = $arm_anchor_tag_data->getAttribute('href'); if( false === strpos($arm_anchor_href, 'https://') && false === strpos($arm_anchor_href, 'http://') ){ $arm_anchor_tag_data->setAttribute('href', $arm_doc_url.$arm_anchor_href); } } $arm_json_paresed_data = $arm_xml_obj->saveHTML(); } $arm_doc_content = json_decode($arm_doc_content); if(!empty($arm_doc_content) && is_object($arm_doc_content)) { $arm_doc_content->data->content = rawurlencode($arm_json_paresed_data); $arm_doc_content = wp_json_encode($arm_doc_content); } } else{ $arm_doc_content = $arm_doc_res->get_error_message(); } echo $arm_doc_content; //phpcs:ignore exit; } } function arm_dont_show_upgrade_notice() { global $wp, $wpdb, $ARMemberLite, $pagenow, $arm_capabilities_global; $ARMemberLite->arm_check_user_cap( $arm_capabilities_global['arm_manage_general_settings'], '1' ); //phpcs:ignore --Reason:Verifying nonce $is_hide = ( isset( $_POST['is_hide'] ) && $_POST['is_hide'] == '1' ) ? 1 : 0; //phpcs:ignore if ( $is_hide == 1 ) { delete_option( 'arm_lite_new_version_installed' ); } die(); } /* Cornerstone Methods */ function arm_front_alert_messages() { $alertMessages = array( 'loadActivityError' => esc_html__( 'There is an error while loading activities, please try again.', 'armember-membership' ), 'pinterestPermissionError' => esc_html__( 'The user chose not to grant permissions or closed the pop-up', 'armember-membership' ), 'pinterestError' => esc_html__( 'Oops, there was a problem getting your information', 'armember-membership' ), 'clickToCopyError' => esc_html__( 'There is a error while copying, please try again', 'armember-membership' ), 'fbUserLoginError' => esc_html__( 'User cancelled login or did not fully authorize.', 'armember-membership' ), 'closeAccountError' => esc_html__( 'There is a error while closing account, please try again.', 'armember-membership' ), 'invalidFileTypeError' => esc_html__( 'Sorry, this file type is not permitted for security reasons.', 'armember-membership' ), 'fileSizeError' => esc_html__( 'File is not allowed bigger than {SIZE}.', 'armember-membership' ), 'fileUploadError' => esc_html__( 'There is an error in uploading file, Please try again.', 'armember-membership' ), 'coverRemoveConfirm' => esc_html__( 'Are you sure you want to remove cover photo?', 'armember-membership' ), 'profileRemoveConfirm' => esc_html__( 'Are you sure you want to remove profile photo?', 'armember-membership' ), 'errorPerformingAction' => esc_html__( 'There is an error while performing this action, please try again.', 'armember-membership' ), 'userSubscriptionCancel' => esc_html__( "User's subscription has been canceled", 'armember-membership' ), 'cancelSubscriptionAlert' => esc_html__( 'Are you sure you want to cancel subscription?', 'armember-membership' ), 'ARM_Loding' => esc_html__( 'Loading..', 'armember-membership' ), ); return $alertMessages; } function arm_alert_messages() { $alertMessages = array( 'wentwrong' => esc_html__( 'Sorry, Something went wrong. Please try again.', 'armember-membership' ), 'bulkActionError' => esc_html__( 'Please select valid action.', 'armember-membership' ), 'bulkRecordsError' => esc_html__( 'Please select one or more records.', 'armember-membership' ), 'clearLoginAttempts' => esc_html__( 'Login attempts cleared successfully.', 'armember-membership' ), 'clearLoginHistory' => esc_html__( 'Login History cleared successfully.', 'armember-membership' ), 'delPlansSuccess' => esc_html__( 'Plan(s) has been deleted successfully.', 'armember-membership' ), 'delPlansError' => esc_html__( 'There is a error while deleting Plan(s), please try again.', 'armember-membership' ), 'delPlanSuccess' => esc_html__( 'Plan has been deleted successfully.', 'armember-membership' ), 'delPlanError' => esc_html__( 'There is a error while deleting Plan, please try again.', 'armember-membership' ), 'delSetupsSuccess' => esc_html__( 'Setup(s) has been deleted successfully.', 'armember-membership' ), 'delSetupsError' => esc_html__( 'There is a error while deleting Setup(s), please try again.', 'armember-membership' ), 'delSetupSuccess' => esc_html__( 'Setup has been deleted successfully.', 'armember-membership' ), 'delSetupError' => esc_html__( 'There is a error while deleting Setup, please try again.', 'armember-membership' ), 'delFormSetSuccess' => esc_html__( 'Form Set Deleted Successfully.', 'armember-membership' ), 'delFormSetError' => esc_html__( 'There is a error while deleting form set, please try again.', 'armember-membership' ), 'delFormSuccess' => esc_html__( 'Form deleted successfully.', 'armember-membership' ), 'delFormError' => esc_html__( 'There is a error while deleting form, please try again.', 'armember-membership' ), 'delRuleSuccess' => esc_html__( 'Rule has been deleted successfully.', 'armember-membership' ), 'delRuleError' => esc_html__( 'There is a error while deleting Rule, please try again.', 'armember-membership' ), 'delRulesSuccess' => esc_html__( 'Rule(s) has been deleted successfully.', 'armember-membership' ), 'delRulesError' => esc_html__( 'There is a error while deleting Rule(s), please try again.', 'armember-membership' ), 'prevTransactionError' => esc_html__( 'There is a error while generating preview of transaction detail, Please try again.', 'armember-membership' ), 'invoiceTransactionError' => esc_html__( 'There is a error while generating invoice of transaction detail, Please try again.', 'armember-membership' ), 'prevMemberDetailError' => esc_html__( 'There is a error while generating preview of members detail, Please try again.', 'armember-membership' ), 'prevMemberActivityError' => esc_html__( 'There is a error while displaying members activities detail, Please try again.', 'armember-membership' ), 'prevCustomCssError' => esc_html__( 'There is a error while displaying ARMember CSS Class Information, Please Try Again.', 'armember-membership' ), 'prevImportMemberDetailError' => esc_html__( 'Please upload appropriate file to import users.', 'armember-membership' ), 'delTransactionSuccess' => esc_html__( 'Transaction has been deleted successfully.', 'armember-membership' ), 'delTransactionsSuccess' => esc_html__( 'Transaction(s) has been deleted successfully.', 'armember-membership' ), 'delAutoMessageSuccess' => esc_html__( 'Message has been deleted successfully.', 'armember-membership' ), 'delAutoMessageError' => esc_html__( 'There is a error while deleting Message, please try again.', 'armember-membership' ), 'delAutoMessagesSuccess' => esc_html__( 'Message(s) has been deleted successfully.', 'armember-membership' ), 'delAutoMessagesError' => esc_html__( 'There is a error while deleting Message(s), please try again.', 'armember-membership' ), 'saveSettingsSuccess' => esc_html__( 'Settings has been saved successfully.', 'armember-membership' ), 'saveSettingsError' => esc_html__( 'There is a error while updating settings, please try again.', 'armember-membership' ), 'saveDefaultRuleSuccess' => esc_html__( 'Default Rules Saved Successfully.', 'armember-membership' ), 'saveDefaultRuleError' => esc_html__( 'There is a error while updating rules, please try again.', 'armember-membership' ), 'delMemberActivityError' => esc_html__( 'There is a error while deleting member activities, please try again.', 'armember-membership' ), 'noTemplateError' => esc_html__( 'Template not found.', 'armember-membership' ), 'saveTemplateSuccess' => esc_html__( 'Template options has been saved successfully.', 'armember-membership' ), 'saveTemplateError' => esc_html__( 'There is a error while updating template options, please try again.', 'armember-membership' ), 'prevTemplateError' => esc_html__( 'There is a error while generating preview of template, Please try again.', 'armember-membership' ), 'addTemplateSuccess' => esc_html__( 'Template has been added successfully.', 'armember-membership' ), 'addTemplateError' => esc_html__( 'There is a error while adding template, please try again.', 'armember-membership' ), 'delTemplateSuccess' => esc_html__( 'Template has been deleted successfully.', 'armember-membership' ), 'delTemplateError' => esc_html__( 'There is a error while deleting template, please try again.', 'armember-membership' ), 'saveEmailTemplateSuccess' => esc_html__( 'Email Template Updated Successfully.', 'armember-membership' ), 'saveAutoMessageSuccess' => esc_html__( 'Message Updated Successfully.', 'armember-membership' ), 'addAchievementSuccess' => esc_html__( 'Achievements Added Successfully.', 'armember-membership' ), 'saveAchievementSuccess' => esc_html__( 'Achievements Updated Successfully.', 'armember-membership' ), 'pastDateError' => esc_html__( 'Cannot Set Past Dates.', 'armember-membership' ), 'pastStartDateError' => esc_html__( 'Start date can not be earlier than current date.', 'armember-membership' ), 'pastExpireDateError' => esc_html__( 'Expire date can not be earlier than current date.', 'armember-membership' ), 'uniqueformsetname' => esc_html__( 'This Set Name is already exist.', 'armember-membership' ), 'uniquesignupformname' => esc_html__( 'This Form Name is already exist.', 'armember-membership' ), 'installAddonError' => esc_html__( 'There is an error while installing addon, Please try again.', 'armember-membership' ), 'installAddonSuccess' => esc_html__( 'Addon installed successfully.', 'armember-membership' ), 'activeAddonError' => esc_html__( 'There is an error while activating addon, Please try agina.', 'armember-membership' ), 'activeAddonSuccess' => esc_html__( 'Addon activated successfully.', 'armember-membership' ), 'deactiveAddonSuccess' => esc_html__( 'Addon deactivated successfully.', 'armember-membership' ), 'confirmCancelSubscription' => esc_html__( 'Are you sure you want to cancel subscription?', 'armember-membership' ), 'errorPerformingAction' => esc_html__( 'There is an error while performing this action, please try again.', 'armember-membership' ), 'userSubscriptionCancel' => esc_html__( "User's subscription has been canceled", 'armember-membership' ), 'cancelSubscriptionAlert' => esc_html__( 'Are you sure you want to cancel subscription?', 'armember-membership' ), 'ARM_Loding' => esc_html__( 'Loading..', 'armember-membership' ), 'arm_nothing_found' => esc_html__( 'Oops, nothing found.', 'armember-membership' ), ); $frontMessages = $this->arm_front_alert_messages(); $alertMessages = array_merge( $alertMessages, $frontMessages ); return $alertMessages; } function arm_prevent_rocket_loader_script( $tag, $handle ) { $script = htmlspecialchars( $tag ); $pattern2 = '/\/(wp\-content\/plugins\/armember-membership)/'; preg_match( $pattern2, $script, $match_script ); /* Check if current script is loaded from ARMember only */ if ( ! isset( $match_script[0] ) || $match_script[0] == '' ) { return $tag; } $pattern = '/(.*?)(data\-cfasync\=)(.*?)/'; preg_match_all( $pattern, $tag, $matches ); if ( ! is_array( $matches ) ) { return str_replace( ' src', ' data-cfasync="false" src', $tag ); } elseif ( ! empty( $matches ) && ! empty( $matches[2] ) && ! empty( $matches[2][0] ) && strtolower( trim( $matches[2][0] ) ) != 'data-cfasync=' ) { return str_replace( ' src', ' data-cfasync="false" src', $tag ); } elseif ( ! empty( $matches ) && empty( $matches[2] ) ) { return str_replace( ' src', ' data-cfasync="false" src', $tag ); } else { return $tag; } } function arm_set_js_css_conditionally() { global $arm_lite_datepicker_loaded, $arm_lite_avatar_loaded, $arm_lite_file_upload_field, $arm_lite_bpopup_loaded, $arm_lite_load_tipso, $arm_lite_load_icheck, $arm_lite_font_awesome_loaded; if ( ! is_admin() ) { if ( $arm_lite_datepicker_loaded == 1 ) { if ( ! wp_script_is( 'arm_bootstrap_datepicker_with_locale_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_bootstrap_datepicker_with_locale_js' ); } } if ( $arm_lite_avatar_loaded == 1 || $arm_lite_file_upload_field == 1 ) { if ( ! wp_script_is( 'arm_file_upload_js', 'enqueued' ) ) { wp_enqueue_script( 'arm_file_upload_js' ); } } if ( $arm_lite_bpopup_loaded == 1 ) { if ( ! wp_script_is( 'arm_bpopup', 'enqueued' ) ) { wp_enqueue_script( 'arm_bpopup' ); } } if ( $arm_lite_load_tipso == 1 ) { if ( ! wp_script_is( 'arm_tipso_front', 'enqueued' ) ) { wp_enqueue_script( 'arm_tipso_front' ); } } if ( $arm_lite_font_awesome_loaded == 1 ) { wp_enqueue_style( 'arm_fontawesome_css' ); } } } function arm_check_font_awesome_icons( $content ) { global $arm_lite_font_awesome_loaded; $fa_class = '/armfa|arm_user_social_icons|arm_user_social_fields/'; $matches = array(); preg_match_all( $fa_class, $content, $matches ); if ( count( $matches ) > 0 && count( $matches[0] ) > 0 ) { $arm_lite_font_awesome_loaded = 1; } return $content; } function arm_check_user_cap( $arm_capabilities = '', $is_ajax_call = '' ) { global $arm_global_settings; $errors = array(); $message = ''; if (!empty($arm_capabilities) && !current_user_can( $arm_capabilities ) ) { $errors[] = esc_html__( 'Sorry, You do not have permission to perform this action.', 'armember-membership' ); $return_array = $arm_global_settings->handle_return_messages( $errors, $message ); $return_array['message'] = $return_array['msg']; echo wp_json_encode( $return_array ); exit; } $wpnonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field($_REQUEST['_wpnonce']) : ''; //phpcs:ignore if(empty($wpnonce)) { $wpnonce = isset($_REQUEST['arm_wp_nonce']) ? sanitize_text_field($_REQUEST['arm_wp_nonce']) : ''; //phpcs:ignore } $arm_verify_nonce_flag = wp_verify_nonce( $wpnonce, 'arm_wp_nonce' ); if(empty( $wpnonce) ) { $errors[] = esc_html__( 'Sorry, Your request can not process due to nonce not found.', 'armember-membership' ); $return_array = $arm_global_settings->handle_return_messages( $errors, $message ); $return_array['message'] = $return_array['msg']; echo wp_json_encode( $return_array ); exit; } else if( !$arm_verify_nonce_flag ) { $errors[] = esc_html__( 'Sorry, Your request can not process due to security reason.', 'armember-membership' ); $return_array = $arm_global_settings->handle_return_messages( $errors, $message ); $return_array['message'] = $return_array['msg']; echo wp_json_encode( $return_array ); exit; } } function arm_session_start( $force = false ) { /** * Start Session */ $arm_session_id = session_id(); if ( empty( $arm_session_id ) || $force == true ) { @session_start(); } } function armember_allowed_html_tags(){ $arm_allowed_html = array( 'a' => array_merge( $this->armember_global_attributes(), array( 'href' => array(), 'rel' => array(), 'target' => array(), ) ), 'b' => $this->armember_global_attributes(), 'br' => $this->armember_global_attributes(), 'button' => array_merge( $this->armember_global_attributes(), array( 'name' => array(), 'type' => array(), 'value' => array() ) ), 'code' => $this->armember_global_attributes(), 'div' => $this->armember_global_attributes(), /* 'embed' => array_merge( $this->armember_global_attributes(), array( 'height' => array(), 'src' => array(), 'type' => array(), 'width' => array(), ) ), */ 'font' => array_merge( $this->armember_global_attributes(), array( 'color' => array(), 'face' => array(), 'size' => array() ) ), 'h1' => $this->armember_global_attributes(), 'h2' => $this->armember_global_attributes(), 'h3' => $this->armember_global_attributes(), 'h4' => $this->armember_global_attributes(), 'h5' => $this->armember_global_attributes(), 'h6' => $this->armember_global_attributes(), 'hr' => $this->armember_global_attributes(), 'i' => $this->armember_global_attributes(), 'img' => array_merge( $this->armember_global_attributes(), array( 'alt' => array(), 'height' => array(), 'src' => array(), 'width' => array() ) ), 'input' => array_merge( $this->armember_global_attributes(), $this->armember_visible_tag_attributes(), array( 'accept' => array(), 'alt' => array(), 'autocomplete' => array(), //'autofocus' => array(), 'checked' => array(), //'dirname' => array(), 'disabled' => array(), //'height' => array(), //'list' => array(), 'max' => array(), 'maxlength' => array(), 'min' => array(), //'multiple' => array(), 'name' => array(), 'onsearch' => array(), //'pattern' => array(), 'placeholder' => array(), 'readonly' => array(), 'required' => array(), 'size' => array(), 'src' => array(), 'step' => array(), 'type' => array(), 'value' => array(), 'width' => array() ) ), 'ins' => $this->armember_global_attributes(), 'label' => array_merge( $this->armember_global_attributes(), array( 'for' => array(), ) ), 'li' => $this->armember_global_attributes(), 'ol' => $this->armember_global_attributes(), 'optgroup' => $this->armember_global_attributes(), 'p' => $this->armember_global_attributes(), 'section' => $this->armember_global_attributes(), 'span' => $this->armember_global_attributes(), 'strong' => $this->armember_global_attributes(), 'sub' => $this->armember_global_attributes(), 'sup' => $this->armember_global_attributes(), 'table' => $this->armember_global_attributes(), 'tbody' => $this->armember_global_attributes(), 'thead' => $this->armember_global_attributes(), 'tfooter' => $this->armember_global_attributes(), 'th' => array_merge( $this->armember_global_attributes(), array( 'colspan' => array(), 'headers' => array(), 'rowspan' => array(), 'scope' => array() ) ), 'td' => array_merge( $this->armember_global_attributes(), array( 'colspan' => array(), 'headers' => array(), 'rowspan' => array() ) ), 'tr' => $this->armember_global_attributes(), 'textarea' => array_merge( $this->armember_global_attributes(), $this->armember_visible_tag_attributes(), array( 'cols' => array(), 'maxlength' => array(), 'name' => array(), 'placeholder' => array(), 'readonly' => array(), 'required' => array(), 'rows' => array(), ) ), 'u' => $this->armember_global_attributes(), 'ul' => $this->armember_global_attributes(), ); return $arm_allowed_html; } function arm_recursive_sanitize_data( $posted_data ) { global $ARMemberLite; if( empty( $posted_data ) ) { return $posted_data; } if ( is_array( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } elseif ( is_object( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } /* if ( preg_match( '/^(\d+)$/', $posted_data ) ) { return intval( $posted_data ); } elseif ( preg_match( '/^(\d+(|\.\d+))$/', $posted_data ) ) { return floatval( $posted_data ); } else */ if ( preg_match( '/<[^<]+>/', $posted_data ) ) { $armlite_allowed_html = $ARMemberLite->armember_allowed_html_tags(); return wp_kses( $posted_data, $armlite_allowed_html ); } elseif ( filter_var( $posted_data, FILTER_VALIDATE_URL ) ) { return esc_url_raw( $posted_data ); } else { return sanitize_text_field( $posted_data ); } return $posted_data; } function arm_recursive_sanitize_data_extend( $posted_data ) { global $ARMemberLite; if( empty( $posted_data ) ) { return $posted_data; } if ( is_array( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } elseif ( is_object( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } /* if ( preg_match( '/^(\d+)$/', $posted_data ) ) { return intval( $posted_data ); } elseif ( preg_match( '/^(\d+(|\.\d+))$/', $posted_data ) ) { return floatval( $posted_data ); } else*/ if ( preg_match( '/<[^<]+>/', $posted_data ) ) { $armlite_allowed_html = $ARMemberLite->armember_allowed_html_tags(); return wp_kses( $posted_data, $armlite_allowed_html ); } elseif ( filter_var( $posted_data, FILTER_VALIDATE_URL ) ) { return esc_url_raw( $posted_data ); } else { return sanitize_textarea_field( $posted_data ); } return $posted_data; } function arm_recursive_sanitize_data_extend_only_kses( $posted_data ) { global $ARMemberLite; if( empty( $posted_data ) ) { return $posted_data; } if ( is_array( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } elseif ( is_object( $posted_data ) ) { return array_map( array( $ARMemberLite, __FUNCTION__ ), json_decode( wp_json_encode( $posted_data ), true ) ); } $armlite_allowed_html = $ARMemberLite->armember_allowed_html_tags(); return wp_kses( $posted_data, $armlite_allowed_html ); } function armember_global_attributes(){ return array( 'class' => array(), 'id' => array(), 'title' => array(), 'tabindex' => array(), 'lang' => array(), 'style' => array(), ); } function armember_visible_tag_attributes(){ return array( /* 'onblur' => array(), 'onchange' => array(), 'onclick' => array(), 'oncontextmenu' => array(), 'oncopy' => array(), 'oncut' => array(), 'ondblclick' => array(), 'ondrag' => array(), 'ondragend' => array(), 'ondragenter' => array(), 'ondragleave' => array(), 'ondragover' => array(), 'ondragstart' => array(), 'ondrop' => array(), 'onfocus' => array(), 'oninput' => array(), 'oninvalid' => array(), 'onkeydown' => array(), 'onkeypress' => array(), 'onkeyup' => array(), 'onmousedown' => array(), 'onmousemove' => array(), 'onmouseout' => array(), 'onmouseover' => array(), 'onmouseup' => array(), 'onmousewheel' => array(), 'onpaste' => array(), 'onscroll' => array(), 'onselect' => array(), 'onwheel' => array() */ ); } function arm_get_basename($filename){ return preg_replace('/^.+[\\\\\\/]/', '', $filename); } function armgetapiurl() { $api_url = 'https://arpluginshop.com/'; return $api_url; } function arm_get_remote_post_params( $plugin_info = '' ) { global $wpdb; $action = ''; $action = $plugin_info; if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_list = get_plugins(); $site_url = ARMLITE_HOME_URL; $plugins = array(); $active_plugins = get_option( 'active_plugins' ); foreach ( $plugin_list as $key => $plugin ) { $is_active = in_array( $key, $active_plugins ); // filter for only armember ones, may get some others if using our naming convention if ( strpos( strtolower( $plugin['Title'] ), 'armember-membership' ) !== false ) { $name = substr( $key, 0, strpos( $key, '/' ) ); $plugins[] = array( 'name' => $name, 'version' => $plugin['Version'], 'is_active' => $is_active, ); } } $plugins = wp_json_encode( $plugins ); // get theme info $theme = wp_get_theme(); $theme_name = $theme->get( 'Name' ); $theme_uri = $theme->get( 'ThemeURI' ); $theme_version = $theme->get( 'Version' ); $theme_author = $theme->get( 'Author' ); $theme_author_uri = $theme->get( 'AuthorURI' ); $im = is_multisite(); $sortorder = get_option( 'armSortOrder' ); $post = array( 'wp' => get_bloginfo( 'version' ), 'php' => phpversion(), 'mysql' => $wpdb->db_version(), 'plugins' => $plugins, 'tn' => $theme_name, 'tu' => $theme_uri, 'tv' => $theme_version, 'ta' => $theme_author, 'tau' => $theme_author_uri, 'im' => $im, 'sortorder' => $sortorder, ); return $post; } } global $ARMemberLite; $arm_lite_api_url = $ARMemberLite->armgetapiurl(); $arm_lite_plugin_slug = basename(dirname(__FILE__)); add_filter('pre_set_site_transient_update_plugins', 'arm_check_for_lite_plugin_update'); function arm_check_for_lite_plugin_update($checked_data) { $arm_lite_force_update_check = get_transient('arm_lite_force_update_check'); if( !empty( $arm_lite_force_update_check ) ) { global $arm_lite_api_url, $arm_lite_plugin_slug, $wp_version, $ARMemberLite, $arm_lite_version; //Comment out these two lines during testing. if (empty($checked_data->checked)) return $checked_data; $args = array( 'slug' => $arm_lite_plugin_slug, 'version' => $arm_lite_version, 'other_variables' => $ARMemberLite->arm_get_remote_post_params(), ); $request_string = array( 'body' => array( 'action' => 'basic_check', 'request' => serialize($args), 'api-key' => md5(ARMLITE_HOME_URL) ), 'sslverify' => false, 'user-agent' => 'ARMLITE-WordPress/' . $wp_version . '; ' . ARMLITE_HOME_URL ); // Start checking for an update $raw_response = wp_remote_post($arm_lite_api_url, $request_string); if( !is_wp_error( $raw_response ) && ( $raw_response['response']['code'] == 200 ) ) $response = @unserialize( $raw_response['body'] ); if(isset($response['access_request']) && !empty($response['access_request']) && 'success' == $response['access_request'] ) { if(isset($response['access_package']) && !empty($response['access_package'])) { $update_package = @unserialize($response['access_package']); if (isset($update_package) && is_object($update_package) && is_object($checked_data) && !empty($update_package)) { $checked_data->response[$arm_lite_plugin_slug . '/' . $arm_lite_plugin_slug . '.php'] = $update_package; } } } } return $checked_data; } add_filter('plugins_api', 'arm_lite_plugin_api_call', 11, 3); function arm_lite_plugin_api_call( $res, $action, $args ) { $arm_lite_force_update_check = get_transient('arm_lite_force_update_check'); if( !empty( $arm_lite_force_update_check ) ) { global $arm_lite_plugin_slug, $arm_lite_api_url, $wp_version, $arm_lite_version; if (!isset($args->slug) || ($args->slug != $arm_lite_plugin_slug)) return $res; $args->version = $arm_lite_version; $request_string = array( 'body' => array( 'action' => $action, 'request' => serialize($args), 'api-key' => md5(ARMLITE_HOME_URL) ), 'sslverify' => false, 'user-agent' => 'ARMLITE-WordPress/' . $wp_version . '; ' . ARMLITE_HOME_URL ); $request = wp_remote_post($arm_lite_api_url, $request_string); if (is_wp_error($request)) { $res = new WP_Error('plugins_api_failed', '<p>'.esc_html__('An Unexpected HTTP Error occurred during the API request.', 'armember-membership') . "</p> <p><a href='?' onclick='document.location.reload(); return false;>".esc_html__('Try again','armember-membership')."</a></p>", $request->get_error_message()); } else { $res = unserialize($request['body']); if ($res === false) $res = new WP_Error('plugins_api_failed', esc_html__('An unknown error occurred', 'armember-membership'), $request['body']); } } return $res; } add_action('init', 'arm_lite_validate_plugin_update'); function arm_lite_validate_plugin_update() { $arm_lite_force_update_check = get_transient('arm_lite_force_update_check'); if( empty( $arm_lite_force_update_check ) ) { if ( ! function_exists( 'plugins_api' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } $validate_active_plugin = plugins_api( 'plugin_information', array( 'slug' => 'armember-membership', 'fields' => array( 'sections' => false, 'versions' => true, ), ) ); if ( is_wp_error( $validate_active_plugin ) ) { $expiration_sec = 60 * 60 * 24; // 24 hours set_transient('arm_lite_force_update_check', 1, $expiration_sec); } } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings