@@ -44,7 +44,7 @@ When a hub sends a verification request, you must confirm the subscription via t
4444``` php
4545add_filter( 'websub_verify_subscription', function( $allow, $subscription_id, $topic, $mode ) {
4646 // Only verify subscriptions from your plugin
47- if ( str_starts_with ( $subscription_id, 'my-plugin-' ) ) {
47+ if ( 0 === strpos ( $subscription_id, 'my-plugin-' ) ) {
4848 // Verify this matches a subscription you requested
4949 $stored_topic = get_option( 'my_plugin_sub_' . $subscription_id );
5050 if ( $stored_topic === $topic ) {
@@ -61,7 +61,7 @@ If you provided a secret when subscribing, you must return it for signature veri
6161
6262``` php
6363add_filter( 'websub_subscription_secret', function( $secret, $subscription_id ) {
64- if ( str_starts_with ( $subscription_id, 'my-plugin-' ) ) {
64+ if ( 0 === strpos ( $subscription_id, 'my-plugin-' ) ) {
6565 return get_option( 'my_plugin_secret_' . $subscription_id );
6666 }
6767 return $secret;
@@ -74,7 +74,7 @@ When the hub delivers new content, handle it via the `websub_received` action:
7474
7575``` php
7676add_action( 'websub_received', function( $subscription_id, $topic, $content, $content_type ) {
77- if ( str_starts_with ( $subscription_id, 'my-plugin-' ) ) {
77+ if ( 0 === strpos ( $subscription_id, 'my-plugin-' ) ) {
7878 // Process the feed content
7979 $feed = simplexml_load_string( $content );
8080 // Update local cache, notify users, etc.
@@ -122,7 +122,7 @@ class My_Feed_Reader {
122122 * Verify subscription requests.
123123 */
124124 public function verify( $allow, $subscription_id, $topic, $mode ) {
125- if ( ! str_starts_with ( $subscription_id, 'my-reader-' ) ) {
125+ if ( 0 !== strpos ( $subscription_id, 'my-reader-' ) ) {
126126 return $allow;
127127 }
128128
@@ -134,7 +134,7 @@ class My_Feed_Reader {
134134 * Provide secret for signature verification.
135135 */
136136 public function get_secret( $secret, $subscription_id ) {
137- if ( str_starts_with ( $subscription_id, 'my-reader-' ) ) {
137+ if ( 0 === strpos ( $subscription_id, 'my-reader-' ) ) {
138138 return get_option( 'my_reader_secret_' . $subscription_id, '' );
139139 }
140140 return $secret;
@@ -144,7 +144,7 @@ class My_Feed_Reader {
144144 * Handle subscription verification success.
145145 */
146146 public function subscription_verified( $subscription_id, $topic, $lease_seconds, $mode ) {
147- if ( ! str_starts_with ( $subscription_id, 'my-reader-' ) ) {
147+ if ( 0 !== strpos ( $subscription_id, 'my-reader-' ) ) {
148148 return;
149149 }
150150
@@ -160,7 +160,7 @@ class My_Feed_Reader {
160160 * Handle received content.
161161 */
162162 public function handle_content( $subscription_id, $topic, $content, $content_type ) {
163- if ( ! str_starts_with ( $subscription_id, 'my-reader-' ) ) {
163+ if ( 0 !== strpos ( $subscription_id, 'my-reader-' ) ) {
164164 return;
165165 }
166166
0 commit comments