Changeset 3085800
- Timestamp:
- 05/13/2024 12:24:53 PM (23 months ago)
- Location:
- redirect-url-to-post
- Files:
-
- 4 edited
- 1 copied
-
tags/0.24.0 (copied) (copied from redirect-url-to-post/trunk)
-
tags/0.24.0/readme.txt (modified) (2 diffs)
-
tags/0.24.0/redirect-url-to-post.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/redirect-url-to-post.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redirect-url-to-post/tags/0.24.0/readme.txt
r3048291 r3085800 4 4 Tags: redirect, random, recent, random post, filter 5 5 Requires at least: 4.9 6 Tested up to: 6. 4.37 Stable tag: 0.2 3.06 Tested up to: 6.5.3 7 Stable tag: 0.24.0 8 8 Requires PHP: 7.4 9 9 License: GPLv3 … … 136 136 == Changelog == 137 137 138 ### 0.24.0 ### 139 140 = Features = 141 142 * New query parameters to search for custom fields (post meta): `meta_key`, `meta_value`, `meta_value_num` and `meta_compare` 143 * New parameter `loop=1` in connection with `redirect_to=prev` or `redirect_to=next` to loop back to the last or first post at the end 144 138 145 ### 0.23.0 ### 139 146 -
redirect-url-to-post/tags/0.24.0/redirect-url-to-post.php
r2962112 r3085800 6 6 Author: Christoph Amthor 7 7 Author URI: https://chattymango.com/ 8 Version: 0.2 3.08 Version: 0.24.0 9 9 License: GNU GENERAL PUBLIC LICENSE, Version 3 10 10 Text Domain: redirect-url-to-post … … 158 158 */ 159 159 private $each_once; 160 161 162 /** 163 * For prev and next, return to the beginning when done 164 * 165 * @var boolean 166 */ 167 private $loop; 160 168 161 169 /** … … 502 510 * Construct the 'date_query' array for redirecting to previous or next 503 511 */ 504 505 512 if ( ! empty( $date_query_items ) ) { 506 513 … … 563 570 'include', 564 571 'minute', 572 'meta_key', 573 'meta_value', 574 'meta_value_num', 575 'meta_compare', 565 576 'monthnum', 566 577 'order', … … 772 783 * Special processing for comment count 773 784 */ 774 775 785 if ( isset( $_GET['comment_count'] ) ) { 776 786 … … 801 811 * Parameters that set properties 802 812 */ 803 804 813 if ( isset( $_GET['each_once'] ) ) { 805 814 … … 811 820 812 821 $this->each_once = false; 822 823 } 824 825 if ( isset( $_GET['loop'] ) && ( 'prev' === $this->redirect_to || 'next' === $this->redirect_to ) ) { 826 827 $this->loop = (bool) $_GET['loop']; 828 829 $this->maybe_add_debug_message( __( 'Looping back to the start when done.', 'redirect-url-to-post' ) ); 830 831 } else { 832 833 $this->loop = false; 813 834 814 835 } … … 1068 1089 } 1069 1090 1091 } elseif ($this->loop) { 1092 1093 if ('prev' === $this->redirect_to) { 1094 1095 if ( $this->debug_mode ) { 1096 1097 $this->add_debug_message( __( 'We are looping back to the last post.', 'redirect-url-to-post' ) ); 1098 1099 $this->output_debug_messages(); 1100 1101 exit; 1102 1103 } 1104 1105 $this->redirection_target = add_query_arg( array( 'redirect_to' => 'last' ) ); 1106 1107 header( 'Cache-Control: no-cache, must-revalidate' ); 1108 header( 'Location: ' . $this->redirection_target, true, 307 ); 1109 1110 exit; 1111 1112 } elseif ('next' === $this->redirect_to) { 1113 1114 if ( $this->debug_mode ) { 1115 1116 $this->add_debug_message( __( 'We are looping back to the first post.', 'redirect-url-to-post' ) ); 1117 1118 $this->output_debug_messages(); 1119 1120 exit; 1121 1122 } 1123 1124 $this->redirection_target = add_query_arg( array('redirect_to' => 'first') ); 1125 1126 header( 'Cache-Control: no-cache, must-revalidate' ); 1127 header( 'Location: ' . $this->redirection_target, true, 307 ); 1128 1129 exit; 1130 1131 } 1070 1132 } 1071 1133 -
redirect-url-to-post/trunk/readme.txt
r3048291 r3085800 4 4 Tags: redirect, random, recent, random post, filter 5 5 Requires at least: 4.9 6 Tested up to: 6. 4.37 Stable tag: 0.2 3.06 Tested up to: 6.5.3 7 Stable tag: 0.24.0 8 8 Requires PHP: 7.4 9 9 License: GPLv3 … … 136 136 == Changelog == 137 137 138 ### 0.24.0 ### 139 140 = Features = 141 142 * New query parameters to search for custom fields (post meta): `meta_key`, `meta_value`, `meta_value_num` and `meta_compare` 143 * New parameter `loop=1` in connection with `redirect_to=prev` or `redirect_to=next` to loop back to the last or first post at the end 144 138 145 ### 0.23.0 ### 139 146 -
redirect-url-to-post/trunk/redirect-url-to-post.php
r2962112 r3085800 6 6 Author: Christoph Amthor 7 7 Author URI: https://chattymango.com/ 8 Version: 0.2 3.08 Version: 0.24.0 9 9 License: GNU GENERAL PUBLIC LICENSE, Version 3 10 10 Text Domain: redirect-url-to-post … … 158 158 */ 159 159 private $each_once; 160 161 162 /** 163 * For prev and next, return to the beginning when done 164 * 165 * @var boolean 166 */ 167 private $loop; 160 168 161 169 /** … … 502 510 * Construct the 'date_query' array for redirecting to previous or next 503 511 */ 504 505 512 if ( ! empty( $date_query_items ) ) { 506 513 … … 563 570 'include', 564 571 'minute', 572 'meta_key', 573 'meta_value', 574 'meta_value_num', 575 'meta_compare', 565 576 'monthnum', 566 577 'order', … … 772 783 * Special processing for comment count 773 784 */ 774 775 785 if ( isset( $_GET['comment_count'] ) ) { 776 786 … … 801 811 * Parameters that set properties 802 812 */ 803 804 813 if ( isset( $_GET['each_once'] ) ) { 805 814 … … 811 820 812 821 $this->each_once = false; 822 823 } 824 825 if ( isset( $_GET['loop'] ) && ( 'prev' === $this->redirect_to || 'next' === $this->redirect_to ) ) { 826 827 $this->loop = (bool) $_GET['loop']; 828 829 $this->maybe_add_debug_message( __( 'Looping back to the start when done.', 'redirect-url-to-post' ) ); 830 831 } else { 832 833 $this->loop = false; 813 834 814 835 } … … 1068 1089 } 1069 1090 1091 } elseif ($this->loop) { 1092 1093 if ('prev' === $this->redirect_to) { 1094 1095 if ( $this->debug_mode ) { 1096 1097 $this->add_debug_message( __( 'We are looping back to the last post.', 'redirect-url-to-post' ) ); 1098 1099 $this->output_debug_messages(); 1100 1101 exit; 1102 1103 } 1104 1105 $this->redirection_target = add_query_arg( array( 'redirect_to' => 'last' ) ); 1106 1107 header( 'Cache-Control: no-cache, must-revalidate' ); 1108 header( 'Location: ' . $this->redirection_target, true, 307 ); 1109 1110 exit; 1111 1112 } elseif ('next' === $this->redirect_to) { 1113 1114 if ( $this->debug_mode ) { 1115 1116 $this->add_debug_message( __( 'We are looping back to the first post.', 'redirect-url-to-post' ) ); 1117 1118 $this->output_debug_messages(); 1119 1120 exit; 1121 1122 } 1123 1124 $this->redirection_target = add_query_arg( array('redirect_to' => 'first') ); 1125 1126 header( 'Cache-Control: no-cache, must-revalidate' ); 1127 header( 'Location: ' . $this->redirection_target, true, 307 ); 1128 1129 exit; 1130 1131 } 1070 1132 } 1071 1133
Note: See TracChangeset
for help on using the changeset viewer.