← All changes
|
features/content-restriction/content-restriction.php
+139
-83
3.9.8
→
4.0.3
View file →
| @@ -59,14 +59,24 @@ | ||
| 59 | 59 | |
| 60 | 60 | $wppb_content_restriction_settings = get_option( 'wppb_content_restriction_settings', 'not_found' ); |
| 61 | 61 | |
| 62 | 62 | ?> |
| 63 | - <div class="wrap wppb-content-restriction-wrap"> | |
| 64 | - <h2> | |
| 65 | - <?php esc_html_e( 'Content Restriction Settings', 'profile-builder' ); ?> | |
| 66 | - <a href="https://www.cozmoslabs.com/docs/profile-builder-2/general-settings/content-restriction/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a> | |
| 67 | - </h2> | |
| 63 | + <div class="wrap wppb-content-restriction-wrap cozmoslabs-wrap"> | |
| 68 | 64 | |
| 65 | + <h1></h1> | |
| 66 | + <!-- WordPress Notices are added after the h1 tag --> | |
| 67 | + | |
| 68 | + <div class="cozmoslabs-page-header"> | |
| 69 | + <div class="cozmoslabs-section-title"> | |
| 70 | + | |
| 71 | + <h2 class="cozmoslabs-page-title"> | |
| 72 | + <?php esc_html_e( 'Content Restriction Settings', 'profile-builder' ); ?> | |
| 73 | + <a href="https://www.cozmoslabs.com/docs/profile-builder/general-settings/content-restriction/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a> | |
| 74 | + </h2> | |
| 75 | + | |
| 76 | + </div> | |
| 77 | + </div> | |
| 78 | + | |
| 69 | 79 | <?php settings_errors(); ?> |
| 70 | 80 | |
| 71 | 81 | <?php wppb_generate_settings_tabs() ?> |
| 72 | 82 | |
| @@ -72,110 +82,141 @@ | ||
| 72 | 82 | |
| 73 | 83 | <form method="post" action="options.php"> |
| 74 | 84 | <?php settings_fields( 'wppb_content_restriction_settings' ); ?> |
| 75 | 85 | |
| 76 | - <div id="wppb-settings-content-restriction"> | |
| 86 | + <div class="cozmoslabs-settings-container"> | |
| 77 | 87 | |
| 78 | - <?php | |
| 79 | - $wppb_generalSettings = get_option( 'wppb_general_settings' ); | |
| 80 | - $content_restriction_activated = 'no'; | |
| 81 | - if( !empty( $wppb_content_restriction_settings['contentRestriction'] ) ){ | |
| 82 | - $content_restriction_activated = $wppb_content_restriction_settings['contentRestriction']; | |
| 83 | - } | |
| 84 | - elseif( !empty( $wppb_generalSettings['contentRestriction'] ) ){ | |
| 85 | - $content_restriction_activated = $wppb_generalSettings['contentRestriction']; | |
| 86 | - } | |
| 87 | - ?> | |
| 88 | - <div class="wppb-restriction-fields-group"> | |
| 89 | - <label class="wppb-restriction-label" for="contentRestrictionSelect"><?php esc_html_e( 'Enable Content Restriction', 'profile-builder' ); ?></label> | |
| 90 | - <div class="wppb-restriction-activated"> | |
| 91 | - <select id="contentRestrictionSelect" name="wppb_content_restriction_settings[contentRestriction]"> | |
| 92 | - <option value="no" <?php if( $content_restriction_activated == 'no' ) echo 'selected'; ?>><?php esc_html_e( 'No', 'profile-builder' ); ?></option> | |
| 93 | - <option value="yes" <?php if( $content_restriction_activated == 'yes' ) echo 'selected'; ?>><?php esc_html_e( 'Yes', 'profile-builder' ); ?></option> | |
| 94 | - </select> | |
| 95 | - <p class="description"><?php esc_html_e( 'Activate Content Restriction', 'profile-builder' ); ?></p> | |
| 88 | + <div class="cozmoslabs-settings"> | |
| 89 | + | |
| 90 | + <div class="cozmoslabs-form-subsection-wrapper cozmoslabs-no-title-section" id="wppb-content-restriction-settings"> | |
| 91 | + | |
| 92 | + <?php | |
| 93 | + $wppb_generalSettings = get_option( 'wppb_general_settings' ); | |
| 94 | + $content_restriction_activated = 'no'; | |
| 95 | + if( !empty( $wppb_content_restriction_settings['contentRestriction'] ) ){ | |
| 96 | + $content_restriction_activated = $wppb_content_restriction_settings['contentRestriction']; | |
| 97 | + } | |
| 98 | + elseif( !empty( $wppb_generalSettings['contentRestriction'] ) ){ | |
| 99 | + $content_restriction_activated = $wppb_generalSettings['contentRestriction']; | |
| 100 | + } | |
| 101 | + ?> | |
| 102 | + | |
| 103 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch"> | |
| 104 | + <label class="cozmoslabs-form-field-label" for="contentRestrictionSelect"><?php esc_html_e( 'Content Restriction', 'profile-builder' ); ?></label> | |
| 105 | + | |
| 106 | + <div class="cozmoslabs-toggle-container"> | |
| 107 | + <input type="checkbox" name="wppb_content_restriction_settings[contentRestriction]" id="contentRestrictionSelect" value="yes" <?php echo ( $content_restriction_activated == 'yes' ) ? 'checked' : ''; ?> > | |
| 108 | + <label class="cozmoslabs-toggle-track" for="contentRestrictionSelect"></label> | |
| 109 | + </div> | |
| 110 | + | |
| 111 | + <div class="cozmoslabs-toggle-description"> | |
| 112 | + <label for="contentRestrictionSelect" class="cozmoslabs-description"><?php esc_html_e( 'Activate Content Restriction.', 'profile-builder' ); ?></label> | |
| 113 | + </div> | |
| 96 | 114 | </div> |
| 97 | - </div> | |
| 98 | 115 | |
| 99 | - <div class="wppb-restriction-fields-group"> | |
| 100 | - <label class="wppb-restriction-label"><?php esc_html_e( 'Type of Restriction', 'profile-builder' ); ?></label> | |
| 116 | + <div class="cozmoslabs-form-field-wrapper"> | |
| 117 | + <label class="cozmoslabs-form-field-label"><?php esc_html_e( 'Type of Restriction', 'profile-builder' ); ?></label> | |
| 101 | 118 | |
| 102 | - <div class="wppb-restriction-type"> | |
| 103 | - <label for="wppb-content-restrict-type-message"> | |
| 104 | - <input type="radio" id="wppb-content-restrict-type-message" value="message" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' && $wppb_content_restriction_settings['restrict_type'] == 'message' ) ? 'checked="checked"' : '' ); ?> name="wppb_content_restriction_settings[restrict_type]"> | |
| 105 | - <?php esc_html_e( 'Message', 'profile-builder' ); ?> | |
| 106 | - </label> | |
| 119 | + <div class="cozmoslabs-radio-inputs-row"> | |
| 120 | + <label for="wppb-content-restrict-type-message"> | |
| 121 | + <input type="radio" id="wppb-content-restrict-type-message" value="message" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' && $wppb_content_restriction_settings['restrict_type'] == 'message' ) ? 'checked="checked"' : '' ); ?> name="wppb_content_restriction_settings[restrict_type]"> | |
| 122 | + <?php esc_html_e( 'Message', 'profile-builder' ); ?> | |
| 123 | + </label> | |
| 107 | 124 | |
| 108 | - <label for="wppb-content-restrict-type-redirect"> | |
| 109 | - <input type="radio" id="wppb-content-restrict-type-redirect" value="redirect" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' && $wppb_content_restriction_settings['restrict_type'] == 'redirect' ) ? 'checked="checked"' : '' ); ?> name="wppb_content_restriction_settings[restrict_type]"> | |
| 110 | - <?php esc_html_e( 'Redirect', 'profile-builder' ); ?> | |
| 111 | - </label> | |
| 125 | + <label for="wppb-content-restrict-type-redirect"> | |
| 126 | + <input type="radio" id="wppb-content-restrict-type-redirect" value="redirect" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' && $wppb_content_restriction_settings['restrict_type'] == 'redirect' ) ? 'checked="checked"' : '' ); ?> name="wppb_content_restriction_settings[restrict_type]"> | |
| 127 | + <?php esc_html_e( 'Redirect', 'profile-builder' ); ?> | |
| 128 | + </label> | |
| 129 | + </div> | |
| 112 | 130 | |
| 113 | - <p class="description" style="margin-top: 10px;"><?php echo esc_html__( 'If you select "Message", the post\'s content will be protected by being replaced with a custom message.', 'profile-builder' ); ?></p> | |
| 114 | - <p class="description"><?php echo esc_html__( 'If you select "Redirect", the post\'s content will be protected by redirecting the user to the URL you specify. The redirect happens only when accessing a single post. On archive pages the restriction message will be displayed, instead of the content.', 'profile-builder' ); ?></p> | |
| 115 | - </div> | |
| 116 | - </div> | |
| 131 | + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php echo esc_html__( 'If you select "Message", the post\'s content will be protected by being replaced with a custom message.', 'profile-builder' ); ?></p> | |
| 132 | + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php echo esc_html__( 'If you select "Redirect", the post\'s content will be protected by redirecting the user to the URL you specify. The redirect happens only when accessing a single post. On archive pages the restriction message will be displayed, instead of the content.', 'profile-builder' ); ?></p> | |
| 133 | + </div> | |
| 117 | 134 | |
| 118 | - <div class="wppb-restriction-fields-group"> | |
| 119 | - <label class="wppb-restriction-label"><?php esc_html_e( 'Redirect URL', 'profile-builder' ); ?></label> | |
| 120 | - <input type="text" class="widefat" name="wppb_content_restriction_settings[redirect_url]" value="<?php echo ( ( $wppb_content_restriction_settings != 'not_found' && ! empty( $wppb_content_restriction_settings['redirect_url'] ) ) ? esc_url( $wppb_content_restriction_settings['redirect_url'] ) : '' ); ?>" /> | |
| 121 | - </div> | |
| 135 | + <div class="cozmoslabs-form-field-wrapper"> | |
| 136 | + <label class="cozmoslabs-form-field-label" for="wppb-content-restrict-redirect-url"><?php esc_html_e( 'Redirect URL', 'profile-builder' ); ?></label> | |
| 137 | + <input type="text" id="wppb-content-restrict-redirect-url" class="widefat" name="wppb_content_restriction_settings[redirect_url]" value="<?php echo ( ( $wppb_content_restriction_settings != 'not_found' && ! empty( $wppb_content_restriction_settings['redirect_url'] ) ) ? esc_url( $wppb_content_restriction_settings['redirect_url'] ) : '' ); ?>" /> | |
| 122 | 138 | |
| 123 | - <div class="wppb-restriction-fields-group"> | |
| 124 | - <label class="wppb-restriction-label"><?php esc_html_e( 'Message for logged-out users', 'profile-builder' ); ?></label> | |
| 125 | - <?php wp_editor( wppb_get_restriction_content_message( 'logged_out' ), 'message_logged_out', array( 'textarea_name' => 'wppb_content_restriction_settings[message_logged_out]', 'editor_height' => 250 ) ); ?> | |
| 126 | - </div> | |
| 139 | + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php echo esc_html__( 'The URL where the user will be redirected if a redirect restriction is selected above.', 'profile-builder' ); ?></p> | |
| 140 | + </div> | |
| 127 | 141 | |
| 128 | - <div class="wppb-restriction-fields-group"> | |
| 129 | - <label class="wppb-restriction-label"><?php esc_html_e( 'Message for logged-in users', 'profile-builder' ); ?></label> | |
| 130 | - <?php wp_editor( wppb_get_restriction_content_message( 'logged_in' ), 'message_logged_in', array( 'textarea_name' => 'wppb_content_restriction_settings[message_logged_in]', 'editor_height' => 250 ) ); ?> | |
| 131 | - </div> | |
| 142 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-column-radios-wrapper"> | |
| 143 | + <label class="cozmoslabs-form-field-label"><?php esc_html_e( 'Restricted Posts Preview', 'profile-builder' ); ?></label> | |
| 132 | 144 | |
| 133 | - <?php if ( ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) || ( is_plugin_active_for_network('woocommerce/woocommerce.php') ) ) : ?> | |
| 134 | - <h4 class="pms-subsection-title"><?php esc_html_e( 'WooCommerce Restriction Messages', 'profile-builder' ); ?></h4> | |
| 145 | + <div class="cozmoslabs-radio-inputs-column"> | |
| 146 | + <label> | |
| 147 | + <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="none" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'none' ? 'checked' : '' ); ?> /> | |
| 148 | + <?php esc_html_e( 'None', 'profile-builder' ); ?> | |
| 149 | + </label> | |
| 135 | 150 | |
| 136 | - <div class="wppb-restriction-fields-group"> | |
| 151 | + <label> | |
| 152 | + <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="trim-content" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'trim-content' ? 'checked' : '' ); ?> /> | |
| 153 | + <?php echo sprintf( __( 'Show the first %s words of the post\'s content', 'profile-builder' ), '<input name="wppb_content_restriction_settings[post_preview_length]" type="text" value="'. ( $wppb_content_restriction_settings != 'not_found' && ! empty( $wppb_content_restriction_settings['post_preview_length'] ) ? esc_attr( $wppb_content_restriction_settings['post_preview_length'] ) : 20 ) .'" style="width: 50px; height: 25px; min-height: 25px;" />' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 154 | + </label> | |
| 137 | 155 | |
| 138 | - <label class="wppb-restriction-label"><?php esc_html_e( 'Messages for restricted product purchase', 'profile-builder' ); ?></label> | |
| 139 | - <?php wp_editor( wppb_get_restriction_content_message( 'purchasing_restricted' ), 'messages_purchasing_restricted', array( 'textarea_name' => 'wppb_content_restriction_settings[purchasing_restricted]', 'editor_height' => 250 ) ); ?> | |
| 156 | + <label> | |
| 157 | + <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="more-tag" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'more-tag' ? 'checked' : '' ); ?> /> | |
| 158 | + <?php echo esc_html__( 'Show the content before the "more" tag', 'profile-builder' ); ?> | |
| 159 | + </label> | |
| 160 | + </div> | |
| 140 | 161 | |
| 162 | + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php echo esc_html__( 'Show a portion of the restricted post to logged-out users or users that are not allowed to see it.', 'profile-builder' ); ?></p> | |
| 163 | + </div> | |
| 164 | + | |
| 165 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch"> | |
| 166 | + <label class="cozmoslabs-form-field-label" for="excludeRestrictedPosts"><?php esc_html_e( 'Exclude Restricted Posts from Queries', 'profile-builder' ); ?></label> | |
| 167 | + | |
| 168 | + <div class="cozmoslabs-toggle-container"> | |
| 169 | + <input type="checkbox" name="wppb_content_restriction_settings[excludePosts]" id="excludeRestrictedPosts" value="yes" <?php echo ( isset( $wppb_content_restriction_settings['excludePosts'] ) && $wppb_content_restriction_settings['excludePosts'] == 'yes' ) ? 'checked' : ''; ?> > | |
| 170 | + <label class="cozmoslabs-toggle-track" for="excludeRestrictedPosts"></label> | |
| 171 | + </div> | |
| 172 | + | |
| 173 | + <div class="cozmoslabs-toggle-description"> | |
| 174 | + <label for="excludeRestrictedPosts" class="cozmoslabs-description"><?php esc_html_e( 'Activate this option to exclude the restricted posts from default WordPress and WooCommerce queries.', 'profile-builder' ); ?></label> | |
| 175 | + </div> | |
| 176 | + </div> | |
| 177 | + | |
| 178 | + <?php do_action( 'wppb_extra_content_restriction_settings', $wppb_content_restriction_settings ); ?> | |
| 179 | + | |
| 141 | 180 | </div> |
| 142 | - <?php endif; ?> | |
| 143 | 181 | |
| 144 | - <div class="wppb-restriction-fields-group"> | |
| 145 | - <label class="wppb-restriction-label" for="restricted-posts-preview"><?php esc_html_e( 'Restricted Posts Preview', 'profile-builder' ) ?></label> | |
| 182 | + <div class="cozmoslabs-form-subsection-wrapper cozmoslabs-wysiwyg-container"> | |
| 183 | + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Message for logged-out users', 'profile-builder' ); ?></h4> | |
| 146 | 184 | |
| 147 | - <div class="wppb-restriction-post-preview"> | |
| 148 | - <div> | |
| 149 | - <label> | |
| 150 | - <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="none" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'none' ? 'checked' : '' ); ?> /> | |
| 151 | - <span><?php esc_html_e( 'None', 'profile-builder' ); ?></span> | |
| 152 | - </label> | |
| 185 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-wysiwyg-wrapper"> | |
| 186 | + <?php wp_editor( wppb_get_restriction_content_message( 'logged_out' ), 'message_logged_out', array( 'textarea_name' => 'wppb_content_restriction_settings[message_logged_out]', 'editor_height' => 180 ) ); ?> | |
| 153 | 187 | </div> |
| 188 | + </div> | |
| 154 | 189 | |
| 155 | - <div> | |
| 156 | - <label> | |
| 157 | - <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="trim-content" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'trim-content' ? 'checked' : '' ); ?> /> | |
| 190 | + <div class="cozmoslabs-form-subsection-wrapper cozmoslabs-wysiwyg-container"> | |
| 191 | + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Message for logged-in users', 'profile-builder' ); ?></h4> | |
| 158 | 192 | |
| 159 | - <span> | |
| 160 | - <?php echo sprintf( __( 'Show the first %s words of the post\'s content', 'profile-builder' ), '<input name="wppb_content_restriction_settings[post_preview_length]" type="text" value="'. ( $wppb_content_restriction_settings != 'not_found' && ! empty( $wppb_content_restriction_settings['post_preview_length'] ) ? esc_attr( $wppb_content_restriction_settings['post_preview_length'] ) : 20 ) .'" style="width: 50px;" />' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 161 | - </span> | |
| 162 | - </label> | |
| 193 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-wysiwyg-wrapper"> | |
| 194 | + <?php wp_editor( wppb_get_restriction_content_message( 'logged_in' ), 'message_logged_in', array( 'textarea_name' => 'wppb_content_restriction_settings[message_logged_in]', 'editor_height' => 180 ) ); ?> | |
| 163 | 195 | </div> |
| 196 | + </div> | |
| 164 | 197 | |
| 165 | - <div> | |
| 166 | - <label> | |
| 167 | - <input type="radio" name="wppb_content_restriction_settings[post_preview]" value="more-tag" <?php echo ( ( $wppb_content_restriction_settings != 'not_found' ) && $wppb_content_restriction_settings['post_preview'] == 'more-tag' ? 'checked' : '' ); ?> /> | |
| 168 | - <span><?php echo esc_html__( 'Show the content before the "more" tag', 'profile-builder' ); ?></span> | |
| 169 | - </label> | |
| 198 | + <?php if ( ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) || ( is_plugin_active_for_network('woocommerce/woocommerce.php') ) ) : ?> | |
| 199 | + <div class="cozmoslabs-form-subsection-wrapper cozmoslabs-wysiwyg-container"> | |
| 200 | + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Message for WooCommerce Restricted Product Purchase', 'profile-builder' ); ?></h4> | |
| 201 | + | |
| 202 | + <div class="cozmoslabs-form-field-wrapper cozmoslabs-wysiwyg-wrapper"> | |
| 203 | + <?php wp_editor( wppb_get_restriction_content_message( 'purchasing_restricted' ), 'messages_purchasing_restricted', array( 'textarea_name' => 'wppb_content_restriction_settings[purchasing_restricted]', 'editor_height' => 180 ) ); ?> | |
| 204 | + </div> | |
| 170 | 205 | </div> |
| 206 | + <?php endif; ?> | |
| 171 | 207 | |
| 172 | - <p class="description"><?php echo esc_html__( 'Show a portion of the restricted post to logged-out users or users that are not allowed to see it.', 'profile-builder' ); ?></p> | |
| 208 | + </div> | |
| 209 | + | |
| 210 | + <div class="submit cozmoslabs-submit"> | |
| 211 | + <h3 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Update Settings', 'profile-builder' ) ?></h3> | |
| 212 | + <div class="cozmoslabs-publish-button-group"> | |
| 213 | + <?php submit_button( __( 'Save Changes', 'profile-builder' ) ); ?> | |
| 173 | 214 | </div> |
| 174 | 215 | </div> |
| 216 | + | |
| 175 | 217 | </div> |
| 176 | 218 | |
| 177 | - <?php submit_button( __( 'Save Changes', 'profile-builder' ) ); ?> | |
| 178 | 219 | </form> |
| 179 | 220 | </div> |
| 180 | 221 | <?php |
| 181 | 222 | |
| @@ -182,10 +223,25 @@ | ||
| 182 | 223 | } |
| 183 | 224 | |
| 184 | 225 | function wppb_content_restriction_scripts_styles($hook_suffix) { |
| 185 | 226 | //Check if it's an editing or adding new post page |
| 186 | - if( $hook_suffix === 'post-new.php' || $hook_suffix === 'edit.php' || ( $hook_suffix === 'post.php' && isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) || ( isset( $_GET['page'] ) && $_GET['page'] === 'profile-builder-content_restriction' ) ){ | |
| 187 | - wp_enqueue_script( 'wppb_content_restriction_js', plugin_dir_url( __FILE__ ) .'assets/js/content-restriction.js', array( 'jquery' ), PROFILE_BUILDER_VERSION ); | |
| 188 | - wp_enqueue_style( 'wppb_content_restriction_css', plugin_dir_url( __FILE__ ) .'assets/css/content-restriction.css', array(), PROFILE_BUILDER_VERSION ); | |
| 227 | + if( $hook_suffix === 'post-new.php' || $hook_suffix === 'edit.php' || $hook_suffix === 'edit-tags.php' || $hook_suffix === 'term.php' || ( $hook_suffix === 'post.php' && isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) || ( isset( $_GET['page'] ) && $_GET['page'] === 'profile-builder-content_restriction' ) ){ | |
| 228 | + wp_enqueue_script( 'wppb_content_restriction_js', plugin_dir_url( __FILE__ ) .'assets/js/content-restriction.js', array( 'jquery' ), PROFILE_BUILDER_VERSION ); | |
| 229 | + wp_enqueue_style( 'wppb_content_restriction_css', plugin_dir_url( __FILE__ ) .'assets/css/content-restriction.css', array(), PROFILE_BUILDER_VERSION ); | |
| 230 | + | |
| 231 | + wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', array(), PROFILE_BUILDER_VERSION ); | |
| 189 | 232 | } |
| 190 | 233 | } |
| 191 | 234 | |
| 235 | +// Declare HPOS compatibility | |
| 236 | +add_action( 'before_woocommerce_init', 'wppb_woo_declare_hpos_compatibility' ); | |
| 237 | +function wppb_woo_declare_hpos_compatibility() { | |
| 238 | + | |
| 239 | + $plugin_slug = 'profile-builder/index.php'; | |
| 240 | + | |
| 241 | + if( defined( 'PROFILE_BUILDER_PAID_VERSION' ) && PROFILE_BUILDER_PAID_VERSION == 'dev' ) | |
| 242 | + $plugin_slug = 'profile-builder-dev/index.php'; | |
| 243 | + | |
| 244 | + if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) | |
| 245 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $plugin_slug, true ); | |
| 246 | + | |
| 247 | +} | |