ID, self::POST_META_KEY_MESSAGE, true );
if ( $stored_message )
echo ' value="' . esc_attr( $stored_message ) . '"';
echo ' />';
if ( ! class_exists( 'Facebook_Social_Publisher_Settings' ) )
require_once( dirname( dirname( __FILE__ ) ) . '/settings-social-publisher.php' );
if ( get_option( Facebook_Social_Publisher_Settings::OPTION_OG_ACTION ) ) {
// set JavaScript properties for localized text
echo '';
}
echo '
';
}
/**
* Save the custom Status, used when posting to a User's Timeline.
*
* @since 1.0
*
* @param int $post_id WordPress post identifier
* @global 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 && post_type_supports( $post_type, 'author' ) ) )
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, $message );
}
}
?>