Changeset 2891046
- Timestamp:
- 03/31/2023 09:08:11 AM (3 years ago)
- Location:
- setupad/trunk
- Files:
-
- 12 edited
-
admin/assets/css/custom.css (modified) (1 diff)
-
admin/assets/js/setupad.js (modified) (2 diffs)
-
admin/includes/database/create-update-ad-unit.php (modified) (3 diffs)
-
admin/includes/database/setupad-tables-upgrade.php (modified) (2 diffs)
-
admin/includes/database/setupad-tables.php (modified) (2 diffs)
-
admin/includes/forms/setupad-create-ad-unit-form.php (modified) (3 diffs)
-
admin/includes/navigation/admin-menu.php (modified) (1 diff)
-
public/includes/add-setupad-shortcode.php (modified) (1 diff)
-
public/includes/helper-functions.php (modified) (2 diffs)
-
public/includes/related-posts.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
setupad.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
setupad/trunk/admin/assets/css/custom.css
r2881084 r2891046 19 19 20 20 .setupad-image { display: none;} 21 .setupad-shortcode { display: none;} 21 22 .setupad-after-position { display: none;} 22 23 -
setupad/trunk/admin/assets/js/setupad.js
r2881084 r2891046 59 59 jQuery(".setupad-content").show(); 60 60 jQuery(".setupad-image").hide(); 61 jQuery(".setupad-shortcode").hide(); 62 jQuery(".setupad-lazy-loading").show(); 61 63 } else if(element.value ==="images") { 62 64 jQuery(".setupad-content").hide(); 63 65 jQuery(".setupad-image").show(); 66 jQuery(".setupad-shortcode").hide(); 67 jQuery(".setupad-lazy-loading").show(); 68 } else if(element.value ==="shortcode") { 69 jQuery(".setupad-content").hide(); 70 jQuery(".setupad-image").hide(); 71 jQuery(".setupad-shortcode").show(); 72 jQuery(".setupad-lazy-loading").hide(); 64 73 } 65 74 } … … 71 80 jQuery(".setupad-content").show(); 72 81 jQuery(".setupad-image").hide(); 82 jQuery(".setupad-shortcode").hide(); 83 jQuery(".setupad-lazy-loading").show(); 73 84 } else if(position ==="images") { 74 85 jQuery(".setupad-content").hide(); 75 86 jQuery(".setupad-image").show(); 87 jQuery(".setupad-shortcode").hide(); 88 jQuery(".setupad-lazy-loading").show(); 89 } else if(position ==="shortcode") { 90 jQuery(".setupad-content").hide(); 91 jQuery(".setupad-image").hide(); 92 jQuery(".setupad-shortcode").show(); 93 jQuery(".setupad-lazy-loading").hide(); 76 94 } 77 95 })) -
setupad/trunk/admin/includes/database/create-update-ad-unit.php
r2875414 r2891046 13 13 'setupad_content_elements' => (isset($_POST['setupad_content_elements'])) ? sanitize_text_field($_POST['setupad_content_elements']) : '', 14 14 'setupad_image_url' => (isset($_POST['setupad_image_url'])) ? sanitize_url($_POST['setupad_image_url']) : '', 15 'setupad_shortcode_content' => (isset($_POST['setupad_shortcode_content'])) ? sanitize_text_field($_POST['setupad_shortcode_content']) : '', 15 16 'setupad_insertion_pages' => (isset($_POST['setupad_insertion_pages'])) ? sanitize_text_field($_POST['setupad_insertion_pages']) : '', 16 17 'setupad_position' => sanitize_text_field($_POST['setupad_position']), … … 49 50 $result = $wpdb->insert($table_name, $item); 50 51 $Id = $wpdb->insert_id; 51 $shortCodeData = [ 'setupad_shortcode' => "[setup _ad num=".$Id."]" ];52 $shortCodeData = [ 'setupad_shortcode' => "[setupad num=".$Id."]" ]; 52 53 $wpdb->update($table_name, $shortCodeData, array('id' => $Id)); 53 54 if ($result) { … … 79 80 setupad_content, 80 81 setupad_content_elements, 81 setupad_image_url, 82 setupad_image_url, 83 setupad_shortcode_content, 82 84 setupad_insertion_pages, 83 85 setupad_position, -
setupad/trunk/admin/includes/database/setupad-tables-upgrade.php
r2875414 r2891046 2 2 global $wpdb; 3 3 $table_name = $wpdb->prefix . "setupad"; 4 $setupad_db_version = '1. 0.0';4 $setupad_db_version = '1.2.0'; 5 5 $charset_collate = $wpdb->get_charset_collate(); 6 6 $setupad_installed_ver = get_option( "setupad_db_version" ); … … 15 15 `setupad_image_url` text NULL DEFAULT NULL, 16 16 `setupad_image_file_path` text NULL DEFAULT NULL, 17 `setupad_shortcode_content` text NULL DEFAULT NULL, 17 18 `setupad_insertion_pages` VARCHAR(100) NULL DEFAULT NULL, 18 19 `setupad_position` VARCHAR(100) NOT NULL, -
setupad/trunk/admin/includes/database/setupad-tables.php
r2875414 r2891046 2 2 global $wpdb; 3 3 $table_name = $wpdb->prefix . "setupad"; 4 $setupad_db_version = '1. 0.0';4 $setupad_db_version = '1.2.0'; 5 5 $charset_collate = $wpdb->get_charset_collate(); 6 6 … … 13 13 `setupad_image_url` text NULL DEFAULT NULL, 14 14 `setupad_image_file_path` text NULL DEFAULT NULL, 15 `setupad_shortcode_content` text NULL DEFAULT NULL, 15 16 `setupad_insertion_pages` VARCHAR(100) NULL DEFAULT NULL, 16 17 `setupad_position` VARCHAR(100) NOT NULL, -
setupad/trunk/admin/includes/forms/setupad-create-ad-unit-form.php
r2881084 r2891046 46 46 <label class="single-d-label"><?php _e('Image', 'setupad')?></label> 47 47 <input class="single-d-input" type="radio" name="setupad_type" value="images" <?php checked( $item['setupad_type'], 'images' ); ?>> 48 </div> 49 <div <?php echo ($item['setupad_position'] == 'shortcode') ? 'class="single-d-div checked"' : 'class="single-d-div"'; ?>> 50 <label class="single-d-label"><?php _e('Shortcode', 'setupad')?></label> 51 <input class="single-d-input" type="radio" name="setupad_type" value="shortcode" <?php checked( $item['setupad_type'], 'shortcode' ); ?>> 48 52 </div> 49 53 </div> … … 247 251 </tr> 248 252 253 <tr class="form-field setupad-shortcode"> 254 <th scope="row"> 255 <label for="setupad_content"><?php _e('Shortcode', 'setupad')?></label> 256 </th> 257 258 <td> 259 <div class="stpd-tooltip"> 260 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> 261 <path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> 262 </svg> 263 <span class="stpd-tooltiptext">Insert any valid shortcode that you want to display on your website.</span> 264 </div> 265 </td> 266 267 <td> 268 <input id="setupad_shortcode_content" name="setupad_shortcode_content" value="<?php if (isset($item['setupad_shortcode_content'])) echo esc_attr(stripslashes($item['setupad_shortcode_content']))?>" 269 size="100" class="code" placeholder="<?php _e('Shortcode, e.g., [my shortcode 5]', 'setupad')?>" AutoComplete=off data-lpignore="true" type="text" style="max-width: 600px;"> 270 </td> 271 </tr> 272 249 273 <tr class="form-field page-selection"> 250 274 <th scope="row"> … … 802 826 </tr> 803 827 804 <tr class="form-field ">828 <tr class="form-field setupad-lazy-loading"> 805 829 <th scope="row"> 806 830 <label for="setupad_title"><?php _e('Enable lazy loading', 'setupad')?></label> -
setupad/trunk/admin/includes/navigation/admin-menu.php
r2875414 r2891046 5 5 global $submenu; 6 6 7 add_menu_page(__('Setupad', 'setupad'), __('Setupad', 'setupad'), 'activate_plugins', 'setupad', 'setupad_my_ads_tab', SETUPAD_BASE_URL .'admin/assets/images/plugin_logo.png');7 add_menu_page(__('Setupad', 'setupad'), __('Setupad', 'setupad'), 'activate_plugins', 'setupad', 'setupad_my_ads_tab', 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iIzljYTFhOCI+CiAgICA8cGF0aCBzdHlsZT0ic3Ryb2tlOm5vbmU7ZmlsbC1ydWxlOmV2ZW5vZGQ7ZmlsbC1vcGFjaXR5OjEiIGQ9Ik04LjY3NiA2LjkwNmMuMDA0IDAgMi4yMzggNi4wNjcgMy4zODYgOS4wOWgyLjc0M2MuNzg1IDAgMS4zNTEtLjc0MiAxLjE0NC0xLjQ5Ni0xLjczLTQuMzc1LTUuMjI2LTEzLjExMy01LjIyNi0xMy4xMTcgMCAuMDA0LTIuMDQzIDUuNTIzLTIuMDQ3IDUuNTIzWk01LjgwNS4wMDhDMy44OTUgNC44NCAxLjk2NSA5LjY2OC4wNSAxNC41Yy0uMjExLjc1NC4zNiAxLjQ5NiAxLjE0NCAxLjQ5NkgzLjkzQzUuMjY2IDEyLjUyMyA5LjM4NyAxLjg2NyAxMC4wOTguMDA4Wm0wIDAiLz4KPC9zdmc+Cg==', 26); 8 8 add_submenu_page('setupad', __('Add new', 'setupad'), __('Add new', 'setupad'), 'activate_plugins', 'stpd-new_ad', 'setupad_create_ad_unit_tab'); 9 9 add_submenu_page('setupad', __('Related Posts', 'setupad'), __('Related Posts', 'setupad'), 'activate_plugins', 'stpd-related-posts', 'setupad_related_posts_tab'); -
setupad/trunk/public/includes/add-setupad-shortcode.php
r2875414 r2891046 18 18 } 19 19 add_shortcode('setup_ad','setupad_ad_sc'); 20 21 function setupad_sc($atts, $content = null) { 22 extract(shortcode_atts(array( 23 'num' => '', 24 ), $atts)); 25 global $wpdb; 26 $tablename= $wpdb->prefix . 'setupad'; 27 28 $setupad_row = $wpdb->get_row( $wpdb->prepare("SELECT * FROM %5s WHERE id = %d", $tablename, $num) ); 29 30 if(!$setupad_row) return; 31 32 $adContents = setupad_get_ad_contents($setupad_row); 33 34 return $adContents; 35 } 36 add_shortcode('setupad','setupad_sc'); -
setupad/trunk/public/includes/helper-functions.php
r2875414 r2891046 26 26 function setupad_get_ad_contents($ad_row) { 27 27 $adContents = ''; 28 $device_selection_array = []; 29 if ($ad_row->setupad_device_selection) $device_selection_array = explode(',', $ad_row->setupad_device_selection); 30 31 //shortcode insertion 32 if ($ad_row->setupad_type === 'shortcode') { 33 if (in_array(setupad_server_side_mobile_detection(), $device_selection_array) || !$ad_row->setupad_device_selection) { 34 if ($ad_row->setupad_contents_alignment && $ad_row->setupad_alignment_css) { 35 return "<div style='". stripslashes($ad_row->setupad_alignment_css) ."'>" . do_shortcode(stripslashes($ad_row->setupad_shortcode_content)) . "</div>"; 36 } else { 37 return do_shortcode(stripcslashes($ad_row->setupad_shortcode_content)); 38 } 39 } else { 40 return false; 41 } 42 } 28 43 29 44 json_decode(stripcslashes($ad_row->setupad_content)); … … 54 69 $adContents = "<div style='". stripslashes($ad_row->setupad_alignment_css) ."'>" . $adContents . "</div>"; 55 70 } 56 57 $device_selection_array = [];58 if ($ad_row->setupad_device_selection) $device_selection_array = explode(',', $ad_row->setupad_device_selection);59 71 60 72 if (in_array(setupad_server_side_mobile_detection(), $device_selection_array) || !$ad_row->setupad_device_selection) -
setupad/trunk/public/includes/related-posts.php
r2881115 r2891046 105 105 while ( $my_query->have_posts() ) { 106 106 $my_query->the_post(); 107 $trimmed_title = strlen($post->post_title) > 35 ? substr($post->post_title,0,35)."..." : $post->post_title; 107 108 if (strlen($post->post_title) > 35) { 109 $s = substr($post->post_title, 0, 35); 110 $trimmed_title = substr($s, 0, strrpos($s, ' ')) . "..."; 111 } else { 112 $trimmed_title = $post->post_title; 113 } 108 114 109 115 ?> … … 122 128 $related_category_content .= "<div class=\"relatedthumb\"> 123 129 <a href=\"" . get_permalink() . "\" rel=\"bookmark\" title=\"" . $post->post_title . "\"> 124 <img src=\"" . get_post_meta($post->ID, 'Image', true) . "\" width=\"196\" height=\"110\"125 alt=\"" . $post->post_title . "\">126 130 " . $trimmed_title . "</a> 127 131 </div>"; -
setupad/trunk/readme.txt
r2881115 r2891046 5 5 Requires at least: 4.4 6 6 Tested up to: 6.1 7 Stable tag: 1. 1.27 Stable tag: 1.2.0 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 78 78 == Changelog == 79 79 80 = 1.2.0 = 81 - Shortcode insertion 82 - Bug fixes, design changes 83 80 84 = 1.1.2 = 81 85 - Bug fixes -
setupad/trunk/setupad.php
r2881115 r2891046 2 2 /** 3 3 * @package Setupad 4 * @version 1. 1.24 * @version 1.2.0 5 5 */ 6 6 /* … … 8 8 Description: Simple and powerful ad insertion and management tool for WordPress users with built-in integration with Setupad header bidding monetization platform. 9 9 Author: Setupad 10 Version: 1. 1.210 Version: 1.2.0 11 11 Author URI: https://setupad.com/ 12 12 */ … … 36 36 if (!isset($_GET['page'])) return; 37 37 if ($_GET['page'] ==='setupad' || $_GET['page'] ==='stpd-new_ad' || $_GET['page'] ==='stpd-ads_txt' || $_GET['page'] ==='stpd-related-posts' || $_GET['page'] ==='stpd-header-footer') { 38 wp_register_style('custom.css', SETUPAD_BASE_URL . 'admin/assets/css/custom.css', array(), '35. 6');38 wp_register_style('custom.css', SETUPAD_BASE_URL . 'admin/assets/css/custom.css', array(), '35.7'); 39 39 wp_enqueue_style('custom.css'); 40 40 41 wp_register_script('setupad.js', SETUPAD_BASE_URL . 'admin/assets/js/setupad.js', array('jquery'), '25. 2');41 wp_register_script('setupad.js', SETUPAD_BASE_URL . 'admin/assets/js/setupad.js', array('jquery'), '25.4'); 42 42 wp_enqueue_script('setupad.js'); 43 43
Note: See TracChangeset
for help on using the changeset viewer.