Changeset 3112817
- Timestamp:
- 07/05/2024 03:18:20 AM (21 months ago)
- Location:
- taro-ad-fields
- Files:
-
- 10 edited
- 1 copied
-
tags/1.2.5 (copied) (copied from taro-ad-fields/trunk)
-
tags/1.2.5/includes/functions.php (modified) (1 diff)
-
tags/1.2.5/includes/ouput.php (modified) (1 diff)
-
tags/1.2.5/readme.txt (modified) (5 diffs)
-
tags/1.2.5/taro-ad-fields.php (modified) (1 diff)
-
tags/1.2.5/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/includes/functions.php (modified) (1 diff)
-
trunk/includes/ouput.php (modified) (1 diff)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/taro-ad-fields.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
taro-ad-fields/tags/1.2.5/includes/functions.php
r3110801 r3112817 112 112 * Render ad content 113 113 * 114 * @pa ckage taf115 * @param string $ position116 * @param string $ beforeDefault empty string117 * @param string $after Default empty string114 * @param string $position Slug of position. 115 * @param string $before Default empty string 116 * @param string $after Default empty string 117 * @param int $number Number to display. Default 1. 118 118 * 119 119 * @return string 120 120 */ 121 function taf_render( $position, $before = '', $after = '' ) { 122 $position = get_term_by( 'slug', $position, 'ad-position' ); 121 function taf_render( $position, $before = '', $after = '', $number = 1 ) { 122 $position = get_term_by( 'slug', $position, 'ad-position' ); 123 if ( ! $position || is_wp_error( $position ) ) { 124 return ''; 125 } 123 126 $is_preview = current_user_can( 'edit_posts' ) && ( 'true' === get_query_var( 'taf_preview' ) ); 124 $args = a rray(127 $args = apply_filters( 'taf_render_query', [ 125 128 'post_type' => 'ad-content', 126 'posts_per_page' => 1, 127 'orderby' => array( 'date' => 'DESC' ), 128 'post_status' => $is_preview ? array( 'publish', 'future' ) : 'publish', 129 'tax_query' => array( 130 array( 129 'posts_per_page' => $number, 130 'orderby' => [ 'date' => 'DESC' ], 131 'no_found_rows' => true, 132 'post_status' => $is_preview ? [ 'publish', 'future' ] : 'publish', 133 'tax_query' => [ 134 [ 131 135 'taxonomy' => 'ad-position', 132 'terms' => $position,136 'terms' => [ $position->slug ], 133 137 'field' => 'slug', 134 ), 135 ), 136 ); 137 foreach ( get_posts( $args ) as $ad ) { 138 $output = ''; 139 140 $meta = get_post_meta( $ad->ID, '_taf_content', true ); 138 ], 139 ], 140 ], $position, $is_preview ); 141 $query = new WP_Query( $args ); 142 if ( ! $query->have_posts() ) { 143 return ''; 144 } 145 $output = ''; 146 foreach ( $query->posts as $ad ) { 147 $meta = get_post_meta( $ad->ID, '_taf_content', true ); 148 $ad_content = ''; 141 149 if ( $meta ) { 142 $output .= $meta; 150 // Meta fields exist. 151 $ad_content .= $meta; 143 152 } 144 153 if ( trim( $ad->post_content ) ) { 145 $output .= apply_filters( 'the_content', $ad->post_content ); 146 } 147 if ( $output ) { 148 return $before . $output . $after; 149 } 150 } 151 return ''; 154 // Post body exists. 155 $ad_content .= apply_filters( 'the_content', $ad->post_content ); 156 } 157 if ( ! empty( $ad_content ) ) { 158 $output .= $before . $ad_content . $after; 159 } 160 } 161 return $output; 152 162 } 153 163 -
taro-ad-fields/tags/1.2.5/includes/ouput.php
r3110801 r3112817 9 9 * Render ad field 10 10 */ 11 add_action( 'taro_ad_field', function ( $position, $before = '', $after = '' ) {12 echo taf_render( $position, $before, $after );13 }, 10, 3);11 add_action( 'taro_ad_field', function ( $position, $before = '', $after = '', $number = 1 ) { 12 echo taf_render( $position, $before, $after, $number ); 13 }, 10, 4 ); -
taro-ad-fields/tags/1.2.5/readme.txt
r3110996 r3112817 5 5 Requires at least: 5.9 6 6 Tested up to: 6.5 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 Requires PHP: 7.4 9 9 License: GPLv3 or later … … 31 31 Hook Arguments 32 32 33 `do_action( $hook_name, $slug, $before, $after );` 33 <code>do_action( $hook_name, $slug, $before, $after, $number );></code> 34 34 35 35 1. **$hook_name**: The action hook name. Always should be `taro_ad_field`. … … 37 37 3. **$before**: String to be output just before ad block. If no ad exists, this won't be displayed. 38 38 4. **$after**: String to be output just after ad block. 39 5. **$number**: Number of ad to be displayed. Default is 1. 39 40 40 41 = From Widget = … … 97 98 = Is there any vulnerability? = 98 99 99 As far as we k onw, **NO**. But nothing is perfect.100 As far as we know, **NO**. But nothing is perfect. 100 101 This plugin allows you to save Javascript like Google Adsense code, 101 102 so please be careful about who can edit your ad. … … 108 109 == Changelog == 109 110 111 = 1.2.5 = 112 113 * Allow multiple ad in one field. 114 110 115 = 1.1.0 = 111 116 -
taro-ad-fields/tags/1.2.5/taro-ad-fields.php
r3110996 r3112817 9 9 Domain Path: /languages/ 10 10 License: GPL v3 or later. 11 Version: 1.2. 411 Version: 1.2.5 12 12 */ 13 13 -
taro-ad-fields/tags/1.2.5/vendor/composer/installed.php
r3110996 r3112817 2 2 'root' => array( 3 3 'name' => 'tarosky/taro-ad-fields', 4 'pretty_version' => '1.2. 4',5 'version' => '1.2. 4.0',6 'reference' => ' a4830696bdbde5b24c2c09365f681e29696b95cd',4 'pretty_version' => '1.2.5', 5 'version' => '1.2.5.0', 6 'reference' => 'e7c8ea68fcd23ab0b1b5754c2d0eb9bcbb50390a', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'tarosky/taro-ad-fields' => array( 14 'pretty_version' => '1.2. 4',15 'version' => '1.2. 4.0',16 'reference' => ' a4830696bdbde5b24c2c09365f681e29696b95cd',14 'pretty_version' => '1.2.5', 15 'version' => '1.2.5.0', 16 'reference' => 'e7c8ea68fcd23ab0b1b5754c2d0eb9bcbb50390a', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
taro-ad-fields/trunk/includes/functions.php
r3110801 r3112817 112 112 * Render ad content 113 113 * 114 * @pa ckage taf115 * @param string $ position116 * @param string $ beforeDefault empty string117 * @param string $after Default empty string114 * @param string $position Slug of position. 115 * @param string $before Default empty string 116 * @param string $after Default empty string 117 * @param int $number Number to display. Default 1. 118 118 * 119 119 * @return string 120 120 */ 121 function taf_render( $position, $before = '', $after = '' ) { 122 $position = get_term_by( 'slug', $position, 'ad-position' ); 121 function taf_render( $position, $before = '', $after = '', $number = 1 ) { 122 $position = get_term_by( 'slug', $position, 'ad-position' ); 123 if ( ! $position || is_wp_error( $position ) ) { 124 return ''; 125 } 123 126 $is_preview = current_user_can( 'edit_posts' ) && ( 'true' === get_query_var( 'taf_preview' ) ); 124 $args = a rray(127 $args = apply_filters( 'taf_render_query', [ 125 128 'post_type' => 'ad-content', 126 'posts_per_page' => 1, 127 'orderby' => array( 'date' => 'DESC' ), 128 'post_status' => $is_preview ? array( 'publish', 'future' ) : 'publish', 129 'tax_query' => array( 130 array( 129 'posts_per_page' => $number, 130 'orderby' => [ 'date' => 'DESC' ], 131 'no_found_rows' => true, 132 'post_status' => $is_preview ? [ 'publish', 'future' ] : 'publish', 133 'tax_query' => [ 134 [ 131 135 'taxonomy' => 'ad-position', 132 'terms' => $position,136 'terms' => [ $position->slug ], 133 137 'field' => 'slug', 134 ), 135 ), 136 ); 137 foreach ( get_posts( $args ) as $ad ) { 138 $output = ''; 139 140 $meta = get_post_meta( $ad->ID, '_taf_content', true ); 138 ], 139 ], 140 ], $position, $is_preview ); 141 $query = new WP_Query( $args ); 142 if ( ! $query->have_posts() ) { 143 return ''; 144 } 145 $output = ''; 146 foreach ( $query->posts as $ad ) { 147 $meta = get_post_meta( $ad->ID, '_taf_content', true ); 148 $ad_content = ''; 141 149 if ( $meta ) { 142 $output .= $meta; 150 // Meta fields exist. 151 $ad_content .= $meta; 143 152 } 144 153 if ( trim( $ad->post_content ) ) { 145 $output .= apply_filters( 'the_content', $ad->post_content ); 146 } 147 if ( $output ) { 148 return $before . $output . $after; 149 } 150 } 151 return ''; 154 // Post body exists. 155 $ad_content .= apply_filters( 'the_content', $ad->post_content ); 156 } 157 if ( ! empty( $ad_content ) ) { 158 $output .= $before . $ad_content . $after; 159 } 160 } 161 return $output; 152 162 } 153 163 -
taro-ad-fields/trunk/includes/ouput.php
r3110801 r3112817 9 9 * Render ad field 10 10 */ 11 add_action( 'taro_ad_field', function ( $position, $before = '', $after = '' ) {12 echo taf_render( $position, $before, $after );13 }, 10, 3);11 add_action( 'taro_ad_field', function ( $position, $before = '', $after = '', $number = 1 ) { 12 echo taf_render( $position, $before, $after, $number ); 13 }, 10, 4 ); -
taro-ad-fields/trunk/readme.txt
r3110996 r3112817 5 5 Requires at least: 5.9 6 6 Tested up to: 6.5 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 Requires PHP: 7.4 9 9 License: GPLv3 or later … … 31 31 Hook Arguments 32 32 33 `do_action( $hook_name, $slug, $before, $after );` 33 <code>do_action( $hook_name, $slug, $before, $after, $number );></code> 34 34 35 35 1. **$hook_name**: The action hook name. Always should be `taro_ad_field`. … … 37 37 3. **$before**: String to be output just before ad block. If no ad exists, this won't be displayed. 38 38 4. **$after**: String to be output just after ad block. 39 5. **$number**: Number of ad to be displayed. Default is 1. 39 40 40 41 = From Widget = … … 97 98 = Is there any vulnerability? = 98 99 99 As far as we k onw, **NO**. But nothing is perfect.100 As far as we know, **NO**. But nothing is perfect. 100 101 This plugin allows you to save Javascript like Google Adsense code, 101 102 so please be careful about who can edit your ad. … … 108 109 == Changelog == 109 110 111 = 1.2.5 = 112 113 * Allow multiple ad in one field. 114 110 115 = 1.1.0 = 111 116 -
taro-ad-fields/trunk/taro-ad-fields.php
r3110996 r3112817 9 9 Domain Path: /languages/ 10 10 License: GPL v3 or later. 11 Version: 1.2. 411 Version: 1.2.5 12 12 */ 13 13 -
taro-ad-fields/trunk/vendor/composer/installed.php
r3110996 r3112817 2 2 'root' => array( 3 3 'name' => 'tarosky/taro-ad-fields', 4 'pretty_version' => '1.2. 4',5 'version' => '1.2. 4.0',6 'reference' => ' a4830696bdbde5b24c2c09365f681e29696b95cd',4 'pretty_version' => '1.2.5', 5 'version' => '1.2.5.0', 6 'reference' => 'e7c8ea68fcd23ab0b1b5754c2d0eb9bcbb50390a', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'tarosky/taro-ad-fields' => array( 14 'pretty_version' => '1.2. 4',15 'version' => '1.2. 4.0',16 'reference' => ' a4830696bdbde5b24c2c09365f681e29696b95cd',14 'pretty_version' => '1.2.5', 15 'version' => '1.2.5.0', 16 'reference' => 'e7c8ea68fcd23ab0b1b5754c2d0eb9bcbb50390a', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.