*/ class Ace_User_Management_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $pluginName The ID of this plugin. */ private $pluginName; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 1.0.0 * @param string $pluginName The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $pluginName, $version ) { $this->pluginName = $pluginName; $this->version = $version; } /** * Register the stylesheets for the admin area. * * @since 1.0.0 */ public function aceEnqueueStyles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Ace_User_Management_Loader as all of the hooks are defined * in that particular class. * * The Ace_User_Management_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_style( $this->pluginName, plugin_dir_url( __FILE__ ) . 'css/ace-user-management-admin.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->pluginName.'-fontawesome', plugin_dir_url( __FILE__ ) . 'css/ace-fontawesome.css', array(), $this->version, 'all' ); wp_enqueue_style( 'font-awesome-cdn', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css', array(), '6.5.0' ); if( !empty( $_GET['page'] ) && sanitize_text_field( $_GET['page'] ) == 'ace-custom-field' ){ wp_enqueue_style( $this->pluginName.'-bootstrap', plugin_dir_url( __FILE__ ) . 'css/bootstrap.min.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->pluginName.'-fontawesome', plugin_dir_url( __FILE__ ) . 'css/ace-fontawesome.css', array(), $this->version, 'all' ); } } /** * Register the JavaScript for the admin area. * * @since 1.0.0 */ public function aceEnqueueScripts() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Ace_User_Management_Loader as all of the hooks are defined * in that particular class. * * The Ace_User_Management_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_script( $this->pluginName, plugin_dir_url( __FILE__ ) . 'js/ace-user-management-admin.js', array( 'jquery' ), $this->version, false ); wp_localize_script( $this->pluginName, 'ajax', array( 'url' => admin_url( 'admin-ajax.php' )) ); if( !empty( $_GET['page'] ) && sanitize_text_field( $_GET['page'] ) == 'ace-custom-field' ){ wp_enqueue_script( $this->pluginName.'-bootjs', plugin_dir_url( __FILE__ ) . 'js/ace-bootstrap.min.js', array(), $this->version, 'all' ); wp_enqueue_script( $this->pluginName.'-jquery-core', get_site_url() . '/wp-includes/js/jquery/ui/core.min.js', array(), $this->version, 'all' ); wp_enqueue_script( $this->pluginName.'-jquery-widget', get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js', array(), $this->version, 'all' ); wp_enqueue_script( $this->pluginName.'-jquery-mouse', get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js', array(), $this->version, 'all' ); wp_enqueue_script( $this->pluginName.'-sortable', get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js', array(), $this->version, 'all' ); } } // wordpress menu public function aceRegisterOptionsPage(){ add_menu_page( 'User Registration', // page title 'User Registration', //menu title 'manage_options', //capability 'ace-user-registration', // menu slug array($this, 'ace_register_page'), // callback function 'dashicons-dashboard', // icon 52 //position ); add_submenu_page( 'ace-user-registration', 'Custom Fields', 'Custom Fields', 'manage_options', 'ace-custom-field', array( $this, 'ace_add_fields_' ) ); add_submenu_page( 'ace-user-registration', // parent slug 'Settings', // page title 'Settings', // menu title 'manage_options', // capability 'Ace-Setting', //menu slug array($this, 'add_all_setting_plugin') // callback function ); } public function languageLoadTextdomain() { $mo_file = plugins_url( 'ace_user_managament/languages/ace_user_managament' ).'-'.get_locale().'mo'; load_textdomain('ace_user_managament', $mo_file ); load_plugin_textdomain('ace_user_managament', false, plugins_url( 'ace_user_managament/languages/' ) ); } public function add_all_setting_plugin(){ global $wpdb; $recaptchaKeys = get_option('custom_reCapatcha_value'); if( isset( $_POST['custom_css'] ) ){ $secretkey = sanitize_text_field( $_POST['secretKEY'] ); $sitekey = sanitize_text_field( $_POST['siteKEY'] ); $success = ''; if( !empty( $secretkey )){ if( strlen( $secretkey ) == 40 ){ if( !empty($sitekey) ) { if( strlen( $sitekey ) == 40){ if( !empty( $_POST['reCapatchacheck'] ) == 1 ){ $checked = 1; }else{ $checked = 0; } $update_reCap = update_option( 'custom_reCapatcha_value', array( 'c_reCaptcha_value' => $checked, 'author_reCap_secertkey' => $secretkey, 'author_siteKey' => $sitekey ) ); }else{ $error['sitekey_vald'] = '! Site key field is empty'; } }else{ $error['sitekey_vald'] = '! Site key field is empty'; } }else{ $error['secretkey_vald'] = '! Secret key not valid'; } }else{ $error['empty_secert_key'] = '! Secret key field is empty'; } if ( isset( $error ) ) { foreach ( $error as $error_key => $error_value ) { echo '
| input_type == 'text'){ ?> input_type == 'textarea') { ?> input_type == 'dropdown') { ?> |