ID, self::POST_META_KEY_FEATURE_ENABLED, true ) === '0' ) $feature_enabled = false; echo '

'; $stored_message = get_post_meta( $post->ID, self::POST_META_KEY, true ); echo '

' . esc_html( sprintf( __( 'This message will show as part of the story on the %s Timeline.', 'facebook'), $page['name'] ) ) . '

'; } /** * Save the custom Status, used when posting to an Fan Page's Timeline. * * @since 1.0 * * @param int $post_id WordPress post identifier * @return void */ public static function save( $post_id ) { // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( ! isset( $_POST[self::FIELD_MESSAGE] ) || empty( $_POST[self::NONCE_NAME] ) || ! wp_verify_nonce( $_POST[self::NONCE_NAME], plugin_basename( __FILE__ ) ) ) return; // Check permissions $post_type = get_post_type( $post_id ); if ( ! $post_type ) return; if ( ! class_exists( 'Facebook_Social_Publisher' ) ) require_once( dirname(__FILE__) . '/social_publisher.php' ); $capability_singular_base = Facebook_Social_Publisher::post_type_capability_base( $post_type ); if ( ! current_user_can( 'edit_' . $capability_singular_base, $post_id ) ) return; $feature_enabled = '1'; if ( ! isset( $_POST[self::FIELD_FEATURE_ENABLED] ) || $_POST[self::FIELD_FEATURE_ENABLED] === '0' ) $feature_enabled = '0'; update_post_meta( $post_id, self::POST_META_KEY_FEATURE_ENABLED, $feature_enabled ); unset( $feature_enabled ); $message = trim( sanitize_text_field( $_POST[self::FIELD_MESSAGE] ) ); if ( $message ) update_post_meta( $post_id, self::POST_META_KEY, $message ); } } ?>