Changeset 770831
- Timestamp:
- 09/12/2013 08:40:43 AM (12 years ago)
- Location:
- indianic-testimonial/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
indianic-testimonial/trunk/add.php
r567750 r770831 4 4 $_result = $_result[0]; 5 5 6 $id = $_result->id;7 $project_name = $_result->project_name;8 $project_url = $_result->project_url;9 $client_name = $_result->client_name;10 $city = $_result->city;11 $state = $_result->state;12 $country = $_result->country;13 $description = $_result->description;14 $tags = $_result->tags;15 $video_url = $_result->video_url;16 $thumb_img_url = $_result->thumb_img_url;17 $large_img_url = $_result->large_img_url;18 $is_featured = $_result->is_featured;6 $id = esc_attr($_result->id); 7 $project_name = esc_attr($_result->project_name); 8 $project_url = esc_attr($_result->project_url); 9 $client_name = esc_attr($_result->client_name); 10 $city = esc_attr($_result->city); 11 $state = esc_attr($_result->state); 12 $country = esc_attr($_result->country); 13 $description = esc_attr($_result->description); 14 $tags = esc_attr($_result->tags); 15 $video_url = esc_attr($_result->video_url); 16 $thumb_img_url = esc_attr($_result->thumb_img_url); 17 $large_img_url = esc_attr($_result->large_img_url); 18 $is_featured = esc_attr($_result->is_featured); 19 19 } 20 20 ?> … … 26 26 <div id="message" class="below-h2"></div> 27 27 <form name="testimonial_add" method="post" action="" enctype="multipart/form-data"> 28 <?php wp_nonce_field('save_testimonial','_nonce'); ?> 28 29 <input type="hidden" name="action" value="iNIC_testimonial_save" /> 29 30 <?php 30 31 if (isset($_REQUEST['id']) && $_REQUEST['id']) { 31 echo '<input type="hidden" name="id" value="' . $_REQUEST['id']. '" />';32 echo '<input type="hidden" name="id" value="' . esc_attr($_REQUEST['id']) . '" />'; 32 33 } 33 34 ?> -
indianic-testimonial/trunk/listing_template.php
r563885 r770831 58 58 59 59 <form name="testimonial_listing_template" method="post" action=""> 60 <?php wp_nonce_field('save_testimonial_listing_template','_nonce'); ?> 60 61 <input type="hidden" name="action" value="iNIC_testimonial_save_listing_template" /> 61 62 … … 71 72 <tr> 72 73 <th><label for="title">Title</label></th> 73 <td><input name="title" type="text" id="title" value="<?php echo $title; ?>" class="regular-text"></td>74 <td><input name="title" type="text" id="title" value="<?php echo esc_attr($title); ?>" class="regular-text"></td> 74 75 </tr> 75 76 … … 77 78 <tr> 78 79 <th><label for="no_of_testimonial">No. of Testimonials</label></th> 79 <td><input name="no_of_testimonial" type="text" id="no_of_testimonial" value="<?php echo $no_of_testimonial; ?>" class="small-text"></td>80 <td><input name="no_of_testimonial" type="text" id="no_of_testimonial" value="<?php echo esc_attr($no_of_testimonial); ?>" class="small-text"></td> 80 81 </tr> 81 82 82 83 <tr> 83 84 <th><label for="list_per_page">Listing Testimonials Per Page</label></th> 84 <td><input name="list_per_page" type="text" id="list_per_page" value="<?php echo $list_per_page; ?>" class="small-text"></td>85 <td><input name="list_per_page" type="text" id="list_per_page" value="<?php echo esc_attr($list_per_page); ?>" class="small-text"></td> 85 86 </tr> 86 87 … … 94 95 foreach ($_table_field as $_table_field) { 95 96 $_is_selected = $_ord_by[0] == $_table_field->Field ? ' selected="selected"' : ''; 96 echo "<option value=\" {$_table_field->Field}\"{$_is_selected}>{$_table_field->Field}</option>";97 echo "<option value=\"". esc_attr($_table_field->Field)."\"{$_is_selected}>{$_table_field->Field}</option>"; 97 98 } 98 99 ?> … … 107 108 <tr> 108 109 <th><label for="filter_by_country">Filter by Country</label></th> 109 <td><input name="filter_by_country" type="text" id="filter_by_country" value="<?php echo $filter_by_country; ?>" class="regular-text"> Comma Separated. <code>country1,country2,country3</code></td>110 <td><input name="filter_by_country" type="text" id="filter_by_country" value="<?php echo esc_attr($filter_by_country); ?>" class="regular-text"> Comma Separated. <code>country1,country2,country3</code></td> 110 111 </tr> 111 112 112 113 <tr> 113 114 <th><label for="filter_by_tags">Filter by Tags</label></th> 114 <td><input name="filter_by_tags" type="text" id="filter_by_tags" value="<?php echo $filter_by_tags; ?>" class="regular-text"> Comma Separated. <code>tag1,tag2,tag3</code></td>115 <td><input name="filter_by_tags" type="text" id="filter_by_tags" value="<?php echo esc_attr($filter_by_tags); ?>" class="regular-text"> Comma Separated. <code>tag1,tag2,tag3</code></td> 115 116 </tr> 116 117 117 118 <tr> 118 119 <th><label for="custom_query">Custom SQL Where condition</label></th> 119 <td><input name="custom_query" type="text" id="custom_query" value="<?php echo $custom_query; ?>" class="regular-text">LIKE <code>feature='1' AND city != ''</code></td>120 <td><input name="custom_query" type="text" id="custom_query" value="<?php echo esc_attr($custom_query); ?>" class="regular-text">LIKE <code>feature='1' AND city != ''</code></td> 120 121 </tr> 121 122 … … 133 134 <tr class="hidewhennotfeatured"> 134 135 <th><label for="no_of_featured">No. of Featured</label></th> 135 <td><input name="no_of_featured" type="text" id="no_of_featured" value="<?php echo $no_of_featured ? $no_of_featured: 1; ?>" class="small-text"></td>136 <td><input name="no_of_featured" type="text" id="no_of_featured" value="<?php echo $no_of_featured ? esc_attr($no_of_featured) : 1; ?>" class="small-text"></td> 136 137 </tr> 137 138 138 139 <tr class="hidewhennotfeatured"> 139 140 <th><label for="featured_template">Featured HTML Template</label></th> 140 <td><?php wp_editor( stripslashes($featured_template), 'featured_template', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td>141 <td><?php wp_editor(esc_attr(stripslashes($featured_template)), 'featured_template', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td> 141 142 </tr> 142 143 143 144 <tr> 144 145 <th><label for="listing_template_odd">Listing HTML Template (Odd)</label></th> 145 <td><?php wp_editor( stripslashes($listing_template_odd), 'listing_template_odd', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td>146 <td><?php wp_editor(esc_attr(stripslashes($listing_template_odd)), 'listing_template_odd', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td> 146 147 </tr> 147 148 148 149 <tr> 149 150 <th><label for="listing_template_even">Listing HTML Template (Even)</label></th> 150 <td><?php wp_editor( stripslashes($listing_template_even), 'listing_template_even', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td>151 <td><?php wp_editor(esc_attr(stripslashes($listing_template_even)), 'listing_template_even', array('media_buttons' => false, 'textarea_rows' => 10, 'tinymce' => false)); ?></td> 151 152 </tr> 152 153 … … 225 226 echo "<tr> 226 227 <td> 227 {$_results->title}<br /><i>[iNICtestimonial tpl={$_results->id}]</i>228 ". esc_html($_results->title)."<br /><i>[iNICtestimonial tpl=". esc_html($_results->id)."]</i> 228 229 <div class=\"row-actions\"> 229 <span class=\"edit\"><a href=\"admin.php?page=inic_testimonial_listing_template&type=add&id= {$_results->id}\" title=\"Edit this item\">Edit</a> | </span>230 <span class=\"trash\"><a class=\"submitdelete\" title=\"Delete this item\" href=\"javascript:void(0)\" rel=\" {$_results->id}\">Delete</a></span>230 <span class=\"edit\"><a href=\"admin.php?page=inic_testimonial_listing_template&type=add&id=". esc_attr($_results->id)."\" title=\"Edit this item\">Edit</a> | </span> 231 <span class=\"trash\"><a class=\"submitdelete\" title=\"Delete this item\" href=\"javascript:void(0)\" rel=\"". esc_attr($_results->id)."\">Delete</a></span> 231 232 </div> 232 233 </td> 233 <td> {$_results->no_of_testimonial}</td>234 <td> {$_results->list_per_page}</td>235 <td> {$_results->ord_by}</td>236 <td> {$_filter_by}</td>237 <td> {$_results->show_featured_at}{$_no_of_featured}</td>234 <td>". esc_html($_results->no_of_testimonial)."</td> 235 <td>". esc_html($_results->list_per_page)."</td> 236 <td>". esc_html($_results->ord_by)."</td> 237 <td>". esc_html($_filter_by)."</td> 238 <td>". esc_html($_results->show_featured_at)." ". esc_html($_no_of_featured)."</td> 238 239 </tr>"; 239 240 } -
indianic-testimonial/trunk/settings.php
r567750 r770831 38 38 39 39 <form name="testimonial_setting" method="post" action=""> 40 <?php wp_nonce_field('save_testimonial_options','_nonce'); ?> 41 40 42 <input type="hidden" name="action" value="iNIC_testimonial_save_setting" /> 41 43 <table class="form-table"> … … 53 55 <tr> 54 56 <th><label for="inic_testimonial_admin_list_per_page">Admin pages show at most</label></th> 55 <td><input name="inic_testimonial_admin_list_per_page" type="text" id="inic_testimonial_admin_list_per_page" value="<?php echo get_option("inic_testimonial_admin_list_per_page"); ?>" class="small-text"> Testimonials</td>57 <td><input name="inic_testimonial_admin_list_per_page" type="text" id="inic_testimonial_admin_list_per_page" value="<?php echo esc_attr(get_option("inic_testimonial_admin_list_per_page")); ?>" class="small-text"> Testimonials</td> 56 58 </tr> 57 59 … … 65 67 foreach($_table_field as $_table_field) { 66 68 $_is_selected = $_ord_by[0] == $_table_field->Field ? ' selected="selected"' : ''; 67 echo "<option value=\" {$_table_field->Field}\"{$_is_selected}>{$_table_field->Field}</option>";69 echo "<option value=\"". esc_attr($_table_field->Field)."\"{$_is_selected}>". esc_attr($_table_field->Field)."</option>"; 68 70 } 69 71 ?> -
indianic-testimonial/trunk/testimonial.php
r770202 r770831 49 49 50 50 $_search = array("{#ID}", "{#ProjectName}", "{#ProjectUrl}", "{#ClientName}", "{#City}", "{#State}", "{#Country}", "{#Description}", "{#Tags}", "{#VideoUrl}", "{#ThumbImgUrl}", "{#LargeImgUrl}", "{#Counter}"); 51 $_replace = array( $_data->id, $_data->project_name, $_data->project_url, $_data->client_name, $_data->city, $_data->state, $_data->country, $_data->description, $_data->tags, $_data->video_url, $_data->thumb_img_url, $_data->large_img_url, $_data->counter);52 $_code_value = array("{#ID}" => $_data->id, "{#ProjectName}" => $_data->project_name, "{#ProjectUrl}" => $_data->project_url, "{#ClientName}" => $_data->client_name, "{#City}" => $_data->city, "{#State}" => $_data->state, "{#Country}" => $_data->country, "{#Description}" => $_data->description, "{#Tags}" => $_data->tags, "{#VideoUrl}" => $_data->video_url, "{#ThumbImgUrl}" => $_data->thumb_img_url, "{#LargeImgUrl}" => $_data->large_img_url, "{#Counter}" => $_data->counter);51 $_replace = array(esc_html($_data->id), esc_html($_data->project_name), esc_html($_data->project_url), esc_html($_data->client_name), esc_html($_data->city), esc_html($_data->state), esc_html($_data->country), esc_html($_data->description), esc_html($_data->tags), esc_html($_data->video_url), esc_html($_data->thumb_img_url), esc_html($_data->large_img_url), esc_html($_data->counter)); 52 $_code_value = array("{#ID}" => esc_html($_data->id), "{#ProjectName}" => esc_html($_data->project_name), "{#ProjectUrl}" => esc_html($_data->project_url), "{#ClientName}" => esc_html($_data->client_name), "{#City}" => esc_html($_data->city), "{#State}" => esc_html($_data->state), "{#Country}" => esc_html($_data->country), "{#Description}" => esc_html($_data->description), "{#Tags}" => esc_html($_data->tags), "{#VideoUrl}" => esc_html($_data->video_url), "{#ThumbImgUrl}" => esc_html($_data->thumb_img_url), "{#LargeImgUrl}" => esc_html($_data->large_img_url), "{#Counter}" => esc_html($_data->counter)); 53 53 54 54 preg_match('#\[IF\s(.+?)](.+?)\[/IF]#s', $_tpl_data, $matches_if); … … 136 136 $_testimonial_result = isset($_array_chunk[$_current_page - 1]) && $_array_chunk[$_current_page - 1] ? $_array_chunk[$_current_page - 1] : $_array_chunk[0]; 137 137 $_pagination = ""; 138 138 139 139 if ($_total_pages > 1) { 140 140 $_pagination .= "<div class='testimonial_pagination'>"; 141 142 if ($_current_page > 1) {143 $_pagination .= "<a href=\"?" .build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => 1)))."\" title=\"Go to the first page\" class=\"first-page\">«</a> ";144 $_pagination .= "<a href=\"?" .build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => ($_current_page - 1))))."\" title=\"Go to the previous page\" class=\"prev-page\">‹</a> ";141 142 if ($_current_page > 1) { 143 $_pagination .= "<a href=\"?" . build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => 1))) . "\" title=\"Go to the first page\" class=\"first-page\">«</a> "; 144 $_pagination .= "<a href=\"?" . build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => ($_current_page - 1)))) . "\" title=\"Go to the previous page\" class=\"prev-page\">‹</a> "; 145 145 } 146 146 147 147 for ($i = 1; $i <= $_total_pages; ++$i) { 148 148 $_url_prefix = build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => $i))); … … 150 150 $_pagination .= "<a href=\"?{$_url_prefix}\"{$_is_active}>{$i}</a> "; 151 151 } 152 153 if ($_current_page < $_total_pages) {154 $_pagination .= "<a href=\"?" .build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => ($_current_page + 1))))."\" title=\"Go to the next page\" class=\"next-page\">›</a> ";155 $_pagination .= "<a href=\"?" .build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => $_total_pages)))."\" title=\"Go to the last page\" class=\"last-page\">»</a> ";152 153 if ($_current_page < $_total_pages) { 154 $_pagination .= "<a href=\"?" . build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => ($_current_page + 1)))) . "\" title=\"Go to the next page\" class=\"next-page\">›</a> "; 155 $_pagination .= "<a href=\"?" . build_query(array_merge($_REQUEST, array($this->blog_page_pagination_key => $_total_pages))) . "\" title=\"Go to the last page\" class=\"last-page\">»</a> "; 156 156 } 157 157 158 158 $_pagination .= "</div>"; 159 159 } 160 161 160 } 162 161 … … 196 195 public function iNIC_testimonial_save() { 197 196 197 if (!wp_verify_nonce($_POST['_nonce'], 'save_testimonial')) { 198 echo json_encode(array('error' => "Sorry, your nonce did not verify.")); 199 die(); 200 } 201 198 202 $_search = array("http://", "https://"); 199 203 $_replace = array("", ""); 200 204 201 205 $_data = array( 202 "project_name" => $_POST['project_name'],203 "project_url" => $_POST['project_url'],204 "client_name" => $_POST['client_name'],205 "city" => $_POST['client_city'],206 "state" => $_POST['client_state'],207 "country" => $_POST['client_country'],208 "description" => $_POST['description'],209 "tags" => $_POST['tags'],210 "video_url" => $_POST['video_url'],211 "thumb_img_url" => str_replace($_SERVER['HTTP_HOST'], "", str_replace($_search, $_replace, $_POST['thumb_img'])),212 "large_img_url" => str_replace($_SERVER['HTTP_HOST'], "", str_replace($_search, $_replace, $_POST['large_img'])),213 "is_featured" => $_POST['is_featured']206 "project_name" => esc_html($this->clean_text($_POST['project_name'])), 207 "project_url" => esc_html($this->clean_text($_POST['project_url'])), 208 "client_name" => esc_html($this->clean_text($_POST['client_name'])), 209 "city" => esc_html($this->clean_text($_POST['client_city'])), 210 "state" => esc_html($this->clean_text($_POST['client_state'])), 211 "country" => esc_html($this->clean_text($_POST['client_country'])), 212 "description" => esc_html($this->clean_text($_POST['description'])), 213 "tags" => esc_html($this->clean_text($_POST['tags'])), 214 "video_url" => esc_html($this->clean_text($_POST['video_url'])), 215 "thumb_img_url" => str_replace($_SERVER['HTTP_HOST'], "", str_replace($_search, $_replace, esc_html($this->clean_text($_POST['thumb_img'])))), 216 "large_img_url" => str_replace($_SERVER['HTTP_HOST'], "", str_replace($_search, $_replace, esc_html($this->clean_text($_POST['large_img'])))), 217 "is_featured" => esc_html($this->clean_text($_POST['is_featured'])) 214 218 ); 215 219 … … 237 241 if ($_POST['action'] == 'iNIC_testimonial_save_listing_template') { 238 242 243 if (!wp_verify_nonce($_POST['_nonce'], 'save_testimonial_listing_template')) { 244 echo json_encode(array('error' => "Sorry, your nonce did not verify.")); 245 die(); 246 } 247 239 248 if ($_POST['title'] && $_POST['listing_template_odd']) { 240 249 $_POST['ord_by'] = "{$_POST['ord_by']} {$_POST['ord_type']}"; 241 250 $_POST['no_of_featured'] = $_POST['no_of_featured'] ? $_POST['no_of_featured'] : "1"; 242 $_POST['filter_by_country'] = $_POST['filter_by_country'] ? str_replace(", ", ",", $ _POST['filter_by_country']) : "";251 $_POST['filter_by_country'] = $_POST['filter_by_country'] ? str_replace(", ", ",", $this->clean_text($_POST['filter_by_country'])) : ""; 243 252 $_POST['filter_by_tags'] = str_replace(", ", ",", $_POST['filter_by_tags']); 244 $_POST['custom_query'] = $_POST['custom_query'] ? str_replace("WHERE ", "", stripslashes($ _POST['custom_query'])) : "";245 $_POST['featured_template'] = stripslashes($_POST['featured_template']);246 $_POST['listing_template_odd'] = stripslashes($_POST['listing_template_odd']);247 $_POST['listing_template_even'] = stripslashes($_POST['listing_template_even']);253 $_POST['custom_query'] = $_POST['custom_query'] ? str_replace("WHERE ", "", stripslashes($this->clean_text($_POST['custom_query']))) : ""; 254 $_POST['featured_template'] = $this->clean_text(stripslashes($_POST['featured_template'])); 255 $_POST['listing_template_odd'] = $this->clean_text(stripslashes($_POST['listing_template_odd'])); 256 $_POST['listing_template_even'] = $this->clean_text(stripslashes($_POST['listing_template_even'])); 248 257 249 258 unset($_POST['action'], $_POST['ord_type']); … … 304 313 if ($_POST['action'] == "iNIC_testimonial_save_widget") { 305 314 315 if (!wp_verify_nonce($_POST['_nonce'], 'save_testimonial_widget_template')) { 316 echo json_encode(array('error' => "Sorry, your nonce did not verify.")); 317 die(); 318 } 319 306 320 if ($_POST['widget_title']) { 307 321 $_POST['no_of_testimonials'] = $_POST['no_of_testimonials'] && is_numeric($_POST['no_of_testimonials']) ? $_POST['no_of_testimonials'] : ""; … … 311 325 312 326 $_data = array( 313 "title" => $_POST['widget_title'],314 "no_of_testimonial" => $ _POST['no_of_testimonials'],315 "only_featured" => $ _POST['list_only_featured_testimonials'],316 "filter_by_country" => $ _POST['filter_by_country'],317 "filter_by_tags" => $ _POST['filter_by_tags'],318 "display_randomly" => $ _POST['display_randomly'],319 "html_template" => $ _POST['widget_template'],327 "title" => esc_html($this->clean_text($_POST['widget_title'])), 328 "no_of_testimonial" => $this->clean_text($_POST['no_of_testimonials']), 329 "only_featured" => $this->clean_text($_POST['list_only_featured_testimonials']), 330 "filter_by_country" => $this->clean_text($_POST['filter_by_country']), 331 "filter_by_tags" => $this->clean_text($_POST['filter_by_tags']), 332 "display_randomly" => $this->clean_text($_POST['display_randomly']), 333 "html_template" => $this->clean_text($_POST['widget_template']), 320 334 ); 321 335 322 336 if (isset($_POST['id']) && $_POST['id']) { 323 337 $this->wpdb->update("{$this->wpdb->prefix}inic_testimonial_widget", $_data, array('id' => $_POST['id'])); … … 342 356 343 357 public function iNIC_testimonial_save_setting() { 358 359 if (!wp_verify_nonce($_POST['_nonce'], 'save_testimonial_options')) { 360 echo json_encode(array('error' => "Sorry, your nonce did not verify.")); 361 die(); 362 } 363 344 364 $_POST['inic_testimonial_admin_list_per_page'] = (is_numeric($_POST['inic_testimonial_admin_list_per_page']) && $_POST['inic_testimonial_admin_list_per_page'] > 0) ? $_POST['inic_testimonial_admin_list_per_page'] : "10"; 345 update_option('inic_testimonial_admin_list_per_page', $_POST['inic_testimonial_admin_list_per_page']);346 update_option('inic_testimonial_html_template', $ _POST['inic_testimonial_html_template']);365 update_option('inic_testimonial_admin_list_per_page', is_numeric($_POST['inic_testimonial_admin_list_per_page']) ? $_POST['inic_testimonial_admin_list_per_page'] : 15); 366 update_option('inic_testimonial_html_template', $this->clean_text($_POST['inic_testimonial_html_template'])); 347 367 update_option("inic_testimonial_list_ord_by", "{$_POST['ord_by']} {$_POST['ord_type']}"); 348 368 $_data['msg'] = "IndiaNIC Testimonial Setting has been saved successfully."; … … 358 378 add_submenu_page("inic_testimonial_view", "Widget Template", "Widget Template", 'administrator', "inic_testimonial_widget_template", array($this, 'inic_testimonial_widget_template')); 359 379 add_submenu_page("inic_testimonial_view", "Settings", "Settings", 'administrator', "inic_testimonial_settings", array($this, 'testimonial_settings')); 360 380 361 381 require_once "{$this->pluginPath}/listing_data_table.php"; 362 382 $this->tbl = new listing_data_table(); … … 450 470 } 451 471 472 public function clean_text($script_str) { 473 $script_str = htmlspecialchars_decode($script_str); 474 $search_arr = array('<script', '</script>'); 475 $script_str = str_ireplace($search_arr, $search_arr, $script_str); 476 $split_arr = explode('<script', $script_str); 477 $remove_jscode_arr = array(); 478 479 foreach ($split_arr as $key => $val) { 480 $newarr = explode('</script>', $split_arr[$key]); 481 $remove_jscode_arr[] = ($key == 0) ? $newarr[0] : $newarr[1]; 482 } 483 484 return implode('', $remove_jscode_arr); 485 } 486 452 487 } 453 488 -
indianic-testimonial/trunk/view.php
r766128 r770831 2 2 3 3 if (isset($_GET['id']) && $_GET['id'] && isset($_GET['action']) && $_GET['action'] == 'delete') { 4 $this->wpdb-> query("DELETE FROM {$this->wpdb->prefix}inic_testimonial WHERE id={$_GET['id']}");4 $this->wpdb->delete("{$this->wpdb->prefix}inic_testimonial", array('id' => $_GET['id'])); 5 5 if ($this->wpdb->rows_affected) { 6 6 $_data['updated'] = "The testimonial has been deleted successfully."; … … 8 8 } 9 9 10 $_ord_by = get_option("inic_testimonial_list_ord_by") ? " ORDER BY " . get_option("inic_testimonial_list_ord_by") : "";11 $_result_per_page = get_option("inic_testimonial_admin_list_per_page");10 $_ord_by = get_option("inic_testimonial_list_ord_by") ? " ORDER BY " . esc_html(get_option("inic_testimonial_list_ord_by")) : ""; 11 $_result_per_page = esc_attr(get_option("inic_testimonial_admin_list_per_page")); 12 12 ?> 13 13 … … 19 19 if(isset($_data) && is_array($_data)) { 20 20 foreach($_data as $_message_type => $_message) { 21 echo '<div id="message" class="'. $_message_type.' below-h2"><p>'.$_message.'</p></div>';21 echo '<div id="message" class="'. esc_attr($_message_type).' below-h2"><p>'.$_message.'</p></div>'; 22 22 } 23 23 } … … 36 36 $this->tbl->display_col_function(function($item, $column_name) { 37 37 $item['is_featured'] = $item['is_featured'] ? "<br /><code style=\"color:#C00;\"> Featured </code>" : ""; 38 return "<a href=\" {$item['project_url']}\" target=\"blank\">{$item['project_name']}</a><br /><i>[ {$item['tags']}]{$item['is_featured']}</i>";38 return "<a href=\"". esc_attr($item['project_url'])."\" target=\"blank\">". esc_html($item['project_name'])."</a><br /><i>[ ". esc_html($item['tags'])." ]{$item['is_featured']}</i>"; 39 39 }); 40 40 41 41 $this->tbl->add_col('client_name', "Client Name", true); 42 42 $this->tbl->display_col_function(function($item, $column_name) { 43 $item['city'] = $item['city'] ? "<br /><i>[ City: {$item['city']}]</i>" : "";44 $item['state'] = $item['state'] ? "<br /><i>[ State: {$item['state']}]</i>" : "";45 $item['country'] = $item['country'] ? "<br /><i>[ Country: {$item['country']}]</i>" : "";46 return "{$item['client_name']}{$item['city']}{$item['state']}{$item['country']}";43 $item['city'] = $item['city'] ? "<br /><i>[ City: ". esc_html($item['city'])." ]</i>" : ""; 44 $item['state'] = $item['state'] ? "<br /><i>[ State: ". esc_html($item['state'])." ]</i>" : ""; 45 $item['country'] = $item['country'] ? "<br /><i>[ Country: ". esc_html($item['country'])." ]</i>" : ""; 46 return esc_html($item['client_name']) . "{$item['city']}{$item['state']}{$item['country']}"; 47 47 }); 48 48 … … 56 56 $this->tbl->add_col('thumb_img_url', "Thumb Image"); 57 57 $this->tbl->display_col_function(function($item, $column_name) { 58 return $item['thumb_img_url'] ? "<a href=\" {$item['large_img_url']}\" target=\"_blank\"><img src=\"{$item['thumb_img_url']}\" width=\"100\" height=\"100\" /></a>" : "";58 return $item['thumb_img_url'] ? "<a href=\"". esc_attr($item['large_img_url'])."\" target=\"_blank\"><img src=\"". esc_attr($item['thumb_img_url'])."\" width=\"100\" height=\"100\" /></a>" : ""; 59 59 }); 60 60 -
indianic-testimonial/trunk/widget.php
r567259 r770831 24 24 <p> 25 25 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 26 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />26 <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" /> 27 27 </p> 28 28 29 29 <p> 30 <label for="<?php echo $this->get_field_id('widget_template_id'); ?>"><?php _e('Select Widget Template:'); ?></label>31 <select class="widefat" id="<?php echo $this->get_field_id('widget_template_id'); ?>" name="<?php echo $this->get_field_name('widget_template_id'); ?>">30 <label for="<?php echo esc_attr($this->get_field_id('widget_template_id')); ?>"><?php _e('Select Widget Template:'); ?></label> 31 <select class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_template_id')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_template_id')); ?>"> 32 32 <?php 33 33 $available_widget_tpl = $this->wpdb->get_results("SELECT * FROM {$this->wpdb->prefix}inic_testimonial_widget"); … … 35 35 foreach ($available_widget_tpl as $available_widget_tpl) { 36 36 $_selected = $widget_template_id == $available_widget_tpl->id ? ' selected="selected"' : ''; 37 echo "<option value=\" {$available_widget_tpl->id}\"{$_selected}>{$available_widget_tpl->title}</option>";37 echo "<option value=\"". esc_attr($available_widget_tpl->id)."\"{$_selected}>". esc_html($available_widget_tpl->title)."</option>"; 38 38 } 39 39 } else { … … 98 98 } 99 99 100 //echo "SELECT * FROM {$this->wpdb->prefix}inic_testimonial{$_where}{$no_of_testimonial}";101 100 $_testimonial_listing = $this->wpdb->get_results("SELECT * FROM {$this->wpdb->prefix}inic_testimonial{$_where}{$display_randomly}{$no_of_testimonial}"); 102 101 if ($_testimonial_listing) { 103 102 foreach ($_testimonial_listing as $_testimonial_listing) { 104 103 $_search = array("{#ID}", "{#ProjectName}", "{#ProjectUrl}", "{#ClientName}", "{#City}", "{#State}", "{#Country}", "{#Description}", "{#Tags}", "{#VideoUrl}", "{#ThumbImgUrl}", "{#LargeImgUrl}", "{#Counter}"); 105 $_replace = array( $_testimonial_listing->id, $_testimonial_listing->project_name, $_testimonial_listing->project_url, $_testimonial_listing->client_name, $_testimonial_listing->city, $_testimonial_listing->state, $_testimonial_listing->country, $_testimonial_listing->description, $_testimonial_listing->tags, $_testimonial_listing->video_url, $_testimonial_listing->thumb_img_url, $_testimonial_listing->large_img_url, $i);104 $_replace = array(esc_html($_testimonial_listing->id), esc_html($_testimonial_listing->project_name), esc_html($_testimonial_listing->project_url), esc_html($_testimonial_listing->client_name), esc_html($_testimonial_listing->city), esc_html($_testimonial_listing->state), esc_html($_testimonial_listing->country), esc_html($_testimonial_listing->description), esc_html($_testimonial_listing->tags), esc_html($_testimonial_listing->video_url), esc_html($_testimonial_listing->thumb_img_url), esc_html($_testimonial_listing->large_img_url), $i); 106 105 107 $_code_value = array("{#ID}" => $_testimonial_listing->id, "{#ProjectName}" => $_testimonial_listing->project_name, "{#ProjectUrl}" => $_testimonial_listing->project_url, "{#ClientName}" => $_testimonial_listing->client_name, "{#City}" => $_testimonial_listing->city, "{#State}" => $_testimonial_listing->state, "{#Country}" => $_testimonial_listing->country, "{#Description}" => $_testimonial_listing->description, "{#Tags}" => $_testimonial_listing->tags, "{#VideoUrl}" => $_testimonial_listing->video_url, "{#ThumbImgUrl}" => $_testimonial_listing->thumb_img_url, "{#LargeImgUrl}" => $_testimonial_listing->large_img_url, "{#Counter}" => $i);106 $_code_value = array("{#ID}" => esc_html($_testimonial_listing->id), "{#ProjectName}" => esc_html($_testimonial_listing->project_name), "{#ProjectUrl}" => esc_html($_testimonial_listing->project_url), "{#ClientName}" => esc_html($_testimonial_listing->client_name), "{#City}" => esc_html($_testimonial_listing->city), "{#State}" => esc_html($_testimonial_listing->state), "{#Country}" => esc_html($_testimonial_listing->country), "{#Description}" => esc_html($_testimonial_listing->description), "{#Tags}" => esc_html($_testimonial_listing->tags), "{#VideoUrl}" => esc_html($_testimonial_listing->video_url), "{#ThumbImgUrl}" => esc_html($_testimonial_listing->thumb_img_url), "{#LargeImgUrl}" => esc_html($_testimonial_listing->large_img_url), "{#Counter}" => $i); 108 107 $inic_testimonial_html_template = $html_template; 109 108 preg_match('#\[IF\s(.+?)](.+?)\[/IF]#s', $inic_testimonial_html_template, $matches_if); -
indianic-testimonial/trunk/widget_template.php
r567259 r770831 50 50 $_current_widget = $this->wpdb->get_results("SELECT * FROM {$this->wpdb->prefix}inic_testimonial_widget WHERE id='{$_GET['id']}'"); 51 51 $_current_widget = $_current_widget[0]; 52 $id = $_current_widget->id;53 $title = $_current_widget->title;54 $no_of_testimonial = $_current_widget->no_of_testimonial;55 $only_featured = $_current_widget->only_featured;56 $filter_by_country = $_current_widget->filter_by_country;57 $filter_by_tags = $_current_widget->filter_by_tags;58 $display_randomly = $_current_widget->display_randomly;59 $html_template = $_current_widget->html_template;52 $id = esc_attr($_current_widget->id); 53 $title = esc_attr($_current_widget->title); 54 $no_of_testimonial = esc_attr($_current_widget->no_of_testimonial); 55 $only_featured = esc_attr($_current_widget->only_featured); 56 $filter_by_country = esc_attr($_current_widget->filter_by_country); 57 $filter_by_tags = esc_attr($_current_widget->filter_by_tags); 58 $display_randomly = esc_attr($_current_widget->display_randomly); 59 $html_template = esc_attr($_current_widget->html_template); 60 60 } else { 61 61 $id = $title = $no_of_testimonial = $only_featured = $filter_by_country = $filter_by_tags = $display_randomly = $html_template = false; … … 64 64 65 65 <form name="testimonial_widget_template" method="post" action=""> 66 <?php wp_nonce_field('save_testimonial_widget_template','_nonce'); ?> 66 67 <input type="hidden" name="action" value="iNIC_testimonial_save_widget" /> 67 68 … … 158 159 $_results->only_featured = ($_results->only_featured) ? 'Yes' : 'No'; 159 160 echo "<tr> 160 <td> {$_results->title}161 <td>". esc_html($_results->title)." 161 162 <div class=\"row-actions\"> 162 <span class=\"edit\"><a href=\"admin.php?page=inic_testimonial_widget_template&type=add&id= {$_results->id}\" title=\"Edit this item\">Edit</a> | </span>163 <span class=\"trash\"><a class=\"submitdelete\" title=\"Delete this item\" href=\"javascript:void(0)\" rel=\" {$_results->id}\">Delete</a></span>163 <span class=\"edit\"><a href=\"admin.php?page=inic_testimonial_widget_template&type=add&id=". esc_attr($_results->id)."\" title=\"Edit this item\">Edit</a> | </span> 164 <span class=\"trash\"><a class=\"submitdelete\" title=\"Delete this item\" href=\"javascript:void(0)\" rel=\"". esc_attr($_results->id)."\">Delete</a></span> 164 165 </div> 165 166 </td> 166 <td> {$_results->no_of_testimonial}</td>167 <td> {$_results->only_featured}</td>168 <td> {$_results->filter_by_country}</td>169 <td> {$_results->filter_by_tags}</td>167 <td>". esc_html($_results->no_of_testimonial)."</td> 168 <td>". esc_html($_results->only_featured)."</td> 169 <td>". esc_html($_results->filter_by_country)."</td> 170 <td>". esc_html($_results->filter_by_tags)."</td> 170 171 </tr>"; 171 172 }
Note: See TracChangeset
for help on using the changeset viewer.