0byt3m1n1
Path:
/
data
/
40
/
5
/
122
/
64
/
5448064
/
user
/
6519071
/
htdocs
/
wp-content
/
themes
/
Jingged
/
[
Home
]
File: functions.php
<?php /** * _tk functions and definitions * * @package _tk */ /** * Set the content width based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 750; /* pixels */ if ( ! function_exists( '_tk_setup' ) ) : /** * Set up theme defaults and register support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. */ function _tk_setup() { global $cap, $content_width; // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); /** * Add default posts and comments RSS feed links to head */ add_theme_support( 'automatic-feed-links' ); /** * Enable support for Post Thumbnails on posts and pages * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); /** * Setup the WordPress core custom background feature. */ add_theme_support( 'custom-background', apply_filters( '_tk_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); /** * Make theme available for translation * Translations can be filed in the /languages/ directory * If you're building a theme based on _tk, use a find and replace * to change '_tk' to the name of your theme in all the template files */ load_theme_textdomain( '_tk', get_template_directory() . '/languages' ); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Header menu', '_tk' ), 'secondary' => __( 'Footer menu', '_tk' ), ) ); } endif; // _tk_setup add_action( 'after_setup_theme', '_tk_setup' ); /** * Register widgetized area and update sidebar with default widgets */ function _tk_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', '_tk' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', '_tk_widgets_init' ); /** * Enqueue scripts and styles */ function _tk_scripts() { // load bootstrap css wp_enqueue_style( '_tk-bootstrap', get_template_directory_uri() . '/includes/resources/bootstrap/css/bootstrap.min.css' ); // load Font Awesome css wp_enqueue_style( '_tk-font-awesome', get_template_directory_uri() . '/includes/css/font-awesome.min.css', false, '4.1.0' ); // load _tk styles wp_enqueue_style( '_tk-style', get_stylesheet_uri() ); // Import the necessary TK Bootstrap WP CSS additions wp_enqueue_style( '_tk-bootstrap-wp', get_template_directory_uri() . '/includes/css/bootstrap-wp.css' ); wp_enqueue_style( '_tk-responsive-wp', get_template_directory_uri() . '/includes/css/responsive-wp.css' ); // load bootstrap js wp_enqueue_script('_tk-bootstrapjs', get_template_directory_uri().'/includes/resources/bootstrap/js/bootstrap.min.js', array('jquery') ); // load bootstrap wp js wp_enqueue_script( '_tk-bootstrapwp', get_template_directory_uri() . '/includes/js/bootstrap-wp.js', array('jquery') ); wp_enqueue_script( '_tk-skip-link-focus-fix', get_template_directory_uri() . '/includes/js/skip-link-focus-fix.js', array(), '20130115', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( '_tk-keyboard-image-navigation', get_template_directory_uri() . '/includes/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', '_tk_scripts' ); function adminEnqueue(){ if( is_user_logged_in() ) { $user = wp_get_current_user(); $role = $user->roles; if ($role[0] == 'subscriber') { wp_enqueue_style( '_tk-admin-wp', get_template_directory_uri() . '/includes/css/admin-wp.css' ); } } } add_action( 'admin_enqueue_scripts', 'adminEnqueue' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/includes/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/includes/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/includes/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/includes/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/includes/jetpack.php'; /** * Load custom WordPress nav walker. */ require get_template_directory() . '/includes/bootstrap-wp-navwalker.php'; if ( ! class_exists( 'WPEX_Theme_Options' ) ) { class WPEX_Theme_Options { /** * Start things up * * @since 1.0.0 */ public function __construct() { // We only need to register the admin panel on the back-end if ( is_admin() ) { add_action( 'admin_menu', array( 'WPEX_Theme_Options', 'add_admin_menu' ) ); add_action( 'admin_init', array( 'WPEX_Theme_Options', 'register_settings' ) ); } } /** * Returns all theme options * * @since 1.0.0 */ public static function get_theme_options() { return get_option( 'theme_options' ); } /** * Returns single theme option * * @since 1.0.0 */ public static function get_theme_option( $id ) { $options = self::get_theme_options(); if ( isset( $options[$id] ) ) { return $options[$id]; } } /** * Add sub menu page * * @since 1.0.0 */ public static function add_admin_menu() { add_menu_page( esc_html__( 'Theme Settings', 'text-domain' ), esc_html__( 'Theme Settings', 'text-domain' ), 'manage_options', 'theme-settings', array( 'WPEX_Theme_Options', 'create_admin_page' ) ); } /** * Register a setting and its sanitization callback. * * We are only registering 1 setting so we can store all options in a single option as * an array. You could, however, register a new setting for each option * * @since 1.0.0 */ public static function register_settings() { register_setting( 'theme_options', 'theme_options', array( 'WPEX_Theme_Options', 'sanitize' ) ); } /** * Sanitization callback * * @since 1.0.0 */ public static function sanitize( $options ) { // If we have options lets sanitize them if ( $options ) { // Checkbox if ( ! empty( $options['checkbox_example'] ) ) { $options['checkbox_example'] = 'on'; } else { unset( $options['checkbox_example'] ); // Remove from options if not checked } // Input if ( ! empty( $options['input_example'] ) ) { $options['input_example'] = sanitize_text_field( $options['input_example'] ); } else { unset( $options['input_example'] ); // Remove from options if empty } // Select if ( ! empty( $options['select_example'] ) ) { $options['select_example'] = sanitize_text_field( $options['select_example'] ); } } // Return sanitized options return $options; } /** * Settings page output * * @since 1.0.0 */ public static function create_admin_page() { ?> <div class="wrap"> <h1><?php esc_html_e( 'Theme Options', 'text-domain' ); ?></h1> <form method="post" action="options.php"> <?php settings_fields( 'theme_options' ); ?> <table class="form-table wpex-custom-admin-login-table"> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Phone Number', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_phone_number' ); ?> <input type="text" name="theme_options[wp_phone_number]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Fax Number', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_fax_number' ); ?> <input type="text" name="theme_options[wp_fax_number]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Email id', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_email_id' ); ?> <input type="text" name="theme_options[wp_email_id]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Facebook Link', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_facebook' ); ?> <input type="text" name="theme_options[wp_facebook]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Twitter Link', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_twitter' ); ?> <input type="text" name="theme_options[wp_twitter]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Linkedin Link', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_linkedin' ); ?> <input type="text" name="theme_options[wp_linkedin]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Instagram Link', 'text-domain' ); ?></th> <td> <?php $value = self::get_theme_option( 'wp_instagram' ); ?> <input type="text" name="theme_options[wp_instagram]" value="<?php echo esc_attr( $value ); ?>"> </td> </tr> </table> <?php submit_button(); ?> </form> </div><!-- .wrap --> <?php } /* get value $value = myprefix_get_theme_option( 'select_example' ); echo $value; https://www.wpexplorer.com/wordpress-theme-options/ */ } } new WPEX_Theme_Options(); // Helper function to use in your theme to return a theme option value function myprefix_get_theme_option( $id = '' ) { return WPEX_Theme_Options::get_theme_option( $id ); } function directory_cat_list_shortcode( $atts ) { global $wpdb; $result = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."directory_cates"); $html = '<select class="form-control" id="directory_cates"><option data-id="0">Country</option>'; foreach ($result as $res) { $html .= '<option data-id="'.$res->id.'">'.$res->name.'</option>'; } $html .= '</select>'; return $html; } add_shortcode( 'directoryCates', 'directory_cat_list_shortcode' ); /*directory list list*/ add_action( 'wp_ajax_nopriv_directory_list', 'directory_list' ); add_action( 'wp_ajax_directory_list', 'directory_list' ); function directory_list() { global $wpdb; $query = "SELECT dr.*, cou.code3, dcat.name FROM ".$wpdb->prefix."directories dr INNER JOIN ".$wpdb->prefix."countries cou ON dr.country_id = cou.id INNER JOIN ".$wpdb->prefix."directory_cates dcat ON dr.directories_cat_id = dcat.id"; $where=" where 1=1"; if(!empty($_POST['sid'])) { $where .= " and dr.state LIKE '".$_POST['sid']."'"; } if($_POST['catid']!=0) { $where .= " and dr.directories_cat_id='".$_POST['catid']."'"; } $query.=$where; //echo $query;exit(); $result = $wpdb->get_results($query); /*echo "<pre>";print_r($result); exit();*/ //$result = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."directories"); $directories=array(); if(count($result)>0) { foreach ($result as $res) { $directory=array('fname'=> $res->fname, 'lname'=> $res->lname); $directories[]=$directory; } } $array=array('data'=>$result); //echo "<pre>";print_r($result);exit(); echo json_encode($array); //echo $abc = '{"data": [{"fname": "Tiger Nixon","lname": "Tiger Nixon"}]}'; die(); } /*state list list*/ add_action( 'wp_ajax_nopriv_state_list', 'state_list' ); add_action( 'wp_ajax_state_list', 'state_list' ); function state_list() { global $wpdb; //print_r( $_POST);exit(); $query = "SELECT state FROM ".$wpdb->prefix."directories WHERE state!='' and directories_cat_id LIKE '".$_POST['cid']."' GROUP BY state"; $result = $wpdb->get_results($query); /*echo "<pre>";print_r($result); exit();*/ //$result = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."directories"); $directories=array(); $html = '<select class="form-control" id="directory_states"><option data-id="0" value="0">States</option>'; if(count($result)>0) { foreach ($result as $res) { $html .= '<option data-state="'.$res->state.'">'.$res->state.'</option>'; } } $html .= '</select>'; echo $html; die(); } add_action( 'admin_head', 'insert_header_wpse_51023' ); function insert_header_wpse_51023() { if( is_user_logged_in() ) { $user = wp_get_current_user(); $role = $user->roles; if ($role[0] == 'subscriber') { require_once('header.php'); } } } add_action( 'wp_ajax_nopriv_custom_reistr', 'custom_reistr' ); add_action( 'wp_ajax_custom_reistr', 'custom_reistr' ); function custom_reistr() { $searcharray=parse_str($_POST['form_all']); $middle_name; $last_name; $degree; $business_na; $street_add; $city_state; $work_ph; $business_email; $business_webs; if($health_care=='') { $health_care='off'; } else { $health_care='Affirmative'; } $health_care; $state_issue; $filed_prof; $cred_lic; //$exp_date=strtotime($exp_date); //$exp_date= ; $end_course1_date_mail=$end_course1_date; $end_course_date_mail=$end_course_date; $end_course1_date=strtotime($end_course1_date); $end_course_date=strtotime($end_course_date); $exp_date; if($credential_chk=='') { $credential_chk='off'; } else { $credential_chk=$credential_chk; } $credential_chk; $course_title; $course_org; $course_faculty; $course_date_mail=$course_date; $course_date=strtotime($course_date); $course_location; $course1_title; $course1_org; $course1_faculty; $course1_date_mail=$course1_date; $course1_date=strtotime($course1_date); $course1_location; $yes_no_disp; $yes_no_aci; $crd_name; $amt_to; $card_exp=strtotime($card_exp); $card_exp; $yes_no_pay; $yes_no_type; $exp_card=strtotime($exp_card); $exp_card; $cc_t; $sign; $curr_dat=strtotime($curr_dat); $curr_dat; $a=get_bloginfo('name'); $site=site_url(); $user_email=$business_email; $user_idz = username_exists($user_email); if($user_idz=='') { $disname=$first_name." ".$last_name; //$random_password = wp_generate_password( $length=12, $include_standard_special_chars=false ); $random_password=$password; $user_id = wp_create_user( $user_email, $random_password, $user_email ); $rand=rand(); $t=time(); $finl=base64_encode($rand."".$t); global $wpdb; $ereminders = $wpdb->query($wpdb->prepare("UPDATE wpky_users SET display_name='$disname',user_activation_key='$finl' WHERE ID=$user_id")); $to = $user_email; $subject = "[".$a."] Your username and password info"; $htmlContent = ' <html> <body> <p>Username: '.$user_email.'</p> <p>To set your password, visit the following address:</p> <p>'.$site.'/reset-password/?key='.$finl.'</p> <p>'.$site.'/login/</p> </body> </html>'; // Set content-type header for sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers1= 'Cc: terry.oleson@gmail.com' . "\r\n"; // Additional headers $headers .= 'From: Auriculotherapy<info@auriculotherapy.org>' . "\r\n"; mail($to,$subject,$htmlContent,$headers); $admin_to='info@auriculotherapy.org'; $admin_subject="Certification Registration"; $headers=$headers.$headers1; $admin_htmlContent = ' <html> <body> <p><strong>First Name:</strong> '.$first_name.'</p> <p><strong>Last Name:</strong> '.$last_name.'</p> <p><strong>Business Address (Street Number):</strong> '.$street_add.'</p> <p><strong>Business Address (City, State, Zipcode, Country):</strong> '.$city_state.'</p> <p><strong>Work Phone:</strong> '.$work_ph.'</p> <p><strong>Business Email:</strong> '.$business_email.'</p> <p><strong>Name of university, college or institute:</strong> '.$nameofuniversity.'</p> <p><strong>Year graduated:</strong> '.$year_graduated.'</p> <p><strong>Degree Obtained:</strong> '.$degree_obtained.'</p> <p><strong>Credit Card Type:</strong> '.$yes_no_type.'</p> <p><strong>Credit Card Number:</strong> '.$credit_card_number.'</p> <p><strong>Expiration Date:</strong> '.$exp_credit_card.'</p> <p><strong>CVS Code on reverse side of card:</strong> '.$cc_t.'</p> <p><strong>I do practice independently:</strong> '.$health_care.'</p> <p><strong>State & Issuing Agency:</strong> '.$state_issue.'</p> <p><strong>Field or Profession:</strong> '.$filed_prof.'</p> <p><strong>Current Credential / License No:</strong> '.$cred_lic.'</p> <p><strong>I do not practice independently:</strong> '.$credential_chk.'</p> <p><strong>Title of Course:</strong> '.$course_title.'</p> <p><strong>Organization offering Training:</strong> '.$course_org.'</p> <p><strong>Faculty Name(s):</strong> '.$course_faculty.'</p> <p><strong>Start Date:</strong> '.$course_date_mail.'</p> <p><strong>End Date:</strong> '.$end_course_date_mail.'</p> <p><strong>Location:</strong> '.$course_location.'</p> <p><strong>Title of Course:</strong> '.$course1_title.'</p> <p><strong>Organization offering Training:</strong> '.$course1_org.'</p> <p><strong>Faculty Name(s):</strong> '.$course1_faculty.'</p> <p><strong>Start Date:</strong> '.$course1_date_mail.'</p> <p><strong>End Date:</strong> '.$course1_date_mail.'</p> <p><strong>Location:</strong> '.$end_course1_date_mail.'</p> <p><strong>Professionally Disciplined:</strong> '.$disciplined_chk.'</p> <p><strong>I am applying for ACI Certification in:</strong> '.$aci_certification.'</p> </body> </html>'; mail($admin_to,$admin_subject,$admin_htmlContent,$headers); $array=array("fname"=>$first_name,"lname"=>$last_name,"street_add"=>$street_add,"city_state"=>$city_state,"work_ph"=>$work_ph,"business_email"=>$business_email,"nameofuniversity"=>$nameofuniversity,"year_graduated"=>$year_graduated,"degree_obtained"=>$degree_obtained,"yes_no_type"=>$yes_no_type,"credit_card_number"=>$credit_card_number,"exp_credit_card"=>$exp_credit_card,"cc_t"=>$cc_t,"health_care"=>$health_care,"state_issue"=>$state_issue,"filed_prof"=>$filed_prof,"cred_lic"=>$cred_lic,"credential_chk"=>$credential_chk,"course_title"=>$course_title,"course_org"=>$course_org,"course_faculty"=>$course_faculty,"course_date"=>$course_date,"course_location"=>$course_location,"course1_title"=>$course1_title,"course1_org"=>$course1_org,"course1_faculty"=>$course1_faculty,"course1_date"=>$course1_date,"course1_location"=>$course1_location,"disciplined_chk"=>$disciplined_chk,"aci_certification"=>$aci_certification,"end_course_date"=>$end_course_date,"end_course1_date"=>$end_course1_date); /*$array=array("fname"=>$first_name,"mname"=>$middle_name,"lname"=>$last_name,"degree"=>$degree,'business_name'=>$business_na,"street_add"=>$street_add,"city_state"=>$city_state,"work_ph"=>$work_ph,"business_webs"=>$business_webs,"health_care"=>$health_care,"state_issue"=>$state_issue,"filed_prof"=>$filed_prof,"cred_lic"=>$cred_lic,"exp_date"=>$exp_date,"credential_chk"=>$credential_chk,"course_title"=>$course_title,"course_org"=>$course_org,"course_faculty"=>$course_faculty,"course_date"=>$course_date,"course_location"=>$course_location,"course1_title"=>$course1_title,"course1_org"=>$course1_org,"course1_faculty"=>$course1_faculty,"course1_date"=>$course1_date,"course1_location"=>$course1_location);*/ /*$array=array("fname"=>$first_name,"mname"=>$middle_name,"lname"=>$last_name,"degree"=>$degree,'business_name'=>$business_na,"street_add"=>$street_add,"city_state"=>$city_state,"work_ph"=>$work_ph,"business_webs"=>$business_webs,"health_care"=>$health_care,"state_issue"=>$state_issue,"filed_prof"=>$filed_prof,"cred_lic"=>$cred_lic,"exp_date"=>$exp_date,"credential_chk"=>$credential_chk,"course_title"=>$course_title,"course_org"=>$course_org,"course_faculty"=>$course_faculty,"course_date"=>$course_date,"course_location"=>$course_location,"course1_title"=>$course1_title,"course1_org"=>$course1_org,"course1_faculty"=>$course1_faculty,"course1_date"=>$course1_date,"course1_location"=>$course1_location,"yes_no_disp"=>$yes_no_disp,"yes_no_aci"=>$yes_no_aci,"crd_name"=>$crd_name,"amt_to"=>$amt_to,"card_exp"=>$card_exp,"card_exp"=>$card_exp,"yes_no_pay"=>$yes_no_pay,"yes_no_type"=>$yes_no_type,"exp_card"=>$exp_card,"cc_t"=>$cc_t,"sign"=>$sign,"curr_dat"=>$curr_dat);*/ $json=json_encode($array); add_user_meta( $user_id, 'user_data_own', $json, '' ); global $wpdb; $wpdb->insert($wpdb->prefix.'emp_student_groups',array('student_id'=>$user_id,'group_id'=>$emp_groups)); $res="done"; } else { $res="already"; } echo $res; die(); } add_action( 'wp_ajax_nopriv_update_pass', 'update_pass' ); add_action( 'wp_ajax_update_pass', 'update_pass' ); function update_pass() { $pass=md5($_POST['pass1']); $key=$_POST['key_ow']; global $wpdb; $sql = "SELECT id FROM wpky_users WHERE user_activation_key='$key'"; $results = $wpdb->get_results($sql); $id=$results[0]->id; $ereminders = $wpdb->query($wpdb->prepare("UPDATE wpky_users SET user_pass='$pass',user_activation_key='' WHERE ID=$id")); die();} add_action( 'admin_bar_menu', 'remove_wp_logo', 999 ); function remove_wp_logo( $wp_admin_bar ) { $wp_admin_bar->remove_node( 'wp-logo' ); } add_action('current_screen', 'disable_dashboard'); function disable_dashboard() { $screen = get_current_screen(); //print_r($screen);exit(); if (current_user_can('subscriber') && ($screen->id=="dashboard" || $screen->id=="profile")) { wp_redirect(home_url('wp-admin/admin.php?page=examapp_UserDashboard')); exit; } } add_filter('option_users_can_register', function($value) { $script = basename(parse_url($_SERVER['SCRIPT_NAME'], PHP_URL_PATH)); if ($script == 'wp-login.php') { $value = false; } return $value; }); add_filter( 'body_class','my_body_classes' ); function my_body_classes( $classes ) { if (current_user_can('subscriber')){ $classes[] = 'sub-login'; } return $classes; } add_filter( 'admin_bar_menu', 'replace_wordpress_howdy', 25 ); function replace_wordpress_howdy( $wp_admin_bar ) { $my_account = $wp_admin_bar->get_node('my-account'); $newtext = str_replace( 'Howdy,', 'Welcome,', $my_account->title ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $newtext, ) ); } add_action('wp_enqueue_scripts', 'mitheme_enqueue_scripts'); function mitheme_enqueue_scripts() { wp_deregister_script('jquery'); wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"), false, null); wp_enqueue_script('jquery'); }