| @@ -152,16 +152,15 @@ | ||
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Add link to sharing settings in the Plugins screen. |
| 155 | 155 | * |
| 156 | - * @deprecated 16.3 Sharing has not shipped as a standalone plugin for years. | |
| 157 | - * | |
| 158 | 156 | * @param array $links An array of plugin action links. |
| 159 | 157 | * |
| 160 | - * @return array The unchanged $links. | |
| 158 | + * @return array | |
| 161 | 159 | */ |
| 162 | 160 | function sharing_plugin_settings( $links ) { |
| 163 | - _deprecated_function( __FUNCTION__, 'jetpack-16.3' ); | |
| 161 | + $settings_link = '<a href="options-general.php?page=sharing.php">' . __( 'Settings', 'jetpack' ) . '</a>'; | |
| 162 | + array_unshift( $links, $settings_link ); | |
| 164 | 163 | return $links; |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | 166 | /** |
| @@ -166,17 +165,19 @@ | ||
| 166 | 165 | |
| 167 | 166 | /** |
| 168 | 167 | * Add links to settings and support in the plugin row. |
| 169 | 168 | * |
| 170 | - * @deprecated 16.3 Sharing has not shipped as a standalone plugin for years. | |
| 171 | - * | |
| 172 | 169 | * @param array $links An array of the plugin's metadata, including the version, author, author URI, and plugin URI. |
| 173 | 170 | * @param string $file Path to the plugin file relative to the plugins directory. |
| 174 | 171 | * |
| 175 | - * @return array The unchanged $links. | |
| 172 | + * @return array | |
| 176 | 173 | */ |
| 177 | -function sharing_add_plugin_settings( $links, $file ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 178 | - _deprecated_function( __FUNCTION__, 'jetpack-16.3' ); | |
| 174 | +function sharing_add_plugin_settings( $links, $file ) { | |
| 175 | + if ( $file === basename( __DIR__ ) . '/' . basename( __FILE__ ) ) { | |
| 176 | + $links[] = '<a href="options-general.php?page=sharing.php">' . __( 'Settings', 'jetpack' ) . '</a>'; | |
| 177 | + $links[] = '<a href="https://support.wordpress.com/sharing/" rel="noopener noreferrer" target="_blank">' . __( 'Support', 'jetpack' ) . '</a>'; | |
| 178 | + } | |
| 179 | + | |
| 179 | 180 | return $links; |
| 180 | 181 | } |
| 181 | 182 | |
| 182 | 183 | /** |
| @@ -193,25 +194,35 @@ | ||
| 193 | 194 | |
| 194 | 195 | /** |
| 195 | 196 | * Add settings to disable CSS and JS normally enqueued by our feature. |
| 196 | 197 | * |
| 197 | - * @deprecated 16.3 Settings > Sharing renders the field itself. | |
| 198 | - * | |
| 199 | 198 | * @return void |
| 200 | 199 | */ |
| 201 | 200 | function sharing_global_resources() { |
| 202 | - _deprecated_function( __FUNCTION__, 'jetpack-16.3', 'Automattic\Jetpack\Sharing_Likes\Settings\Sharing_Resources::render' ); | |
| 201 | + $disable = get_option( 'sharedaddy_disable_resources' ); | |
| 202 | + ?> | |
| 203 | +<tr valign="top"> | |
| 204 | + <th scope="row"><label for="disable_css"><?php esc_html_e( 'Disable CSS and JS', 'jetpack' ); ?></label></th> | |
| 205 | + <td> | |
| 206 | + <?php | |
| 207 | + printf( | |
| 208 | + '<input id="disable_css" type="checkbox" name="disable_resources"%1$s /> <small><em>%2$s</em></small>', | |
| 209 | + ( 1 == $disable ) ? ' checked="checked"' : '', // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual | |
| 210 | + esc_html__( 'Advanced. If this option is checked, you must include these files in your theme manually for the sharing links to work.', 'jetpack' ) | |
| 211 | + ); | |
| 212 | + ?> | |
| 213 | + </td> | |
| 214 | +</tr> | |
| 215 | + <?php | |
| 203 | 216 | } |
| 204 | 217 | |
| 205 | 218 | /** |
| 206 | 219 | * Save settings to disable CSS and JS normally enqueued by our feature. |
| 207 | 220 | * |
| 208 | - * @deprecated 16.3 Settings > Sharing saves the field itself. | |
| 209 | - * | |
| 210 | 221 | * @return void |
| 211 | 222 | */ |
| 212 | 223 | function sharing_global_resources_save() { |
| 213 | - _deprecated_function( __FUNCTION__, 'jetpack-16.3', 'Automattic\Jetpack\Sharing_Likes\Settings\Sharing_Resources::save' ); | |
| 224 | + update_option( 'sharedaddy_disable_resources', isset( $_POST['disable_resources'] ) ? 1 : 0 ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce handling is handled for all elements at once. | |
| 214 | 225 | } |
| 215 | 226 | |
| 216 | 227 | add_action( 'init', 'sharing_init' ); |
| 217 | 228 | add_action( 'add_meta_boxes', 'sharing_add_meta_box' ); |
| @@ -216,4 +227,8 @@ | ||
| 216 | 227 | add_action( 'init', 'sharing_init' ); |
| 217 | 228 | add_action( 'add_meta_boxes', 'sharing_add_meta_box' ); |
| 218 | 229 | add_action( 'save_post', 'sharing_meta_box_save' ); |
| 219 | 230 | add_action( 'edit_attachment', 'sharing_meta_box_save' ); |
| 231 | +add_action( 'sharing_global_options', 'sharing_global_resources', 30 ); | |
| 232 | +add_action( 'sharing_admin_update', 'sharing_global_resources_save' ); | |
| 233 | +add_action( 'plugin_action_links_' . basename( __DIR__ ) . '/' . basename( __FILE__ ), 'sharing_plugin_settings', 10, 4 ); | |
| 234 | +add_filter( 'plugin_row_meta', 'sharing_add_plugin_settings', 10, 2 ); | |