PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/sharedaddy/sharedaddy.php +21 -31 13.8.3 → 16.3-a.5 View file →
@@ -5,8 +5,12 @@
5 5 *
6 6 * @package automattic/jetpack
7 7 */
8 8
9 +if ( ! defined( 'ABSPATH' ) ) {
10 + exit( 0 );
11 +}
12 +
9 13 // Set up Sharing in wp-admin.
10 14 require_once plugin_dir_path( __FILE__ ) . 'sharing.php';
11 15
12 16 /**
@@ -113,9 +117,10 @@
113 117 $post_type_object = get_post_type_object( sanitize_key( $_POST['post_type'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation.
114 118
115 119 // Record sharing disable.
116 120 if (
117 - $post_type_object->public
121 + $post_type_object instanceof \WP_Post_Type
122 + && $post_type_object->public
118 123 && current_user_can( 'edit_post', $post_id )
119 124 && isset( $_POST['sharing_status_hidden'] ) // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation.
120 125 ) {
121 126 if ( ! isset( $_POST['enable_post_sharing'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation.
@@ -147,15 +152,16 @@
147 152
148 153 /**
149 154 * Add link to sharing settings in the Plugins screen.
150 155 *
156 + * @deprecated 16.3 Sharing has not shipped as a standalone plugin for years.
157 + *
151 158 * @param array $links An array of plugin action links.
152 159 *
153 - * @return array
160 + * @return array The unchanged $links.
154 161 */
155 162 function sharing_plugin_settings( $links ) {
156 - $settings_link = '<a href="options-general.php?page=sharing.php">' . __( 'Settings', 'jetpack' ) . '</a>';
157 - array_unshift( $links, $settings_link );
163 + _deprecated_function( __FUNCTION__, 'jetpack-16.3' );
158 164 return $links;
159 165 }
160 166
161 167 /**
@@ -160,19 +166,17 @@
160 166
161 167 /**
162 168 * Add links to settings and support in the plugin row.
163 169 *
170 + * @deprecated 16.3 Sharing has not shipped as a standalone plugin for years.
171 + *
164 172 * @param array $links An array of the plugin's metadata, including the version, author, author URI, and plugin URI.
165 173 * @param string $file Path to the plugin file relative to the plugins directory.
166 174 *
167 - * @return array
175 + * @return array The unchanged $links.
168 176 */
169 -function sharing_add_plugin_settings( $links, $file ) {
170 - if ( $file === basename( __DIR__ ) . '/' . basename( __FILE__ ) ) {
171 - $links[] = '<a href="options-general.php?page=sharing.php">' . __( 'Settings', 'jetpack' ) . '</a>';
172 - $links[] = '<a href="https://support.wordpress.com/sharing/" rel="noopener noreferrer" target="_blank">' . __( 'Support', 'jetpack' ) . '</a>';
173 - }
174 -
177 +function sharing_add_plugin_settings( $links, $file ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
178 + _deprecated_function( __FUNCTION__, 'jetpack-16.3' );
175 179 return $links;
176 180 }
177 181
178 182 /**
@@ -189,35 +193,25 @@
189 193
190 194 /**
191 195 * Add settings to disable CSS and JS normally enqueued by our feature.
192 196 *
197 + * @deprecated 16.3 Settings > Sharing renders the field itself.
198 + *
193 199 * @return void
194 200 */
195 201 function sharing_global_resources() {
196 - $disable = get_option( 'sharedaddy_disable_resources' );
197 - ?>
198 -<tr valign="top">
199 - <th scope="row"><label for="disable_css"><?php esc_html_e( 'Disable CSS and JS', 'jetpack' ); ?></label></th>
200 - <td>
201 - <?php
202 - printf(
203 - '<input id="disable_css" type="checkbox" name="disable_resources"%1$s /> <small><em>%2$s</em></small>',
204 - ( 1 == $disable ) ? ' checked="checked"' : '', // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
205 - esc_html__( 'Advanced. If this option is checked, you must include these files in your theme manually for the sharing links to work.', 'jetpack' )
206 - );
207 - ?>
208 - </td>
209 -</tr>
210 - <?php
202 + _deprecated_function( __FUNCTION__, 'jetpack-16.3', 'Automattic\Jetpack\Sharing_Likes\Settings\Sharing_Resources::render' );
211 203 }
212 204
213 205 /**
214 206 * Save settings to disable CSS and JS normally enqueued by our feature.
215 207 *
208 + * @deprecated 16.3 Settings > Sharing saves the field itself.
209 + *
216 210 * @return void
217 211 */
218 212 function sharing_global_resources_save() {
219 - 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.
213 + _deprecated_function( __FUNCTION__, 'jetpack-16.3', 'Automattic\Jetpack\Sharing_Likes\Settings\Sharing_Resources::save' );
220 214 }
221 215
222 216 add_action( 'init', 'sharing_init' );
223 217 add_action( 'add_meta_boxes', 'sharing_add_meta_box' );
@@ -222,8 +216,4 @@
222 216 add_action( 'init', 'sharing_init' );
223 217 add_action( 'add_meta_boxes', 'sharing_add_meta_box' );
224 218 add_action( 'save_post', 'sharing_meta_box_save' );
225 219 add_action( 'edit_attachment', 'sharing_meta_box_save' );
226 -add_action( 'sharing_global_options', 'sharing_global_resources', 30 );
227 -add_action( 'sharing_admin_update', 'sharing_global_resources_save' );
228 -add_action( 'plugin_action_links_' . basename( __DIR__ ) . '/' . basename( __FILE__ ), 'sharing_plugin_settings', 10, 4 );
229 -add_filter( 'plugin_row_meta', 'sharing_add_plugin_settings', 10, 2 );