*/ 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' ); $page = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : ''; if (!empty($page) && sanitize_text_field($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' ), 'nonce' => wp_create_nonce( 'delete_user_nonce' )) ); 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', 'User Registration', 'manage_options', 'ace-user-registration', array($this, 'ace_register_page'), 'dashicons-dashboard', 52 ); 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', 'Settings', 'Settings', 'manage_options', 'Ace-Setting', array($this, 'add_all_setting_plugin') ); } public function languageLoadTextdomain() { $mo_file = plugins_url( 'ace_user_managament/languages/ace_user_managament' ).'-'.get_locale().'mo'; load_textdomain('ace_user_managament', $mo_file ); } public function add_all_setting_plugin() { global $wpdb; $recaptchaKeys = get_option('custom_reCapatcha_value'); if ( isset( $_POST['custom_css'] ) && isset( $_POST['ace_user_management_nonce'] ) ) { $nonce = sanitize_text_field( wp_unslash( $_POST['ace_user_management_nonce'] ) ); if ( wp_verify_nonce( $nonce, 'ace_user_management_settings' )) { if ( isset( $_POST['secretKEY'] ) ) { $secretkey = sanitize_text_field( wp_unslash( $_POST['secretKEY'] ) ); } if ( isset( $_POST['siteKEY'] ) ) { $sitekey = sanitize_text_field( wp_unslash( $_POST['siteKEY'] ) ); } $error = array(); $success = ''; if ( ! empty( $secretkey ) ) { if ( strlen( $secretkey ) == 40 ) { if ( ! empty( $sitekey ) ) { if ( strlen( $sitekey ) == 40 ) { $checked = ( isset( $_POST['reCapatchacheck'] ) && $_POST['reCapatchacheck'] == 1 ) ? 1 : 0; $update_reCap = update_option( 'custom_reCapatcha_value', array( 'c_reCaptcha_value' => $checked, 'author_reCap_secrectkey' => $secretkey, 'author_siteKey' => $sitekey ) ); if ( $update_reCap ) { $success = ' Successfully updated'; } else { $error['update_error'] = 'There was an error updating reCaptcha settings.'; } } else { $error['sitekey_vald'] = '! Site key not valid'; } } else { $error['sitekey_vald'] = '! Site key field is empty'; } } else { $error['secretkey_vald'] = '! Secret key is not valid'; } } else { $error['empty_secret_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') { ?> |