get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'registeration';"); if (!$page_id) { $my_page = array( 'post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'registeration', 'post_title' => __('registeration page', 'pana_reg_localization'), 'post_content' => '[registeration_form]' ); $page_id = wp_insert_post($my_page); } } /*build the from and be shown through a shortcode---------------------------------------*/ public function pana_build_form() { require_once('template/index.php'); } /*redirect user to registeration page--------------------------------------------------*/ public function pana_catch_register() { wp_redirect( home_url( '/registeration' ) ); exit(); } /*adds plguin's script-----------------------------------------------------------------*/ public function pana_registeration_script() { wp_register_script( 'ajax-of-registeration', plugin_dir_url(__FILE__).'scripts/ajax.js' ); wp_localize_script( 'ajax-of-registeration', 'panaregurl', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ),'PanaRegNonce' => wp_create_nonce( 'pana-registeration-nonce' ) ) ); wp_enqueue_script( 'ajax-of-registeration' ); } /*adds plguin's styles---------------------------------------------------------------*/ public function pana_registeration_style() { wp_register_style( 'style-of-registeration', plugin_dir_url(__FILE__).'styles/reg-page.css' ); wp_register_style( 'style-of-registeration-rtl', plugin_dir_url(__FILE__).'styles/reg-page-rtl.css' ); wp_enqueue_style( 'style-of-registeration' ); if(is_rtl()) { wp_enqueue_style( 'style-of-registeration-rtl' ); } } public function pana_reg_ajax() { require_once('template/pana_reg_process.php'); exit; } } /*create an instance-----------------------------------------------------------start---*/ new pana_registeration_page(); /*create an instance-----------------------------------------------------------end-----*/ ?>