@@ -445,7 +445,7 @@ |
||
| 445 | 445 | * |
| 446 | 446 | * @since 3.0.0 |
| 447 | 447 | * |
| 448 | - * @return bool True if the configuration is set otherwise false. |
|
| 448 | + * @return boolean|null True if the configuration is set otherwise false. |
|
| 449 | 449 | */ |
| 450 | 450 | function wl_configuration_validate() { |
| 451 | 451 | |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function wl_configuration_admin_menu( $parent_slug, $capability ) { |
| 20 | 20 | |
| 21 | - // see http://codex.wordpress.org/Function_Reference/add_submenu_page |
|
| 22 | - add_submenu_page( |
|
| 23 | - $parent_slug, // The parent menu slug, provided by the calling hook. |
|
| 24 | - __( 'Settings', 'wordlift' ), // page title |
|
| 25 | - __( 'Settings', 'wordlift' ), // menu title |
|
| 26 | - $capability, // The required capability, provided by the calling hook. |
|
| 27 | - 'wl_configuration_admin_menu', // the menu slug |
|
| 28 | - 'wl_configuration_admin_menu_callback' // the menu callback for displaying the page content |
|
| 29 | - ); |
|
| 21 | + // see http://codex.wordpress.org/Function_Reference/add_submenu_page |
|
| 22 | + add_submenu_page( |
|
| 23 | + $parent_slug, // The parent menu slug, provided by the calling hook. |
|
| 24 | + __( 'Settings', 'wordlift' ), // page title |
|
| 25 | + __( 'Settings', 'wordlift' ), // menu title |
|
| 26 | + $capability, // The required capability, provided by the calling hook. |
|
| 27 | + 'wl_configuration_admin_menu', // the menu slug |
|
| 28 | + 'wl_configuration_admin_menu_callback' // the menu callback for displaying the page content |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function wl_configuration_admin_menu_callback( $display_page_title = true ) { |
| 43 | 43 | |
| 44 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 45 | - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
|
| 46 | - } |
|
| 44 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
| 45 | + wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - // Ony show advanced settings tab if the relative constant exists and is set to true. |
|
| 49 | - $can_show_advanced_settings = defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION; |
|
| 48 | + // Ony show advanced settings tab if the relative constant exists and is set to true. |
|
| 49 | + $can_show_advanced_settings = defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION; |
|
| 50 | 50 | |
| 51 | - ?> |
|
| 51 | + ?> |
|
| 52 | 52 | |
| 53 | 53 | <div class="wrap"> |
| 54 | 54 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | <?php settings_errors(); ?> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general_settings'; |
|
| 64 | - ?> |
|
| 63 | + $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general_settings'; |
|
| 64 | + ?> |
|
| 65 | 65 | |
| 66 | 66 | <h2 class="nav-tab-wrapper"> |
| 67 | 67 | <a href="?page=<?php echo( $_GET['page'] ); ?>&tab=general_settings" |
@@ -75,17 +75,17 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | <form action="options.php" method="post"> |
| 77 | 77 | <?php |
| 78 | - if ( 'general_settings' === $active_tab ) { |
|
| 79 | - settings_fields( 'wl_general_settings' ); |
|
| 80 | - do_settings_sections( 'wl_general_settings' ); |
|
| 78 | + if ( 'general_settings' === $active_tab ) { |
|
| 79 | + settings_fields( 'wl_general_settings' ); |
|
| 80 | + do_settings_sections( 'wl_general_settings' ); |
|
| 81 | 81 | |
| 82 | - } else if ( $can_show_advanced_settings && 'advanced_settings' === $active_tab ) { |
|
| 83 | - settings_fields( 'wl_advanced_settings' ); |
|
| 84 | - do_settings_sections( 'wl_advanced_settings' ); |
|
| 85 | - } |
|
| 82 | + } else if ( $can_show_advanced_settings && 'advanced_settings' === $active_tab ) { |
|
| 83 | + settings_fields( 'wl_advanced_settings' ); |
|
| 84 | + do_settings_sections( 'wl_advanced_settings' ); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - submit_button(); |
|
| 88 | - ?> |
|
| 87 | + submit_button(); |
|
| 88 | + ?> |
|
| 89 | 89 | </form> |
| 90 | 90 | |
| 91 | 91 | <div style="margin-top: 100px; font-size: 10px;">The entities blocks are designed by Lukasz M. Pogoda from the |
@@ -108,163 +108,163 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | function wl_configuration_settings() { |
| 110 | 110 | |
| 111 | - register_setting( |
|
| 112 | - 'wl_general_settings', |
|
| 113 | - 'wl_general_settings', |
|
| 114 | - 'wl_configuration_sanitize_settings' |
|
| 115 | - ); |
|
| 116 | - |
|
| 117 | - add_settings_section( |
|
| 118 | - 'wl_general_settings_section', // ID used to identify this section and with which to register options |
|
| 119 | - 'General Settings', // Title to be displayed on the administration page |
|
| 120 | - 'wl_configuration_general_settings_section_callback', // Callback used to render the description of the section |
|
| 121 | - 'wl_general_settings' // Page on which to add this section of options |
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - add_settings_field( |
|
| 125 | - WL_CONFIG_WORDLIFT_KEY, // ID used to identify the field throughout the theme |
|
| 126 | - __( 'WordLift Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 127 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 128 | - 'wl_general_settings', // The page on which this option will be displayed |
|
| 129 | - 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 130 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 131 | - 'id' => 'wl-key', |
|
| 132 | - 'name' => 'wl_general_settings[key]', |
|
| 133 | - 'value' => wl_configuration_get_key(), |
|
| 134 | - 'description' => __( 'Insert the WordLift Key', 'wordlift' ) |
|
| 135 | - ) |
|
| 136 | - ); |
|
| 137 | - |
|
| 138 | - add_settings_field( |
|
| 139 | - WL_CONFIG_ENABLE_COLOR_CODING_ON_FRONTEND_NAME, |
|
| 140 | - __( 'Enable color coding on front-end', 'wordlift' ), |
|
| 141 | - 'wl_configuration_checkbox', |
|
| 142 | - 'wl_general_settings', |
|
| 143 | - 'wl_general_settings_section', |
|
| 144 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 145 | - 'id' => 'wl-enable-color-coding', |
|
| 146 | - 'name' => 'wl_general_settings[enable_color_coding]', |
|
| 147 | - 'value' => wl_configuration_get_enable_color_coding(), |
|
| 148 | - 'description' => __( 'Enable color coding', 'wordlift' ) |
|
| 149 | - ) |
|
| 150 | - ); |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - add_settings_field( |
|
| 154 | - WL_CONFIG_SITE_LANGUAGE_NAME, |
|
| 155 | - __( 'Site Language', 'wordlift' ), |
|
| 156 | - 'wl_configuration_select', |
|
| 157 | - 'wl_general_settings', |
|
| 158 | - 'wl_general_settings_section', |
|
| 159 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 160 | - 'id' => 'wl-site-language', |
|
| 161 | - 'name' => 'wl_general_settings[site_language]', |
|
| 162 | - 'value' => wl_configuration_get_site_language(), |
|
| 163 | - 'description' => __( 'The site language', 'wordlift' ), |
|
| 164 | - 'options' => wl_configuration_get_languages() |
|
| 165 | - ) |
|
| 166 | - ); |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - if ( defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION ) { |
|
| 170 | - |
|
| 171 | - register_setting( |
|
| 172 | - 'wl_advanced_settings', |
|
| 173 | - 'wl_advanced_settings', |
|
| 174 | - 'wl_configuration_sanitize_settings' |
|
| 175 | - ); |
|
| 176 | - |
|
| 177 | - add_settings_section( |
|
| 178 | - 'wl_advanced_settings_section', // ID used to identify this section and with which to register options |
|
| 179 | - 'Advanced', // Title to be displayed on the administration page |
|
| 180 | - 'wl_configuration_advanced_settings_section_callback', // Callback used to render the description of the section |
|
| 181 | - 'wl_advanced_settings' // Page on which to add this section of options |
|
| 182 | - ); |
|
| 183 | - |
|
| 184 | - add_settings_field( |
|
| 185 | - WL_CONFIG_API_URL, // ID used to identify the field throughout the theme |
|
| 186 | - __( 'API URL', 'wordlift' ), // The label to the left of the option interface element |
|
| 187 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 188 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 189 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 190 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 191 | - 'id' => 'wl-api-url', |
|
| 192 | - 'name' => 'wl_advanced_settings[api_url]', |
|
| 193 | - 'value' => wl_configuration_get_api_url(), |
|
| 194 | - 'description' => __( 'The API URL', 'wordlift' ) |
|
| 195 | - ) |
|
| 196 | - ); |
|
| 197 | - |
|
| 198 | - add_settings_field( |
|
| 199 | - WL_CONFIG_APPLICATION_KEY_NAME, // ID used to identify the field throughout the theme |
|
| 200 | - __( 'Redlink Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 201 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 202 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 203 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 204 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 205 | - 'id' => 'wl-redlink-key', |
|
| 206 | - 'name' => 'wl_advanced_settings[redlink_key]', |
|
| 207 | - 'value' => wl_configuration_get_redlink_key(), |
|
| 208 | - 'description' => __( 'The Redlink key', 'wordlift' ) |
|
| 209 | - ) |
|
| 210 | - ); |
|
| 211 | - |
|
| 212 | - add_settings_field( |
|
| 213 | - WL_CONFIG_USER_ID_NAME, // ID used to identify the field throughout the theme |
|
| 214 | - __( 'Redlink User Id', 'wordlift' ), // The label to the left of the option interface element |
|
| 215 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 216 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 217 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 218 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 219 | - 'id' => 'wl-redlink-user-id', |
|
| 220 | - 'name' => 'wl_advanced_settings[redlink_user_id]', |
|
| 221 | - 'value' => wl_configuration_get_redlink_user_id(), |
|
| 222 | - 'description' => __( 'The Redlink User Id', 'wordlift' ) |
|
| 223 | - ) |
|
| 224 | - ); |
|
| 225 | - |
|
| 226 | - add_settings_field( |
|
| 227 | - WL_CONFIG_DATASET_NAME, // ID used to identify the field throughout the theme |
|
| 228 | - __( 'Redlink Dataset name', 'wordlift' ), // The label to the left of the option interface element |
|
| 229 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 230 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 231 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 232 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 233 | - 'id' => 'wl-redlink-dataset-name', |
|
| 234 | - 'name' => 'wl_advanced_settings[redlink_dataset_name]', |
|
| 235 | - 'value' => wl_configuration_get_redlink_dataset_name(), |
|
| 236 | - 'description' => __( 'The Redlink Dataset Name', 'wordlift' ) |
|
| 237 | - ) |
|
| 238 | - ); |
|
| 239 | - |
|
| 240 | - add_settings_field( |
|
| 241 | - WL_CONFIG_DATASET_BASE_URI_NAME, // ID used to identify the field throughout the theme |
|
| 242 | - __( 'Redlink Dataset URI', 'wordlift' ), // The label to the left of the option interface element |
|
| 243 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 244 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 245 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 246 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 247 | - 'id' => 'wl-redlink-dataset-uri', |
|
| 248 | - 'name' => 'wl_advanced_settings[redlink_dataset_uri]', |
|
| 249 | - 'value' => wl_configuration_get_redlink_dataset_uri(), |
|
| 250 | - 'description' => __( 'The Redlink Dataset URI', 'wordlift' ) |
|
| 251 | - ) |
|
| 252 | - ); |
|
| 253 | - |
|
| 254 | - add_settings_field( |
|
| 255 | - WL_CONFIG_ANALYSIS_NAME, // ID used to identify the field throughout the theme |
|
| 256 | - __( 'Redlink Application Name', 'wordlift' ), // The label to the left of the option interface element |
|
| 257 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 258 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 259 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 260 | - array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 261 | - 'id' => 'wl-redlink-application-name', |
|
| 262 | - 'name' => 'wl_advanced_settings[redlink_application_name]', |
|
| 263 | - 'value' => wl_configuration_get_redlink_application_name(), |
|
| 264 | - 'description' => __( 'The Redlink Application Name', 'wordlift' ) |
|
| 265 | - ) |
|
| 266 | - ); |
|
| 267 | - } |
|
| 111 | + register_setting( |
|
| 112 | + 'wl_general_settings', |
|
| 113 | + 'wl_general_settings', |
|
| 114 | + 'wl_configuration_sanitize_settings' |
|
| 115 | + ); |
|
| 116 | + |
|
| 117 | + add_settings_section( |
|
| 118 | + 'wl_general_settings_section', // ID used to identify this section and with which to register options |
|
| 119 | + 'General Settings', // Title to be displayed on the administration page |
|
| 120 | + 'wl_configuration_general_settings_section_callback', // Callback used to render the description of the section |
|
| 121 | + 'wl_general_settings' // Page on which to add this section of options |
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + add_settings_field( |
|
| 125 | + WL_CONFIG_WORDLIFT_KEY, // ID used to identify the field throughout the theme |
|
| 126 | + __( 'WordLift Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 127 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 128 | + 'wl_general_settings', // The page on which this option will be displayed |
|
| 129 | + 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 130 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 131 | + 'id' => 'wl-key', |
|
| 132 | + 'name' => 'wl_general_settings[key]', |
|
| 133 | + 'value' => wl_configuration_get_key(), |
|
| 134 | + 'description' => __( 'Insert the WordLift Key', 'wordlift' ) |
|
| 135 | + ) |
|
| 136 | + ); |
|
| 137 | + |
|
| 138 | + add_settings_field( |
|
| 139 | + WL_CONFIG_ENABLE_COLOR_CODING_ON_FRONTEND_NAME, |
|
| 140 | + __( 'Enable color coding on front-end', 'wordlift' ), |
|
| 141 | + 'wl_configuration_checkbox', |
|
| 142 | + 'wl_general_settings', |
|
| 143 | + 'wl_general_settings_section', |
|
| 144 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 145 | + 'id' => 'wl-enable-color-coding', |
|
| 146 | + 'name' => 'wl_general_settings[enable_color_coding]', |
|
| 147 | + 'value' => wl_configuration_get_enable_color_coding(), |
|
| 148 | + 'description' => __( 'Enable color coding', 'wordlift' ) |
|
| 149 | + ) |
|
| 150 | + ); |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + add_settings_field( |
|
| 154 | + WL_CONFIG_SITE_LANGUAGE_NAME, |
|
| 155 | + __( 'Site Language', 'wordlift' ), |
|
| 156 | + 'wl_configuration_select', |
|
| 157 | + 'wl_general_settings', |
|
| 158 | + 'wl_general_settings_section', |
|
| 159 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 160 | + 'id' => 'wl-site-language', |
|
| 161 | + 'name' => 'wl_general_settings[site_language]', |
|
| 162 | + 'value' => wl_configuration_get_site_language(), |
|
| 163 | + 'description' => __( 'The site language', 'wordlift' ), |
|
| 164 | + 'options' => wl_configuration_get_languages() |
|
| 165 | + ) |
|
| 166 | + ); |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + if ( defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION ) { |
|
| 170 | + |
|
| 171 | + register_setting( |
|
| 172 | + 'wl_advanced_settings', |
|
| 173 | + 'wl_advanced_settings', |
|
| 174 | + 'wl_configuration_sanitize_settings' |
|
| 175 | + ); |
|
| 176 | + |
|
| 177 | + add_settings_section( |
|
| 178 | + 'wl_advanced_settings_section', // ID used to identify this section and with which to register options |
|
| 179 | + 'Advanced', // Title to be displayed on the administration page |
|
| 180 | + 'wl_configuration_advanced_settings_section_callback', // Callback used to render the description of the section |
|
| 181 | + 'wl_advanced_settings' // Page on which to add this section of options |
|
| 182 | + ); |
|
| 183 | + |
|
| 184 | + add_settings_field( |
|
| 185 | + WL_CONFIG_API_URL, // ID used to identify the field throughout the theme |
|
| 186 | + __( 'API URL', 'wordlift' ), // The label to the left of the option interface element |
|
| 187 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 188 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 189 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 190 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 191 | + 'id' => 'wl-api-url', |
|
| 192 | + 'name' => 'wl_advanced_settings[api_url]', |
|
| 193 | + 'value' => wl_configuration_get_api_url(), |
|
| 194 | + 'description' => __( 'The API URL', 'wordlift' ) |
|
| 195 | + ) |
|
| 196 | + ); |
|
| 197 | + |
|
| 198 | + add_settings_field( |
|
| 199 | + WL_CONFIG_APPLICATION_KEY_NAME, // ID used to identify the field throughout the theme |
|
| 200 | + __( 'Redlink Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 201 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 202 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 203 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 204 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 205 | + 'id' => 'wl-redlink-key', |
|
| 206 | + 'name' => 'wl_advanced_settings[redlink_key]', |
|
| 207 | + 'value' => wl_configuration_get_redlink_key(), |
|
| 208 | + 'description' => __( 'The Redlink key', 'wordlift' ) |
|
| 209 | + ) |
|
| 210 | + ); |
|
| 211 | + |
|
| 212 | + add_settings_field( |
|
| 213 | + WL_CONFIG_USER_ID_NAME, // ID used to identify the field throughout the theme |
|
| 214 | + __( 'Redlink User Id', 'wordlift' ), // The label to the left of the option interface element |
|
| 215 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 216 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 217 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 218 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 219 | + 'id' => 'wl-redlink-user-id', |
|
| 220 | + 'name' => 'wl_advanced_settings[redlink_user_id]', |
|
| 221 | + 'value' => wl_configuration_get_redlink_user_id(), |
|
| 222 | + 'description' => __( 'The Redlink User Id', 'wordlift' ) |
|
| 223 | + ) |
|
| 224 | + ); |
|
| 225 | + |
|
| 226 | + add_settings_field( |
|
| 227 | + WL_CONFIG_DATASET_NAME, // ID used to identify the field throughout the theme |
|
| 228 | + __( 'Redlink Dataset name', 'wordlift' ), // The label to the left of the option interface element |
|
| 229 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 230 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 231 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 232 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 233 | + 'id' => 'wl-redlink-dataset-name', |
|
| 234 | + 'name' => 'wl_advanced_settings[redlink_dataset_name]', |
|
| 235 | + 'value' => wl_configuration_get_redlink_dataset_name(), |
|
| 236 | + 'description' => __( 'The Redlink Dataset Name', 'wordlift' ) |
|
| 237 | + ) |
|
| 238 | + ); |
|
| 239 | + |
|
| 240 | + add_settings_field( |
|
| 241 | + WL_CONFIG_DATASET_BASE_URI_NAME, // ID used to identify the field throughout the theme |
|
| 242 | + __( 'Redlink Dataset URI', 'wordlift' ), // The label to the left of the option interface element |
|
| 243 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 244 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 245 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 246 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 247 | + 'id' => 'wl-redlink-dataset-uri', |
|
| 248 | + 'name' => 'wl_advanced_settings[redlink_dataset_uri]', |
|
| 249 | + 'value' => wl_configuration_get_redlink_dataset_uri(), |
|
| 250 | + 'description' => __( 'The Redlink Dataset URI', 'wordlift' ) |
|
| 251 | + ) |
|
| 252 | + ); |
|
| 253 | + |
|
| 254 | + add_settings_field( |
|
| 255 | + WL_CONFIG_ANALYSIS_NAME, // ID used to identify the field throughout the theme |
|
| 256 | + __( 'Redlink Application Name', 'wordlift' ), // The label to the left of the option interface element |
|
| 257 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 258 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 259 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 260 | + array( // The array of arguments to pass to the callback. In this case, just a description. |
|
| 261 | + 'id' => 'wl-redlink-application-name', |
|
| 262 | + 'name' => 'wl_advanced_settings[redlink_application_name]', |
|
| 263 | + 'value' => wl_configuration_get_redlink_application_name(), |
|
| 264 | + 'description' => __( 'The Redlink Application Name', 'wordlift' ) |
|
| 265 | + ) |
|
| 266 | + ); |
|
| 267 | + } |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | add_action( 'admin_init', 'wl_configuration_settings' ); |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | function wl_configuration_general_settings_section_callback() { |
| 278 | 278 | |
| 279 | - // TODO: set the following text. |
|
| 280 | - ?> |
|
| 279 | + // TODO: set the following text. |
|
| 280 | + ?> |
|
| 281 | 281 | Configure WordLift general options. |
| 282 | 282 | <?php |
| 283 | 283 | } |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | function wl_configuration_advanced_settings_section_callback() { |
| 291 | 291 | |
| 292 | - // TODO: set the following text. |
|
| 293 | - ?> |
|
| 292 | + // TODO: set the following text. |
|
| 293 | + ?> |
|
| 294 | 294 | Configure WordLift advanced options. |
| 295 | 295 | <?php |
| 296 | 296 | } |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | function wl_configuration_sanitize_settings( $input ) { |
| 308 | 308 | |
| 309 | - // TODO: add sanitization checks. |
|
| 310 | - return apply_filters( 'wl_configuration_sanitize_settings', $input, $input ); |
|
| 309 | + // TODO: add sanitization checks. |
|
| 310 | + return apply_filters( 'wl_configuration_sanitize_settings', $input, $input ); |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @param array $args An array of configuration parameters. |
| 320 | 320 | */ |
| 321 | 321 | function wl_configuration_input_box( $args ) { |
| 322 | - ?> |
|
| 322 | + ?> |
|
| 323 | 323 | |
| 324 | 324 | <input type="text" id="<?php echo esc_attr( $args['id'] ); ?>" |
| 325 | 325 | name="<?php echo esc_attr( $args['name'] ); ?>" |
@@ -336,15 +336,15 @@ discard block |
||
| 336 | 336 | * @param array $args The select configuration parameters. |
| 337 | 337 | */ |
| 338 | 338 | function wl_configuration_select( $args ) { |
| 339 | - ?> |
|
| 339 | + ?> |
|
| 340 | 340 | |
| 341 | 341 | <select id="<?php echo esc_attr( $args['id'] ); ?>" |
| 342 | 342 | name="<?php echo esc_attr( $args['name'] ); ?>"> |
| 343 | 343 | <?php foreach ( $args['options'] as $value => $label ) { ?> |
| 344 | 344 | <option value="<?php echo esc_attr( $value ); ?>" <?php if ( $args['value'] === $value ) { |
| 345 | - echo 'selected'; |
|
| 346 | - } |
|
| 347 | - ?>><?php echo esc_html( $label ); ?></option> |
|
| 345 | + echo 'selected'; |
|
| 346 | + } |
|
| 347 | + ?>><?php echo esc_html( $label ); ?></option> |
|
| 348 | 348 | <?php } ?> |
| 349 | 349 | </select> |
| 350 | 350 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @param array $args The checkbox parameters. |
| 360 | 360 | */ |
| 361 | 361 | function wl_configuration_checkbox( $args ) { |
| 362 | - ?> |
|
| 362 | + ?> |
|
| 363 | 363 | |
| 364 | 364 | <input type="checkbox" id="<?php echo esc_attr( $args['id'] ); ?>" |
| 365 | 365 | name="<?php echo esc_attr( $args['name'] ); ?>" |
@@ -379,10 +379,10 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | function wl_configuration_settings_links( $links ) { |
| 381 | 381 | |
| 382 | - // TODO: this link is different within SEO Ultimate. |
|
| 383 | - array_push( $links, '<a href="' . get_admin_url( null, 'admin.php?page=wl_configuration_admin_menu' ) . '">Settings</a>' ); |
|
| 382 | + // TODO: this link is different within SEO Ultimate. |
|
| 383 | + array_push( $links, '<a href="' . get_admin_url( null, 'admin.php?page=wl_configuration_admin_menu' ) . '">Settings</a>' ); |
|
| 384 | 384 | |
| 385 | - return $links; |
|
| 385 | + return $links; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // add the settings link for the plugin. |
@@ -398,27 +398,27 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | function wl_configuration_get_languages() { |
| 400 | 400 | |
| 401 | - // prepare the language array. |
|
| 402 | - $langs = array(); |
|
| 401 | + // prepare the language array. |
|
| 402 | + $langs = array(); |
|
| 403 | 403 | |
| 404 | - // set the path to the language file. |
|
| 405 | - $filename = dirname( __FILE__ ) . '/ISO-639-2_utf-8.txt'; |
|
| 404 | + // set the path to the language file. |
|
| 405 | + $filename = dirname( __FILE__ ) . '/ISO-639-2_utf-8.txt'; |
|
| 406 | 406 | |
| 407 | - if ( ( $handle = fopen( $filename, 'r' ) ) !== false ) { |
|
| 408 | - while ( ( $data = fgetcsv( $handle, 1000, '|' ) ) !== false ) { |
|
| 409 | - if ( ! empty( $data[2] ) ) { |
|
| 410 | - $code = $data[2]; |
|
| 411 | - $label = htmlentities( $data[3] ); |
|
| 412 | - $langs[ $code ] = $label; |
|
| 413 | - } |
|
| 414 | - } |
|
| 415 | - fclose( $handle ); |
|
| 416 | - } |
|
| 407 | + if ( ( $handle = fopen( $filename, 'r' ) ) !== false ) { |
|
| 408 | + while ( ( $data = fgetcsv( $handle, 1000, '|' ) ) !== false ) { |
|
| 409 | + if ( ! empty( $data[2] ) ) { |
|
| 410 | + $code = $data[2]; |
|
| 411 | + $label = htmlentities( $data[3] ); |
|
| 412 | + $langs[ $code ] = $label; |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + fclose( $handle ); |
|
| 416 | + } |
|
| 417 | 417 | |
| 418 | - // sort the languages; |
|
| 419 | - asort( $langs ); |
|
| 418 | + // sort the languages; |
|
| 419 | + asort( $langs ); |
|
| 420 | 420 | |
| 421 | - return $langs; |
|
| 421 | + return $langs; |
|
| 422 | 422 | |
| 423 | 423 | } |
| 424 | 424 | |
@@ -430,13 +430,13 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | function wl_config_get_recursion_depth() { |
| 432 | 432 | |
| 433 | - // get the plugin options. |
|
| 434 | - $options = get_option( WL_OPTIONS_NAME ); |
|
| 433 | + // get the plugin options. |
|
| 434 | + $options = get_option( WL_OPTIONS_NAME ); |
|
| 435 | 435 | |
| 436 | - return ( isset( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 437 | - && is_numeric( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 438 | - ? $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] |
|
| 439 | - : WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ); |
|
| 436 | + return ( isset( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 437 | + && is_numeric( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 438 | + ? $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] |
|
| 439 | + : WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
@@ -449,13 +449,13 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | function wl_configuration_validate() { |
| 451 | 451 | |
| 452 | - // Check that the WordLift key has been set or show a notice. |
|
| 453 | - if ( '' !== wl_configuration_get_key() ) { |
|
| 454 | - return; |
|
| 455 | - } |
|
| 452 | + // Check that the WordLift key has been set or show a notice. |
|
| 453 | + if ( '' !== wl_configuration_get_key() ) { |
|
| 454 | + return; |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | - Wordlift_Notice_Service::get_instance() |
|
| 458 | - ->add_error( sprintf( __( 'application-key-not-set', 'wordlift' ), 'http://join.wordlift.it' ) ); |
|
| 457 | + Wordlift_Notice_Service::get_instance() |
|
| 458 | + ->add_error( sprintf( __( 'application-key-not-set', 'wordlift' ), 'http://join.wordlift.it' ) ); |
|
| 459 | 459 | |
| 460 | 460 | } |
| 461 | 461 | |
@@ -471,37 +471,37 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | function wl_configuration_update_key( $old_value, $new_value ) { |
| 473 | 473 | |
| 474 | - // wl_write_log( "Going to request set redlink dataset uri if needed" ); |
|
| 474 | + // wl_write_log( "Going to request set redlink dataset uri if needed" ); |
|
| 475 | 475 | |
| 476 | - // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 477 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 478 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 476 | + // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 477 | + $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 478 | + $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 479 | 479 | |
| 480 | - // wl_write_log( "[ old value :: $old_key ][ new value :: $new_key ]" ); |
|
| 480 | + // wl_write_log( "[ old value :: $old_key ][ new value :: $new_key ]" ); |
|
| 481 | 481 | |
| 482 | - // If the key hasn't changed, don't do anything. |
|
| 483 | - // WARN The 'update_option' hook is fired only if the new and old value are not equal |
|
| 484 | - if ( $old_key === $new_key ) { |
|
| 485 | - return; |
|
| 486 | - } |
|
| 482 | + // If the key hasn't changed, don't do anything. |
|
| 483 | + // WARN The 'update_option' hook is fired only if the new and old value are not equal |
|
| 484 | + if ( $old_key === $new_key ) { |
|
| 485 | + return; |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - // If the key is empty, empty the dataset URI. |
|
| 489 | - if ( '' === $new_key ) { |
|
| 490 | - wl_configuration_set_redlink_dataset_uri( '' ); |
|
| 491 | - } |
|
| 488 | + // If the key is empty, empty the dataset URI. |
|
| 489 | + if ( '' === $new_key ) { |
|
| 490 | + wl_configuration_set_redlink_dataset_uri( '' ); |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | - // Request the dataset URI. |
|
| 494 | - $response = wp_remote_get( wl_configuration_get_accounts_by_key_dataset_uri( $new_key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) ); |
|
| 493 | + // Request the dataset URI. |
|
| 494 | + $response = wp_remote_get( wl_configuration_get_accounts_by_key_dataset_uri( $new_key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) ); |
|
| 495 | 495 | |
| 496 | - // If the response is valid, then set the value. |
|
| 497 | - if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) { |
|
| 496 | + // If the response is valid, then set the value. |
|
| 497 | + if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) { |
|
| 498 | 498 | |
| 499 | - // wl_write_log( "[ Retrieved dataset :: " . $response['body'] . " ]" ); |
|
| 500 | - wl_configuration_set_redlink_dataset_uri( $response['body'] ); |
|
| 499 | + // wl_write_log( "[ Retrieved dataset :: " . $response['body'] . " ]" ); |
|
| 500 | + wl_configuration_set_redlink_dataset_uri( $response['body'] ); |
|
| 501 | 501 | |
| 502 | - } else { |
|
| 503 | - wl_write_log( "Error on dataset uri remote retrieving [ " . var_export( $response, true ) . " ]" ); |
|
| 504 | - } |
|
| 502 | + } else { |
|
| 503 | + wl_write_log( "Error on dataset uri remote retrieving [ " . var_export( $response, true ) . " ]" ); |
|
| 504 | + } |
|
| 505 | 505 | |
| 506 | 506 | } |
| 507 | 507 | |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | * * methods for retrieving configuration data |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -require_once( 'wordlift_configuration_constants.php' ); |
|
| 9 | -require_once( 'wordlift_configuration_settings.php' ); |
|
| 8 | +require_once('wordlift_configuration_constants.php'); |
|
| 9 | +require_once('wordlift_configuration_settings.php'); |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * This function is called by the *wl_admin_menu* hook which is raised when WordLift builds the admin_menu. |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | * @param string $parent_slug The parent slug for the menu. |
| 17 | 17 | * @param string $capability The required capability to access the page. |
| 18 | 18 | */ |
| 19 | -function wl_configuration_admin_menu( $parent_slug, $capability ) { |
|
| 19 | +function wl_configuration_admin_menu($parent_slug, $capability) { |
|
| 20 | 20 | |
| 21 | 21 | // see http://codex.wordpress.org/Function_Reference/add_submenu_page |
| 22 | 22 | add_submenu_page( |
| 23 | 23 | $parent_slug, // The parent menu slug, provided by the calling hook. |
| 24 | - __( 'Settings', 'wordlift' ), // page title |
|
| 25 | - __( 'Settings', 'wordlift' ), // menu title |
|
| 26 | - $capability, // The required capability, provided by the calling hook. |
|
| 27 | - 'wl_configuration_admin_menu', // the menu slug |
|
| 24 | + __('Settings', 'wordlift'), // page title |
|
| 25 | + __('Settings', 'wordlift'), // menu title |
|
| 26 | + $capability, // The required capability, provided by the calling hook. |
|
| 27 | + 'wl_configuration_admin_menu', // the menu slug |
|
| 28 | 28 | 'wl_configuration_admin_menu_callback' // the menu callback for displaying the page content |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -add_action( 'wl_admin_menu', 'wl_configuration_admin_menu', 10, 2 ); |
|
| 33 | +add_action('wl_admin_menu', 'wl_configuration_admin_menu', 10, 2); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Displays the page content. |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param boolean $display_page_title If true, prints out the page title. |
| 41 | 41 | */ |
| 42 | -function wl_configuration_admin_menu_callback( $display_page_title = true ) { |
|
| 42 | +function wl_configuration_admin_menu_callback($display_page_title = true) { |
|
| 43 | 43 | |
| 44 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 45 | - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
|
| 44 | + if ( ! current_user_can('manage_options')) { |
|
| 45 | + wp_die(__('You do not have sufficient permissions to access this page.')); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Ony show advanced settings tab if the relative constant exists and is set to true. |
| 49 | - $can_show_advanced_settings = defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION; |
|
| 49 | + $can_show_advanced_settings = defined('WL_ENABLE_ADVANCED_CONFIGURATION') && WL_ENABLE_ADVANCED_CONFIGURATION; |
|
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | 52 | |
| 53 | 53 | <div class="wrap"> |
| 54 | 54 | |
| 55 | - <?php if ( $display_page_title ) { ?> |
|
| 55 | + <?php if ($display_page_title) { ?> |
|
| 56 | 56 | <div id="icon-themes" class="icon32"></div> |
| 57 | 57 | <h2>WordLift</h2> |
| 58 | 58 | <?php } ?> |
@@ -60,28 +60,28 @@ discard block |
||
| 60 | 60 | <?php settings_errors(); ?> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general_settings'; |
|
| 63 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general_settings'; |
|
| 64 | 64 | ?> |
| 65 | 65 | |
| 66 | 66 | <h2 class="nav-tab-wrapper"> |
| 67 | - <a href="?page=<?php echo( $_GET['page'] ); ?>&tab=general_settings" |
|
| 68 | - class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php esc_attr_e( 'General', 'wordlift' ); ?></a> |
|
| 67 | + <a href="?page=<?php echo($_GET['page']); ?>&tab=general_settings" |
|
| 68 | + class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php esc_attr_e('General', 'wordlift'); ?></a> |
|
| 69 | 69 | |
| 70 | - <?php if ( $can_show_advanced_settings ): ?> |
|
| 71 | - <a href="?page=<?php echo( $_GET['page'] ); ?>&tab=advanced_settings" |
|
| 72 | - class="nav-tab <?php echo $active_tab == 'advanced_settings' ? 'nav-tab-active' : ''; ?>"><?php esc_attr_e( 'Advanced', 'wordlift' ); ?></a> |
|
| 70 | + <?php if ($can_show_advanced_settings): ?> |
|
| 71 | + <a href="?page=<?php echo($_GET['page']); ?>&tab=advanced_settings" |
|
| 72 | + class="nav-tab <?php echo $active_tab == 'advanced_settings' ? 'nav-tab-active' : ''; ?>"><?php esc_attr_e('Advanced', 'wordlift'); ?></a> |
|
| 73 | 73 | <?php endif; ?> |
| 74 | 74 | </h2> |
| 75 | 75 | |
| 76 | 76 | <form action="options.php" method="post"> |
| 77 | 77 | <?php |
| 78 | - if ( 'general_settings' === $active_tab ) { |
|
| 79 | - settings_fields( 'wl_general_settings' ); |
|
| 80 | - do_settings_sections( 'wl_general_settings' ); |
|
| 78 | + if ('general_settings' === $active_tab) { |
|
| 79 | + settings_fields('wl_general_settings'); |
|
| 80 | + do_settings_sections('wl_general_settings'); |
|
| 81 | 81 | |
| 82 | - } else if ( $can_show_advanced_settings && 'advanced_settings' === $active_tab ) { |
|
| 83 | - settings_fields( 'wl_advanced_settings' ); |
|
| 84 | - do_settings_sections( 'wl_advanced_settings' ); |
|
| 82 | + } else if ($can_show_advanced_settings && 'advanced_settings' === $active_tab) { |
|
| 83 | + settings_fields('wl_advanced_settings'); |
|
| 84 | + do_settings_sections('wl_advanced_settings'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | submit_button(); |
@@ -115,29 +115,29 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | add_settings_section( |
| 118 | - 'wl_general_settings_section', // ID used to identify this section and with which to register options |
|
| 119 | - 'General Settings', // Title to be displayed on the administration page |
|
| 118 | + 'wl_general_settings_section', // ID used to identify this section and with which to register options |
|
| 119 | + 'General Settings', // Title to be displayed on the administration page |
|
| 120 | 120 | 'wl_configuration_general_settings_section_callback', // Callback used to render the description of the section |
| 121 | 121 | 'wl_general_settings' // Page on which to add this section of options |
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | add_settings_field( |
| 125 | - WL_CONFIG_WORDLIFT_KEY, // ID used to identify the field throughout the theme |
|
| 126 | - __( 'WordLift Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 127 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 128 | - 'wl_general_settings', // The page on which this option will be displayed |
|
| 129 | - 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 125 | + WL_CONFIG_WORDLIFT_KEY, // ID used to identify the field throughout the theme |
|
| 126 | + __('WordLift Key', 'wordlift'), // The label to the left of the option interface element |
|
| 127 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 128 | + 'wl_general_settings', // The page on which this option will be displayed |
|
| 129 | + 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 130 | 130 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 131 | 131 | 'id' => 'wl-key', |
| 132 | 132 | 'name' => 'wl_general_settings[key]', |
| 133 | 133 | 'value' => wl_configuration_get_key(), |
| 134 | - 'description' => __( 'Insert the WordLift Key', 'wordlift' ) |
|
| 134 | + 'description' => __('Insert the WordLift Key', 'wordlift') |
|
| 135 | 135 | ) |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | 138 | add_settings_field( |
| 139 | 139 | WL_CONFIG_ENABLE_COLOR_CODING_ON_FRONTEND_NAME, |
| 140 | - __( 'Enable color coding on front-end', 'wordlift' ), |
|
| 140 | + __('Enable color coding on front-end', 'wordlift'), |
|
| 141 | 141 | 'wl_configuration_checkbox', |
| 142 | 142 | 'wl_general_settings', |
| 143 | 143 | 'wl_general_settings_section', |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | 'id' => 'wl-enable-color-coding', |
| 146 | 146 | 'name' => 'wl_general_settings[enable_color_coding]', |
| 147 | 147 | 'value' => wl_configuration_get_enable_color_coding(), |
| 148 | - 'description' => __( 'Enable color coding', 'wordlift' ) |
|
| 148 | + 'description' => __('Enable color coding', 'wordlift') |
|
| 149 | 149 | ) |
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | add_settings_field( |
| 154 | 154 | WL_CONFIG_SITE_LANGUAGE_NAME, |
| 155 | - __( 'Site Language', 'wordlift' ), |
|
| 155 | + __('Site Language', 'wordlift'), |
|
| 156 | 156 | 'wl_configuration_select', |
| 157 | 157 | 'wl_general_settings', |
| 158 | 158 | 'wl_general_settings_section', |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | 'id' => 'wl-site-language', |
| 161 | 161 | 'name' => 'wl_general_settings[site_language]', |
| 162 | 162 | 'value' => wl_configuration_get_site_language(), |
| 163 | - 'description' => __( 'The site language', 'wordlift' ), |
|
| 163 | + 'description' => __('The site language', 'wordlift'), |
|
| 164 | 164 | 'options' => wl_configuration_get_languages() |
| 165 | 165 | ) |
| 166 | 166 | ); |
| 167 | 167 | |
| 168 | 168 | |
| 169 | - if ( defined( 'WL_ENABLE_ADVANCED_CONFIGURATION' ) && WL_ENABLE_ADVANCED_CONFIGURATION ) { |
|
| 169 | + if (defined('WL_ENABLE_ADVANCED_CONFIGURATION') && WL_ENABLE_ADVANCED_CONFIGURATION) { |
|
| 170 | 170 | |
| 171 | 171 | register_setting( |
| 172 | 172 | 'wl_advanced_settings', |
@@ -175,99 +175,99 @@ discard block |
||
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | add_settings_section( |
| 178 | - 'wl_advanced_settings_section', // ID used to identify this section and with which to register options |
|
| 179 | - 'Advanced', // Title to be displayed on the administration page |
|
| 178 | + 'wl_advanced_settings_section', // ID used to identify this section and with which to register options |
|
| 179 | + 'Advanced', // Title to be displayed on the administration page |
|
| 180 | 180 | 'wl_configuration_advanced_settings_section_callback', // Callback used to render the description of the section |
| 181 | 181 | 'wl_advanced_settings' // Page on which to add this section of options |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | 184 | add_settings_field( |
| 185 | - WL_CONFIG_API_URL, // ID used to identify the field throughout the theme |
|
| 186 | - __( 'API URL', 'wordlift' ), // The label to the left of the option interface element |
|
| 187 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 188 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 189 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 185 | + WL_CONFIG_API_URL, // ID used to identify the field throughout the theme |
|
| 186 | + __('API URL', 'wordlift'), // The label to the left of the option interface element |
|
| 187 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 188 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 189 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 190 | 190 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 191 | 191 | 'id' => 'wl-api-url', |
| 192 | 192 | 'name' => 'wl_advanced_settings[api_url]', |
| 193 | 193 | 'value' => wl_configuration_get_api_url(), |
| 194 | - 'description' => __( 'The API URL', 'wordlift' ) |
|
| 194 | + 'description' => __('The API URL', 'wordlift') |
|
| 195 | 195 | ) |
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | 198 | add_settings_field( |
| 199 | - WL_CONFIG_APPLICATION_KEY_NAME, // ID used to identify the field throughout the theme |
|
| 200 | - __( 'Redlink Key', 'wordlift' ), // The label to the left of the option interface element |
|
| 201 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 202 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 203 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 199 | + WL_CONFIG_APPLICATION_KEY_NAME, // ID used to identify the field throughout the theme |
|
| 200 | + __('Redlink Key', 'wordlift'), // The label to the left of the option interface element |
|
| 201 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 202 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 203 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 204 | 204 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 205 | 205 | 'id' => 'wl-redlink-key', |
| 206 | 206 | 'name' => 'wl_advanced_settings[redlink_key]', |
| 207 | 207 | 'value' => wl_configuration_get_redlink_key(), |
| 208 | - 'description' => __( 'The Redlink key', 'wordlift' ) |
|
| 208 | + 'description' => __('The Redlink key', 'wordlift') |
|
| 209 | 209 | ) |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | 212 | add_settings_field( |
| 213 | - WL_CONFIG_USER_ID_NAME, // ID used to identify the field throughout the theme |
|
| 214 | - __( 'Redlink User Id', 'wordlift' ), // The label to the left of the option interface element |
|
| 215 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 216 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 217 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 213 | + WL_CONFIG_USER_ID_NAME, // ID used to identify the field throughout the theme |
|
| 214 | + __('Redlink User Id', 'wordlift'), // The label to the left of the option interface element |
|
| 215 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 216 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 217 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 218 | 218 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 219 | 219 | 'id' => 'wl-redlink-user-id', |
| 220 | 220 | 'name' => 'wl_advanced_settings[redlink_user_id]', |
| 221 | 221 | 'value' => wl_configuration_get_redlink_user_id(), |
| 222 | - 'description' => __( 'The Redlink User Id', 'wordlift' ) |
|
| 222 | + 'description' => __('The Redlink User Id', 'wordlift') |
|
| 223 | 223 | ) |
| 224 | 224 | ); |
| 225 | 225 | |
| 226 | 226 | add_settings_field( |
| 227 | - WL_CONFIG_DATASET_NAME, // ID used to identify the field throughout the theme |
|
| 228 | - __( 'Redlink Dataset name', 'wordlift' ), // The label to the left of the option interface element |
|
| 229 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 230 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 231 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 227 | + WL_CONFIG_DATASET_NAME, // ID used to identify the field throughout the theme |
|
| 228 | + __('Redlink Dataset name', 'wordlift'), // The label to the left of the option interface element |
|
| 229 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 230 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 231 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 232 | 232 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 233 | 233 | 'id' => 'wl-redlink-dataset-name', |
| 234 | 234 | 'name' => 'wl_advanced_settings[redlink_dataset_name]', |
| 235 | 235 | 'value' => wl_configuration_get_redlink_dataset_name(), |
| 236 | - 'description' => __( 'The Redlink Dataset Name', 'wordlift' ) |
|
| 236 | + 'description' => __('The Redlink Dataset Name', 'wordlift') |
|
| 237 | 237 | ) |
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | 240 | add_settings_field( |
| 241 | - WL_CONFIG_DATASET_BASE_URI_NAME, // ID used to identify the field throughout the theme |
|
| 242 | - __( 'Redlink Dataset URI', 'wordlift' ), // The label to the left of the option interface element |
|
| 243 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 244 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 245 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 241 | + WL_CONFIG_DATASET_BASE_URI_NAME, // ID used to identify the field throughout the theme |
|
| 242 | + __('Redlink Dataset URI', 'wordlift'), // The label to the left of the option interface element |
|
| 243 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 244 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 245 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 246 | 246 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 247 | 247 | 'id' => 'wl-redlink-dataset-uri', |
| 248 | 248 | 'name' => 'wl_advanced_settings[redlink_dataset_uri]', |
| 249 | 249 | 'value' => wl_configuration_get_redlink_dataset_uri(), |
| 250 | - 'description' => __( 'The Redlink Dataset URI', 'wordlift' ) |
|
| 250 | + 'description' => __('The Redlink Dataset URI', 'wordlift') |
|
| 251 | 251 | ) |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | 254 | add_settings_field( |
| 255 | - WL_CONFIG_ANALYSIS_NAME, // ID used to identify the field throughout the theme |
|
| 256 | - __( 'Redlink Application Name', 'wordlift' ), // The label to the left of the option interface element |
|
| 257 | - 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 258 | - 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 259 | - 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 255 | + WL_CONFIG_ANALYSIS_NAME, // ID used to identify the field throughout the theme |
|
| 256 | + __('Redlink Application Name', 'wordlift'), // The label to the left of the option interface element |
|
| 257 | + 'wl_configuration_input_box', // The name of the function responsible for rendering the option interface |
|
| 258 | + 'wl_advanced_settings', // The page on which this option will be displayed |
|
| 259 | + 'wl_advanced_settings_section', // The name of the section to which this field belongs |
|
| 260 | 260 | array( // The array of arguments to pass to the callback. In this case, just a description. |
| 261 | 261 | 'id' => 'wl-redlink-application-name', |
| 262 | 262 | 'name' => 'wl_advanced_settings[redlink_application_name]', |
| 263 | 263 | 'value' => wl_configuration_get_redlink_application_name(), |
| 264 | - 'description' => __( 'The Redlink Application Name', 'wordlift' ) |
|
| 264 | + 'description' => __('The Redlink Application Name', 'wordlift') |
|
| 265 | 265 | ) |
| 266 | 266 | ); |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | -add_action( 'admin_init', 'wl_configuration_settings' ); |
|
| 270 | +add_action('admin_init', 'wl_configuration_settings'); |
|
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Display the general settings description. Called from a hook set by *wl_configuration_settings*. |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @return mixed |
| 306 | 306 | */ |
| 307 | -function wl_configuration_sanitize_settings( $input ) { |
|
| 307 | +function wl_configuration_sanitize_settings($input) { |
|
| 308 | 308 | |
| 309 | 309 | // TODO: add sanitization checks. |
| 310 | - return apply_filters( 'wl_configuration_sanitize_settings', $input, $input ); |
|
| 310 | + return apply_filters('wl_configuration_sanitize_settings', $input, $input); |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @param array $args An array of configuration parameters. |
| 320 | 320 | */ |
| 321 | -function wl_configuration_input_box( $args ) { |
|
| 321 | +function wl_configuration_input_box($args) { |
|
| 322 | 322 | ?> |
| 323 | 323 | |
| 324 | - <input type="text" id="<?php echo esc_attr( $args['id'] ); ?>" |
|
| 325 | - name="<?php echo esc_attr( $args['name'] ); ?>" |
|
| 326 | - value="<?php echo esc_attr( $args['value'] ); ?>"/> |
|
| 324 | + <input type="text" id="<?php echo esc_attr($args['id']); ?>" |
|
| 325 | + name="<?php echo esc_attr($args['name']); ?>" |
|
| 326 | + value="<?php echo esc_attr($args['value']); ?>"/> |
|
| 327 | 327 | |
| 328 | 328 | <?php |
| 329 | 329 | } |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | * |
| 336 | 336 | * @param array $args The select configuration parameters. |
| 337 | 337 | */ |
| 338 | -function wl_configuration_select( $args ) { |
|
| 338 | +function wl_configuration_select($args) { |
|
| 339 | 339 | ?> |
| 340 | 340 | |
| 341 | - <select id="<?php echo esc_attr( $args['id'] ); ?>" |
|
| 342 | - name="<?php echo esc_attr( $args['name'] ); ?>"> |
|
| 343 | - <?php foreach ( $args['options'] as $value => $label ) { ?> |
|
| 344 | - <option value="<?php echo esc_attr( $value ); ?>" <?php if ( $args['value'] === $value ) { |
|
| 341 | + <select id="<?php echo esc_attr($args['id']); ?>" |
|
| 342 | + name="<?php echo esc_attr($args['name']); ?>"> |
|
| 343 | + <?php foreach ($args['options'] as $value => $label) { ?> |
|
| 344 | + <option value="<?php echo esc_attr($value); ?>" <?php if ($args['value'] === $value) { |
|
| 345 | 345 | echo 'selected'; |
| 346 | 346 | } |
| 347 | - ?>><?php echo esc_html( $label ); ?></option> |
|
| 347 | + ?>><?php echo esc_html($label); ?></option> |
|
| 348 | 348 | <?php } ?> |
| 349 | 349 | </select> |
| 350 | 350 | |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @param array $args The checkbox parameters. |
| 360 | 360 | */ |
| 361 | -function wl_configuration_checkbox( $args ) { |
|
| 361 | +function wl_configuration_checkbox($args) { |
|
| 362 | 362 | ?> |
| 363 | 363 | |
| 364 | - <input type="checkbox" id="<?php echo esc_attr( $args['id'] ); ?>" |
|
| 365 | - name="<?php echo esc_attr( $args['name'] ); ?>" |
|
| 366 | - value="1" <?php checked( 1, $args['value'], true ); ?>/> |
|
| 364 | + <input type="checkbox" id="<?php echo esc_attr($args['id']); ?>" |
|
| 365 | + name="<?php echo esc_attr($args['name']); ?>" |
|
| 366 | + value="1" <?php checked(1, $args['value'], true); ?>/> |
|
| 367 | 367 | |
| 368 | 368 | <?php |
| 369 | 369 | } |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | * @return array An array of links including those added by the plugin. |
| 379 | 379 | */ |
| 380 | -function wl_configuration_settings_links( $links ) { |
|
| 380 | +function wl_configuration_settings_links($links) { |
|
| 381 | 381 | |
| 382 | 382 | // TODO: this link is different within SEO Ultimate. |
| 383 | - array_push( $links, '<a href="' . get_admin_url( null, 'admin.php?page=wl_configuration_admin_menu' ) . '">Settings</a>' ); |
|
| 383 | + array_push($links, '<a href="'.get_admin_url(null, 'admin.php?page=wl_configuration_admin_menu').'">Settings</a>'); |
|
| 384 | 384 | |
| 385 | 385 | return $links; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // add the settings link for the plugin. |
| 389 | -add_filter( "plugin_action_links_wordlift/wordlift.php", 'wl_configuration_settings_links' ); |
|
| 389 | +add_filter("plugin_action_links_wordlift/wordlift.php", 'wl_configuration_settings_links'); |
|
| 390 | 390 | |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -402,21 +402,21 @@ discard block |
||
| 402 | 402 | $langs = array(); |
| 403 | 403 | |
| 404 | 404 | // set the path to the language file. |
| 405 | - $filename = dirname( __FILE__ ) . '/ISO-639-2_utf-8.txt'; |
|
| 405 | + $filename = dirname(__FILE__).'/ISO-639-2_utf-8.txt'; |
|
| 406 | 406 | |
| 407 | - if ( ( $handle = fopen( $filename, 'r' ) ) !== false ) { |
|
| 408 | - while ( ( $data = fgetcsv( $handle, 1000, '|' ) ) !== false ) { |
|
| 409 | - if ( ! empty( $data[2] ) ) { |
|
| 407 | + if (($handle = fopen($filename, 'r')) !== false) { |
|
| 408 | + while (($data = fgetcsv($handle, 1000, '|')) !== false) { |
|
| 409 | + if ( ! empty($data[2])) { |
|
| 410 | 410 | $code = $data[2]; |
| 411 | - $label = htmlentities( $data[3] ); |
|
| 412 | - $langs[ $code ] = $label; |
|
| 411 | + $label = htmlentities($data[3]); |
|
| 412 | + $langs[$code] = $label; |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | - fclose( $handle ); |
|
| 415 | + fclose($handle); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | // sort the languages; |
| 419 | - asort( $langs ); |
|
| 419 | + asort($langs); |
|
| 420 | 420 | |
| 421 | 421 | return $langs; |
| 422 | 422 | |
@@ -431,12 +431,12 @@ discard block |
||
| 431 | 431 | function wl_config_get_recursion_depth() { |
| 432 | 432 | |
| 433 | 433 | // get the plugin options. |
| 434 | - $options = get_option( WL_OPTIONS_NAME ); |
|
| 434 | + $options = get_option(WL_OPTIONS_NAME); |
|
| 435 | 435 | |
| 436 | - return ( isset( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 437 | - && is_numeric( $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] ) |
|
| 438 | - ? $options[ WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ] |
|
| 439 | - : WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING ); |
|
| 436 | + return (isset($options[WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING]) |
|
| 437 | + && is_numeric($options[WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING]) |
|
| 438 | + ? $options[WL_CONFIG_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING] |
|
| 439 | + : WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
@@ -450,16 +450,16 @@ discard block |
||
| 450 | 450 | function wl_configuration_validate() { |
| 451 | 451 | |
| 452 | 452 | // Check that the WordLift key has been set or show a notice. |
| 453 | - if ( '' !== wl_configuration_get_key() ) { |
|
| 453 | + if ('' !== wl_configuration_get_key()) { |
|
| 454 | 454 | return; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | Wordlift_Notice_Service::get_instance() |
| 458 | - ->add_error( sprintf( __( 'application-key-not-set', 'wordlift' ), 'http://join.wordlift.it' ) ); |
|
| 458 | + ->add_error(sprintf(__('application-key-not-set', 'wordlift'), 'http://join.wordlift.it')); |
|
| 459 | 459 | |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | -add_action( 'admin_init', 'wl_configuration_validate' ); |
|
| 462 | +add_action('admin_init', 'wl_configuration_validate'); |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Intercept the change of the WordLift key in order to set the dataset URI. |
@@ -469,40 +469,40 @@ discard block |
||
| 469 | 469 | * @param array $old_value The old settings. |
| 470 | 470 | * @param array $new_value The new settings. |
| 471 | 471 | */ |
| 472 | -function wl_configuration_update_key( $old_value, $new_value ) { |
|
| 472 | +function wl_configuration_update_key($old_value, $new_value) { |
|
| 473 | 473 | |
| 474 | 474 | // wl_write_log( "Going to request set redlink dataset uri if needed" ); |
| 475 | 475 | |
| 476 | 476 | // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
| 477 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 478 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 477 | + $old_key = isset($old_value['key']) ? $old_value['key'] : ''; |
|
| 478 | + $new_key = isset($new_value['key']) ? $new_value['key'] : ''; |
|
| 479 | 479 | |
| 480 | 480 | // wl_write_log( "[ old value :: $old_key ][ new value :: $new_key ]" ); |
| 481 | 481 | |
| 482 | 482 | // If the key hasn't changed, don't do anything. |
| 483 | 483 | // WARN The 'update_option' hook is fired only if the new and old value are not equal |
| 484 | - if ( $old_key === $new_key ) { |
|
| 484 | + if ($old_key === $new_key) { |
|
| 485 | 485 | return; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | // If the key is empty, empty the dataset URI. |
| 489 | - if ( '' === $new_key ) { |
|
| 490 | - wl_configuration_set_redlink_dataset_uri( '' ); |
|
| 489 | + if ('' === $new_key) { |
|
| 490 | + wl_configuration_set_redlink_dataset_uri(''); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // Request the dataset URI. |
| 494 | - $response = wp_remote_get( wl_configuration_get_accounts_by_key_dataset_uri( $new_key ), unserialize( WL_REDLINK_API_HTTP_OPTIONS ) ); |
|
| 494 | + $response = wp_remote_get(wl_configuration_get_accounts_by_key_dataset_uri($new_key), unserialize(WL_REDLINK_API_HTTP_OPTIONS)); |
|
| 495 | 495 | |
| 496 | 496 | // If the response is valid, then set the value. |
| 497 | - if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) { |
|
| 497 | + if ( ! is_wp_error($response) && 200 === (int) $response['response']['code']) { |
|
| 498 | 498 | |
| 499 | 499 | // wl_write_log( "[ Retrieved dataset :: " . $response['body'] . " ]" ); |
| 500 | - wl_configuration_set_redlink_dataset_uri( $response['body'] ); |
|
| 500 | + wl_configuration_set_redlink_dataset_uri($response['body']); |
|
| 501 | 501 | |
| 502 | 502 | } else { |
| 503 | - wl_write_log( "Error on dataset uri remote retrieving [ " . var_export( $response, true ) . " ]" ); |
|
| 503 | + wl_write_log("Error on dataset uri remote retrieving [ ".var_export($response, true)." ]"); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | -add_action( 'update_option_wl_general_settings', 'wl_configuration_update_key', 10, 2 ); |
|
| 509 | 508 | \ No newline at end of file |
| 509 | +add_action('update_option_wl_general_settings', 'wl_configuration_update_key', 10, 2); |
|
| 510 | 510 | \ No newline at end of file |
@@ -7,142 +7,142 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_Notice_Service { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * The template used to display notices. The <em>notice dismissible</em> style classes make this notice dismissible |
|
| 12 | - * on the WordPress UI (via a small X button on the right side of the notice). |
|
| 13 | - * |
|
| 14 | - * @since 3.2.0 |
|
| 15 | - */ |
|
| 16 | - const TEMPLATE = '<div class="wl-notice notice is-dismissible %s"><p>%s</p></div>'; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * The standard WordPress <em>update</em> style class. |
|
| 20 | - * |
|
| 21 | - * @since 3.2.0 |
|
| 22 | - */ |
|
| 23 | - const UPDATE = 'update'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * The standard WordPress <em>update-nag</em> style class. |
|
| 27 | - * |
|
| 28 | - * @since 3.2.0 |
|
| 29 | - */ |
|
| 30 | - const UPDATE_NAG = 'update-nag'; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * The standard WordPress <em>error</em> style class. |
|
| 34 | - * |
|
| 35 | - * @since 3.2.0 |
|
| 36 | - */ |
|
| 37 | - const ERROR = 'error'; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * The array of notices. |
|
| 41 | - * |
|
| 42 | - * @since 3.2.0 |
|
| 43 | - * @access private |
|
| 44 | - * @var array $notices The array of notices. |
|
| 45 | - */ |
|
| 46 | - private $notices = array(); |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * A singleton instance of the Notice service. |
|
| 50 | - * |
|
| 51 | - * @since 3.2.0 |
|
| 52 | - * @access private |
|
| 53 | - * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 54 | - */ |
|
| 55 | - private static $instance; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Create an instance of the Notice service. |
|
| 59 | - * |
|
| 60 | - * @since 3.2.0 |
|
| 61 | - */ |
|
| 62 | - public function __construct() { |
|
| 63 | - |
|
| 64 | - // Hook to be called when to display notices. |
|
| 65 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 66 | - |
|
| 67 | - self::$instance = $this; |
|
| 68 | - |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Get the singleton instance of the Notice service. |
|
| 73 | - * |
|
| 74 | - * @since 3.2.0 |
|
| 75 | - * @return \Wordlift_Notice_Service The singleton instance of the Notice service. |
|
| 76 | - */ |
|
| 77 | - public static function get_instance() { |
|
| 78 | - |
|
| 79 | - return self::$instance; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Add a notice. |
|
| 84 | - * |
|
| 85 | - * @since 3.2.0 |
|
| 86 | - * |
|
| 87 | - * @param string $class The css class. |
|
| 88 | - * @param string $message The message. |
|
| 89 | - */ |
|
| 90 | - public function add( $class, $message ) { |
|
| 91 | - |
|
| 92 | - $this->notices[] = sprintf( self::TEMPLATE, $class, $message ); |
|
| 93 | - |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Add an update notice (message with a white background and a green left border). |
|
| 98 | - * |
|
| 99 | - * @since 3.2.0 |
|
| 100 | - * |
|
| 101 | - * @param string $message The message to display. |
|
| 102 | - */ |
|
| 103 | - public function add_update( $message ) { |
|
| 104 | - |
|
| 105 | - $this->add( self::UPDATE, $message ); |
|
| 106 | - |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Add an update nag notice (message with a white background and a yellow left border). |
|
| 111 | - * |
|
| 112 | - * @since 3.2.0 |
|
| 113 | - * |
|
| 114 | - * @param string $message The message to display. |
|
| 115 | - */ |
|
| 116 | - public function add_update_nag( $message ) { |
|
| 117 | - |
|
| 118 | - $this->add( self::UPDATE_NAG, $message ); |
|
| 119 | - |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Add an error notice (message with a white background and a red left border). |
|
| 124 | - * |
|
| 125 | - * @since 3.2.0 |
|
| 126 | - * |
|
| 127 | - * @param string $message The message to display. |
|
| 128 | - */ |
|
| 129 | - public function add_error( $message ) { |
|
| 130 | - |
|
| 131 | - $this->add( self::ERROR, $message ); |
|
| 132 | - |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Print out the notices when the admin_notices action is called. |
|
| 137 | - * |
|
| 138 | - * @since 3.2.0 |
|
| 139 | - */ |
|
| 140 | - public function admin_notices() { |
|
| 141 | - |
|
| 142 | - foreach ( $this->notices as $notice ) { |
|
| 143 | - echo( $notice ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - } |
|
| 10 | + /** |
|
| 11 | + * The template used to display notices. The <em>notice dismissible</em> style classes make this notice dismissible |
|
| 12 | + * on the WordPress UI (via a small X button on the right side of the notice). |
|
| 13 | + * |
|
| 14 | + * @since 3.2.0 |
|
| 15 | + */ |
|
| 16 | + const TEMPLATE = '<div class="wl-notice notice is-dismissible %s"><p>%s</p></div>'; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * The standard WordPress <em>update</em> style class. |
|
| 20 | + * |
|
| 21 | + * @since 3.2.0 |
|
| 22 | + */ |
|
| 23 | + const UPDATE = 'update'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * The standard WordPress <em>update-nag</em> style class. |
|
| 27 | + * |
|
| 28 | + * @since 3.2.0 |
|
| 29 | + */ |
|
| 30 | + const UPDATE_NAG = 'update-nag'; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * The standard WordPress <em>error</em> style class. |
|
| 34 | + * |
|
| 35 | + * @since 3.2.0 |
|
| 36 | + */ |
|
| 37 | + const ERROR = 'error'; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * The array of notices. |
|
| 41 | + * |
|
| 42 | + * @since 3.2.0 |
|
| 43 | + * @access private |
|
| 44 | + * @var array $notices The array of notices. |
|
| 45 | + */ |
|
| 46 | + private $notices = array(); |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * A singleton instance of the Notice service. |
|
| 50 | + * |
|
| 51 | + * @since 3.2.0 |
|
| 52 | + * @access private |
|
| 53 | + * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 54 | + */ |
|
| 55 | + private static $instance; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Create an instance of the Notice service. |
|
| 59 | + * |
|
| 60 | + * @since 3.2.0 |
|
| 61 | + */ |
|
| 62 | + public function __construct() { |
|
| 63 | + |
|
| 64 | + // Hook to be called when to display notices. |
|
| 65 | + add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 66 | + |
|
| 67 | + self::$instance = $this; |
|
| 68 | + |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Get the singleton instance of the Notice service. |
|
| 73 | + * |
|
| 74 | + * @since 3.2.0 |
|
| 75 | + * @return \Wordlift_Notice_Service The singleton instance of the Notice service. |
|
| 76 | + */ |
|
| 77 | + public static function get_instance() { |
|
| 78 | + |
|
| 79 | + return self::$instance; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Add a notice. |
|
| 84 | + * |
|
| 85 | + * @since 3.2.0 |
|
| 86 | + * |
|
| 87 | + * @param string $class The css class. |
|
| 88 | + * @param string $message The message. |
|
| 89 | + */ |
|
| 90 | + public function add( $class, $message ) { |
|
| 91 | + |
|
| 92 | + $this->notices[] = sprintf( self::TEMPLATE, $class, $message ); |
|
| 93 | + |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Add an update notice (message with a white background and a green left border). |
|
| 98 | + * |
|
| 99 | + * @since 3.2.0 |
|
| 100 | + * |
|
| 101 | + * @param string $message The message to display. |
|
| 102 | + */ |
|
| 103 | + public function add_update( $message ) { |
|
| 104 | + |
|
| 105 | + $this->add( self::UPDATE, $message ); |
|
| 106 | + |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Add an update nag notice (message with a white background and a yellow left border). |
|
| 111 | + * |
|
| 112 | + * @since 3.2.0 |
|
| 113 | + * |
|
| 114 | + * @param string $message The message to display. |
|
| 115 | + */ |
|
| 116 | + public function add_update_nag( $message ) { |
|
| 117 | + |
|
| 118 | + $this->add( self::UPDATE_NAG, $message ); |
|
| 119 | + |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Add an error notice (message with a white background and a red left border). |
|
| 124 | + * |
|
| 125 | + * @since 3.2.0 |
|
| 126 | + * |
|
| 127 | + * @param string $message The message to display. |
|
| 128 | + */ |
|
| 129 | + public function add_error( $message ) { |
|
| 130 | + |
|
| 131 | + $this->add( self::ERROR, $message ); |
|
| 132 | + |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Print out the notices when the admin_notices action is called. |
|
| 137 | + * |
|
| 138 | + * @since 3.2.0 |
|
| 139 | + */ |
|
| 140 | + public function admin_notices() { |
|
| 141 | + |
|
| 142 | + foreach ( $this->notices as $notice ) { |
|
| 143 | + echo( $notice ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | 148 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function __construct() { |
| 63 | 63 | |
| 64 | 64 | // Hook to be called when to display notices. |
| 65 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
| 65 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
| 66 | 66 | |
| 67 | 67 | self::$instance = $this; |
| 68 | 68 | |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | * @param string $class The css class. |
| 88 | 88 | * @param string $message The message. |
| 89 | 89 | */ |
| 90 | - public function add( $class, $message ) { |
|
| 90 | + public function add($class, $message) { |
|
| 91 | 91 | |
| 92 | - $this->notices[] = sprintf( self::TEMPLATE, $class, $message ); |
|
| 92 | + $this->notices[] = sprintf(self::TEMPLATE, $class, $message); |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param string $message The message to display. |
| 102 | 102 | */ |
| 103 | - public function add_update( $message ) { |
|
| 103 | + public function add_update($message) { |
|
| 104 | 104 | |
| 105 | - $this->add( self::UPDATE, $message ); |
|
| 105 | + $this->add(self::UPDATE, $message); |
|
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param string $message The message to display. |
| 115 | 115 | */ |
| 116 | - public function add_update_nag( $message ) { |
|
| 116 | + public function add_update_nag($message) { |
|
| 117 | 117 | |
| 118 | - $this->add( self::UPDATE_NAG, $message ); |
|
| 118 | + $this->add(self::UPDATE_NAG, $message); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @param string $message The message to display. |
| 128 | 128 | */ |
| 129 | - public function add_error( $message ) { |
|
| 129 | + public function add_error($message) { |
|
| 130 | 130 | |
| 131 | - $this->add( self::ERROR, $message ); |
|
| 131 | + $this->add(self::ERROR, $message); |
|
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function admin_notices() { |
| 141 | 141 | |
| 142 | - foreach ( $this->notices as $notice ) { |
|
| 143 | - echo( $notice ); |
|
| 142 | + foreach ($this->notices as $notice) { |
|
| 143 | + echo($notice); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | } |
@@ -29,351 +29,351 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Wordlift { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | - * the plugin. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access protected |
|
| 38 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | - */ |
|
| 40 | - protected $loader; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * The unique identifier of this plugin. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @access protected |
|
| 47 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | - */ |
|
| 49 | - protected $plugin_name; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * The current version of the plugin. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @access protected |
|
| 56 | - * @var string $version The current version of the plugin. |
|
| 57 | - */ |
|
| 58 | - protected $version; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * The Thumbnail service. |
|
| 62 | - * |
|
| 63 | - * @since 3.1.5 |
|
| 64 | - * @access private |
|
| 65 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | - */ |
|
| 67 | - private $thumbnail_service; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The Entity service. |
|
| 71 | - * |
|
| 72 | - * @since 3.1.0 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 75 | - */ |
|
| 76 | - private $entity_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The User service. |
|
| 80 | - * |
|
| 81 | - * @since 3.1.7 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 84 | - */ |
|
| 85 | - private $user_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Timeline service. |
|
| 89 | - * |
|
| 90 | - * @since 3.1.0 |
|
| 91 | - * @access private |
|
| 92 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 93 | - */ |
|
| 94 | - private $timeline_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Entity Types Taxonomy Walker. |
|
| 98 | - * |
|
| 99 | - * @since 3.1.0 |
|
| 100 | - * @access private |
|
| 101 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 102 | - */ |
|
| 103 | - private $entity_types_taxonomy_walker; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The ShareThis service. |
|
| 107 | - * |
|
| 108 | - * @since 3.2.0 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 111 | - */ |
|
| 112 | - private $sharethis_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Define the core functionality of the plugin. |
|
| 116 | - * |
|
| 117 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 118 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 119 | - * the public-facing side of the site. |
|
| 120 | - * |
|
| 121 | - * @since 1.0.0 |
|
| 122 | - */ |
|
| 123 | - public function __construct() { |
|
| 124 | - |
|
| 125 | - $this->plugin_name = 'wordlift'; |
|
| 126 | - |
|
| 127 | - $this->version = '3.2.0-dev'; |
|
| 128 | - |
|
| 129 | - $this->load_dependencies(); |
|
| 130 | - $this->set_locale(); |
|
| 131 | - $this->define_admin_hooks(); |
|
| 132 | - $this->define_public_hooks(); |
|
| 133 | - |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Load the required dependencies for this plugin. |
|
| 138 | - * |
|
| 139 | - * Include the following files that make up the plugin: |
|
| 140 | - * |
|
| 141 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 142 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 143 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 144 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 145 | - * |
|
| 146 | - * Create an instance of the loader which will be used to register the hooks |
|
| 147 | - * with WordPress. |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @access private |
|
| 151 | - */ |
|
| 152 | - private function load_dependencies() { |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * The class responsible for orchestrating the actions and filters of the |
|
| 156 | - * core plugin. |
|
| 157 | - */ |
|
| 158 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The class responsible for defining internationalization functionality |
|
| 162 | - * of the plugin. |
|
| 163 | - */ |
|
| 164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * The Log service. |
|
| 168 | - */ |
|
| 169 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * The Query builder. |
|
| 173 | - */ |
|
| 174 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * The Schema service. |
|
| 178 | - */ |
|
| 179 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * The Thumbnail service. |
|
| 183 | - */ |
|
| 184 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The Entity Types Taxonomy service. |
|
| 188 | - */ |
|
| 189 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * The Entity service. |
|
| 193 | - */ |
|
| 194 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The User service. |
|
| 198 | - */ |
|
| 199 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * The Timeline service. |
|
| 203 | - */ |
|
| 204 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 208 | - */ |
|
| 209 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 213 | - */ |
|
| 214 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * The Notice service. |
|
| 218 | - */ |
|
| 219 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 223 | - * side of the site. |
|
| 224 | - */ |
|
| 225 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * The Timeline shortcode. |
|
| 229 | - */ |
|
| 230 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * The ShareThis service. |
|
| 234 | - */ |
|
| 235 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 236 | - |
|
| 237 | - $this->loader = new Wordlift_Loader(); |
|
| 238 | - |
|
| 239 | - // Instantiate a global logger. |
|
| 240 | - global $wl_logger; |
|
| 241 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 242 | - |
|
| 243 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 244 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 245 | - |
|
| 246 | - // Create an instance of the Schema service. |
|
| 247 | - new Wordlift_Schema_Service(); |
|
| 248 | - |
|
| 249 | - $this->entity_service = new Wordlift_Entity_Service(); |
|
| 250 | - |
|
| 251 | - // Create an instance of the User service. |
|
| 252 | - $this->user_service = new Wordlift_User_Service(); |
|
| 253 | - |
|
| 254 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 255 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 256 | - |
|
| 257 | - // Create an instance of the Timeline shortcode. |
|
| 258 | - new Wordlift_Timeline_Shortcode(); |
|
| 259 | - |
|
| 260 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 261 | - |
|
| 262 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 263 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 264 | - |
|
| 265 | - // Create an instance of the Notice service. |
|
| 266 | - $notice_service = new Wordlift_Notice_Service(); |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - /** |
|
| 270 | - * Define the locale for this plugin for internationalization. |
|
| 271 | - * |
|
| 272 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 273 | - * with WordPress. |
|
| 274 | - * |
|
| 275 | - * @since 1.0.0 |
|
| 276 | - * @access private |
|
| 277 | - */ |
|
| 278 | - private function set_locale() { |
|
| 279 | - |
|
| 280 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 281 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 282 | - |
|
| 283 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 284 | - |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * Register all of the hooks related to the admin area functionality |
|
| 289 | - * of the plugin. |
|
| 290 | - * |
|
| 291 | - * @since 1.0.0 |
|
| 292 | - * @access private |
|
| 293 | - */ |
|
| 294 | - private function define_admin_hooks() { |
|
| 295 | - |
|
| 296 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 297 | - |
|
| 298 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 299 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 300 | - |
|
| 301 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 302 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 303 | - |
|
| 304 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 305 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 306 | - |
|
| 307 | - // Hook posts inserts (or updates) to the user service. |
|
| 308 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 309 | - |
|
| 310 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 311 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 312 | - |
|
| 313 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 314 | - |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * Register all of the hooks related to the public-facing functionality |
|
| 319 | - * of the plugin. |
|
| 320 | - * |
|
| 321 | - * @since 1.0.0 |
|
| 322 | - * @access private |
|
| 323 | - */ |
|
| 324 | - private function define_public_hooks() { |
|
| 325 | - |
|
| 326 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 327 | - |
|
| 328 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 329 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 330 | - |
|
| 331 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 332 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 333 | - |
|
| 334 | - // Hook the ShareThis service. |
|
| 335 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 336 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 341 | - * |
|
| 342 | - * @since 1.0.0 |
|
| 343 | - */ |
|
| 344 | - public function run() { |
|
| 345 | - $this->loader->run(); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 350 | - * WordPress and to define internationalization functionality. |
|
| 351 | - * |
|
| 352 | - * @since 1.0.0 |
|
| 353 | - * @return string The name of the plugin. |
|
| 354 | - */ |
|
| 355 | - public function get_plugin_name() { |
|
| 356 | - return $this->plugin_name; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 361 | - * |
|
| 362 | - * @since 1.0.0 |
|
| 363 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 364 | - */ |
|
| 365 | - public function get_loader() { |
|
| 366 | - return $this->loader; |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * Retrieve the version number of the plugin. |
|
| 371 | - * |
|
| 372 | - * @since 1.0.0 |
|
| 373 | - * @return string The version number of the plugin. |
|
| 374 | - */ |
|
| 375 | - public function get_version() { |
|
| 376 | - return $this->version; |
|
| 377 | - } |
|
| 32 | + /** |
|
| 33 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | + * the plugin. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access protected |
|
| 38 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | + */ |
|
| 40 | + protected $loader; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * The unique identifier of this plugin. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @access protected |
|
| 47 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | + */ |
|
| 49 | + protected $plugin_name; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * The current version of the plugin. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @access protected |
|
| 56 | + * @var string $version The current version of the plugin. |
|
| 57 | + */ |
|
| 58 | + protected $version; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * The Thumbnail service. |
|
| 62 | + * |
|
| 63 | + * @since 3.1.5 |
|
| 64 | + * @access private |
|
| 65 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | + */ |
|
| 67 | + private $thumbnail_service; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The Entity service. |
|
| 71 | + * |
|
| 72 | + * @since 3.1.0 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 75 | + */ |
|
| 76 | + private $entity_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The User service. |
|
| 80 | + * |
|
| 81 | + * @since 3.1.7 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 84 | + */ |
|
| 85 | + private $user_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Timeline service. |
|
| 89 | + * |
|
| 90 | + * @since 3.1.0 |
|
| 91 | + * @access private |
|
| 92 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 93 | + */ |
|
| 94 | + private $timeline_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Entity Types Taxonomy Walker. |
|
| 98 | + * |
|
| 99 | + * @since 3.1.0 |
|
| 100 | + * @access private |
|
| 101 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 102 | + */ |
|
| 103 | + private $entity_types_taxonomy_walker; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The ShareThis service. |
|
| 107 | + * |
|
| 108 | + * @since 3.2.0 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 111 | + */ |
|
| 112 | + private $sharethis_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Define the core functionality of the plugin. |
|
| 116 | + * |
|
| 117 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 118 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 119 | + * the public-facing side of the site. |
|
| 120 | + * |
|
| 121 | + * @since 1.0.0 |
|
| 122 | + */ |
|
| 123 | + public function __construct() { |
|
| 124 | + |
|
| 125 | + $this->plugin_name = 'wordlift'; |
|
| 126 | + |
|
| 127 | + $this->version = '3.2.0-dev'; |
|
| 128 | + |
|
| 129 | + $this->load_dependencies(); |
|
| 130 | + $this->set_locale(); |
|
| 131 | + $this->define_admin_hooks(); |
|
| 132 | + $this->define_public_hooks(); |
|
| 133 | + |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Load the required dependencies for this plugin. |
|
| 138 | + * |
|
| 139 | + * Include the following files that make up the plugin: |
|
| 140 | + * |
|
| 141 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 142 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 143 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 144 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 145 | + * |
|
| 146 | + * Create an instance of the loader which will be used to register the hooks |
|
| 147 | + * with WordPress. |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @access private |
|
| 151 | + */ |
|
| 152 | + private function load_dependencies() { |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * The class responsible for orchestrating the actions and filters of the |
|
| 156 | + * core plugin. |
|
| 157 | + */ |
|
| 158 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The class responsible for defining internationalization functionality |
|
| 162 | + * of the plugin. |
|
| 163 | + */ |
|
| 164 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * The Log service. |
|
| 168 | + */ |
|
| 169 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * The Query builder. |
|
| 173 | + */ |
|
| 174 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * The Schema service. |
|
| 178 | + */ |
|
| 179 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * The Thumbnail service. |
|
| 183 | + */ |
|
| 184 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The Entity Types Taxonomy service. |
|
| 188 | + */ |
|
| 189 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * The Entity service. |
|
| 193 | + */ |
|
| 194 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The User service. |
|
| 198 | + */ |
|
| 199 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * The Timeline service. |
|
| 203 | + */ |
|
| 204 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 208 | + */ |
|
| 209 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 213 | + */ |
|
| 214 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * The Notice service. |
|
| 218 | + */ |
|
| 219 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 223 | + * side of the site. |
|
| 224 | + */ |
|
| 225 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * The Timeline shortcode. |
|
| 229 | + */ |
|
| 230 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * The ShareThis service. |
|
| 234 | + */ |
|
| 235 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 236 | + |
|
| 237 | + $this->loader = new Wordlift_Loader(); |
|
| 238 | + |
|
| 239 | + // Instantiate a global logger. |
|
| 240 | + global $wl_logger; |
|
| 241 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 242 | + |
|
| 243 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 244 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 245 | + |
|
| 246 | + // Create an instance of the Schema service. |
|
| 247 | + new Wordlift_Schema_Service(); |
|
| 248 | + |
|
| 249 | + $this->entity_service = new Wordlift_Entity_Service(); |
|
| 250 | + |
|
| 251 | + // Create an instance of the User service. |
|
| 252 | + $this->user_service = new Wordlift_User_Service(); |
|
| 253 | + |
|
| 254 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 255 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 256 | + |
|
| 257 | + // Create an instance of the Timeline shortcode. |
|
| 258 | + new Wordlift_Timeline_Shortcode(); |
|
| 259 | + |
|
| 260 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 261 | + |
|
| 262 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 263 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 264 | + |
|
| 265 | + // Create an instance of the Notice service. |
|
| 266 | + $notice_service = new Wordlift_Notice_Service(); |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * Define the locale for this plugin for internationalization. |
|
| 271 | + * |
|
| 272 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 273 | + * with WordPress. |
|
| 274 | + * |
|
| 275 | + * @since 1.0.0 |
|
| 276 | + * @access private |
|
| 277 | + */ |
|
| 278 | + private function set_locale() { |
|
| 279 | + |
|
| 280 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 281 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 282 | + |
|
| 283 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 284 | + |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * Register all of the hooks related to the admin area functionality |
|
| 289 | + * of the plugin. |
|
| 290 | + * |
|
| 291 | + * @since 1.0.0 |
|
| 292 | + * @access private |
|
| 293 | + */ |
|
| 294 | + private function define_admin_hooks() { |
|
| 295 | + |
|
| 296 | + $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 297 | + |
|
| 298 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 299 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 300 | + |
|
| 301 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 302 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 303 | + |
|
| 304 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 305 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 306 | + |
|
| 307 | + // Hook posts inserts (or updates) to the user service. |
|
| 308 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 309 | + |
|
| 310 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 311 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 312 | + |
|
| 313 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 314 | + |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * Register all of the hooks related to the public-facing functionality |
|
| 319 | + * of the plugin. |
|
| 320 | + * |
|
| 321 | + * @since 1.0.0 |
|
| 322 | + * @access private |
|
| 323 | + */ |
|
| 324 | + private function define_public_hooks() { |
|
| 325 | + |
|
| 326 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 327 | + |
|
| 328 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 329 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 330 | + |
|
| 331 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 332 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 333 | + |
|
| 334 | + // Hook the ShareThis service. |
|
| 335 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 336 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 341 | + * |
|
| 342 | + * @since 1.0.0 |
|
| 343 | + */ |
|
| 344 | + public function run() { |
|
| 345 | + $this->loader->run(); |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 350 | + * WordPress and to define internationalization functionality. |
|
| 351 | + * |
|
| 352 | + * @since 1.0.0 |
|
| 353 | + * @return string The name of the plugin. |
|
| 354 | + */ |
|
| 355 | + public function get_plugin_name() { |
|
| 356 | + return $this->plugin_name; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 361 | + * |
|
| 362 | + * @since 1.0.0 |
|
| 363 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 364 | + */ |
|
| 365 | + public function get_loader() { |
|
| 366 | + return $this->loader; |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * Retrieve the version number of the plugin. |
|
| 371 | + * |
|
| 372 | + * @since 1.0.0 |
|
| 373 | + * @return string The version number of the plugin. |
|
| 374 | + */ |
|
| 375 | + public function get_version() { |
|
| 376 | + return $this->version; |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | 379 | } |
@@ -155,90 +155,90 @@ discard block |
||
| 155 | 155 | * The class responsible for orchestrating the actions and filters of the |
| 156 | 156 | * core plugin. |
| 157 | 157 | */ |
| 158 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 158 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * The class responsible for defining internationalization functionality |
| 162 | 162 | * of the plugin. |
| 163 | 163 | */ |
| 164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 164 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * The Log service. |
| 168 | 168 | */ |
| 169 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 169 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * The Query builder. |
| 173 | 173 | */ |
| 174 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 174 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | 177 | * The Schema service. |
| 178 | 178 | */ |
| 179 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 179 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * The Thumbnail service. |
| 183 | 183 | */ |
| 184 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 184 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * The Entity Types Taxonomy service. |
| 188 | 188 | */ |
| 189 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 189 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * The Entity service. |
| 193 | 193 | */ |
| 194 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 194 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * The User service. |
| 198 | 198 | */ |
| 199 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 199 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * The Timeline service. |
| 203 | 203 | */ |
| 204 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 204 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * The class responsible for defining all actions that occur in the admin area. |
| 208 | 208 | */ |
| 209 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 209 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 213 | 213 | */ |
| 214 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 214 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * The Notice service. |
| 218 | 218 | */ |
| 219 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 219 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * The class responsible for defining all actions that occur in the public-facing |
| 223 | 223 | * side of the site. |
| 224 | 224 | */ |
| 225 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 225 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * The Timeline shortcode. |
| 229 | 229 | */ |
| 230 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 230 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * The ShareThis service. |
| 234 | 234 | */ |
| 235 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 235 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 236 | 236 | |
| 237 | 237 | $this->loader = new Wordlift_Loader(); |
| 238 | 238 | |
| 239 | 239 | // Instantiate a global logger. |
| 240 | 240 | global $wl_logger; |
| 241 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 241 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 242 | 242 | |
| 243 | 243 | // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
| 244 | 244 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $this->user_service = new Wordlift_User_Service(); |
| 253 | 253 | |
| 254 | 254 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 255 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 255 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service); |
|
| 256 | 256 | |
| 257 | 257 | // Create an instance of the Timeline shortcode. |
| 258 | 258 | new Wordlift_Timeline_Shortcode(); |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | private function set_locale() { |
| 279 | 279 | |
| 280 | 280 | $plugin_i18n = new Wordlift_i18n(); |
| 281 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 281 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 282 | 282 | |
| 283 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 283 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 284 | 284 | |
| 285 | 285 | } |
| 286 | 286 | |
@@ -293,24 +293,24 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | private function define_admin_hooks() { |
| 295 | 295 | |
| 296 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 296 | + $plugin_admin = new Wordlift_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 297 | 297 | |
| 298 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 299 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 298 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 299 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 300 | 300 | |
| 301 | 301 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 302 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 302 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 303 | 303 | |
| 304 | 304 | // Hook the added_post_meta action to the Thumbnail service. |
| 305 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 305 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4); |
|
| 306 | 306 | |
| 307 | 307 | // Hook posts inserts (or updates) to the user service. |
| 308 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 308 | + $this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3); |
|
| 309 | 309 | |
| 310 | 310 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 311 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 311 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 312 | 312 | |
| 313 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 313 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 314 | 314 | |
| 315 | 315 | } |
| 316 | 316 | |
@@ -323,17 +323,17 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | private function define_public_hooks() { |
| 325 | 325 | |
| 326 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 326 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 327 | 327 | |
| 328 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 329 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 328 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 329 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 330 | 330 | |
| 331 | 331 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 332 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 332 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 333 | 333 | |
| 334 | 334 | // Hook the ShareThis service. |
| 335 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 336 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 335 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 336 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |