__( 'URL', WPRSS_TEXT_DOMAIN ), 'id' => $prefix .'url', 'type' => 'url', 'after' => 'wprss_validate_feed_link', 'placeholder' => 'http://' ); $wprss_meta_fields[ 'limit' ] = array( 'label' => __( 'Limit', WPRSS_TEXT_DOMAIN ), 'id' => $prefix . 'limit', 'type' => 'number' ); $wprss_meta_fields[ 'enclosure' ] = array( 'label' => __( 'Link to enclosure', WPRSS_TEXT_DOMAIN ), 'id' => $prefix . 'enclosure', 'type' => 'checkbox' ); $wprss_meta_fields[ 'unique_titles' ] = array( 'label' => __( 'Unique titles only', WPRSS_TEXT_DOMAIN ), 'id' => $prefix . 'unique_titles', 'type' => 'checkbox' ); $wprss_meta_fields[ 'source_link' ] = array( 'label' => __( 'Link Source', WPRSS_TEXT_DOMAIN ), 'id' => $prefix . 'source_link', 'type' => 'boolean_fallback' ); // for extensibility, allows more meta fields to be added return apply_filters( 'wprss_fields', $wprss_meta_fields ); } /** * Set up the meta box for the wprss_feed post type * * @since 2.0 */ function wprss_show_meta_box_callback() { global $post; $meta_fields = wprss_get_custom_fields(); $field_tooltip_id_prefix = 'field_'; $help = WPRSS_Help::get_instance(); // Use nonce for verification wp_nonce_field( basename( __FILE__ ), 'wprss_meta_box_nonce' ); // Fix for WordpRess SEO JS issue ?>ID, $field['id'], true ); // begin a table row with ?>
'', 'placeholder' => '', 'type' => 'text' ) ); $tooltip = isset( $field['tooltip'] ) ? trim( $field['tooltip'] ) : null; $tooltip_id = isset( $field['id'] ) ? $field_tooltip_id_prefix . $field['id'] : uniqid( $field_tooltip_id_prefix ); $field_description = __( $field['desc'], WPRSS_TEXT_DOMAIN ); /* * So, here's how tooltips work here. * Tooltip output will be attempted in any case. * If 'tooltip' index is not defined, or is null, then * a registered tooltip will be attempted. If that is * not found, default value will be output. This value * is by default an empty string, but can be altered * by the `tooltip_not_found_handle_html` option of `WPRSS_Help`. */ switch( $field['type'] ) { // text/url case 'url': case 'text': ?>tooltip( $tooltip_id, $tooltip ); if ( strlen( trim( $field['desc'] ) ) > 0 ) { ?>
tooltip( $tooltip_id, $tooltip ); if ( strlen( trim( $field['desc'] ) ) > 0 ) { ?>
/>tooltip( $tooltip_id, $tooltip ); if ( strlen( trim( $field['desc'] ) ) > 0 ) { ?>tooltip( $tooltip_id, $tooltip ); if ( strlen( trim( $field['desc'] ) ) > 0 ) { ?>tooltip( $tooltip_id, $tooltip ); break; // number case 'number': ?>tooltip( $tooltip_id, $tooltip ); if ( strlen( trim( $field['desc'] ) ) > 0 ) { ?>
Validate feed post_type ); /* Check if the current user has permission to edit the post. */ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; /* // Stop WP from clearing custom fields on autosave - maybe not needed if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; // Prevent quick edit from clearing custom fields - maybe not needed if (defined('DOING_AJAX') && DOING_AJAX) return; */ /** Bail out if running an autosave, ajax or a cron */ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return; if ( defined( 'DOING_CRON' ) && DOING_CRON ) return; // Change the limit, if it is zero, to an empty string if ( isset( $_POST['wprss_limit'] ) && strval( $_POST['wprss_limit'] ) == '0' ) { $_POST['wprss_limit'] = ''; } // loop through fields and save the data foreach ( $meta_fields as $field ) { $old = get_post_meta( $post_id, $field[ 'id' ], true ); $new = trim( $_POST[ $field[ 'id' ] ] ); if ( $new !== '' && $new != $old ) { update_post_meta( $post_id, $field[ 'id' ], $new ); } elseif ( '' == $new && $old ) { delete_post_meta( $post_id, $field[ 'id' ], $old ); } } // end foreach $force_feed = ( isset( $_POST['wprss_force_feed'] ) )? $_POST['wprss_force_feed'] : 'false'; $state = ( isset( $_POST['wprss_state'] ) )? $_POST['wprss_state'] : 'active'; $activate = ( isset( $_POST['wprss_activate_feed'] ) )? stripslashes( $_POST['wprss_activate_feed'] ) : ''; $pause = ( isset( $_POST['wprss_pause_feed'] ) )? stripslashes( $_POST['wprss_pause_feed'] ) : ''; $age_limit = ( isset( $_POST['wprss_age_limit'] ) )? stripslashes( $_POST['wprss_age_limit'] ) : ''; $age_unit = ( isset( $_POST['wprss_age_unit'] ) )? stripslashes( $_POST['wprss_age_unit'] ) : ''; $update_interval = ( isset( $_POST['wprss_update_interval'] ) )? stripslashes( $_POST['wprss_update_interval'] ) : wprss_get_default_feed_source_update_interval(); $old_update_interval = get_post_meta( $post_id, 'wprss_update_interval', TRUE ); // Update the feed source meta update_post_meta( $post_id, 'wprss_force_feed', $force_feed ); update_post_meta( $post_id, 'wprss_activate_feed', $activate ); update_post_meta( $post_id, 'wprss_pause_feed', $pause ); update_post_meta( $post_id, 'wprss_age_limit', $age_limit ); update_post_meta( $post_id, 'wprss_age_unit', $age_unit ); update_post_meta( $post_id, 'wprss_update_interval', $update_interval ); // Check if the state or the update interval has changed if ( get_post_meta( $post_id, 'wprss_state', TRUE ) !== $state || $old_update_interval !== $update_interval ) { // Pause the feed source, and if it is active, re-activate it. // This should update the feed's scheduling wprss_pause_feed_source( $post_id ); if ( $state === 'active' ) wprss_activate_feed_source( $post_id ); } // Update the schedules wprss_update_feed_processing_schedules( $post_id ); // If the feed source uses the global updating system, update the feed on publish if ( $update_interval === wprss_get_default_feed_source_update_interval() ) { wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( $post_id ) ); } } /** * Generate a preview of the latest 5 posts from the feed source being added/edited * * @since 2.0 */ function wprss_preview_meta_box_callback() { global $post; $feed_url = get_post_meta( $post->ID, 'wprss_url', true ); $help = WPRSS_Help::get_instance(); /* @var $help WPRSS_Help */ echo '
'; if ( ! empty( $feed_url ) ) { $feed = wprss_fetch_feed( $feed_url, $post->ID ); if ( ! is_wp_error( $feed ) ) { $items = $feed->get_items(); // Figure out how many total items there are $total = $feed->get_item_quantity(); // Get the number of items again, but limit it to 5. $maxitems = $feed->get_item_quantity(5); // Build an array of all the items, starting with element 0 (first element). $items = $feed->get_items( 0, $maxitems ); ?>

Invalid feed URL - Double check the feed source URL setting above.', WPRSS_TEXT_DOMAIN ) ?> get_error_message(), NULL, WPRSS_LOG_LEVEL_INFO ); ?> Click here for a visual guide. ', WPRSS_TEXT_DOMAIN ), 'http://webtrends.about.com/od/webfeedsyndicationrss/ss/rss_howto.htm' ) ); } } else { echo '

' . __( 'No feed URL defined yet', WPRSS_TEXT_DOMAIN ) . '

'; } echo '
'; echo '
'; wprss_render_force_feed_option( $post->ID, TRUE ); echo '
'; } /** * Renders the Force Feed option for the Feed Preview. * * @param int|string $feed_source_id (Optional) The ID of the feed source for the option will be rendered. If not given or * its value is null, the option will not be checked. * @param bool $echo (Optional) If set to true, the function will immediately echo the option, * rather than return a string of the option's markup. Default: False. * @return string|null A string containing the HTML for the rendered option if $echo is set to false, * or null if $echo is set to true. * @since 4.6.12 */ function wprss_render_force_feed_option( $feed_source_id = NULL, $echo = FALSE ) { if ( ! $echo ) ob_start(); $force_feed = $feed_source_id === NULL ? '' : get_post_meta( $feed_source_id, 'wprss_force_feed', TRUE ); ?>

/> tooltip( 'field_wprss_force_feed' ) ?>

ID, 'wprss_state', TRUE ); $activate = get_post_meta( $post->ID, 'wprss_activate_feed', TRUE ); $pause = get_post_meta( $post->ID, 'wprss_pause_feed', TRUE ); $update_interval = get_post_meta( $post->ID, 'wprss_update_interval', TRUE ); $age_limit = get_post_meta( $post->ID, 'wprss_age_limit', FALSE ); $age_unit = get_post_meta( $post->ID, 'wprss_age_unit', FALSE ); $age_limit = ( count( $age_limit ) === 0 )? wprss_get_general_setting( 'limit_feed_items_age' ) : $age_limit[0]; $age_unit = ( count( $age_unit ) === 0 )? wprss_get_general_setting( 'limit_feed_items_age_unit' ) : $age_unit[0]; // Set default strings for activate and pause times $default_activate = 'immediately'; $default_pause = 'never'; // Prepare the states $states = array( 'active' => __( 'Active', WPRSS_TEXT_DOMAIN ), 'paused' => __( 'Paused', WPRSS_TEXT_DOMAIN ), ); // Prepare the schedules $default_interval = __( 'Default', WPRSS_TEXT_DOMAIN ); $wprss_schedules = apply_filters( 'wprss_schedules', wprss_get_schedules() ); $default_interval_key = wprss_get_default_feed_source_update_interval(); $schedules = array_merge( array( $default_interval_key => array( 'display' => $default_interval, 'interval' => $default_interval, ), ), $wprss_schedules ); // Inline help $help = WPRSS_Help::get_instance(); $help_options = array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-side'); ?>
tooltip( 'field_wprss_state', null, $help_options ) ?>

Edit tooltip( 'field_wprss_activate_feed', null, $help_options ) ?>

Current UTC time is:

Edit tooltip( 'field_wprss_pause_feed', null, $help_options ) ?>

Current UTC time is:

Edit tooltip( 'field_wprss_update_interval', null, $help_options ) ?>

Edit tooltip( 'field_wprss_age_limit', null, $help_options ) ?>

View the documentation

'; echo '

'; _e( 'Need help?', WPRSS_TEXT_DOMAIN ); echo ' '; _e( 'Check out the support forum', WPRSS_TEXT_DOMAIN ); echo '

'; echo ' '; _e( 'Suggest a new feature', WPRSS_TEXT_DOMAIN ); echo '

'; } /** * Generate Like this plugin meta box * * @since 2.0 * */ function wprss_like_meta_box_callback() { ?>

id ) return; // Remove meta boxes of other plugins that tend to appear on all posts //remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' ); remove_meta_box( 'postpsp', 'wprss_feed' ,'normal' ); remove_meta_box( 'su_postmeta', 'wprss_feed' ,'normal' ); remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' ); remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' ); remove_meta_box( 'wpar_plugin_meta_box ', 'wprss_feed' ,'normal' ); remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' ); remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' ); remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' ); remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' ); remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' ); remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' ); remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' ); remove_meta_box( 'aiosp', 'wprss_feed' ,'advanced' ); remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' ); }