plugin_dir = WP_PLUGIN_DIR . '/adminpress/'; $this->plugin_url = plugins_url( '/', __FILE__ ); $this->version = '0.1'; $this->modules_dir = $this->plugin_dir . 'modules'; $this->options = $this->get_settings(); register_activation_hook( __FILE__, array( $this, 'menu_tables_install' ) ); //add_action( 'init', array( $this, 'admp_load_textdomain' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'adminpress_admin_theme_style' ) ); add_action( 'login_enqueue_scripts', array( $this, 'adminpress_admin_theme_style' ) ); add_action( 'login_head', array( $this, 'login_internal_style' ) ); add_action( 'admin_head', array( $this, 'admin_internal_style' ) ); add_action( 'admin_menu', array( $this, 'register_adminpress_page' ) ); add_action( 'admin_notices', array( $this, 'adminpress_admin_notice' ) ); add_action( 'admin_footer', array( $this, 'quick_link' ) ); } /* * */ public function menu_tables_install() { do_action( 'plg_tables_installed' ); } /* * Attaching language file with the plugin */ public function admp_load_textdomain() { load_plugin_textdomain( 'admp', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); } /* * Adding stylesheet and script in the plugin */ public function adminpress_admin_theme_style() { wp_enqueue_media(); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'adminpress-admin-theme', $this->plugin_url . 'assets/css/adminpress.css', false, $this->version ); wp_enqueue_style( 'adminpress-font-awesome', $this->plugin_url . 'assets/css/font-awesome.min.css', false, $this->version ); wp_register_script( 'adminpress-js', $this->plugin_url . 'assets/js/adminpress.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), $this->version ); wp_localize_script( 'adminpress-js', 'data', array( 'media_box_title' => __( 'Custom Image', 'admp' ), 'media_btn_txt' => __( 'Upload Image', 'admp' ) ) ); wp_enqueue_script( 'adminpress-js' ); } /* * Get stored data */ public function get_settings() { return get_option( 'admp' ); } /* * Include dynamic style for admin page */ public function admin_internal_style() { include $this->plugin_dir . 'includes/admin-internal.php'; } /* * Include dynamic style for login page */ public function login_internal_style() { include $this->plugin_dir . 'includes/login-internal.php'; } /* * Registering admin menu for the plugin */ public function register_adminpress_page() { add_menu_page( 'Adminpress', 'Adminpress', 'manage_options', 'adminpress', array( $this, 'admin_settings_page' ) ); } /* * Main form */ public function admin_settings_page() { if( isset( $_POST['adminpress_option'] ) || isset( $_REQUEST['adminpress_nonce_field'] ) ){ if ( ! check_admin_referer( 'adminpress_nonce_action', 'adminpress_nonce_field' )){echo 100; if( ! wp_verify_nonce( $_REQUEST['adminpress_nonce_field'], 'adminpress_nonce_action' ) ) echo 100; return; return; } if( isset( $_POST['admp'] ) ){ $d = apply_filters( 'submitted_data', $_POST ); $admp = $d['admp']; } else $admp = array(); if( count( $admp ) > 0 ) update_option( 'admp', $admp ); do_action( 'save_adminpress_data', $_POST, $_REQUEST ); wp_redirect( admin_url( 'admin.php?page=adminpress&&done_action=saved' ) ); exit; } $form = ''; ?>

$strlen) return false; return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; } // Creating instance $adminPress = new AdminPress(); // Adding modules $modules = scandir( $adminPress->modules_dir ); foreach( $modules as $module ){ if( $module != '.' && $module != '..' && strpos($module, "class.") === 0 && endswith( $module, '.php' ) ){ include $adminPress->plugin_dir . 'modules/' . $module; } } } function admp_load_textdomain() { load_plugin_textdomain( 'admp', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); } add_action( 'init', 'admp_load_textdomain' );