'SFDC Environment', 'option_name' => 'select-environment', 'type' => 'select-environment', 'description' => '', 'default' => ''), //array( 'name' => 'API', 'option_name' => 'id_api_salesforce', 'type' => 'input', 'description' => 'Insert Link Api Salesforce', 'default' => ''), array( 'name' => 'API', 'option_name' => 'select-api', 'type' => 'select-api', 'description' => '', 'default' => ''), array( 'name' => 'Call to Action Tel ', 'option_name' => 'cta_tel', 'type' => 'select-phone', 'description' => 'Telephone', 'default' => '1.800.800.2537'), array( 'name' => 'Brand ID', 'option_name' => 'id_brand', 'type' => 'select-brand', 'description' => 'Brand ID', 'default' => ''), array( 'name' => 'Version', 'option_name' => 'id_version', 'type' => 'input', 'description' => '', 'default' => ''), array( 'name' => 'Responsys Campaign', 'option_name' => 'responsys_campaign', 'type' => 'input', 'description' => 'Responsys Campaign', 'default' => ''), /*array( 'name' => 'Encrption KEY', 'option_name' => 'encrption_key', 'type' => 'input', 'description' => 'Encrption KEY', 'default' => ''), array( 'name' => 'Singnature KEY', 'option_name' => 'signature_key', 'type' => 'textarea', 'description' => 'Singnature KEY', 'default' => ''),*/ array( 'name' => 'Call to Action', 'option_name' => 'title', 'type' => 'title', 'description' => '', 'default' => 'title'), array( 'name' => 'Call to Action Title ', 'option_name' => 'cta_title', 'type' => 'input', 'description' => '', 'default' => 'Operators Are Standing By'), //array( 'name' => 'Phone Assistance ', 'option_name' => 'assistance_phone', 'type' => 'input', 'description' => 'Assistance Phone(Error SF Page)', 'default' => '1.800.800.2538'), array( 'name' => 'Call to Action Descr ', 'option_name' => 'cta_descr', 'type' => 'input', 'description' => '', 'default' => 'CALL NOW TO ORDER!'), array( 'name' => 'Pages Template', 'option_name' => 'Pages Template', 'type' => 'title', 'description' => '', 'default' => 'title'), array( 'name' => 'Home', 'option_name' => 'id_medical_home', 'type' => 'select-page', 'description' => 'Select Home page', 'default' => ''), //array( 'name' => 'Product', 'option_name' => 'id_medical_product', 'type' => 'select-page', 'description' => 'Select product page', 'default' => ''), array( 'name' => 'Shipping', 'option_name' => 'id_medical_shipping', 'type' => 'select-page', 'description' => 'Select Shipping page', 'default' => ''), array( 'name' => 'Order Detail', 'option_name' => 'id_medical_order', 'type' => 'select-page', 'description' => 'Select Order page', 'default' => ''), array( 'name' => 'Profile Set up', 'option_name' => 'id_medical_profile', 'type' => 'select-page', 'description' => 'Select Profile page', 'default' => ''), array( 'name' => 'Thank', 'option_name' => 'id_medical_thank', 'type' => 'select-page', 'description' => 'Select Thank page', 'default' => ''), array( 'name' => 'Accessories', 'option_name' => 'id_medical_accessories', 'type' => 'select-page', 'description' => 'Select Select Accessories page', 'default' => ''), array( 'name' => 'Colors Selection', 'option_name' => 'Colors Selection', 'type' => 'title', 'description' => '', 'default' => 'title'), array( 'name' => 'Product Button Color', 'option_name' => 'id_product_color', 'type' => 'input', 'description' => 'Insert hexadecimal product button Color. ', 'default' => '#da9333'), array( 'name' => 'Products background Color', 'option_name' => 'id_product_background_color', 'type' => 'input', 'description' => 'Insert hexadecimal products background Color. ', 'default' => '#89d0f2'), array( 'name' => 'Objects in Evidence and Nav Color', 'option_name' => 'id_in_evidence_color', 'type' => 'input', 'description' => 'Insert hexadecimal Product in Evidence and Nav color, Modal window h1 and Upsell Price. ', 'default' => '#0b2265'), array( 'name' => 'Accessories Button Color', 'option_name' => 'id_acc_btn_color', 'type' => 'input', 'description' => 'Insert hexadecimal accessories page button Color. ', 'default' => '#a8a8a7'), array( 'name' => 'Title page, Place Order and Next Button Color', 'option_name' => 'id_next_btn_color', 'type' => 'input', 'description' => 'Insert hexadecimal Title page, Place Order and Next Button Color. ', 'default' => '#9c3039') ); add_filter('single_template','IperCptTemplate_single'); add_filter('archive_template','IperCptTemplate_archive'); /* Disable smithers for now add_action( 'wp_footer', 'environment_indicator'); function environment_indicator() { $s_env = get_option('select-environment'); $s_campaign = do_shortcode('[campaign_id]') ?: "N/A"; $s_five9 = do_shortcode('[campaign_five9]') ?: "Webform Submissions H"; $s_toll = do_shortcode('[phone_number]') ?: "800-800-2537"; $smithers_img = plugin_dir_url( __FILE__ ) . 'templates/images/smithers.png'; $smithers_js = plugin_dir_url( __FILE__ ) . 'templates/script/smithers.js'; if (defined('PANTHEON_ENVIRONMENT') && (PANTHEON_ENVIRONMENT !== 'live')) { echo '
'; } } */ //route single-template if(!function_exists('IperCptTemplate_single')){ function IperCptTemplate_single($single_template){ global $post; $found = locate_template('single-product.php'); if($post->post_type == 'product' && $found == ''){ $single_template = dirname(__FILE__).'/templates/template-product.php'; } return $single_template; } } //route archive-template if(!function_exists('IperCptTemplate_archive')){ function IperCptTemplate_archive($template){ if(is_post_type_archive('product')){ $theme_files = array('archive-product.php'); $exists_in_theme = locate_template($theme_files, false); if($exists_in_theme == ''){ return plugin_dir_path(__FILE__) . '/templates/template-medical-home.php'; } } return $template; } } function ajax_shortcode() { $stripslashes = do_shortcode( '[web_promo]' ); $stripslash = stripslashes($stripslashes); echo $stripslash; die(); } add_action('admin_menu', 'iper_menu_page'); function iper_menu_page() { $themename = "Medical Alert eCommerce"; $shortname = "iper_medical_alert"; $menu_slug="edit_posts"; //Capability add_object_page($themename, $themename, $menu_slug, $shortname,'id_main_admin'); } function id_main_admin(){ $i=0; global $themename, $shortname,$id_setting; $themename = "Medical Alert eCommerce"; $save=false; if ( 'save' == $_POST['action'] ) { $save=true; foreach($id_setting as $id_single) { update_option( sanitize_text_field($id_single['option_name']), sanitize_text_field($_POST[$id_single['option_name']]) ); $i++; } } if ( $save ) echo '

'.$themename.' Settings save..

'; ?>
".$themename." "; echo $admin_header; ?>
" /> ';}?>

0,'name' => $id_single['option_name'], 'selected' => get_option($id_single['option_name']))); ?>

0,'echo' => 0,'name' => $id_single['option_name'], 'selected' => stripslashes(get_option($id_single['option_name']))));?>

0,'echo' => 0,'taxonomy' => 'product_tag','name' => $id_single['option_name'], 'selected' => stripslashes(get_option($id_single['option_name']))));?>

0,'echo' => 0,'taxonomy' => 'wpsc_product_category','name' => $id_single['option_name'], 'selected' => stripslashes(get_option($id_single['option_name']))));?>

admin_url( 'admin-ajax.php' ) ) ); wp_localize_script( 'iperjs', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ),'plugin_url'=> plugin_dir_url( __FILE__ )) ); wp_enqueue_script( 'bootstrap-select', plugin_dir_url( __FILE__ ). '/templates/bootstrap/js/bootstrap-select.min.js', array('jquery'), false, true ); wp_enqueue_style( 'bootstrap-select', plugin_dir_url( __FILE__ ).'/templates/bootstrap/css/bootstrap-select.min.css', array(), false ); } add_action( 'wp_enqueue_scripts', 'theme_scripts_important', 15 ); function theme_scripts() { wp_enqueue_script( 'bootstrap-js', plugin_dir_url( __FILE__ ). 'templates/bootstrap/js/bootstrap.bundle.min.js', array('jquery'), false, true ); wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ).'templates/bootstrap/css/bootstrap.min.css', array(), false ); wp_enqueue_script( 'jquery', plugin_dir_url( __FILE__ ). 'templates/script/jquery-3.4.1.min.js', array(), false, true ); wp_enqueue_script( 'sticky', plugin_dir_url( __FILE__ ). 'templates/script/jquery.sticky.js', array('jquery'), false, true ); } add_action( 'wp_enqueue_scripts', 'theme_scripts' ); // ADD ACTIVE BTN TO PRODUCT POST function publish_in_frontpage($post){ $value = get_post_meta($post->ID, 'publish_in_frontpage', true); echo '
' . '' .'
'; } add_action( 'post_submitbox_misc_actions', 'publish_in_frontpage' ); function order_priority($post){ $value = get_post_meta($post->ID, 'order_priority', true); $html_1 = '
'; $html = $html_1.$html_2.$html_3; echo $html; } add_action( 'post_submitbox_misc_actions', 'order_priority' ); function meta_sortable($post){ switch ( $post->post_type ) { case 'rateplan': $value = get_post_meta($post->ID, 'order_priority', true); $html = '
'.get_post_meta($post->ID, 'product_rateplan', true).'
'; echo $html; break; case 'upsell': $html1 = '
'.get_post_meta($post->ID, 'product_upsell', true).'
'; $html2 = '
'.get_post_meta($post->ID, 'rateplan_upsell', true).'
'; echo $html1.$html2; break; } } add_action( 'post_submitbox_misc_actions', 'meta_sortable' ); function save_postdata($postid){ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false; if ( !current_user_can( 'edit_page', $postid ) ) return false; if(empty($postid) || $_POST['post_type'] != ('product' || 'rateplan')) return false; if($_POST['action'] == 'editpost'){ delete_post_meta($postid, 'publish_in_frontpage'); delete_post_meta($postid, 'order_priority'); } add_post_meta($postid, 'publish_in_frontpage', sanitize_text_field($_POST['publish_in_frontpage'])); add_post_meta($postid, 'order_priority', sanitize_text_field($_POST['order_priority_value'])); update_post_meta($postid, '_wp_page_template', sanitize_text_field($_POST['page_template'])); /* update_post_meta($postid, 'order_priority', $_POST['order_priority_value']);*/ } add_action( 'save_post', 'save_postdata'); function hex2rgba($color, $opacity = false) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)) return $default; //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if($opacity){ if(abs($opacity) > 1) $opacity = 1.0; $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; } else { $output = 'rgb('.implode(",",$rgb).')'; } //Return rgb(a) color string return $output;} function iper_set_style($btn_color, $card_color, $nav_active_color, $btn_accessories, $btn_place_order){ ?> get_row($preparedData, $type); } else { $res = $new_db->get_results($preparedData, $type); } if ($new_db->last_errors != "") { die("ERROR ON SQL \n" . $new_db->last_errors . "\n SQL: " . $new_db->last_query); } unset($new_db); return $res; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } } } function call_the_style(){ iper_set_style(get_option('id_product_color'), get_option('id_product_background_color'), get_option('id_in_evidence_color'), get_option('id_acc_btn_color'), get_option('id_next_btn_color')); } function iper_hook_css(){ add_action('wp_head','call_the_style'); } add_action ( 'wp_head', 'googleapi' ); function googleapi(){ global $CountdownDate; global $days_from_eom; global $finaldate; ?> $value ) { $new_columns[ $key ] = $value; if ( $key == 'title' ) $new_columns[ 'product_rateplan' ] = 'Related Product'; $new_columns[ 'order_priority' ] = 'Order Priority'; } return $new_columns; case 'upsell': $new_columns = array(); foreach( $columns as $key => $value ) { $new_columns[ $key ] = $value; if ( $key == 'title' ) $new_columns[ 'product_upsell' ] = 'Related Product'; $new_columns[ 'rate_plan' ] = 'Related RatePlan'; $new_columns[ 'order_priority' ] = 'Order Priority'; } return $new_columns; case 'product': $new_columns = array(); foreach( $columns as $key => $value ) { $new_columns[ $key ] = $value; if ( $key == 'title' ) $new_columns[ 'order_priority' ] = 'order priority'; } return $new_columns; } return $columns; } add_action('manage_posts_custom_column', 'manage_posts_custom_column_callback', 10, 2); function manage_posts_custom_column_callback( $column_name, $post_id ) { global $post; if (get_post_meta($post->ID, 'order_priority', true) == '' || get_post_meta($post->ID, 'order_priority', true) == ' ') { add_post_meta($post->ID, 'order_priority', '-'); update_post_meta($post->ID, 'order_priority', '-'); } $post_id = sanitize_text_field($post_id); switch ($column_name) { case 'product_rateplan': echo '
' . get_post_meta($post_id, 'product_rateplan', true) . '
'; break; case 'order_priority': echo '
' . get_post_meta($post_id, 'order_priority', true) . '
'; break; case 'rate_plan': echo '
' . get_post_meta($post_id, 'rateplan_upsell', true) . '
'; break; case 'product_upsell': echo '
' . get_post_meta($post_id, 'product_upsell', true) . '
'; break; } } add_filter('manage_edit-rateplan_sortable_columns', 'tcb_register_rateplan_sortable_columns'); add_filter('manage_edit-upsell_sortable_columns', 'tcb_register_upsell_sortable_columns'); add_filter('manage_edit-product_sortable_columns', 'tcb_register_product_sortable_columns'); function tcb_register_rateplan_sortable_columns( $columns ){ $columns['order_priority'] = 'order_priority'; $columns['product_rateplan'] = 'product_rateplan'; return $columns; } function tcb_register_product_sortable_columns( $columns ){ $columns['order_priority'] = 'order_priority'; return $columns; } function tcb_register_upsell_sortable_columns( $columns ){ $columns['order_priority'] = 'order_priority'; $columns['rate_plan'] = 'rateplan_upsell'; $columns['product_upsell'] = 'product_upsell'; return $columns; } add_action( 'pre_get_posts', 'manage_wp_posts_be_qe_pre_get_posts', 1 ); function manage_wp_posts_be_qe_pre_get_posts( $query ) { /** * We only want our code to run in the main WP query * AND if an orderby query variable is designated. */ if ( $query->is_main_query() && ( $orderby = $query->get( 'orderby' ) ) ) { switch( $orderby ) { // If we're ordering by 'film_rating' case 'order_priority': // set our query's meta_key, which is used for custom fields $query->set( 'meta_key', 'order_priority' ); /** * Tell the query to order by our custom field/meta_key's * value, in this film rating's case: PG, PG-13, R, etc. * * If your meta value are numbers, change 'meta_value' * to 'meta_value_num'. */ $query->set( 'orderby', 'meta_value_num' ); break; case 'rate_plan': // set our query's meta_key, which is used for custom fields $query->set( 'meta_key', 'rateplan_upsell' ); /** * Tell the query to order by our custom field/meta_key's * value, in this film rating's case: PG, PG-13, R, etc. * * If your meta value are numbers, change 'meta_value' * to 'meta_value_num'. */ $query->set( 'orderby', 'meta_value' ); break; case 'product_upsell': // set our query's meta_key, which is used for custom fields $query->set( 'meta_key', 'product_upsell' ); /** * Tell the query to order by our custom field/meta_key's * value, in this film rating's case: PG, PG-13, R, etc. * * If your meta value are numbers, change 'meta_value' * to 'meta_value_num'. */ $query->set( 'orderby', 'meta_value' ); break; case 'product_rateplan': // set our query's meta_key, which is used for custom fields $query->set( 'meta_key', 'product_rateplan' ); /** * Tell the query to order by our custom field/meta_key's * value, in this film rating's case: PG, PG-13, R, etc. * * If your meta value are numbers, change 'meta_value' * to 'meta_value_num'. */ $query->set( 'orderby', 'meta_value' ); break; } } } add_action( 'init', create_function('', 'register_shortcode_ajax( "ajax_shortcode", "ajax_shortcode" ); ')); function register_shortcode_ajax( $callable, $action ) { if ( empty( $_POST['action'] ) || $_POST['action'] != $action ) return; call_user_func( $callable ); } include_once("page-types.php"); include_once("medical-shortcode.php"); include_once("medical-metabox.php"); // medical alert encryption classes include_once("encryption/message-content.php"); include_once("encryption/message-content-signed.php"); include_once("encryption/encrypted-content.php"); include_once("encryption/secured-content.php");