function cwp_add_comment_meta_values($comment_id) { for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { if (isset($_POST['meta_option_' . $i])) { ${'meta_option_' . $i} = wp_filter_nohtml_kses($_POST['meta_option_' . $i]); add_comment_meta($comment_id, 'meta_option_' . $i, ${'meta_option_' . $i}, false); } } }
function cwp_pac_before_content($content) { global $post; $cwp_review_stored_meta = get_post_meta($post->ID); $return_string = cwppos_show_review(); //var_dump($return_string); if (@$cwp_review_stored_meta['cwp_meta_box_check'][0] == 'Yes' && (is_single() || is_page())) { if (cwppos("cwppos_show_reviewbox") == 'yes') { return $content . $return_string; } if (cwppos("cwppos_show_reviewbox") == 'no') { return $return_string . $content; } return $content; } else { return $content; } }
$pinfo_temp = $preloaded_info[$post_id]["option" . $i]['pro']; if (!empty($pinfo_temp)) { echo "<li>" . $pinfo_temp . "</li>"; } else { echo "<li>-</li>"; } } ?> </ul><!-- end .cwp_pitem_options_pros --> <ul class="cwp_pitem_options_cons"> <h4><?php _e("Cons", "cwppos"); ?> </h4> <?php for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { $pinfo_temp = $preloaded_info[$post_id]["option" . $i]['cons']; if (!empty($pinfo_temp)) { echo "<li>" . $pinfo_temp . "</li>"; } else { echo "<li>-</li>"; } } ?> </ul><!-- end .cwp_pitem_options_cons --> </div><!-- end .cwp_pitem_info --> </li><!-- end .cwp_preloaded_item --> <?php } wp_reset_postdata();
public function change_review_icon($tabid, $name, $description, $id, $class = '') { $html = "<div class='controls'>\n\t\t\t\t\t\t<div class='explain'>{$name}</div>\n\t\t\t\t\t\t<p class='field_description'>{$description}</p>"; $html .= "<li>"; if (cwppos('cwppos_show_poweredby') == 'yes' || function_exists('wppr_ci_custom_bar_icon')) { $html .= "<button id='cwp_select_bar_icon'>Select Bar Icon</button>"; $html .= "<input type='hidden' id='cwp_bar_icon_field' name='" . cwppos_config("menu_slug") . "[" . $id . "][]' value='"; if (isset($this->options[$id])) { if ($this->options[$id][0] == "#") { $html .= $this->options[$id]; } else { $html .= $this->options[$id][0]; } } $html .= "'/> <span class='current_bar_icon'>"; if (!empty($this->options[$id][0])) { //var_dump($this->options[$id][0]); if ($this->options[$id][0] === "#") { $code = $this->options[$id]; } else { $code = $this->options[$id][0]; } $html .= "<i class='fa fa-fw'>&" . $code . "</i> <a href='#' class='useDefault'>Use Default Styling</a>"; } else { $html .= "* Currently set to the default styling</span>"; } } else { $html .= '<span style="color:red;">' . __("You need the custom icon add-on in order to change this.", "cwppos") . "</span>"; } $html .= "</li>"; $html .= "</div>"; $this->tabs[$tabid]["elements"][] = array("type" => "change_icon", "html" => $html); }
/** * Function for saving the review custom meta boxes. */ function cwp_review_meta_boxes_save($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['cwp_meta_box_nonce']) && wp_verify_nonce($_POST['cwp_meta_box_nonce'], 'cwp_product_review_meta_box_nonce') ? 'true' : 'false'; if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } if (isset($_POST['cwp_rev_product_name'])) { update_post_meta($post_id, 'cwp_rev_product_name', sanitize_text_field($_POST['cwp_rev_product_name'])); } if (isset($_POST['cwp_rev_price'])) { update_post_meta($post_id, 'cwp_rev_price', sanitize_text_field($_POST['cwp_rev_price'])); } if (isset($_POST['cwp_meta_box_check'])) { update_post_meta($post_id, 'cwp_meta_box_check', sanitize_text_field($_POST['cwp_meta_box_check'])); } if (isset($_POST['cwp_image_link'])) { update_post_meta($post_id, 'cwp_image_link', sanitize_text_field($_POST['cwp_image_link'])); } if (isset($_POST['cwp_product_affiliate_text'])) { update_post_meta($post_id, 'cwp_product_affiliate_text', sanitize_text_field($_POST['cwp_product_affiliate_text'])); } if (isset($_POST['cwp_product_affiliate_link'])) { update_post_meta($post_id, 'cwp_product_affiliate_link', esc_url($_POST['cwp_product_affiliate_link'])); } if (isset($_POST['cwp_product_affiliate_text2'])) { update_post_meta($post_id, 'cwp_product_affiliate_text2', sanitize_text_field($_POST['cwp_product_affiliate_text2'])); } if (isset($_POST['cwp_product_affiliate_link2'])) { update_post_meta($post_id, 'cwp_product_affiliate_link2', esc_url($_POST['cwp_product_affiliate_link2'])); } if (!empty($_POST['cwp_bar_icon'])) { update_post_meta($post_id, 'cwp_bar_icon', esc_url($_POST['cwp_bar_icon'])); } else { update_post_meta($post_id, 'cwp_bar_icon', ""); } for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { if (isset($_POST['option_' . $i . '_content'])) { update_post_meta($post_id, 'option_' . $i . '_content', sanitize_text_field($_POST['option_' . $i . '_content'])); } if (isset($_POST['option_' . $i . '_grade'])) { update_post_meta($post_id, 'option_' . $i . '_grade', sanitize_text_field($_POST['option_' . $i . '_grade'])); } } if (isset($_POST['cwp_rev_product_image'])) { update_post_meta($post_id, 'cwp_rev_product_image', sanitize_text_field($_POST['cwp_rev_product_image'])); } elseif (cwppos("cwppos_show_poweredby") == 'yes' || class_exists('CWP_PR_PRO_Core')) { $image = ""; if (strlen($img = get_the_post_thumbnail($post_id, array(150, 150)))) { $image_array = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'optional-size'); $image = $image_array[0]; } else { $post = get_post($post_id); $image = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); //$image = $matches[1][0]; } update_post_meta($post_id, 'cwp_rev_product_image', $image); } for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { if (isset($_POST['cwp_option_' . $i . '_pro'])) { update_post_meta($post_id, 'cwp_option_' . $i . '_pro', sanitize_text_field($_POST['cwp_option_' . $i . '_pro'])); } if (isset($_POST['cwp_option_' . $i . '_cons'])) { update_post_meta($post_id, 'cwp_option_' . $i . '_cons', sanitize_text_field($_POST['cwp_option_' . $i . '_cons'])); } } $overall_score = ""; $iter = 0; for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { ${"option" . $i . "_grade"} = get_post_meta($post_id, "option_" . $i . "_grade", true); if (!empty(${"option" . $i . "_grade"}) || ${"option" . $i . "_grade"} === '0') { $overall_score += ${"option" . $i . "_grade"}; $iter++; } } if ($iter == 0) { $overall_score = 0; } else { $overall_score = $overall_score / $iter; } update_post_meta($post_id, 'option_overall_score', $overall_score / 10); }
function cwppos_dynamic_stylesheet() { $options = cwppos(); ?> <style type="text/css"> #review-statistics .review-wrap-up .cwpr-review-top { border-top: <?php echo $options['cwppos_reviewboxbd_width']; ?> px solid <?php echo $options['cwppos_reviewboxbd_color']; ?> ; } .user-comments-grades .comment-meta-grade-bar, #review-statistics .review-wu-bars ul li{ background: <?php echo $options['cwppos_rating_default']; ?> ; } #review-statistics .rev-option.customBarIcon ul li { color: <?php echo $options['cwppos_rating_default']; ?> ; } <?php if ($options['cwppos_widget_size'] != "") { ?> #review-statistics{ width:<?php echo $options['cwppos_widget_size']; ?> px!important; } <?php } ?> #review-statistics .review-wrap-up .review-wu-right ul li,#review-statistics .review-wu-bars h3, .review-wu-bars span,#review-statistics .review-wrap-up .cwpr-review-top .cwp-item-category a{ color: <?php echo $options['cwppos_font_color']; ?> ; } #review-statistics .review-wrap-up .review-wu-right .pros h2 { color: <?php echo $options['cwppos_pros_color']; ?> ; } #review-statistics .review-wrap-up .review-wu-right .cons h2{ color: <?php echo $options['cwppos_cons_color']; ?> ; } .affiliate-button a{ border: 2px solid <?php echo $options['cwppos_buttonbd_color']; ?> ; } .affiliate-button a:hover{ border: 2px solid <?php echo $options['cwppos_buttonbh_color']; ?> ; } .affiliate-button a{ background: <?php echo $options['cwppos_buttonbkd_color']; ?> ; } .affiliate-button a:hover{ background: <?php echo $options['cwppos_buttonbkh_color']; ?> ; } .affiliate-button a span{ color: <?php echo $options['cwppos_buttontxtd_color']; ?> ; } .affiliate-button a:hover span{ color: <?php echo $options['cwppos_buttontxth_color']; ?> ; } <?php if ($options['cwppos_show_icon'] == 'yes') { ?> .affiliate-button a span { background:url("<?php echo plugins_url('', __FILE__); ?> /images/cart-icon.png") no-repeat left center; } .affiliate-button a:hover span{ background:url("<?php echo plugins_url('', __FILE__); ?> /images/cart-icon-hover.png") no-repeat left center; } <?php } ?> </style> <script type="text/javascript"> var c1 = "<?php echo $options['cwppos_rating_weak']; ?> "; var c2 = "<?php echo $options['cwppos_rating_notbad']; ?> "; var c3 = "<?php echo $options['cwppos_rating_good']; ?> "; var c4 = "<?php echo $options['cwppos_rating_very_good']; ?> "; </script> <?php }
function cwppos_js_preloader() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ function cwpPreloadOptions(item) { for (var i = 1; i <= <?php echo cwppos("cwppos_option_nr"); ?> ; i++) { var preloadListItem = jQuery(item).parent().parent().children(".cwp_pitem_info").children(".cwp_pitem_options_content").children("li:eq("+(i-1)+")").text(); if(preloadListItem != "-") { jQuery("input#option_" + i + "_content").val(preloadListItem); } }; } function cwpPreloadCons(item) { for (var i = 1; i <= <?php echo cwppos("cwppos_option_nr"); ?> ; i++) { var preloadListItem = jQuery(item).parent().parent().children(".cwp_pitem_info").children(".cwp_pitem_options_pros").children("li:eq("+(i-1)+")").text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + i + "_pro").val(preloadListItem); } }; } function cwpPreloadPros(item) { for (var i = 1; i <= <?php echo cwppos("cwppos_option_nr"); ?> ; i++) { var preloadListItem = jQuery(item).parent().parent().children(".cwp_pitem_info").children(".cwp_pitem_options_cons").children("li:eq("+(i-1)+")").text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + i + "_cons").val(preloadListItem); } }; } jQuery(".preload_info").click(function(e){ e.preventDefault(); var cwpThemeUrl = '<?php echo plugins_url('', __FILE__); ?> '; var ajaxLoad = "<img class='ajax_load_icon' src='" + cwpThemeUrl +"/images/ajaxload.gif' alt='Loading...'/>"; jQuery("body #wpwrap").append("<div class='preload_result'><div class='preload_inner'><header><h2>Preload Info</h2><div class='preload_close'></div></header><div class='preloader_body'><ul class='preload_list'></ul></div></div></div>"); jQuery(".preload_result").fadeIn(); jQuery(".preload_close").bind("click", function(){ jQuery(".preload_result").fadeOut(); }); jQuery(".preload_list").html(ajaxLoad); jQuery.get(ajaxurl,{'action':'cwp_load_preloader'}, function(response){ jQuery(".preload_list").html(response); }) //jQuery(".preload_list").html(ajaxLoad).load(loadUrl); jQuery(".preload_list .cwp_p_title").live("click", function(){ jQuery(this).parent().parent().children(".cwp_pitem_info").slideToggle(); }); jQuery(".preload_list li button.preload").live("click", function(){ cwpPreloadOptions(this); cwpPreloadCons(this); cwpPreloadPros(this); jQuery(".preload_result").fadeOut(); }); jQuery(".preload_list .cwp_pitem_options_content li").live("click",function(){ var plIndex = jQuery(this).index(); var preloadListItem = jQuery(this).text(); if(preloadListItem != "-") { jQuery("input#option_" + plIndex + "_content").val(preloadListItem); } }); jQuery(".preload_list .cwp_pitem_options_pros li").live("click",function(){ var plIndex = jQuery(this).index(); var preloadListItem = jQuery(this).text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + plIndex + "_pro").val(preloadListItem); } }); jQuery(".preload_list .cwp_pitem_options_cons li").live("click",function(){ var plIndex = jQuery(this).index(); var preloadListItem = jQuery(this).text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + plIndex + "_cons").val(preloadListItem); } }); }); }); </script> <?php }
public function change_review_icon($tabid, $name, $description, $id, $class = '') { $html = "<div class='controls'>\r\n\t\t\t\t\t\t<div class='explain'>{$name}</div>\r\n\t\t\t\t\t\t<p class='field_description'>{$description}</p>"; $html .= "<li>"; if (cwppos('cwppos_show_poweredby') == 'yes' || function_exists('wppr_ci_custom_bar_icon')) { wp_enqueue_script("cwp-custom-bar-icon", WPPR_URL . "/admin/layout/js/custom-bar-icon.js", false, WPPR_LITE_VERSION, "all"); if (cwppos("cwppos_fontawesome") === 'no') { wp_enqueue_style("font-awesome-cdn", "//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"); } $html .= "<button id='cwp_select_bar_icon'>Select Bar Icon</button>"; $html .= "<input type='hidden' id='cwp_bar_icon_field' name='" . cwppos_config("menu_slug") . "[" . $id . "][]' value='"; if (isset($this->options[$id])) { if (@$this->options[$id][0] == "#") { $html .= $this->options[$id]; } else { $html .= @$this->options[$id][0]; } } $html .= "'/> <span class='current_bar_icon'>"; if (!empty($this->options[$id][0])) { //var_dump($this->options[$id][0]); if ($this->options[$id][0] === "#") { $code = $this->options[$id]; } else { $code = $this->options[$id][0]; } $html .= "<i class='fa fa-fw'>&" . $code . "</i> <a href='#' class='useDefault'>Use Default Styling</a>"; } else { $html .= "* Currently set to the default styling</span>"; } } else { $html .= '<span style="color:red;">' . __('You need the custom icon <a style="color:red;" href="http://themeisle.com/plugins/wppr-custom-icon/" target="_blank" >add-on</a> in order to change this.', "cwppos") . "</span>"; } $html .= "</li>"; $html .= "</div>"; $this->tabs[$tabid]["elements"][] = array("type" => "change_icon", "html" => $html); }
function cwpPreloadCons(item) { for (var i = 1; i <= <?php echo cwppos("cwppos_option_nr"); ?> ; i++) { var preloadListItem = jQuery(item).parent().parent().children(".cwp_pitem_info").children(".cwp_pitem_options_pros").children("li:eq("+(i-1)+")").text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + i + "_pro").val(preloadListItem); } }; } function cwpPreloadPros(item) { for (var i = 1; i <= <?php echo cwppos("cwppos_option_nr"); ?> ; i++) { var preloadListItem = jQuery(item).parent().parent().children(".cwp_pitem_info").children(".cwp_pitem_options_cons").children("li:eq("+(i-1)+")").text(); if(preloadListItem != "-") { jQuery("input#cwp_option_" + i + "_cons").val(preloadListItem); } }; } jQuery(".preload_info").click(function(e){ e.preventDefault(); var cwpThemeUrl = '<?php echo plugins_url('', __FILE__); ?> '; var ajaxLoad = "<img class='ajax_load_icon' src='" + cwpThemeUrl +"/images/ajaxload.gif' alt='Loading...'/>"; var loadUrl = cwpThemeUrl + "/review-preloader.php";
function cwppos_dynamic_stylesheet() { $options = cwppos(); //Get theme content width or plugin setting content width global $content_width; $c_width = 700; if ($options['cwppos_widget_size'] != "") { $c_width = $options['cwppos_widget_size']; } else { $c_width = $content_width; } if ($c_width < 200) { $c_width = 600; } $f_img_size = min(180, $c_width * 0.51 * 0.4); $h_tleft = $f_img_size + 10; $chart_size = 0.8 * $f_img_size; ?> <style type="text/css"> @media (min-width: 820px) { #review-statistics .review-wrap-up .review-wu-left .rev-wu-image, #review-statistics .review-wrap-up .review-wu-left .review-wu-grade { height:<?php echo $h_tleft; ?> px;} #review-statistics .review-wrap-up .review-wu-left .review-wu-grade .cwp-review-chart .cwp-review-percentage { margin-top: <?php echo $f_img_size * 0.1; ?> %; } #review-statistics .review-wrap-up .review-wu-left .review-wu-grade .cwp-review-chart span { font-size: <?php echo round(30 * $f_img_size / 140); ?> px; } <?php if ($options['cwppos_widget_size'] != "") { ?> #review-statistics{ width:<?php echo $options['cwppos_widget_size']; ?> px; } <?php } ?> } #review-statistics .review-wrap-up div.cwpr-review-top { border-top: <?php echo $options['cwppos_reviewboxbd_width']; ?> px solid <?php echo $options['cwppos_reviewboxbd_color']; ?> ; } .user-comments-grades .comment-meta-grade-bar, #review-statistics .review-wu-bars ul li{ background: <?php echo $options['cwppos_rating_default']; ?> ; } #review-statistics .rev-option.customBarIcon ul li { color: <?php echo $options['cwppos_rating_default']; ?> ; } #review-statistics .review-wrap-up .review-wu-right ul li,#review-statistics .review-wu-bars h3, .review-wu-bars span,#review-statistics .review-wrap-up .cwpr-review-top .cwp-item-category a{ color: <?php echo $options['cwppos_font_color']; ?> ; } #review-statistics .review-wrap-up .review-wu-right .pros h2 { color: <?php echo $options['cwppos_pros_color']; ?> ; } #review-statistics .review-wrap-up .review-wu-right .cons h2{ color: <?php echo $options['cwppos_cons_color']; ?> ; } div.affiliate-button a{ border: 2px solid <?php echo $options['cwppos_buttonbd_color']; ?> ; } div.affiliate-button a:hover{ border: 2px solid <?php echo $options['cwppos_buttonbh_color']; ?> ; } div.affiliate-button a{ background: <?php echo $options['cwppos_buttonbkd_color']; ?> ; } div.affiliate-button a:hover{ background: <?php echo $options['cwppos_buttonbkh_color']; ?> ; } div.affiliate-button a span{ color: <?php echo $options['cwppos_buttontxtd_color']; ?> ; } div.affiliate-button a:hover span{ color: <?php echo $options['cwppos_buttontxth_color']; ?> ; } <?php if ($options['cwppos_show_icon'] == 'yes') { ?> div.affiliate-button a span { background:url("<?php echo WPPR_URL; ?> /images/cart-icon.png") no-repeat left center; } div.affiliate-button a:hover span{ background:url("<?php echo WPPR_URL; ?> /images/cart-icon-hover.png") no-repeat left center; } <?php } ?> <?php if ($options['cwppos_show_userreview'] == 'yes') { ?> .commentlist .comment-body p { clear:left; } <?php } ?> </style> <script type="text/javascript"> var c1 = "<?php echo $options['cwppos_rating_weak']; ?> "; var c2 = "<?php echo $options['cwppos_rating_notbad']; ?> "; var c3 = "<?php echo $options['cwppos_rating_good']; ?> "; var c4 = "<?php echo $options['cwppos_rating_very_good']; ?> "; </script> <?php }