1 | <?php |
||
3 | class Jetpack_Sync_Module_Posts extends Jetpack_Sync_Module { |
||
4 | |||
5 | public function name() { |
||
8 | |||
9 | public function set_defaults() { |
||
11 | |||
12 | public function init_listeners( $callable ) { |
||
17 | |||
18 | public function init_full_sync_listeners( $callable ) { |
||
21 | |||
22 | public function init_before_send() { |
||
28 | |||
29 | public function enqueue_full_sync_actions( $config ) { |
||
30 | global $wpdb; |
||
31 | |||
32 | return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_posts', $wpdb->posts, 'ID', $this->get_where_sql( $config ) ); |
||
33 | } |
||
34 | |||
35 | public function estimate_full_sync_actions( $config ) { |
||
43 | |||
44 | private function get_where_sql( $config ) { |
||
54 | |||
55 | function get_full_sync_actions() { |
||
58 | |||
59 | /** |
||
60 | * Process content before send |
||
61 | */ |
||
62 | |||
63 | function expand_wp_insert_post( $args ) { |
||
66 | |||
67 | // Expands wp_insert_post to include filtered content |
||
68 | function filter_post_content_and_add_links( $post_object ) { |
||
69 | global $post; |
||
70 | $post = $post_object; |
||
71 | /** |
||
72 | * Filters whether to prevent sending post data to .com |
||
73 | * |
||
74 | * Passing true to the filter will prevent the post data from being sent |
||
75 | * to the WordPress.com. |
||
76 | * Instead we pass data that will still enable us to do a checksum against the |
||
77 | * Jetpacks data but will prevent us from displaying the data on in the API as well as |
||
78 | * other services. |
||
79 | * @since 4.2.0 |
||
80 | * |
||
81 | * @param boolean false prevent post data from being synced to WordPress.com |
||
82 | * @param mixed $post WP_POST object |
||
83 | */ |
||
84 | if ( apply_filters( 'jetpack_sync_prevent_sending_post_data', false, $post ) ) { |
||
85 | // We only send the bare necessary object to be able to create a checksum. |
||
86 | $blocked_post = new stdClass(); |
||
87 | $blocked_post->ID = $post->ID; |
||
88 | $blocked_post->post_modified = $post->post_modified; |
||
89 | $blocked_post->post_modified_gmt = $post->post_modified_gmt; |
||
90 | $blocked_post->post_status = 'jetpack_sync_blocked'; |
||
91 | |||
92 | return $blocked_post; |
||
93 | } |
||
94 | |||
95 | if ( 0 < strlen( $post->post_password ) ) { |
||
96 | $post->post_password = 'auto-' . wp_generate_password( 10, false ); |
||
97 | } |
||
98 | /** This filter is already documented in core. wp-includes/post-template.php */ |
||
99 | $post->post_content_filtered = apply_filters( 'the_content', $post->post_content ); |
||
100 | $post->post_excerpt_filtered = apply_filters( 'the_content', $post->post_excerpt ); |
||
101 | $post->permalink = get_permalink( $post->ID ); |
||
102 | $post->shortlink = wp_get_shortlink( $post->ID ); |
||
103 | $post->dont_email_post_to_subs = Jetpack::is_module_active( 'subscriptions' ) ? |
||
104 | get_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', true ) : |
||
105 | true; // Don't email subscription if the subscription module is not active. |
||
106 | |||
107 | return $post; |
||
108 | } |
||
109 | |||
110 | public function expand_post_ids( $args ) { |
||
122 | } |
||
123 |
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
will have no issues, while
will report issues in lines 1 and 2.