$val){ if(in_array($key, $popup_atts)){ $atts .= $key .'="'. $val .'" '; } } if( !empty($value['customlink']) ){ $message .= ' '. $policyTxt .' '; } $content = '[pl_popup popup_content_back="color" trig_load="true" popup_cookie_session="true" popup_sel_close="true" popup_cookie_name="site-cookie-consent" popup_cookie_exp="365" '.$atts.'][/pl_popup][pl_row stretch="auto" col_gap="10" width_content="auto" row_height="default" overlay_hover_delay="400" row_shape_top_color="#fff" row_shape_top_width="100" row_shape_top_height="100" row_shape_bottom_color="#fff" row_shape_bottom_width="100" row_shape_bottom_height="100" content_pos="center"][pl_col overlay_hover_delay="400" col_width="76.29"][pl_heading heading_state="normal" color="'. $value["color"]. '"]'. $message .'[/pl_heading][/pl_col][pl_col overlay_hover_delay="400" col_width="23.71"][pl_btn text="'. $btn_text .'" align="center" type="pagelayer-btn-custom" size="pagelayer-btn-small" btn_hover_delay="400" icon_position="pagelayer-btn-icon-left" icon_spacing="5" ele_classes="'. $btn_class .'" btn_typo=",15,,,,,Solid,,,1," btn_bg_color="'. $value['btn_bg_color'].'" btn_color="'. $value['btn_color'].'"][/pl_btn][/pl_col][/pl_row]'; // We need to create the post if( empty($value['templ_id']) || empty(get_post((int)$value['templ_id'])) ){ $ret = wp_insert_post([ 'post_type' => 'pagelayer-template', 'post_title' => 'Cookie-Consent', 'post_content' => $content, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed' ]); $value['templ_id'] = $ret; // Save our template metas update_post_meta($ret, 'pagelayer_template_type', 'popup'); update_post_meta($ret, 'pagelayer-data', time()); update_option('sitepad_cookieconsent', $value); }else if( isset($_POST['submit']) ){ // Save global widget content $post = array( 'ID' => (int) $value['templ_id'], 'post_content' => $content, ); // Update the post into the database $ret = wp_update_post($post); } if( !empty($value['templ_id']) && !empty($value['cookieconsentOn']) ){ $meta_array = get_post_meta($value['templ_id'], 'pagelayer_template_conditions', true); if( empty($meta_array) ){ $condi_array[0] = array( 'type' => 'include', 'template' => '', 'sub_template' => '', 'id' => '', ); update_post_meta($value['templ_id'], 'pagelayer_template_conditions', $condi_array); } }else{ update_post_meta($value['templ_id'], 'pagelayer_template_conditions', array()); } } if(!empty($value['templ_id']) && isset($_POST['edit_sitepad']) ){ $templ_link = wp_get_shortlink( (int)$value['templ_id'] ); $templ_link .= substr_count($link, '?') > 0 ? '&pagelayer-live=1' : '&pagelayer-live=1'; if( wp_redirect($templ_link) ){ exit; } } // Include Admin Header $title = __('Cookie Consent'); require_once( ABSPATH . 'site-admin/admin-header.php' ); echo ' '; if(!empty($value) && !empty($_POST) && isset($_POST['submit']) ){ $update = update_option('sitepad_cookieconsent', $value); echo '
'.__('Cookie Consent settings has been saved successfully !').'