@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | namespace Subway; |
21 | 21 | |
22 | 22 | if (! defined('ABSPATH') ) { |
23 | - return; |
|
23 | + return; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -36,116 +36,116 @@ discard block |
||
36 | 36 | final class PageRedirect |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Redirects pages into our login page. |
|
41 | - * |
|
42 | - * @return void. |
|
43 | - */ |
|
44 | - public static function index() |
|
45 | - { |
|
39 | + /** |
|
40 | + * Redirects pages into our login page. |
|
41 | + * |
|
42 | + * @return void. |
|
43 | + */ |
|
44 | + public static function index() |
|
45 | + { |
|
46 | 46 | |
47 | - // Additional filter for custom pages, taxonomy, links, parameterized urls, etc. |
|
48 | - // Callback function/method must return true (boolean) to disable redirect. |
|
49 | - $should_exit = apply_filters( 'subway/classes/subway-page-redirect/index/before-page-redirect', false ); |
|
47 | + // Additional filter for custom pages, taxonomy, links, parameterized urls, etc. |
|
48 | + // Callback function/method must return true (boolean) to disable redirect. |
|
49 | + $should_exit = apply_filters( 'subway/classes/subway-page-redirect/index/before-page-redirect', false ); |
|
50 | 50 | |
51 | - if ( $should_exit ) { |
|
52 | - return; |
|
53 | - } |
|
51 | + if ( $should_exit ) { |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - // Only execute for non logged in users. |
|
56 | - if (is_user_logged_in() ) { |
|
57 | - return; |
|
58 | - } |
|
55 | + // Only execute for non logged in users. |
|
56 | + if (is_user_logged_in() ) { |
|
57 | + return; |
|
58 | + } |
|
59 | 59 | |
60 | - $queried_id = get_queried_object_id(); |
|
60 | + $queried_id = get_queried_object_id(); |
|
61 | 61 | |
62 | - $current_post = get_post(absint($queried_id)); |
|
62 | + $current_post = get_post(absint($queried_id)); |
|
63 | 63 | |
64 | - $login_page_id = absint(get_option('subway_login_page')); |
|
64 | + $login_page_id = absint(get_option('subway_login_page')); |
|
65 | 65 | |
66 | - $excluded_page = Options::getPublicPostsIdentifiers(); |
|
66 | + $excluded_page = Options::getPublicPostsIdentifiers(); |
|
67 | 67 | |
68 | - // Already escaped inside 'subway_get_redirect_page_url'. |
|
69 | - $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
|
68 | + // Already escaped inside 'subway_get_redirect_page_url'. |
|
69 | + $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
|
70 | 70 | |
71 | 71 | $is_private = Metabox::isPostPrivate( $current_post->ID ); |
72 | 72 | |
73 | - // do_action( 'subway/classes/subway-page-redirect/index/before_page_redirect' ); |
|
74 | - |
|
75 | - // Turn off if is in 'wc-ajax' (woocommerce) |
|
76 | - if ( function_exists( 'is_ajax') ) { |
|
77 | - if ( is_ajax() ) { |
|
78 | - return; |
|
79 | - } |
|
80 | - } |
|
81 | - |
|
82 | - // Same for normal ajax requests. |
|
83 | - if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
84 | - return; |
|
85 | - } |
|
86 | - |
|
87 | - // Exit if site is public. |
|
88 | - if ( Options::isPublicSite() ) { |
|
89 | - return; |
|
90 | - } |
|
91 | - |
|
92 | - // Check if redirect page is empty or not. |
|
93 | - if ( empty( $redirect_page ) ) { |
|
94 | - return; |
|
95 | - } |
|
96 | - |
|
97 | - // Check if buddypress activate page. |
|
98 | - if (function_exists('bp_is_activation_page') ) { |
|
99 | - if (bp_is_activation_page() ) { |
|
100 | - return; |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - // Check if buddypress registration page. |
|
105 | - if (function_exists('bp_is_register_page') ) { |
|
106 | - if (bp_is_register_page() ) { |
|
107 | - return; |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - // Assign 0 value to empty $post->ID to prevent exception. |
|
112 | - // This applies to custom WordPress pages such as BP Members Page and Groups. |
|
113 | - if (empty($current_post) ) { |
|
114 | - $current_post = new \stdclass; |
|
115 | - $current_post->ID = 0; |
|
116 | - } |
|
117 | - |
|
118 | - $current_page_id = absint($current_post->ID); |
|
119 | - |
|
120 | - // Check if $current_page_id && $selected_blog_id is equal to each other. |
|
121 | - // Get the page ID instead of global $post->ID that the query returns. |
|
122 | - // The ID of the first post object inside the loop is not correct. |
|
123 | - $blog_id = absint(get_option('page_for_posts')); |
|
124 | - |
|
125 | - if (is_home() ) { |
|
126 | - if ($blog_id === $login_page_id ) { |
|
127 | - $current_page_id = $blog_id; |
|
128 | - } |
|
129 | - } |
|
130 | - |
|
131 | - // Only execute the script for non-loggedin visitors. |
|
132 | - if ( ! is_user_logged_in() ) { |
|
133 | - |
|
134 | - if ($current_page_id !== $login_page_id ) { |
|
135 | - |
|
136 | - if ( ! in_array( $current_page_id, $excluded_page, true ) || in_array( $current_page_id, $excluded_page, true ) && true === $is_private ) { |
|
137 | - |
|
138 | - wp_safe_redirect( |
|
139 | - add_query_arg( |
|
140 | - array( '_redirected' => 'yes' ), |
|
141 | - $redirect_page |
|
142 | - ) |
|
143 | - ); |
|
144 | - |
|
145 | - Helpers::close(); |
|
146 | - } |
|
147 | - } |
|
148 | - } |
|
149 | - } |
|
73 | + // do_action( 'subway/classes/subway-page-redirect/index/before_page_redirect' ); |
|
74 | + |
|
75 | + // Turn off if is in 'wc-ajax' (woocommerce) |
|
76 | + if ( function_exists( 'is_ajax') ) { |
|
77 | + if ( is_ajax() ) { |
|
78 | + return; |
|
79 | + } |
|
80 | + } |
|
81 | + |
|
82 | + // Same for normal ajax requests. |
|
83 | + if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
84 | + return; |
|
85 | + } |
|
86 | + |
|
87 | + // Exit if site is public. |
|
88 | + if ( Options::isPublicSite() ) { |
|
89 | + return; |
|
90 | + } |
|
91 | + |
|
92 | + // Check if redirect page is empty or not. |
|
93 | + if ( empty( $redirect_page ) ) { |
|
94 | + return; |
|
95 | + } |
|
96 | + |
|
97 | + // Check if buddypress activate page. |
|
98 | + if (function_exists('bp_is_activation_page') ) { |
|
99 | + if (bp_is_activation_page() ) { |
|
100 | + return; |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + // Check if buddypress registration page. |
|
105 | + if (function_exists('bp_is_register_page') ) { |
|
106 | + if (bp_is_register_page() ) { |
|
107 | + return; |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + // Assign 0 value to empty $post->ID to prevent exception. |
|
112 | + // This applies to custom WordPress pages such as BP Members Page and Groups. |
|
113 | + if (empty($current_post) ) { |
|
114 | + $current_post = new \stdclass; |
|
115 | + $current_post->ID = 0; |
|
116 | + } |
|
117 | + |
|
118 | + $current_page_id = absint($current_post->ID); |
|
119 | + |
|
120 | + // Check if $current_page_id && $selected_blog_id is equal to each other. |
|
121 | + // Get the page ID instead of global $post->ID that the query returns. |
|
122 | + // The ID of the first post object inside the loop is not correct. |
|
123 | + $blog_id = absint(get_option('page_for_posts')); |
|
124 | + |
|
125 | + if (is_home() ) { |
|
126 | + if ($blog_id === $login_page_id ) { |
|
127 | + $current_page_id = $blog_id; |
|
128 | + } |
|
129 | + } |
|
130 | + |
|
131 | + // Only execute the script for non-loggedin visitors. |
|
132 | + if ( ! is_user_logged_in() ) { |
|
133 | + |
|
134 | + if ($current_page_id !== $login_page_id ) { |
|
135 | + |
|
136 | + if ( ! in_array( $current_page_id, $excluded_page, true ) || in_array( $current_page_id, $excluded_page, true ) && true === $is_private ) { |
|
137 | + |
|
138 | + wp_safe_redirect( |
|
139 | + add_query_arg( |
|
140 | + array( '_redirected' => 'yes' ), |
|
141 | + $redirect_page |
|
142 | + ) |
|
143 | + ); |
|
144 | + |
|
145 | + Helpers::close(); |
|
146 | + } |
|
147 | + } |
|
148 | + } |
|
149 | + } |
|
150 | 150 | |
151 | 151 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | namespace Subway; |
21 | 21 | |
22 | -if (! defined('ABSPATH') ) { |
|
22 | +if ( ! defined('ABSPATH')) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | // Additional filter for custom pages, taxonomy, links, parameterized urls, etc. |
48 | 48 | // Callback function/method must return true (boolean) to disable redirect. |
49 | - $should_exit = apply_filters( 'subway/classes/subway-page-redirect/index/before-page-redirect', false ); |
|
49 | + $should_exit = apply_filters('subway/classes/subway-page-redirect/index/before-page-redirect', false); |
|
50 | 50 | |
51 | - if ( $should_exit ) { |
|
51 | + if ($should_exit) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Only execute for non logged in users. |
56 | - if (is_user_logged_in() ) { |
|
56 | + if (is_user_logged_in()) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
@@ -68,49 +68,49 @@ discard block |
||
68 | 68 | // Already escaped inside 'subway_get_redirect_page_url'. |
69 | 69 | $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
70 | 70 | |
71 | - $is_private = Metabox::isPostPrivate( $current_post->ID ); |
|
71 | + $is_private = Metabox::isPostPrivate($current_post->ID); |
|
72 | 72 | |
73 | 73 | // do_action( 'subway/classes/subway-page-redirect/index/before_page_redirect' ); |
74 | 74 | |
75 | 75 | // Turn off if is in 'wc-ajax' (woocommerce) |
76 | - if ( function_exists( 'is_ajax') ) { |
|
77 | - if ( is_ajax() ) { |
|
76 | + if (function_exists('is_ajax')) { |
|
77 | + if (is_ajax()) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | 82 | // Same for normal ajax requests. |
83 | - if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
83 | + if (is_admin() && defined('DOING_AJAX') && DOING_AJAX) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // Exit if site is public. |
88 | - if ( Options::isPublicSite() ) { |
|
88 | + if (Options::isPublicSite()) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | 92 | // Check if redirect page is empty or not. |
93 | - if ( empty( $redirect_page ) ) { |
|
93 | + if (empty($redirect_page)) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | // Check if buddypress activate page. |
98 | - if (function_exists('bp_is_activation_page') ) { |
|
99 | - if (bp_is_activation_page() ) { |
|
98 | + if (function_exists('bp_is_activation_page')) { |
|
99 | + if (bp_is_activation_page()) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | // Check if buddypress registration page. |
105 | - if (function_exists('bp_is_register_page') ) { |
|
106 | - if (bp_is_register_page() ) { |
|
105 | + if (function_exists('bp_is_register_page')) { |
|
106 | + if (bp_is_register_page()) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | 111 | // Assign 0 value to empty $post->ID to prevent exception. |
112 | 112 | // This applies to custom WordPress pages such as BP Members Page and Groups. |
113 | - if (empty($current_post) ) { |
|
113 | + if (empty($current_post)) { |
|
114 | 114 | $current_post = new \stdclass; |
115 | 115 | $current_post->ID = 0; |
116 | 116 | } |
@@ -122,22 +122,22 @@ discard block |
||
122 | 122 | // The ID of the first post object inside the loop is not correct. |
123 | 123 | $blog_id = absint(get_option('page_for_posts')); |
124 | 124 | |
125 | - if (is_home() ) { |
|
126 | - if ($blog_id === $login_page_id ) { |
|
125 | + if (is_home()) { |
|
126 | + if ($blog_id === $login_page_id) { |
|
127 | 127 | $current_page_id = $blog_id; |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Only execute the script for non-loggedin visitors. |
132 | - if ( ! is_user_logged_in() ) { |
|
132 | + if ( ! is_user_logged_in()) { |
|
133 | 133 | |
134 | - if ($current_page_id !== $login_page_id ) { |
|
134 | + if ($current_page_id !== $login_page_id) { |
|
135 | 135 | |
136 | - if ( ! in_array( $current_page_id, $excluded_page, true ) || in_array( $current_page_id, $excluded_page, true ) && true === $is_private ) { |
|
136 | + if ( ! in_array($current_page_id, $excluded_page, true) || in_array($current_page_id, $excluded_page, true) && true === $is_private) { |
|
137 | 137 | |
138 | 138 | wp_safe_redirect( |
139 | 139 | add_query_arg( |
140 | - array( '_redirected' => 'yes' ), |
|
140 | + array('_redirected' => 'yes'), |
|
141 | 141 | $redirect_page |
142 | 142 | ) |
143 | 143 | ); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | namespace Subway; |
22 | 22 | |
23 | 23 | if (! defined('ABSPATH') ) { |
24 | - return; |
|
24 | + return; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -37,116 +37,116 @@ discard block |
||
37 | 37 | final class Metabox |
38 | 38 | { |
39 | 39 | |
40 | - /** |
|
41 | - * Subway visibility meta value, |
|
42 | - * |
|
43 | - * @since 2.0.9 |
|
44 | - * @const string VISIBILITY_METAKEY |
|
45 | - */ |
|
46 | - const VISIBILITY_METAKEY = 'subway_visibility_meta_key'; |
|
47 | - |
|
48 | - /** |
|
49 | - * Registers and update metabox with its intended method below. |
|
50 | - * |
|
51 | - * @since 2.0.9 |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function __construct() |
|
55 | - { |
|
56 | - add_action( |
|
57 | - 'add_meta_boxes', |
|
58 | - array( |
|
59 | - $this, |
|
60 | - 'addMetabox' |
|
61 | - ) |
|
62 | - ); |
|
63 | - add_action( |
|
64 | - 'save_post', |
|
65 | - array( |
|
66 | - $this, |
|
67 | - 'saveMetaboxValues' |
|
68 | - ) |
|
69 | - ); |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * Initialize metabox |
|
74 | - * |
|
75 | - * @since 2.0.9 |
|
76 | - * @access public |
|
77 | - * @return void |
|
78 | - */ |
|
79 | - public static function initMetabox() |
|
80 | - { |
|
81 | - new Metabox(); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * Initialize metabox |
|
86 | - * |
|
87 | - * @since 2.0.9 |
|
88 | - * @access public |
|
89 | - * @return void |
|
90 | - */ |
|
91 | - public function addMetabox() |
|
92 | - { |
|
93 | - $post_types = $this->getPostTypes(); |
|
94 | - |
|
95 | - foreach ( $post_types as $post_type => $value ) { |
|
96 | - add_meta_box( |
|
97 | - 'subway_visibility_metabox', |
|
98 | - esc_html__('Subway: Visibility Option', 'subway'), |
|
99 | - array( $this, 'visibilityMetabox' ), |
|
100 | - $post_type, |
|
101 | - 'side', |
|
102 | - 'low' |
|
103 | - ); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * This method displays the Subway Visibility checkbox. |
|
109 | - * |
|
110 | - * @param object $post Contains data from the current post. |
|
111 | - * |
|
112 | - * @since 2.0.9 |
|
113 | - * @access public |
|
114 | - * @return void |
|
115 | - */ |
|
116 | - public function visibilityMetabox( $post ) |
|
117 | - { |
|
118 | - $howto = __( |
|
119 | - 'Select a radio button to make this post/page public or private', |
|
120 | - 'subway' |
|
121 | - ); |
|
122 | - $public_label = '<strong>'. __('public', 'subway') .'</strong>'; |
|
123 | - $public_setting_label = __( |
|
124 | - 'Select to make this post ', |
|
125 | - 'subway' |
|
126 | - ) . $public_label; |
|
127 | - $private_label = '<strong>'. __('private', 'subway') .'</strong>'; |
|
128 | - $private_setting_label = __( |
|
129 | - 'Select to make this post ', |
|
130 | - 'subway' |
|
131 | - ) . $private_label; |
|
132 | - $is_post_public = self::isPostPublic($post->ID); |
|
133 | - $is_post_private = self::isPostPrivate($post->ID); |
|
134 | - $public_value = ''; |
|
135 | - $private_value = ''; |
|
136 | - |
|
137 | - if ($is_post_public ) { |
|
138 | - $public_value = 'public'; |
|
139 | - } |
|
140 | - if ($is_post_private ) { |
|
141 | - $private_value = 'private'; |
|
142 | - } |
|
143 | - |
|
144 | - // Make sure the form request comes from WordPress |
|
145 | - wp_nonce_field( |
|
146 | - basename(__FILE__), |
|
147 | - 'subway_post_visibility_nonce' |
|
148 | - ); |
|
149 | - ?> |
|
40 | + /** |
|
41 | + * Subway visibility meta value, |
|
42 | + * |
|
43 | + * @since 2.0.9 |
|
44 | + * @const string VISIBILITY_METAKEY |
|
45 | + */ |
|
46 | + const VISIBILITY_METAKEY = 'subway_visibility_meta_key'; |
|
47 | + |
|
48 | + /** |
|
49 | + * Registers and update metabox with its intended method below. |
|
50 | + * |
|
51 | + * @since 2.0.9 |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function __construct() |
|
55 | + { |
|
56 | + add_action( |
|
57 | + 'add_meta_boxes', |
|
58 | + array( |
|
59 | + $this, |
|
60 | + 'addMetabox' |
|
61 | + ) |
|
62 | + ); |
|
63 | + add_action( |
|
64 | + 'save_post', |
|
65 | + array( |
|
66 | + $this, |
|
67 | + 'saveMetaboxValues' |
|
68 | + ) |
|
69 | + ); |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * Initialize metabox |
|
74 | + * |
|
75 | + * @since 2.0.9 |
|
76 | + * @access public |
|
77 | + * @return void |
|
78 | + */ |
|
79 | + public static function initMetabox() |
|
80 | + { |
|
81 | + new Metabox(); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * Initialize metabox |
|
86 | + * |
|
87 | + * @since 2.0.9 |
|
88 | + * @access public |
|
89 | + * @return void |
|
90 | + */ |
|
91 | + public function addMetabox() |
|
92 | + { |
|
93 | + $post_types = $this->getPostTypes(); |
|
94 | + |
|
95 | + foreach ( $post_types as $post_type => $value ) { |
|
96 | + add_meta_box( |
|
97 | + 'subway_visibility_metabox', |
|
98 | + esc_html__('Subway: Visibility Option', 'subway'), |
|
99 | + array( $this, 'visibilityMetabox' ), |
|
100 | + $post_type, |
|
101 | + 'side', |
|
102 | + 'low' |
|
103 | + ); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * This method displays the Subway Visibility checkbox. |
|
109 | + * |
|
110 | + * @param object $post Contains data from the current post. |
|
111 | + * |
|
112 | + * @since 2.0.9 |
|
113 | + * @access public |
|
114 | + * @return void |
|
115 | + */ |
|
116 | + public function visibilityMetabox( $post ) |
|
117 | + { |
|
118 | + $howto = __( |
|
119 | + 'Select a radio button to make this post/page public or private', |
|
120 | + 'subway' |
|
121 | + ); |
|
122 | + $public_label = '<strong>'. __('public', 'subway') .'</strong>'; |
|
123 | + $public_setting_label = __( |
|
124 | + 'Select to make this post ', |
|
125 | + 'subway' |
|
126 | + ) . $public_label; |
|
127 | + $private_label = '<strong>'. __('private', 'subway') .'</strong>'; |
|
128 | + $private_setting_label = __( |
|
129 | + 'Select to make this post ', |
|
130 | + 'subway' |
|
131 | + ) . $private_label; |
|
132 | + $is_post_public = self::isPostPublic($post->ID); |
|
133 | + $is_post_private = self::isPostPrivate($post->ID); |
|
134 | + $public_value = ''; |
|
135 | + $private_value = ''; |
|
136 | + |
|
137 | + if ($is_post_public ) { |
|
138 | + $public_value = 'public'; |
|
139 | + } |
|
140 | + if ($is_post_private ) { |
|
141 | + $private_value = 'private'; |
|
142 | + } |
|
143 | + |
|
144 | + // Make sure the form request comes from WordPress |
|
145 | + wp_nonce_field( |
|
146 | + basename(__FILE__), |
|
147 | + 'subway_post_visibility_nonce' |
|
148 | + ); |
|
149 | + ?> |
|
150 | 150 | |
151 | 151 | <label class="screen-reader-text" for="subway-visibility"> |
152 | 152 | <?php echo esc_html($setting_label); ?> |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | <?php echo checked('public', esc_attr($public_value), false); ?>> |
162 | 162 | |
163 | 163 | <?php |
164 | - echo wp_kses( |
|
165 | - $public_setting_label, |
|
166 | - array( |
|
167 | - 'strong' => array() |
|
168 | - ) |
|
169 | - ); |
|
170 | - ?> |
|
164 | + echo wp_kses( |
|
165 | + $public_setting_label, |
|
166 | + array( |
|
167 | + 'strong' => array() |
|
168 | + ) |
|
169 | + ); |
|
170 | + ?> |
|
171 | 171 | </label><br/> |
172 | 172 | |
173 | 173 | <label class="subway-visibility-settings-checkbox-label" |
@@ -179,188 +179,188 @@ discard block |
||
179 | 179 | <?php echo checked('private', esc_attr($private_value), false); ?>> |
180 | 180 | |
181 | 181 | <?php |
182 | - echo wp_kses( |
|
183 | - $private_setting_label, |
|
184 | - array( 'strong' => array() ) |
|
185 | - ); |
|
186 | - ?> |
|
182 | + echo wp_kses( |
|
183 | + $private_setting_label, |
|
184 | + array( 'strong' => array() ) |
|
185 | + ); |
|
186 | + ?> |
|
187 | 187 | </label> |
188 | 188 | |
189 | 189 | <p class="howto"><?php echo esc_html($howto); ?></p> |
190 | 190 | |
191 | 191 | <?php |
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * This method verify if nonce is valid then updates a post_meta. |
|
196 | - * |
|
197 | - * @param integer $post_id Contains ID of the current post. |
|
198 | - * |
|
199 | - * @since 2.0.9 |
|
200 | - * @access public |
|
201 | - * @return boolean false Returns false if nonce is not valid. |
|
202 | - */ |
|
203 | - public function saveVisibilityMetabox( $post_id = '' ) |
|
204 | - { |
|
205 | - |
|
206 | - $public_posts = Options::getPublicPostsIdentifiers(); |
|
207 | - |
|
208 | - $posts_implode = ''; |
|
209 | - |
|
210 | - $visibility_field = 'subway-visibility-settings'; |
|
211 | - |
|
212 | - $visibility_nonce = filter_input( |
|
213 | - INPUT_POST, |
|
214 | - 'subway_post_visibility_nonce', |
|
215 | - FILTER_SANITIZE_STRING |
|
216 | - ); |
|
217 | - |
|
218 | - $post_visibility = filter_input( |
|
219 | - INPUT_POST, |
|
220 | - $visibility_field, |
|
221 | - FILTER_SANITIZE_STRING |
|
222 | - ); |
|
223 | - |
|
224 | - $is_valid_visibility_nonce = self::isNonceValid( |
|
225 | - $visibility_nonce |
|
226 | - ); |
|
227 | - |
|
228 | - // verify taxonomies meta box nonce |
|
229 | - if (false === $is_valid_visibility_nonce ) { |
|
230 | - return; |
|
231 | - } |
|
232 | - |
|
233 | - if (! empty($post_visibility) ) { |
|
234 | - if (! empty($post_id) ) { |
|
235 | - if ('public' === $post_visibility ) { |
|
236 | - if (! in_array($post_id, $public_posts) ) { |
|
237 | - array_push($public_posts, $post_id); |
|
238 | - } |
|
239 | - } |
|
240 | - if ('private' === $post_visibility ) { |
|
241 | - unset($public_posts[ array_search($post_id, $public_posts) ]); |
|
242 | - } |
|
243 | - } |
|
244 | - } |
|
245 | - |
|
246 | - if (! empty($post_id) ) { |
|
247 | - $posts_implode = implode(", ", $public_posts); |
|
248 | - |
|
249 | - if ('inherit' !== get_post_status($post_id) ) { |
|
250 | - |
|
251 | - if (true === $is_valid_visibility_nonce ) { |
|
252 | - update_option('subway_public_post', $posts_implode); |
|
253 | - update_post_meta( |
|
254 | - $post_id, |
|
255 | - self::VISIBILITY_METAKEY, |
|
256 | - $post_visibility |
|
257 | - ); |
|
258 | - } |
|
259 | - |
|
260 | - } |
|
261 | - } |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * This method runs the methods that handles the update for a post_meta. |
|
266 | - * |
|
267 | - * @param integer $post_id Contains ID of the current post. |
|
268 | - * |
|
269 | - * @since 2.0.9 |
|
270 | - * @access public |
|
271 | - * @return boolean false Returns false if nonce is not valid. |
|
272 | - */ |
|
273 | - public function saveMetaboxValues( $post_id ) |
|
274 | - { |
|
275 | - $this->saveVisibilityMetabox($post_id); |
|
276 | - return; |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Initialize metabox arguments. |
|
281 | - * |
|
282 | - * @param array $args The arguments for the get_post_types(). |
|
283 | - * @param string $output Your desired output for the data. |
|
284 | - * |
|
285 | - * @since 2.0.9 |
|
286 | - * @access public |
|
287 | - * @return void |
|
288 | - */ |
|
289 | - public static function getPostTypes( $args = '', $output = '' ) |
|
290 | - { |
|
291 | - if (empty($args) ) { |
|
292 | - $args = array( |
|
293 | - 'public' => true, |
|
294 | - ); |
|
295 | - $output = 'names'; |
|
296 | - } |
|
297 | - |
|
298 | - $post_types = get_post_types($args, $output); |
|
299 | - |
|
300 | - return $post_types; |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * This method verify if nonce is valid. |
|
305 | - * |
|
306 | - * @param mixed $nonce the name of a metabox nonce. |
|
307 | - * |
|
308 | - * @since 2.0.9 |
|
309 | - * @access public |
|
310 | - * @return boolean true Returns true if nonce is valid. |
|
311 | - */ |
|
312 | - public function isNonceValid( $nonce ) |
|
313 | - { |
|
314 | - if (!isset($nonce) || !wp_verify_nonce($nonce, basename(__FILE__)) ) { |
|
315 | - return; |
|
316 | - } |
|
317 | - |
|
318 | - return true; |
|
319 | - } |
|
320 | - |
|
321 | - /** |
|
322 | - * Checks if a post is set to private. |
|
323 | - * |
|
324 | - * @param integer $post_id Contains ID of the current post. |
|
325 | - * |
|
326 | - * @since 2.0.9 |
|
327 | - * @access public |
|
328 | - * @return boolean true Returns true if post is private. Otherwise false. |
|
329 | - */ |
|
330 | - public static function isPostPrivate( $post_id ) |
|
331 | - { |
|
332 | - $meta_value = ''; |
|
333 | - |
|
334 | - if (! empty($post_id) ) { |
|
335 | - $meta_value = get_post_meta($post_id, self::VISIBILITY_METAKEY, true); |
|
336 | - if ('private' === $meta_value ) { |
|
337 | - return true; |
|
338 | - } |
|
339 | - } |
|
340 | - |
|
341 | - return false; |
|
342 | - } |
|
343 | - |
|
344 | - /** |
|
345 | - * Checks if a post is set to public. |
|
346 | - * |
|
347 | - * @param integer $post_id Contains ID of the current post. |
|
348 | - * |
|
349 | - * @since 2.0.9 |
|
350 | - * @access public |
|
351 | - * @return boolean true Returns true if post is public. Otherwise false. |
|
352 | - */ |
|
353 | - public static function isPostPublic( $post_id ) |
|
354 | - { |
|
355 | - $public_post = Options::getPublicPostsIdentifiers(); |
|
356 | - |
|
357 | - if (! empty($post_id) ) { |
|
358 | - if (! in_array($post_id, $public_post, true) ) { |
|
359 | - return true; |
|
360 | - } |
|
361 | - } |
|
362 | - |
|
363 | - return false; |
|
364 | - } |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * This method verify if nonce is valid then updates a post_meta. |
|
196 | + * |
|
197 | + * @param integer $post_id Contains ID of the current post. |
|
198 | + * |
|
199 | + * @since 2.0.9 |
|
200 | + * @access public |
|
201 | + * @return boolean false Returns false if nonce is not valid. |
|
202 | + */ |
|
203 | + public function saveVisibilityMetabox( $post_id = '' ) |
|
204 | + { |
|
205 | + |
|
206 | + $public_posts = Options::getPublicPostsIdentifiers(); |
|
207 | + |
|
208 | + $posts_implode = ''; |
|
209 | + |
|
210 | + $visibility_field = 'subway-visibility-settings'; |
|
211 | + |
|
212 | + $visibility_nonce = filter_input( |
|
213 | + INPUT_POST, |
|
214 | + 'subway_post_visibility_nonce', |
|
215 | + FILTER_SANITIZE_STRING |
|
216 | + ); |
|
217 | + |
|
218 | + $post_visibility = filter_input( |
|
219 | + INPUT_POST, |
|
220 | + $visibility_field, |
|
221 | + FILTER_SANITIZE_STRING |
|
222 | + ); |
|
223 | + |
|
224 | + $is_valid_visibility_nonce = self::isNonceValid( |
|
225 | + $visibility_nonce |
|
226 | + ); |
|
227 | + |
|
228 | + // verify taxonomies meta box nonce |
|
229 | + if (false === $is_valid_visibility_nonce ) { |
|
230 | + return; |
|
231 | + } |
|
232 | + |
|
233 | + if (! empty($post_visibility) ) { |
|
234 | + if (! empty($post_id) ) { |
|
235 | + if ('public' === $post_visibility ) { |
|
236 | + if (! in_array($post_id, $public_posts) ) { |
|
237 | + array_push($public_posts, $post_id); |
|
238 | + } |
|
239 | + } |
|
240 | + if ('private' === $post_visibility ) { |
|
241 | + unset($public_posts[ array_search($post_id, $public_posts) ]); |
|
242 | + } |
|
243 | + } |
|
244 | + } |
|
245 | + |
|
246 | + if (! empty($post_id) ) { |
|
247 | + $posts_implode = implode(", ", $public_posts); |
|
248 | + |
|
249 | + if ('inherit' !== get_post_status($post_id) ) { |
|
250 | + |
|
251 | + if (true === $is_valid_visibility_nonce ) { |
|
252 | + update_option('subway_public_post', $posts_implode); |
|
253 | + update_post_meta( |
|
254 | + $post_id, |
|
255 | + self::VISIBILITY_METAKEY, |
|
256 | + $post_visibility |
|
257 | + ); |
|
258 | + } |
|
259 | + |
|
260 | + } |
|
261 | + } |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * This method runs the methods that handles the update for a post_meta. |
|
266 | + * |
|
267 | + * @param integer $post_id Contains ID of the current post. |
|
268 | + * |
|
269 | + * @since 2.0.9 |
|
270 | + * @access public |
|
271 | + * @return boolean false Returns false if nonce is not valid. |
|
272 | + */ |
|
273 | + public function saveMetaboxValues( $post_id ) |
|
274 | + { |
|
275 | + $this->saveVisibilityMetabox($post_id); |
|
276 | + return; |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Initialize metabox arguments. |
|
281 | + * |
|
282 | + * @param array $args The arguments for the get_post_types(). |
|
283 | + * @param string $output Your desired output for the data. |
|
284 | + * |
|
285 | + * @since 2.0.9 |
|
286 | + * @access public |
|
287 | + * @return void |
|
288 | + */ |
|
289 | + public static function getPostTypes( $args = '', $output = '' ) |
|
290 | + { |
|
291 | + if (empty($args) ) { |
|
292 | + $args = array( |
|
293 | + 'public' => true, |
|
294 | + ); |
|
295 | + $output = 'names'; |
|
296 | + } |
|
297 | + |
|
298 | + $post_types = get_post_types($args, $output); |
|
299 | + |
|
300 | + return $post_types; |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * This method verify if nonce is valid. |
|
305 | + * |
|
306 | + * @param mixed $nonce the name of a metabox nonce. |
|
307 | + * |
|
308 | + * @since 2.0.9 |
|
309 | + * @access public |
|
310 | + * @return boolean true Returns true if nonce is valid. |
|
311 | + */ |
|
312 | + public function isNonceValid( $nonce ) |
|
313 | + { |
|
314 | + if (!isset($nonce) || !wp_verify_nonce($nonce, basename(__FILE__)) ) { |
|
315 | + return; |
|
316 | + } |
|
317 | + |
|
318 | + return true; |
|
319 | + } |
|
320 | + |
|
321 | + /** |
|
322 | + * Checks if a post is set to private. |
|
323 | + * |
|
324 | + * @param integer $post_id Contains ID of the current post. |
|
325 | + * |
|
326 | + * @since 2.0.9 |
|
327 | + * @access public |
|
328 | + * @return boolean true Returns true if post is private. Otherwise false. |
|
329 | + */ |
|
330 | + public static function isPostPrivate( $post_id ) |
|
331 | + { |
|
332 | + $meta_value = ''; |
|
333 | + |
|
334 | + if (! empty($post_id) ) { |
|
335 | + $meta_value = get_post_meta($post_id, self::VISIBILITY_METAKEY, true); |
|
336 | + if ('private' === $meta_value ) { |
|
337 | + return true; |
|
338 | + } |
|
339 | + } |
|
340 | + |
|
341 | + return false; |
|
342 | + } |
|
343 | + |
|
344 | + /** |
|
345 | + * Checks if a post is set to public. |
|
346 | + * |
|
347 | + * @param integer $post_id Contains ID of the current post. |
|
348 | + * |
|
349 | + * @since 2.0.9 |
|
350 | + * @access public |
|
351 | + * @return boolean true Returns true if post is public. Otherwise false. |
|
352 | + */ |
|
353 | + public static function isPostPublic( $post_id ) |
|
354 | + { |
|
355 | + $public_post = Options::getPublicPostsIdentifiers(); |
|
356 | + |
|
357 | + if (! empty($post_id) ) { |
|
358 | + if (! in_array($post_id, $public_post, true) ) { |
|
359 | + return true; |
|
360 | + } |
|
361 | + } |
|
362 | + |
|
363 | + return false; |
|
364 | + } |
|
365 | 365 | |
366 | 366 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | namespace Subway; |
22 | 22 | |
23 | -if (! defined('ABSPATH') ) { |
|
23 | +if ( ! defined('ABSPATH')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | { |
93 | 93 | $post_types = $this->getPostTypes(); |
94 | 94 | |
95 | - foreach ( $post_types as $post_type => $value ) { |
|
95 | + foreach ($post_types as $post_type => $value) { |
|
96 | 96 | add_meta_box( |
97 | 97 | 'subway_visibility_metabox', |
98 | 98 | esc_html__('Subway: Visibility Option', 'subway'), |
99 | - array( $this, 'visibilityMetabox' ), |
|
99 | + array($this, 'visibilityMetabox'), |
|
100 | 100 | $post_type, |
101 | 101 | 'side', |
102 | 102 | 'low' |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | * @access public |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - public function visibilityMetabox( $post ) |
|
116 | + public function visibilityMetabox($post) |
|
117 | 117 | { |
118 | 118 | $howto = __( |
119 | 119 | 'Select a radio button to make this post/page public or private', |
120 | 120 | 'subway' |
121 | 121 | ); |
122 | - $public_label = '<strong>'. __('public', 'subway') .'</strong>'; |
|
122 | + $public_label = '<strong>' . __('public', 'subway') . '</strong>'; |
|
123 | 123 | $public_setting_label = __( |
124 | 124 | 'Select to make this post ', |
125 | 125 | 'subway' |
126 | 126 | ) . $public_label; |
127 | - $private_label = '<strong>'. __('private', 'subway') .'</strong>'; |
|
127 | + $private_label = '<strong>' . __('private', 'subway') . '</strong>'; |
|
128 | 128 | $private_setting_label = __( |
129 | 129 | 'Select to make this post ', |
130 | 130 | 'subway' |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | $public_value = ''; |
135 | 135 | $private_value = ''; |
136 | 136 | |
137 | - if ($is_post_public ) { |
|
137 | + if ($is_post_public) { |
|
138 | 138 | $public_value = 'public'; |
139 | 139 | } |
140 | - if ($is_post_private ) { |
|
140 | + if ($is_post_private) { |
|
141 | 141 | $private_value = 'private'; |
142 | 142 | } |
143 | 143 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | <?php |
182 | 182 | echo wp_kses( |
183 | 183 | $private_setting_label, |
184 | - array( 'strong' => array() ) |
|
184 | + array('strong' => array()) |
|
185 | 185 | ); |
186 | 186 | ?> |
187 | 187 | </label> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @access public |
201 | 201 | * @return boolean false Returns false if nonce is not valid. |
202 | 202 | */ |
203 | - public function saveVisibilityMetabox( $post_id = '' ) |
|
203 | + public function saveVisibilityMetabox($post_id = '') |
|
204 | 204 | { |
205 | 205 | |
206 | 206 | $public_posts = Options::getPublicPostsIdentifiers(); |
@@ -226,29 +226,29 @@ discard block |
||
226 | 226 | ); |
227 | 227 | |
228 | 228 | // verify taxonomies meta box nonce |
229 | - if (false === $is_valid_visibility_nonce ) { |
|
229 | + if (false === $is_valid_visibility_nonce) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - if (! empty($post_visibility) ) { |
|
234 | - if (! empty($post_id) ) { |
|
235 | - if ('public' === $post_visibility ) { |
|
236 | - if (! in_array($post_id, $public_posts) ) { |
|
233 | + if ( ! empty($post_visibility)) { |
|
234 | + if ( ! empty($post_id)) { |
|
235 | + if ('public' === $post_visibility) { |
|
236 | + if ( ! in_array($post_id, $public_posts)) { |
|
237 | 237 | array_push($public_posts, $post_id); |
238 | 238 | } |
239 | 239 | } |
240 | - if ('private' === $post_visibility ) { |
|
241 | - unset($public_posts[ array_search($post_id, $public_posts) ]); |
|
240 | + if ('private' === $post_visibility) { |
|
241 | + unset($public_posts[array_search($post_id, $public_posts)]); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | - if (! empty($post_id) ) { |
|
246 | + if ( ! empty($post_id)) { |
|
247 | 247 | $posts_implode = implode(", ", $public_posts); |
248 | 248 | |
249 | - if ('inherit' !== get_post_status($post_id) ) { |
|
249 | + if ('inherit' !== get_post_status($post_id)) { |
|
250 | 250 | |
251 | - if (true === $is_valid_visibility_nonce ) { |
|
251 | + if (true === $is_valid_visibility_nonce) { |
|
252 | 252 | update_option('subway_public_post', $posts_implode); |
253 | 253 | update_post_meta( |
254 | 254 | $post_id, |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @return boolean false Returns false if nonce is not valid. |
272 | 272 | */ |
273 | - public function saveMetaboxValues( $post_id ) |
|
273 | + public function saveMetaboxValues($post_id) |
|
274 | 274 | { |
275 | 275 | $this->saveVisibilityMetabox($post_id); |
276 | 276 | return; |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | * @access public |
287 | 287 | * @return void |
288 | 288 | */ |
289 | - public static function getPostTypes( $args = '', $output = '' ) |
|
289 | + public static function getPostTypes($args = '', $output = '') |
|
290 | 290 | { |
291 | - if (empty($args) ) { |
|
291 | + if (empty($args)) { |
|
292 | 292 | $args = array( |
293 | 293 | 'public' => true, |
294 | 294 | ); |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | * @access public |
310 | 310 | * @return boolean true Returns true if nonce is valid. |
311 | 311 | */ |
312 | - public function isNonceValid( $nonce ) |
|
312 | + public function isNonceValid($nonce) |
|
313 | 313 | { |
314 | - if (!isset($nonce) || !wp_verify_nonce($nonce, basename(__FILE__)) ) { |
|
314 | + if ( ! isset($nonce) || ! wp_verify_nonce($nonce, basename(__FILE__))) { |
|
315 | 315 | return; |
316 | 316 | } |
317 | 317 | |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | * @access public |
328 | 328 | * @return boolean true Returns true if post is private. Otherwise false. |
329 | 329 | */ |
330 | - public static function isPostPrivate( $post_id ) |
|
330 | + public static function isPostPrivate($post_id) |
|
331 | 331 | { |
332 | 332 | $meta_value = ''; |
333 | 333 | |
334 | - if (! empty($post_id) ) { |
|
334 | + if ( ! empty($post_id)) { |
|
335 | 335 | $meta_value = get_post_meta($post_id, self::VISIBILITY_METAKEY, true); |
336 | - if ('private' === $meta_value ) { |
|
336 | + if ('private' === $meta_value) { |
|
337 | 337 | return true; |
338 | 338 | } |
339 | 339 | } |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | * @access public |
351 | 351 | * @return boolean true Returns true if post is public. Otherwise false. |
352 | 352 | */ |
353 | - public static function isPostPublic( $post_id ) |
|
353 | + public static function isPostPublic($post_id) |
|
354 | 354 | { |
355 | 355 | $public_post = Options::getPublicPostsIdentifiers(); |
356 | 356 | |
357 | - if (! empty($post_id) ) { |
|
358 | - if (! in_array($post_id, $public_post, true) ) { |
|
357 | + if ( ! empty($post_id)) { |
|
358 | + if ( ! in_array($post_id, $public_post, true)) { |
|
359 | 359 | return true; |
360 | 360 | } |
361 | 361 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | <p class="description"> |
20 | 20 | <?php |
21 | - echo sprintf( __( "In case, you were locked out. Use the link below to bypass the log-in page and go directly |
|
22 | - to your website's wp-login URL (http://yoursiteurl.com/wp-login.php): <strong class='subway-settings-text-notice'>%s</strong>", 'subway' ), site_url( 'wp-login.php?no_redirect=true' ) ); |
|
21 | + echo sprintf(__("In case, you were locked out. Use the link below to bypass the log-in page and go directly |
|
22 | + to your website's wp-login URL (http://yoursiteurl.com/wp-login.php): <strong class='subway-settings-text-notice'>%s</strong>", 'subway'), site_url('wp-login.php?no_redirect=true')); |
|
23 | 23 | ?> |
24 | 24 | </p> |
25 | 25 | <?php |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | <!-- Page --> |
27 | 27 | <label for="subway_use_page"> |
28 | 28 | |
29 | - <input <?php checked( 'page', get_option( 'subway_redirect_type' ), true ); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
29 | + <input <?php checked('page', get_option('subway_redirect_type'), true); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
30 | 30 | |
31 | - <?php esc_html_e( 'Custom Page', 'subway' ); ?> |
|
31 | + <?php esc_html_e('Custom Page', 'subway'); ?> |
|
32 | 32 | |
33 | 33 | </label> |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | <label for="subway_use_custom_url"> |
38 | 38 | |
39 | - <input <?php checked( 'custom_url', get_option( 'subway_redirect_type' ), true ); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> |
|
39 | + <input <?php checked('custom_url', get_option('subway_redirect_type'), true); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> |
|
40 | 40 | |
41 | - <?php esc_html_e( 'Custom URL', 'subway' ); ?> |
|
41 | + <?php esc_html_e('Custom URL', 'subway'); ?> |
|
42 | 42 | |
43 | 43 | </label> |
44 | 44 | |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | <label for="subway_use_default"> |
48 | 48 | |
49 | - <input <?php checked( 'default', get_option( 'subway_redirect_type' ), true ); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
49 | + <input <?php checked('default', get_option('subway_redirect_type'), true); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
50 | 50 | |
51 | - <?php esc_html_e( 'Default Behavior', 'subway' ); ?> |
|
51 | + <?php esc_html_e('Default Behavior', 'subway'); ?> |
|
52 | 52 | |
53 | 53 | </label> |
54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <div id="subway_redirect_page_option_section" class="hidden subway-redirect-option-section"> |
65 | 65 | |
66 | 66 | <label for="subway_redirect_page_id"> |
67 | - <?php esc_html_e( 'Select Page' ); ?> |
|
67 | + <?php esc_html_e('Select Page'); ?> |
|
68 | 68 | </label> |
69 | 69 | |
70 | 70 | <?php |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | wp_dropdown_pages( |
73 | 73 | array( |
74 | 74 | 'name' => 'subway_redirect_page_id', |
75 | - 'selected' => intval( get_option( 'subway_redirect_page_id' ) ), |
|
76 | - 'show_option_none' => esc_html__( '-', 'subway' ), |
|
75 | + 'selected' => intval(get_option('subway_redirect_page_id')), |
|
76 | + 'show_option_none' => esc_html__('-', 'subway'), |
|
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | <p class="description"> |
83 | 83 | |
84 | - <?php _e( 'The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway' ); ?> |
|
84 | + <?php _e('The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway'); ?> |
|
85 | 85 | |
86 | 86 | </p> |
87 | 87 | |
@@ -90,29 +90,29 @@ discard block |
||
90 | 90 | <div id="subway_redirect_custom_url_option_section" class="hidden subway-redirect-option-section"> |
91 | 91 | |
92 | 92 | <label for="subway_redirect_custom_url"> |
93 | - <?php esc_attr_e( 'Enter Redirect URL:', 'subway' ); ?> |
|
93 | + <?php esc_attr_e('Enter Redirect URL:', 'subway'); ?> |
|
94 | 94 | </label> |
95 | 95 | |
96 | - <input value="<?php echo esc_attr( esc_url( get_option( 'subway_redirect_custom_url' ) ) ); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e( 'http://', 'subway' ); ?>" |
|
96 | + <input value="<?php echo esc_attr(esc_url(get_option('subway_redirect_custom_url'))); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e('http://', 'subway'); ?>" |
|
97 | 97 | id="subway_redirect_custom_url" size="75" /> |
98 | 98 | |
99 | 99 | <p class="description"><br> |
100 | 100 | |
101 | 101 | <?php |
102 | - echo sprintf( __( 'When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway' ), '%user_id%', '%user_name%' ); |
|
102 | + echo sprintf(__('When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway'), '%user_id%', '%user_name%'); |
|
103 | 103 | ?> |
104 | 104 | |
105 | 105 | </p><br> |
106 | 106 | |
107 | 107 | <p class="description"> |
108 | 108 | |
109 | - <?php esc_attr_e( 'Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway' ); ?> |
|
109 | + <?php esc_attr_e('Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway'); ?> |
|
110 | 110 | |
111 | 111 | </p><br> |
112 | 112 | |
113 | 113 | <p class="description"> |
114 | 114 | |
115 | - <?php esc_html_e( 'Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway' ); ?> |
|
115 | + <?php esc_html_e('Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway'); ?> |
|
116 | 116 | |
117 | 117 | </p> |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <div id="subway_redirect_default_option_section" class="hidden subway-redirect-option-section"> |
123 | 123 | <p> |
124 | 124 | <?php |
125 | - esc_html_e( "By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway' ); |
|
125 | + esc_html_e("By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway'); |
|
126 | 126 | ?> |
127 | 127 | </p> |
128 | 128 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function subway_login_page_form() { |
23 | 23 | |
24 | - $subway_login_page_id = intval( get_option( 'subway_login_page' ) ); |
|
24 | + $subway_login_page_id = intval(get_option('subway_login_page')); |
|
25 | 25 | |
26 | - if ( ! empty( $subway_login_page_id ) ) { |
|
26 | + if ( ! empty($subway_login_page_id)) { |
|
27 | 27 | |
28 | - $login_page_object = get_post( $subway_login_page_id ); |
|
28 | + $login_page_object = get_post($subway_login_page_id); |
|
29 | 29 | |
30 | - if ( ! empty( $login_page_object ) && isset( $login_page_object->post_content ) ) { |
|
30 | + if ( ! empty($login_page_object) && isset($login_page_object->post_content)) { |
|
31 | 31 | |
32 | 32 | // Automatically prepend the login shortcode if no |
33 | 33 | // Shortcode exists in the selected login page. |
34 | - if ( ! has_shortcode( $login_page_object->post_content, 'subway_login' ) ) { |
|
34 | + if ( ! has_shortcode($login_page_object->post_content, 'subway_login')) { |
|
35 | 35 | |
36 | 36 | $new_post_object = array( |
37 | 37 | 'ID' => $login_page_object->ID, |
38 | - 'post_content' => '[subway_login] ' . $login_page_object->post_content,// Prepend Only. |
|
38 | + 'post_content' => '[subway_login] ' . $login_page_object->post_content, // Prepend Only. |
|
39 | 39 | ); |
40 | 40 | |
41 | - wp_update_post( $new_post_object ); |
|
41 | + wp_update_post($new_post_object); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | wp_dropdown_pages( |
47 | 47 | array( |
48 | 48 | 'name' => 'subway_login_page', |
49 | - 'selected' => intval( $subway_login_page_id ), |
|
50 | - 'show_option_none' => esc_html__( '---', 'subway' ), |
|
49 | + 'selected' => intval($subway_login_page_id), |
|
50 | + 'show_option_none' => esc_html__('---', 'subway'), |
|
51 | 51 | ) |
52 | 52 | ); |
53 | 53 | |
54 | - echo '<p class="description">' . sprintf( esc_html__( 'Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway' ), '<span class="subway-settings-notice">' . esc_html__( 'You need to add "[subway_login]" shortcode in the selected page to show the login form (this will be done automatically after saving)', 'subway' ) ) . '</span></p>'; |
|
54 | + echo '<p class="description">' . sprintf(esc_html__('Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway'), '<span class="subway-settings-notice">' . esc_html__('You need to add "[subway_login]" shortcode in the selected page to show the login form (this will be done automatically after saving)', 'subway')) . '</span></p>'; |
|
55 | 55 | |
56 | 56 | return; |
57 | 57 | } |
@@ -10,16 +10,16 @@ |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | function subway_public_post() { |
18 | 18 | |
19 | - echo '<textarea id="subway_public_post" name="subway_public_post_deprecated" rows="5" cols="95" readonly="readonly">' . esc_attr( trim( get_option( 'subway_public_post' ) ) ) . '</textarea>'; |
|
19 | + echo '<textarea id="subway_public_post" name="subway_public_post_deprecated" rows="5" cols="95" readonly="readonly">' . esc_attr(trim(get_option('subway_public_post'))) . '</textarea>'; |
|
20 | 20 | |
21 | - echo '<p class="description">' . nl2br( esc_html( "Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma), for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway' ) ); |
|
22 | - echo '<span class="subway-settings-notice">' . nl2br( esc_html( ' This setting is now disabled on Subway 2.0.9 and future versions. To make your post/page private, go to your individual post/page and check the "Subway: Visibility Option" checkbox.', 'subway' ) ) . '</span>' . '</p>'; |
|
21 | + echo '<p class="description">' . nl2br(esc_html("Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma), for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway')); |
|
22 | + echo '<span class="subway-settings-notice">' . nl2br(esc_html(' This setting is now disabled on Subway 2.0.9 and future versions. To make your post/page private, go to your individual post/page and check the "Subway: Visibility Option" checkbox.', 'subway')) . '</span>' . '</p>'; |
|
23 | 23 | |
24 | 24 | return; |
25 | 25 |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @package Subway |
32 | 32 | */ |
33 | 33 | |
34 | -if ( ! defined( 'ABSPATH' ) ) { |
|
34 | +if ( ! defined('ABSPATH')) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Terminate Subway for PHP version 5.3.0 and below. |
39 | -if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) { |
|
40 | - add_action( 'admin_notices', 'subway_admin_notice' ); |
|
39 | +if (version_compare(PHP_VERSION, '5.3.0', '<')) { |
|
40 | + add_action('admin_notices', 'subway_admin_notice'); |
|
41 | 41 | /** |
42 | 42 | * Displays admin notifications if the installed PHP version is less than 5.3.0 |
43 | 43 | * |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | <div class="notice notice-error is-dismissible"> |
49 | 49 | <p> |
50 | 50 | <strong> |
51 | - <?php esc_html_e( 'Notice: Subway uses PHP Class Namespaces |
|
51 | + <?php esc_html_e('Notice: Subway uses PHP Class Namespaces |
|
52 | 52 | which is only available in servers with PHP 5.3.0 version and above. |
53 | 53 | Update your server\'s PHP version. You can deactivate |
54 | - Subway in the meantime.', 'subway' ); ?> |
|
54 | + Subway in the meantime.', 'subway'); ?> |
|
55 | 55 | </strong> |
56 | 56 | </p> |
57 | 57 | </div> |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // Define Subway Plugin Version. |
63 | -define( 'SUBWAY_VERSION', '2.0' ); |
|
63 | +define('SUBWAY_VERSION', '2.0'); |
|
64 | 64 | |
65 | 65 | // Define Subway Directory Path. |
66 | -define( 'SUBWAY_DIR_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
66 | +define('SUBWAY_DIR_PATH', trailingslashit(plugin_dir_path(__FILE__))); |
|
67 | 67 | |
68 | 68 | // Define Subway URL Path. |
69 | -define( 'SUBWAY_DIR_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); |
|
69 | +define('SUBWAY_DIR_URL', trailingslashit(plugin_dir_url(__FILE__))); |
|
70 | 70 | |
71 | 71 | // Include Subway i18n. |
72 | 72 | require_once SUBWAY_DIR_PATH . 'i18.php'; |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | require_once SUBWAY_DIR_PATH . 'shortcodes/subway-shortcodes.php'; |
97 | 97 | |
98 | 98 | // Redirect (302) all front-end request to the login page. |
99 | -add_action( 'wp', array( 'Subway\PageRedirect', 'index' ) ); |
|
99 | +add_action('wp', array('Subway\PageRedirect', 'index')); |
|
100 | 100 | |
101 | 101 | // Redirect (302) invalid login request to the login page. |
102 | -add_action( 'wp_ajax_nopriv_subway_logging_in', array( 'Subway\AuthRedirect', 'handleAuthentication' ) ); |
|
102 | +add_action('wp_ajax_nopriv_subway_logging_in', array('Subway\AuthRedirect', 'handleAuthentication')); |
|
103 | 103 | |
104 | 104 | // Load our JS and CSS files. |
105 | -add_action( 'wp_enqueue_scripts', array( 'Subway\Enqueue', 'registerJs' ) ); |
|
105 | +add_action('wp_enqueue_scripts', array('Subway\Enqueue', 'registerJs')); |
|
106 | 106 | |
107 | 107 | // Change the default login url to our sign-in page. |
108 | -add_filter( 'login_url', array( 'Subway\AuthRedirect', 'loginUrl' ), 10, 3 ); |
|
108 | +add_filter('login_url', array('Subway\AuthRedirect', 'loginUrl'), 10, 3); |
|
109 | 109 | |
110 | 110 | // Redirect the user after successful logged in to the right page. |
111 | 111 | // Does not trigger when using ajax form. Only on default wp-login.php and wp_login_form(). |
112 | -add_filter( 'login_redirect', array( 'Subway\AuthRedirect', 'getLoginRedirectUrl' ), 10, 3 ); |
|
112 | +add_filter('login_redirect', array('Subway\AuthRedirect', 'getLoginRedirectUrl'), 10, 3); |
|
113 | 113 | |
114 | 114 | // Change the default logout url to our sign-in page. |
115 | -add_action( 'wp_logout', array( 'Subway\AuthRedirect', 'logoutUrl' ), 10, 3 ); |
|
115 | +add_action('wp_logout', array('Subway\AuthRedirect', 'logoutUrl'), 10, 3); |
|
116 | 116 | |
117 | 117 | // Adds the Subvway metabox. |
118 | -add_action( 'plugins_loaded', array( 'Subway\Metabox', 'initMetabox' ) ); |
|
118 | +add_action('plugins_loaded', array('Subway\Metabox', 'initMetabox')); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | namespace Subway; |
21 | 21 | |
22 | 22 | if (! defined('ABSPATH') ) { |
23 | - return; |
|
23 | + return; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -36,55 +36,55 @@ discard block |
||
36 | 36 | final class AdminSettings |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Our class constructor |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
39 | + /** |
|
40 | + * Our class constructor |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | 44 | |
45 | - add_action('admin_menu', array( $this, 'adminMenu' )); |
|
45 | + add_action('admin_menu', array( $this, 'adminMenu' )); |
|
46 | 46 | |
47 | - add_action('admin_init', array( $this, 'registerSettings' )); |
|
47 | + add_action('admin_init', array( $this, 'registerSettings' )); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Display 'Subway' link under 'Settings' |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function adminMenu() |
|
57 | - { |
|
51 | + /** |
|
52 | + * Display 'Subway' link under 'Settings' |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function adminMenu() |
|
57 | + { |
|
58 | 58 | |
59 | - add_options_page( |
|
60 | - 'Subway Settings', 'Subway', 'manage_options', |
|
61 | - 'subway', array( $this, 'optionsPage' ) |
|
62 | - ); |
|
59 | + add_options_page( |
|
60 | + 'Subway Settings', 'Subway', 'manage_options', |
|
61 | + 'subway', array( $this, 'optionsPage' ) |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueueSettingsScripts' ) ); |
65 | 65 | |
66 | - return; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Registers all settings related to Subway. |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - public function registerSettings() |
|
75 | - { |
|
76 | - |
|
77 | - // Register our settings section. |
|
78 | - add_settings_section( |
|
79 | - 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
80 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
81 | - ); |
|
82 | - |
|
83 | - // Register Redirect Options pages. |
|
84 | - add_settings_section( |
|
85 | - 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
86 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
87 | - ); |
|
66 | + return; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Registers all settings related to Subway. |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + public function registerSettings() |
|
75 | + { |
|
76 | + |
|
77 | + // Register our settings section. |
|
78 | + add_settings_section( |
|
79 | + 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
80 | + array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
81 | + ); |
|
82 | + |
|
83 | + // Register Redirect Options pages. |
|
84 | + add_settings_section( |
|
85 | + 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
86 | + array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
87 | + ); |
|
88 | 88 | |
89 | 89 | $is_public_site = Options::isPublicSite(); |
90 | 90 | $hidden_class = ''; |
@@ -93,127 +93,127 @@ discard block |
||
93 | 93 | $hidden_class = 'hidden'; |
94 | 94 | } |
95 | 95 | |
96 | - // Register the fields. |
|
97 | - $fields = array( |
|
98 | - array( |
|
99 | - 'id' => 'subway_is_public', |
|
100 | - 'label' => __('Public Website', 'subway'), |
|
101 | - 'callback' => 'subway_is_public_form', |
|
102 | - 'section' => 'subway-settings-section', |
|
103 | - 'group' => 'subway-page-visibility-section', |
|
96 | + // Register the fields. |
|
97 | + $fields = array( |
|
98 | + array( |
|
99 | + 'id' => 'subway_is_public', |
|
100 | + 'label' => __('Public Website', 'subway'), |
|
101 | + 'callback' => 'subway_is_public_form', |
|
102 | + 'section' => 'subway-settings-section', |
|
103 | + 'group' => 'subway-page-visibility-section', |
|
104 | 104 | 'args' => array( |
105 | 105 | 'label_for' => 'subway_is_public', |
106 | 106 | 'class' => 'subway_is_public-option', |
107 | 107 | ), |
108 | - ), |
|
109 | - |
|
110 | - array( |
|
111 | - 'id' => 'subway_login_page', |
|
112 | - 'label' => __('Private Login Page', 'subway'), |
|
113 | - 'callback' => 'subway_login_page_form', |
|
114 | - 'section' => 'subway-settings-section', |
|
115 | - 'group' => 'subway-page-visibility-section', |
|
108 | + ), |
|
109 | + |
|
110 | + array( |
|
111 | + 'id' => 'subway_login_page', |
|
112 | + 'label' => __('Private Login Page', 'subway'), |
|
113 | + 'callback' => 'subway_login_page_form', |
|
114 | + 'section' => 'subway-settings-section', |
|
115 | + 'group' => 'subway-page-visibility-section', |
|
116 | 116 | 'args' => array( |
117 | 117 | 'label_for' => 'subway_login_page', |
118 | 118 | 'class' => 'subway_login_page-option', |
119 | 119 | ), |
120 | - ), |
|
121 | - array( |
|
122 | - 'id' => 'subway_public_post_deprecated', |
|
123 | - 'label' => __('Public Posts IDs', 'subway'), |
|
124 | - 'callback' => 'subway_public_post', |
|
125 | - 'section' => 'subway-settings-section', |
|
126 | - 'group' => 'subway-page-visibility-section', |
|
120 | + ), |
|
121 | + array( |
|
122 | + 'id' => 'subway_public_post_deprecated', |
|
123 | + 'label' => __('Public Posts IDs', 'subway'), |
|
124 | + 'callback' => 'subway_public_post', |
|
125 | + 'section' => 'subway-settings-section', |
|
126 | + 'group' => 'subway-page-visibility-section', |
|
127 | 127 | 'args' => array( |
128 | 128 | 'label_for' => 'subway_public_post_deprecated', |
129 | 129 | 'class' => 'subway_public_post_deprecated-option ' . $hidden_class, |
130 | 130 | ), |
131 | - ), |
|
132 | - |
|
133 | - array( |
|
134 | - 'id' => 'subway_redirect_type', |
|
135 | - 'label' => __('Redirect Type', 'subway'), |
|
136 | - 'callback' => 'subway_redirect_option_form', |
|
137 | - 'section' => 'subway-settings-section', |
|
138 | - 'group' => 'subway-redirect-section', |
|
131 | + ), |
|
132 | + |
|
133 | + array( |
|
134 | + 'id' => 'subway_redirect_type', |
|
135 | + 'label' => __('Redirect Type', 'subway'), |
|
136 | + 'callback' => 'subway_redirect_option_form', |
|
137 | + 'section' => 'subway-settings-section', |
|
138 | + 'group' => 'subway-redirect-section', |
|
139 | 139 | 'args' => array( |
140 | 140 | 'label_for' => 'subway_redirect_type', |
141 | 141 | 'class' => 'subway_redirect_type-option ' . $hidden_class, |
142 | 142 | ), |
143 | - ), |
|
144 | - array( |
|
145 | - 'id' => 'subway_redirect_wp_admin', |
|
146 | - 'label' => __('Bypassing <em>wp-login.php</em>', 'subway'), |
|
147 | - 'callback' => 'subway_lock_wp_admin', |
|
148 | - 'section' => 'subway-settings-section', |
|
149 | - 'group' => 'subway-redirect-section', |
|
143 | + ), |
|
144 | + array( |
|
145 | + 'id' => 'subway_redirect_wp_admin', |
|
146 | + 'label' => __('Bypassing <em>wp-login.php</em>', 'subway'), |
|
147 | + 'callback' => 'subway_lock_wp_admin', |
|
148 | + 'section' => 'subway-settings-section', |
|
149 | + 'group' => 'subway-redirect-section', |
|
150 | 150 | 'args' => array( |
151 | 151 | 'label_for' => 'subway_redirect_wp_admin', |
152 | 152 | 'class' => 'subway_redirect_wp_admin-option ' . $hidden_class, |
153 | 153 | ), |
154 | - ), |
|
155 | - ); |
|
154 | + ), |
|
155 | + ); |
|
156 | 156 | |
157 | - foreach ( $fields as $field ) { |
|
157 | + foreach ( $fields as $field ) { |
|
158 | 158 | |
159 | - add_settings_field( |
|
160 | - $field['id'], $field['label'], |
|
161 | - $field['callback'], $field['section'], |
|
162 | - $field['group'], $field['args'] |
|
163 | - ); |
|
159 | + add_settings_field( |
|
160 | + $field['id'], $field['label'], |
|
161 | + $field['callback'], $field['section'], |
|
162 | + $field['group'], $field['args'] |
|
163 | + ); |
|
164 | 164 | |
165 | - register_setting('subway-settings-group', $field['id']); |
|
165 | + register_setting('subway-settings-group', $field['id']); |
|
166 | 166 | |
167 | - $file = str_replace('_', '-', $field['callback']); |
|
167 | + $file = str_replace('_', '-', $field['callback']); |
|
168 | 168 | |
169 | - include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
170 | - 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
169 | + include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
170 | + 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
171 | 171 | |
172 | - } |
|
172 | + } |
|
173 | 173 | |
174 | - // Register Redirect Page ID Settings. |
|
175 | - register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
174 | + // Register Redirect Page ID Settings. |
|
175 | + register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
176 | 176 | |
177 | - // Register Redirect Custom URL Settings. |
|
178 | - register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
177 | + // Register Redirect Custom URL Settings. |
|
178 | + register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
179 | 179 | |
180 | 180 | $this->registerSettingsScripts(); |
181 | 181 | |
182 | - return; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Callback function for the first Section. |
|
187 | - * |
|
188 | - * @return void |
|
189 | - */ |
|
190 | - public function sectionCallback() |
|
191 | - { |
|
192 | - echo esc_html_e( |
|
193 | - 'All settings related to the |
|
182 | + return; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Callback function for the first Section. |
|
187 | + * |
|
188 | + * @return void |
|
189 | + */ |
|
190 | + public function sectionCallback() |
|
191 | + { |
|
192 | + echo esc_html_e( |
|
193 | + 'All settings related to the |
|
194 | 194 | visibility of your site and pages.', 'subway' |
195 | - ); |
|
196 | - return; |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Callback function for the second Section. |
|
201 | - * |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public function redirectCallback() |
|
205 | - { |
|
206 | - return; |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * Renders the 'wrapper' for our options pages. |
|
211 | - * |
|
212 | - * @return void |
|
213 | - */ |
|
214 | - public function optionsPage() |
|
215 | - { |
|
216 | - ?> |
|
195 | + ); |
|
196 | + return; |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Callback function for the second Section. |
|
201 | + * |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public function redirectCallback() |
|
205 | + { |
|
206 | + return; |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * Renders the 'wrapper' for our options pages. |
|
211 | + * |
|
212 | + * @return void |
|
213 | + */ |
|
214 | + public function optionsPage() |
|
215 | + { |
|
216 | + ?> |
|
217 | 217 | |
218 | 218 | <div class="wrap"> |
219 | 219 | <h2> |
@@ -227,30 +227,30 @@ discard block |
||
227 | 227 | </div> |
228 | 228 | |
229 | 229 | <?php |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | /** |
233 | - * Registers the scipts for the Subway settings page. |
|
234 | - * |
|
233 | + * Registers the scipts for the Subway settings page. |
|
234 | + * |
|
235 | 235 | * @since 2.0.9 |
236 | - * @access public |
|
237 | - * @return void |
|
238 | - */ |
|
236 | + * @access public |
|
237 | + * @return void |
|
238 | + */ |
|
239 | 239 | public function registerSettingsScripts() { |
240 | 240 | |
241 | 241 | // Registers the Subway settings Javascript. |
242 | - wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | - wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
242 | + wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | + wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | - * Loads the scipts for the Subway settings page. |
|
247 | + * Loads the scipts for the Subway settings page. |
|
248 | 248 | * |
249 | 249 | * @since 2.0.9 |
250 | - * @access public |
|
251 | - * @return void |
|
252 | - * @return void |
|
253 | - */ |
|
250 | + * @access public |
|
251 | + * @return void |
|
252 | + * @return void |
|
253 | + */ |
|
254 | 254 | public function enqueueSettingsScripts( $hook ) { |
255 | 255 | // Checks if page hook is Subway settings page. |
256 | 256 | if ( 'settings_page_subway' === $hook ) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | namespace Subway; |
21 | 21 | |
22 | -if (! defined('ABSPATH') ) { |
|
22 | +if ( ! defined('ABSPATH')) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | public function __construct() |
43 | 43 | { |
44 | 44 | |
45 | - add_action('admin_menu', array( $this, 'adminMenu' )); |
|
45 | + add_action('admin_menu', array($this, 'adminMenu')); |
|
46 | 46 | |
47 | - add_action('admin_init', array( $this, 'registerSettings' )); |
|
47 | + add_action('admin_init', array($this, 'registerSettings')); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | |
59 | 59 | add_options_page( |
60 | 60 | 'Subway Settings', 'Subway', 'manage_options', |
61 | - 'subway', array( $this, 'optionsPage' ) |
|
61 | + 'subway', array($this, 'optionsPage') |
|
62 | 62 | ); |
63 | 63 | |
64 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueueSettingsScripts' ) ); |
|
64 | + add_action('admin_enqueue_scripts', array($this, 'enqueueSettingsScripts')); |
|
65 | 65 | |
66 | 66 | return; |
67 | 67 | } |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | // Register our settings section. |
78 | 78 | add_settings_section( |
79 | 79 | 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
80 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
80 | + array($this, 'sectionCallback'), 'subway-settings-section' |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Register Redirect Options pages. |
84 | 84 | add_settings_section( |
85 | 85 | 'subway-redirect-section', __('Redirect Options', 'subway'), |
86 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
86 | + array($this, 'redirectCallback'), 'subway-settings-section' |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | $is_public_site = Options::isPublicSite(); |
90 | 90 | $hidden_class = ''; |
91 | 91 | |
92 | - if ( $is_public_site ) { |
|
92 | + if ($is_public_site) { |
|
93 | 93 | $hidden_class = 'hidden'; |
94 | 94 | } |
95 | 95 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ), |
155 | 155 | ); |
156 | 156 | |
157 | - foreach ( $fields as $field ) { |
|
157 | + foreach ($fields as $field) { |
|
158 | 158 | |
159 | 159 | add_settings_field( |
160 | 160 | $field['id'], $field['label'], |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | public function registerSettingsScripts() { |
240 | 240 | |
241 | 241 | // Registers the Subway settings Javascript. |
242 | - wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | - wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
242 | + wp_register_script('subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__)); |
|
243 | + wp_register_style('subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__)); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | * @return void |
253 | 253 | */ |
254 | - public function enqueueSettingsScripts( $hook ) { |
|
254 | + public function enqueueSettingsScripts($hook) { |
|
255 | 255 | // Checks if page hook is Subway settings page. |
256 | - if ( 'settings_page_subway' === $hook ) { |
|
256 | + if ('settings_page_subway' === $hook) { |
|
257 | 257 | // Enqueues the script only on the Subway Settings page. |
258 | - wp_enqueue_script( 'subway-settings-script' ); |
|
259 | - wp_enqueue_style( 'subway-settings-style' ); |
|
258 | + wp_enqueue_script('subway-settings-script'); |
|
259 | + wp_enqueue_style('subway-settings-style'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |