__( 'General plugin settings', WPRSS_TEXT_DOMAIN ), 'display' => __( 'General display settings', WPRSS_TEXT_DOMAIN ), 'source' => __( 'Source display settings', WPRSS_TEXT_DOMAIN ), 'date' => __( 'Date display settings', WPRSS_TEXT_DOMAIN ), 'styles' => __( 'Styles', WPRSS_TEXT_DOMAIN ), ) ); // Define the settings per section $settings = apply_filters( 'wprss_settings_array', array( 'general' => array( 'limit-feed-items-by-age' => array( 'label' => __( 'Limit feed items stored by age', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_limit_feed_items_age_callback' ), 'limit-feed-items-imported' => array( 'label' => __( 'Limit feed items stored per feed', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_limit_feed_items_imported_callback' ), 'limit-feed-items-db' => array( 'label' => __( 'Limit feed items stored', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_limit_feed_items_callback' ), 'limit_feed_items_per_import' => array( 'label' => __( 'Limit feed items per import', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_limit_feed_items_per_import_callback' ), 'feed_items_import_order' => array( 'label' => __( 'Import order', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_feed_items_import_order_callback' ), 'cron-interval' => array( 'label' => __( 'Feed processing interval', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_cron_interval_callback' ), 'unique-titles' => array( 'label' => __( 'Unique titles only', WPRSS_TEXT_DOMAIN), 'callback' => 'wprss_setting_unique_titles' ), 'custom-feed-url' => array( 'label' => __( 'Custom feed URL', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_settings_custom_feed_url_callback' ), 'custom-feed-title' => array( 'label' => __( 'Custom feed Title', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_settings_custom_feed_title_callback' ), 'custom-feed-limit' => array( 'label' => __( 'Custom feed limit', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setings_custom_feed_limit_callback' ), // 'tracking' => array( // 'label' => __( 'Anonymous tracking', WPRSS_TEXT_DOMAIN ), // 'callback' => 'wprss_tracking_callback', // ) ), 'display' => array( // Title options 'link-enable' => array( 'label' => __( 'Link title', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_title_link_callback' ), 'title-limit' => array( 'label' => __( 'Title maximum length', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_title_length_callback' ), // Misc Options 'authors-enable' => array( 'label' => __( 'Show authors', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_authors_enable_callback', ), 'video-links' => array( 'label' => __( 'For video feed items use', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_video_links_callback' ), 'pagination' => array( 'label' => __( 'Pagination type', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_pagination_type_callback', ), 'feed-limit' => array( 'label' => __( 'Feed display limit', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_feed_limit_callback' ), 'open-dd' => array( 'label' => __( 'Open links behaviour', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_open_dd_callback' ), 'follow-dd' => array( 'label' => __( 'Set links as nofollow', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_follow_dd_callback' ), ), // Source Options 'source' => array( 'source-enable' => array( 'label' => __( 'Show source', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_source_enable_callback' ), 'text-preceding-source' => array( 'label' => __( 'Text preceding source', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_text_preceding_source_callback' ), 'source-link' => array( 'label' => __( 'Link source', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_source_link_callback' ), ), // Date options 'date' => array( 'date-enable' => array( 'label' => __( 'Show date', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_date_enable_callback' ), 'text-preceding-date' => array( 'label' => __( 'Text preceding date', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_text_preceding_date_callback' ), 'date-format' => array( 'label' => __( 'Date format', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_date_format_callback' ), 'time-ago-format-enable' => array( 'label' => __( 'Time ago format', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_time_ago_format_enable_callback' ), ), 'styles' => array( 'styles-disable' => array( 'label' => __( 'Disable Styles', WPRSS_TEXT_DOMAIN ), 'callback' => 'wprss_setting_styles_disable_callback' ) ) ) ); if ( apply_filters( 'wprss_use_fixed_feed_limit', FALSE ) === FALSE ) { unset( $settings['general']['limit-feed-items-db'] ); } $setting_field_id_prefix = 'wprss-settings-'; // Loop through each setting field and register it foreach( $settings as $section => $fields ) { if ( count( $fields ) > 0 ) { $section_desc = $sections[ $section ]; add_settings_section( "wprss_settings_${section}_section", $section_desc, "wprss_settings_${section}_callback", 'wprss_settings_general' ); foreach ( $fields as $id => $data ) { /** * @var This will be passed to the field callback as the only argument * @see http://codex.wordpress.org/Function_Reference/add_settings_field#Parameters */ $callback_args = array( 'field_id' => $id, 'field_id_prefix' => $setting_field_id_prefix, 'section_id' => $section, 'field_label' => isset( $data['label'] ) ? $data['label'] : null, 'tooltip' => isset( $data['tooltip'] ) ? $data['tooltip'] : null ); add_settings_field( $setting_field_id_prefix . $id, $data['label'], $data['callback'], 'wprss_settings_general', "wprss_settings_${section}_section", $callback_args ); } } } /* // SECURE RESET OPTION register_setting( 'wprss_secure_reset', // A settings group name. 'wprss_secure_reset_code', // The name of an option to sanitize and save. '' // A callback function that sanitizes the option's value. ); add_settings_section( 'wprss_secure_reset_section', // ID of section __( 'Secure Reset', WPRSS_TEXT_DOMAIN ), // Title of section 'wprss_secure_reset_section_callback', // Callback that renders the section header 'wprss_settings_general' // The page on which to display the section ); add_settings_field( 'wprss-settings-secure-reset', // ID of setting __( 'Secure Reset', WPRSS_TEXT_DOMAIN ), // The title of the setting 'wprss_settings_secure_reset_code_callback', // The callback that renders the setting 'wprss_settings_general', // The page on which to display the setting "wprss_secure_reset_section" // The section in which to display the setting ); */ //If user requested to download system info, generate the download. if ( isset( $_POST['wprss-sysinfo'] ) ) do_action( 'wprss_download_sysinfo' ); if ( isset( $_POST['wprss-sysinfo'] ) ) { // do_action( 'wprss_download_log' ); } do_action( 'wprss_admin_init' ); } /** * Returns the HTML of a tooltip handle. * * Filters used: * - `wprss_settings_inline_help_default_options` - The default options for "Settings" page's tooltips * - `wprss_settings_inline_help_id_prefix` - The prefix for all tooltip IDs for the "Settings" page. * * @param string $id The ID of the tooltip * @param string|null $text Text for this tooltip, if any. * @param array $options Any options for this setting. * @return string Tooltip handle HTML. See {@link WPRSS_Help::tooltip()}. */ function wprss_settings_inline_help( $id, $text = null, $options = array() ) { $help = WPRSS_Help::get_instance(); // Default options, entry point $defaults = apply_filters( 'wprss_settings_inline_help_default_options', array( 'tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-setting' )); $options = $help->array_merge_recursive_distinct( $defaults, $options ); // ID Prefix $id = apply_filters( 'wprss_settings_inline_help_id_prefix', 'setting-' ) . $id; return $help->tooltip( $id, $text, $options ); } /** * * @param type $string * @return type */ function wprss_settings_field_name_prefix( $string = '' ) { $string = (string) $string; $prefix = apply_filters( 'wprss_settings_field_name_prefix', 'wprss_settings_', $string ); return $prefix . $string; } /** * Generates a uniform setting field name for use in HTML. * The parts used are the ID of the field, the section it is in, and an optional prefix. * All parts are optional, but, if they appear, they shall appear in this order: $prefix, $section, $id. * * If only the section is not specified, the $id will be simply prefixed by $prefix. * If either the $id or the $section are empty (but not both), $prefix will be stripped of known separators. * Empty parts will be excluded. * * @param string $id ID of the field. * @param string|null $section Name of the section, to which this field belongs. * @param string|null $prefix The string to prefix the name with; appears first. If boolean false, no prefix will be applied. Default: return value of {@link wprss_settings_field_name_prefix()}. * @return string Name of the settings field, namespaced and optionally prefixed. */ function wprss_settings_field_name( $id = null, $section = null, $prefix = null ) { if( $prefix !== false ) $prefix = is_null( $prefix ) ? wprss_settings_field_name_prefix() : $prefix; else $prefix = ''; $section = (string) $section; $format = ''; if( !strlen( $section ) xor !strlen($id) ) $prefix = trim ( $prefix, "\t\n\r _-:" ); if( strlen( $prefix ) ) $format .= '%3$s'; if( strlen( $section ) ) $format .= '%2$s'; if( strlen( $id ) ) $format .= ( !strlen( $section ) ? '%1$s' : '[%1$s]' ); return apply_filters( 'wprss_settings_field_name', sprintf( $format, $id, $section, $prefix ), $id, $section, $prefix ); } /** * Build the plugin settings page, used to save general settings like whether a link should be follow or no follow * @since 1.1 */ function wprss_settings_page_display() { ?>

array( 'label' => __( 'General', WPRSS_TEXT_DOMAIN ), 'slug' => 'general_settings', ), 'licenses' => array( 'label' => __( 'Licenses', WPRSS_TEXT_DOMAIN ), 'slug' => 'licenses_settings' ) ); $addon_tabs = apply_filters( 'wprss_options_tabs', array() ); $tabs = array_merge( array( $default_tabs['general'] ), $addon_tabs , array( $default_tabs['licenses'] ) ); $show_tabs = ( count( $addon_tabs ) > 0 ) || apply_filters( 'wprss_show_settings_tabs_condition', FALSE ); if ( $show_tabs ) { ?>
/> __( 'Original page link', WPRSS_TEXT_DOMAIN ), 'true' => __( 'Embedded video player link', WPRSS_TEXT_DOMAIN ) ); ?>

__( 'Lightbox', WPRSS_TEXT_DOMAIN ), 'blank' => __( 'New window', WPRSS_TEXT_DOMAIN ), 'self' => __( 'Self', WPRSS_TEXT_DOMAIN ) ); ?>

/> /> /> HTML tag from its parameters. * * @since 4.10 * @return string The HTML of a > $_item ) { $_key = (string) $_key; $_item = (string) $_item; $isSelected = $selected == $_key; ?> __('On', WPRSS_TEXT_DOMAIN), 0 => __('Off', WPRSS_TEXT_DOMAIN), -1 => __('Default', WPRSS_TEXT_DOMAIN), ); } /** * Set text preceding source * @since 3.0 */ function wprss_setting_text_preceding_source_callback( $field ) { $text_preceding_source = wprss_get_general_setting( 'text_preceding_source' ); ?> /> /> __( '"Older posts" and "Newer posts" links', WPRSS_TEXT_DOMAIN ), 'numbered' => __( 'Page numbers with "Next" and "Previous" page links', WPRSS_TEXT_DOMAIN ), ); ?>
/> /> $id, 'name' => \Aventura\Wprss\Core\Model\SettingsAbstract::getNameHtml(array($mainOptionName, $id)), 'placeholder' => __( 'No Limit', WPRSS_TEXT_DOMAIN ) )); ?> __('Any', WPRSS_TEXT_DOMAIN), 'latest' => __('Latest First', WPRSS_TEXT_DOMAIN), 'oldest' => __('Oldest First', WPRSS_TEXT_DOMAIN), ); ?>

You use this code by adding any of the following to any URL on your site.', WPRSS_TEXT_DOMAIN ) ?>

  1. "?wprss_action=reset&wprss_security_code=<your_code>" -
  2. "?wprss_action=deactivate&wprss_security_code=<your_code>" -
  3. "?wprss_action=reset_and_deactivate&wprss_security_code=<your_code>" -

/> /> $value ) { // Check to see if the current option has a value. If so, process it. if( isset( $input[ $key ] ) ) { // Strip all HTML and PHP tags and properly handle quoted strings $output[ $key ] = strip_tags( stripslashes( $input[ $key ] ) ); } // end if } // end foreach // If limit_feed_items_age_unit is not set or it set to zero, set it to empty if ( ! isset( $input['limit_feed_items_age'] ) || strval( $input['limit_feed_items_age'] ) == '0' ) { $output['limit_feed_items_age'] = ''; } if ( ! isset( $input['title_link'] ) || $input['title_link'] != '1' ) $output['title_link'] = 0; else $output['title_link'] = 1; if ( ! isset( $input['source_enable'] ) || $input['source_enable'] != '1' ) $output['source_enable'] = 0; else $output['source_enable'] = 1; if ( ! isset( $input['date_enable'] ) || $input['date_enable'] != '1' ) $output['date_enable'] = 0; else $output['date_enable'] = 1; if ( ! isset( $input['styles_disable'] ) || $input['styles_disable'] != '1' ) $output['styles_disable'] = 0; else $output['styles_disable'] = 1; if ( ! isset( $input['video_link'] ) || strtolower( $input['video_link'] ) !== 'true' ) $output['video_link'] = 'false'; else $output['video_link'] = 'true'; if ( $input['cron_interval'] != $current_cron_interval ) { wp_clear_scheduled_hook( 'wprss_fetch_all_feeds_hook' ); wp_schedule_event( time(), $input['cron_interval'], 'wprss_fetch_all_feeds_hook' ); } if ( ! isset( $input['unique_titles'] ) || $input['unique_titles'] !== '1' ) $output['unique_titles'] = 0; else $output['unique_titles'] = 1; // Return the array processing any additional functions filtered by this action return apply_filters( 'wprss_settings_general_validate', $output, $input ); } /** * Validates the licenses settings * * @since 3.8 */ function wprss_settings_license_keys_validate( $input ) { // Get the current licenses option $licenses = get_option( 'wprss_settings_license_keys' ); // If no licenses have been defined yet, create an empty array if ( !is_array( $licenses ) ) { $licenses = array(); } // For each entry in the received input foreach ( $input as $addon => $license_code ) { $addon_code = explode( '_', $addon ); $addon_code = isset( $addon_code[0] ) ? $addon_code[0] : null; // Only save if the entry does not exist OR the code is different if ( array_key_exists( $addon, $licenses ) && $license_code === $licenses[ $addon ] ) continue; $is_valid = apply_filters( 'wprss_settings_license_key_is_valid', true, $license_code ); if( $addon_code ) $is_valid = apply_filters( "wprss_settings_license_key_{$addon_code}_is_valid", $is_valid, $license_code ); if( !$is_valid ) continue; // Save it to the licenses option $licenses[ $addon ] = $license_code; } wprss_check_license_statuses(); // Return the new licenses return $licenses; } add_action( 'wprss_check_license_statuses', 'wprss_check_license_statuses' ); /** * Checks the license statuses * * @since 3.8.1 */ function wprss_check_license_statuses() { $license_statuses = get_option( 'wprss_settings_license_statuses', array() ); if ( count( $license_statuses ) === 0 ) return; $found_inactive = FALSE; foreach ( $license_statuses as $addon => $status ) { if ( $status !== 'active' ) { $found_inactive = TRUE; break; } } if ( $found_inactive ) { set_transient( 'wprss_notify_inactive_licenses', 1, 0 ); } } /** * Validates the wprss_secure_reset_code option * * @since 3.7.1 */ function wprss_secure_reset_code_validate( $input ) { return $input; } /** * Validates the presstrends setting * * @since 3.6 */ function wprss_tracking_validate ( $input ) { $output = $input; if ( ! isset( $input['wprss_tracking'] ) ) { $output['wprss_tracking'] = 0; } return $output; } /** * Returns the units used for the limit by age option. * * @since 3.8 */ function wprss_age_limit_units() { return apply_filters( 'wprss_age_limit_units', array( 'days', 'weeks', 'months', 'years' ) ); }