← All changes
|
classes/Controllers/Frontend/Restrictions/MainQuery.php
+10
-8
2.0.12
→
2.6.1
View file →
| @@ -86,16 +86,18 @@ | ||
| 86 | 86 | * @param \ContentControl\Models\Restriction $restriction Restriction object. |
| 87 | 87 | */ |
| 88 | 88 | do_action( 'content_control/restrict_main_query', $restriction ); |
| 89 | 89 | |
| 90 | - switch ( $restriction->protection_method ) { | |
| 90 | + $method = $restriction->get_setting( 'protectionMethod' ); | |
| 91 | + | |
| 92 | + switch ( $method ) { | |
| 91 | 93 | case 'redirect': |
| 92 | - redirect( $restriction->redirect_type, $restriction->redirect_url ); | |
| 94 | + redirect( $restriction->get_setting( 'redirectType' ), $restriction->get_setting( 'redirectUrl' ) ); | |
| 93 | 95 | return; |
| 94 | 96 | |
| 95 | 97 | case 'replace': |
| 96 | - if ( 'page' === $restriction->replacement_type ) { | |
| 97 | - set_query_to_page( $restriction->replacement_page ); | |
| 98 | + if ( 'page' === $restriction->get_setting( 'replacementType' ) ) { | |
| 99 | + set_query_to_page( $restriction->get_setting( 'replacementPage' ) ); | |
| 98 | 100 | return; |
| 99 | 101 | } |
| 100 | 102 | } |
| 101 | 103 | } |
| @@ -140,9 +142,9 @@ | ||
| 140 | 142 | * @var \ContentControl\Models\Restriction |
| 141 | 143 | */ |
| 142 | 144 | $restriction = $post_restriction['restriction']; |
| 143 | 145 | |
| 144 | - if ( 'redirect' === $restriction->archive_handling || 'replace_archive_page' === $restriction->archive_handling ) { | |
| 146 | + if ( 'redirect' === $restriction->get_setting( 'archiveHandling' ) || 'replace_archive_page' === $restriction->get_setting( 'archiveHandling' ) ) { | |
| 145 | 147 | $restriction_match = $post_restriction; |
| 146 | 148 | break; |
| 147 | 149 | } |
| 148 | 150 | } |
| @@ -179,14 +181,14 @@ | ||
| 179 | 181 | * @param int[] $post_id Post ID. |
| 180 | 182 | */ |
| 181 | 183 | do_action( 'content_control/restrict_main_query_post', $restriction, $post_ids ); |
| 182 | 184 | |
| 183 | - switch ( $restriction->archive_handling ) { | |
| 185 | + switch ( $restriction->get_setting( 'archiveHandling' ) ) { | |
| 184 | 186 | case 'replace_archive_page': |
| 185 | - set_query_to_page( $restriction->archive_replacement_page ); | |
| 187 | + set_query_to_page( $restriction->get_setting( 'archiveReplacementPage' ) ); | |
| 186 | 188 | break; |
| 187 | 189 | case 'redirect': |
| 188 | - redirect( $restriction->archive_redirect_type, $restriction->archive_redirect_url ); | |
| 190 | + redirect( $restriction->get_setting( 'archiveRedirectType' ), $restriction->get_setting( 'archiveRedirectUrl' ) ); | |
| 189 | 191 | break; |
| 190 | 192 | } |
| 191 | 193 | } |
| 192 | 194 | } |