WP Realtime Sitemap to set options. Version: 1.5 Author: Daniel Tweedy Author URI: http://www.daniel-tweedy.co.uk/ License: GPL2 */ /* Copyright 2010 WP Realtime Sitemap (email : support@daniel-tweedy.co.uk) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ if (!class_exists('WPRealtimeSitemap')) { class WPRealtimeSitemap { var $plugin_base = ''; function WPRealtimeSitemap() { //constructor // Add Init add_action('init', array(&$this, 'addInit')); // Add Meta add_filter('plugin_row_meta', array(&$this, 'addMeta'), 10, 2); // Add Action Links add_filter('plugin_action_links', array(&$this, 'addActionLinks'), 10, 2); // Add Help add_filter('contextual_help', array(&$this, 'addHelp'), 10, 2 ); // Add Settings Panel add_action('admin_menu', array($this, 'addOptions')); add_action('admin_init', array($this, 'addOptionsInit')); // Add Form Shortcode add_shortcode('wp-realtime-sitemap', array($this, 'showOutput')); $options = get_option('plugin_wp_realtime_sitemap_settings'); // Install Default Settings register_activation_hook( __FILE__, array(&$this, 'installSettings') ); // UnInstall Settings register_deactivation_hook( __FILE__, array(&$this, 'unInstallSettings') ); } function addMeta($links, $file) { $plugin_file = basename(__FILE__); if (basename($file) == $plugin_file) { $faq_link = '' . __('FAQ', 'wp-realtime-sitemap') . ''; array_unshift($links, $faq_link); $support_link = '' . __('Support', 'wp-realtime-sitemap') . ''; array_unshift($links, $support_link); $donate_link = '' . __('Donate', 'wp-realtime-sitemap') . ''; array_unshift($links, $donate_link); $amazon_link = '' . __('Amazon Wishlist', 'wp-realtime-sitemap') . ''; array_unshift($links, $amazon_link); $amazon_link = '' . __('Contact Me', 'wp-realtime-sitemap') . ''; array_unshift($links, $amazon_link); } return $links; } function addActionLinks($links, $file) { $plugin_file = basename(__FILE__); if (basename($file) == $plugin_file) { $settings_link = '' . __('Settings', 'wp-realtime-sitemap') . ''; array_unshift($links, $settings_link); } return $links; } function addHelp( $help, $screen ) { if ( $screen == 'settings_page_wp-realtime-sitemap' ) { $help .= '
' . __('WP Realtime Sitemap Help', 'wp-realtime-sitemap') . '

'; $help .= '' . __('Amazon Wishlist', 'wp-realtime-sitemap') . '
'; $help .= '' . __( 'Donate', 'wp-realtime-sitemap' ).'
'; $help .= '' . __( 'Support', 'wp-realtime-sitemap' ).'
'; $help .= '' . __( 'FAQ', 'wp-realtime-sitemap' ).'
'; $help .= '' . __( 'Home Page', 'wp-realtime-sitemap' ).'
'; $help .= '' . __('Contact Me', 'wp-realtime-sitemap') . '
'; $help .= __('Please read the plugin information and FAQ, before asking a question.', 'wp-realtime-sitemap') . '

'; } return $help; } function addSubMenu() { $plugin_file = basename(__FILE__); $settingsCSS = (!isset($_GET['sub'])) ? ' class="current"' : ''; $supportCSS = (!isset($_GET['sub']) && $_GET['sub'] == 'support') ? ' class="current"' : ''; $translationsCSS = (!isset($_GET['sub']) && $_GET['sub'] == 'translations') ? ' class="current"' : ''; $sublinks = '

'; return $sublinks; } function addInit() { $this->plugin_base_url = WP_PLUGIN_URL . '/' . str_replace(basename( __FILE__), '', plugin_basename(__FILE__)); $this->plugin_base_dir = WP_PLUGIN_DIR . '/' . str_replace(basename( __FILE__), '', plugin_basename(__FILE__)); // Localization load_plugin_textdomain('wp-realtime-sitemap', false, dirname(plugin_basename(__FILE__)) . '/language'); } function addOptions() { add_options_page(__('WP Realtime Sitemap Options', 'wp-realtime-sitemap'), __('WP Realtime Sitemap', 'wp-realtime-sitemap'), 'manage_options', basename(__FILE__), array(&$this, 'showAdminScreen')); } function showAdminScreen() { return $this->_optionsForm(); } function addOptionsInit() { register_setting('update_settings', 'plugin_wp_realtime_sitemap_settings', array($this, '_formValidate')); add_settings_section('page_settings', __('Page Settings', 'wp-realtime-sitemap'), array($this, 'page_section_text'), __FILE__); add_settings_field('page_sort_column', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_sort_column', 'section' => 'page')); add_settings_field('page_sort_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_sort_order', 'section' => 'page')); add_settings_field('page_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'page_settings', array('dbfield' => 'page_exclude', 'section' => 'page')); add_settings_field('page_depth', __('Hierarchy Depth', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_depth', 'section' => 'page')); add_settings_field('page_show_date', __('Display Date', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'page_settings', array('dbfield' => 'page_show_date', 'section' => 'page')); // add_settings_field('page_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'page_settings', array('dbfield' => 'page_number', 'section' => 'page')); add_settings_section('post_settings', __('Post & Custom Post Type Settings', 'wp-realtime-sitemap'), array($this, 'post_section_text'), __FILE__); add_settings_field('post_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_orderby', 'section' => 'post')); add_settings_field('post_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_order', 'section' => 'post')); add_settings_field('post_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'post_settings', array('dbfield' => 'post_exclude', 'section' => 'post')); add_settings_field('post_show_date', __('Display Date', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'post_settings', array('dbfield' => 'post_show_date', 'section' => 'post')); add_settings_field('post_numberposts', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'post_settings', array('dbfield' => 'post_numberposts', 'section' => 'post')); add_settings_section('archive_settings', __('Archive Settings', 'wp-realtime-sitemap'), array($this, 'archive_section_text'), __FILE__); add_settings_field('archive_type', __('Type', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_type', 'section' => 'archive')); add_settings_field('archive_limit', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_limit', 'section' => 'archive')); add_settings_field('archive_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'archive_settings', array('dbfield' => 'archive_show_post_count', 'section' => 'archive')); add_settings_section('category_settings', __('Category Settings', 'wp-realtime-sitemap'), array($this, 'category_section_text'), __FILE__); add_settings_field('category_tagcloud', __('Show as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_tagcloud', 'section' => 'category')); add_settings_field('category_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_orderby', 'section' => 'category')); add_settings_field('category_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_order', 'section' => 'category')); add_settings_field('category_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_show_post_count', 'section' => 'category')); add_settings_field('category_hide_empty', __('Hide Empty', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_hide_empty', 'section' => 'category')); add_settings_field('category_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'category_settings', array('dbfield' => 'category_exclude', 'section' => 'category')); add_settings_field('category_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'category_settings', array('dbfield' => 'category_number', 'section' => 'category')); add_settings_field('category_depth', __('Hierarchy Depth', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'category_settings', array('dbfield' => 'category_depth', 'section' => 'category')); add_settings_section('tag_settings', __('Tag Settings', 'wp-realtime-sitemap'), array($this, 'tag_section_text'), __FILE__); add_settings_field('tags_tagcloud', __('Show as a Tag Cloud', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_tagcloud', 'section' => 'tag')); add_settings_field('tags_orderby', __('Order By', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_orderby', 'section' => 'tag')); add_settings_field('tags_order', __('Order', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_order', 'section' => 'tag')); add_settings_field('tags_show_post_count', __('Post Count', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_show_post_count', 'section' => 'tag')); add_settings_field('tags_hide_empty', __('Hide Empty', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_hide_empty', 'section' => 'tag')); add_settings_field('tags_exclude', __('Exclude IDs', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_exclude', 'section' => 'tag')); add_settings_field('tags_number', __('Limit', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'tag_settings', array('dbfield' => 'tags_number', 'section' => 'tag')); add_settings_section('header_settings', __('Header Settings', 'wp-realtime-sitemap'), array($this, 'header_section_text'), __FILE__); add_settings_field('pages_header', __('Pages Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'pages_header', 'section' => 'header')); add_settings_field('posts_header', __('Posts Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'posts_header', 'section' => 'header')); add_settings_field('archives_header', __('Archives Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'archives_header', 'section' => 'header')); add_settings_field('categories_header', __('Categories Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'categories_header', 'section' => 'header')); add_settings_field('tags_header', __('Tags Header', 'wp-realtime-sitemap'), array($this, '_formTextInput'), __FILE__, 'header_settings', array('dbfield' => 'tags_header', 'section' => 'header')); add_settings_section('display_settings', __('Display Settings', 'wp-realtime-sitemap'), array($this, 'display_section_text'), __FILE__); add_settings_field('show_pages', __('Show Pages', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_pages', 'section' => 'display')); add_settings_field('show_posts', __('Show Posts', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_posts', 'section' => 'display')); add_settings_field('show_custom_post_types', __('Show ALL Custom Post Types', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_custom_post_types', 'section' => 'display')); add_settings_field('show_archives', __('Show Archives', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_archives', 'section' => 'display')); add_settings_field('show_categories', __('Show Categories', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_categories', 'section' => 'display')); add_settings_field('show_tags', __('Show Tags', 'wp-realtime-sitemap'), array($this, '_formSelectInput'), __FILE__, 'display_settings', array('dbfield' => 'show_tags', 'section' => 'display')); } function page_section_text($args) { echo '

' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '

'; } function post_section_text() { echo '

' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Display Date is to show the date that the post itself was created/published.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Limit is used to apply a limit as to how many posts should be shown on the sitemap, useful for if you have a very large blog and as such a large number of posts, use -1 to show all posts and not apply a limit.', 'wp-realtime-sitemap') . '

'; } function archive_section_text($args) { echo '

' . __('Limit is used to apply a limit as to how many archives should be shown on the sitemap, useful for if you have a very large blog and as such a large number of archives, leave blank to show all archives and not apply a limit.', 'wp-realtime-sitemap') . '

'; } function category_section_text($args) { echo '

' . __('All options apply to the tag cloud, unless otherwise explicity stated.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Limit is used to apply a limit as to how many categories should be shown on the sitemap, useful for if you have a very large blog and as such a large number of categories, use 0 to show all categories and not apply a limit.', 'wp-realtime-sitemap') . '

'; } function tag_section_text($args) { echo '

' . __('All options apply to the tag cloud, unless otherwise explicity stated.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Exclude IDs must be either left blank, or be a comma seperated list of IDs.', 'wp-realtime-sitemap') . '

'; echo '

' . __('Limit is used to apply a limit as to how many tags should be shown on the sitemap, useful for if you have a very large blog and as such a large number of tags, use 0 to show all tags and not apply a limit.', 'wp-realtime-sitemap') . '

'; } function header_section_text() { echo '

' . __('This section is optional, you can change the names of the sections if you wish from the defaults. Defaults are used when the below options are left blank/empty.', 'wp-realtime-sitemap') . '

'; } function display_section_text() { echo '

' . __('Choose what you would like to be displayed on your site map.', 'wp-realtime-sitemap') . '

'; } function _formValidDefaults($args) { $values = false; switch($args['dbfield']) { case 'page_sort_column': $values = array( 'post_title' => __('Alphabetically (by title) (Default)', 'wp-realtime-sitemap'), 'menu_order' => __('Page order', 'wp-realtime-sitemap'), 'post_date' => __('Creation time', 'wp-realtime-sitemap'), 'post_modified' => __('Time last modified', 'wp-realtime-sitemap'), 'ID' => __('Numeric Page ID', 'wp-realtime-sitemap'), 'post_author' => __('Page author', 'wp-realtime-sitemap'), 'post_name' => __('Alphabetically (by post slug)', 'wp-realtime-sitemap'), ); break; case 'page_sort_order': $values = array( 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'), 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'), ); break; case 'page_depth': $values = array( '0' => __('Displays pages at any depth and arranges them hierarchically in nested lists (Default)', 'wp-realtime-sitemap'), '-1' => __('Displays pages at any depth and arranges them in a single, flat list', 'wp-realtime-sitemap'), '1' => __('Displays top-level Pages only', 'wp-realtime-sitemap'), ); break; case 'page_show_date': $values = array( '' => __('Display no date (Default)', 'wp-realtime-sitemap'), 'modified' => __('Display the date last modified', 'wp-realtime-sitemap'), 'created' => __('Display the date first created', 'wp-realtime-sitemap'), ); break; /* case 'page_number': $values = array('numeric' => 'numeric'); break; */ case 'post_orderby': $values = array( 'post_date' => __('Sort by post date (Default)', 'wp-realtime-sitemap'), 'author' => __('Sort by the numeric author IDs', 'wp-realtime-sitemap'), 'category' => __('Sort by the numeric category IDs', 'wp-realtime-sitemap'), 'content' => __('Sort by content', 'wp-realtime-sitemap'), 'date' => __('Sort by creation date', 'wp-realtime-sitemap'), 'ID' => __('Sort by numeric Post ID', 'wp-realtime-sitemap'), 'modified' => __('Sort by last modified date', 'wp-realtime-sitemap'), 'name' => __('Sort by stub', 'wp-realtime-sitemap'), 'parent' => __('Sort by parent ID', 'wp-realtime-sitemap'), 'password' => __('Sort by password', 'wp-realtime-sitemap'), 'rand' => __('Randomly sort results', 'wp-realtime-sitemap'), 'status' => __('Sort by status', 'wp-realtime-sitemap'), 'title' => __('Sort by title', 'wp-realtime-sitemap'), 'type' => __('Sort by type', 'wp-realtime-sitemap'), ); break; case 'post_order': $values = array( 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'), 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'), ); break; case 'post_show_date': $values = array( 'Yes' => __('Yes/On', 'wp-realtime-sitemap'), 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'), ); break; case 'post_numberposts': $values = array('numeric' => 'numeric'); break; case 'archive_type': $values = array( 'yearly' => __('Yearly', 'wp-realtime-sitemap'), 'monthly' => __('Monthly (Default)', 'wp-realtime-sitemap'), 'daily' => __('Daily', 'wp-realtime-sitemap'), 'weekly' => __('Weekly', 'wp-realtime-sitemap'), ); break; case 'archive_limit': $values = array('numeric' => 'numeric'); break; case 'archive_show_post_count': $values = array( true => __('True (Default)', 'wp-realtime-sitemap'), false => __('False', 'wp-realtime-sitemap'), ); break; case 'category_tagcloud': $values = array( 'Yes' => __('Yes/On', 'wp-realtime-sitemap'), 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'), ); break; case 'category_orderby': $values = array( 'ID' => __('ID', 'wp-realtime-sitemap'), 'name' => __('Name (Default)', 'wp-realtime-sitemap'), 'slug' => __('Slug', 'wp-realtime-sitemap'), 'count' => __('Count', 'wp-realtime-sitemap'), 'term_group' => __('Term Group', 'wp-realtime-sitemap'), ); break; case 'category_order': $values = array( 'ASC' => __('Sort from lowest to highest (Default)', 'wp-realtime-sitemap'), 'DESC' => __('Sort from highest to lowest', 'wp-realtime-sitemap'), ); break; case 'category_show_post_count': $values = array( true => __('True', 'wp-realtime-sitemap'), false => __('False (Default)', 'wp-realtime-sitemap'), ); break; case 'category_hide_empty': $values = array( true => __('True (Default)', 'wp-realtime-sitemap'), false => __('False', 'wp-realtime-sitemap'), ); break; case 'category_number': $values = array('numeric' => 'numeric'); break; case 'category_depth': $values = array( '0' => __('All Categories and child Categories (Default)', 'wp-realtime-sitemap'), '-1' => __('All Categories displayed in flat (no indent) form', 'wp-realtime-sitemap'), '1' => __('Show only top level Categories ', 'wp-realtime-sitemap'), ); break; case 'tags_tagcloud': $values = array( 'Yes' => __('Yes/On', 'wp-realtime-sitemap'), 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'), ); break; case 'tags_orderby': $values = array( 'ID' => __('ID', 'wp-realtime-sitemap'), 'name' => __('Name (Default)', 'wp-realtime-sitemap'), 'slug' => __('Slug', 'wp-realtime-sitemap'), 'count' => __('Count', 'wp-realtime-sitemap'), 'term_group' => __('Term Group', 'wp-realtime-sitemap'), ); break; case 'tags_order': $values = array( 'ASC' => __('Sort ascending (Default)', 'wp-realtime-sitemap'), 'DESC' => __('Sort descending', 'wp-realtime-sitemap'), ); break; case 'tags_show_post_count': $values = array( true => __('True', 'wp-realtime-sitemap'), false => __('False (Default)', 'wp-realtime-sitemap'), ); break; case 'tags_hide_empty': $values = array( true => __('True (Default)', 'wp-realtime-sitemap'), false => __('False', 'wp-realtime-sitemap'), ); break; case 'tags_number': $values = array('numeric' => 'numeric'); break; case 'show_pages': $values = array( 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'), 'No' => __('No/Off', 'wp-realtime-sitemap'), ); break; case 'show_posts': $values = array( 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'), 'No' => __('No/Off', 'wp-realtime-sitemap'), ); break; case 'show_custom_post_types': $values = array( 'Yes' => __('Yes/On', 'wp-realtime-sitemap'), 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'), ); break; case 'show_archives': $values = array( 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'), 'No' => __('No/Off', 'wp-realtime-sitemap'), ); break; case 'show_categories': $values = array( 'Yes' => __('Yes/On (Default)', 'wp-realtime-sitemap'), 'No' => __('No/Off', 'wp-realtime-sitemap'), ); break; case 'show_tags': $values = array( 'Yes' => __('Yes/On', 'wp-realtime-sitemap'), 'No' => __('No/Off (Default)', 'wp-realtime-sitemap'), ); break; } return $values; } function _formInfoText($args) { switch($args['dbfield']) { case 'page_sort_column': $infotext = ''; break; case 'page_sort_order': $infotext = ''; break; case 'page_exclude': $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap'); break; case 'page_depth': $infotext = ''; break; case 'page_show_date': $infotext = ''; break; /* case 'page_number': $infotext = __('leave blank to show all.', 'wp-realtime-sitemap'); break; */ case 'post_orderby': $infotext = ''; break; case 'post_order': $infotext = ''; break; case 'post_exclude': $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap'); break; case 'post_show_date': $infotext = ''; break; case 'post_numberposts': $infotext = __('-1 to show all.', 'wp-realtime-sitemap'); break; case 'archive_type': $infotext = ''; break; case 'archive_limit': $infotext = __('leave blank to show all.', 'wp-realtime-sitemap'); break; case 'archive_show_post_count': $infotext = ''; break; case 'category_tagcloud': $infotext = ''; break; case 'category_orderby': $infotext = ''; break; case 'category_order': $infotext = ''; break; case 'category_show_post_count': $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap'); break; case 'category_hide_empty': $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap'); break; case 'category_exclude': $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap'); break; case 'category_number': $infotext = __('0 to show all.', 'wp-realtime-sitemap'); break; case 'category_depth': $infotext = ''; break; case 'tags_tagcloud': $infotext = ''; break; case 'tags_orderby': $infotext = ''; break; case 'tags_order': $infotext = ''; break; case 'tags_show_post_count': $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap'); break; case 'tags_hide_empty': $infotext = __('This is ignored with the tag cloud setting.', 'wp-realtime-sitemap'); break; case 'tags_exclude': $infotext = __('Comma separated list of IDs.', 'wp-realtime-sitemap'); break; case 'tags_number': $infotext = __('0 to show all tags.', 'wp-realtime-sitemap'); break; case 'pages_header': $infotext = ''; break; case 'posts_header': $infotext = ''; break; case 'archives_header': $infotext = ''; break; case 'categories_header': $infotext = ''; break; case 'tags_header': $infotext = ''; break; case 'show_pages': $infotext = ''; break; case 'show_posts': $infotext = ''; break; case 'show_custom_post_types': $infotext = ''; break; case 'show_archives': $infotext = ''; break; case 'show_categories': $infotext = ''; break; case 'show_tags': $infotext = ''; break; } return $infotext; } function _formSelectInput($args) { // Get current options from the database. extract(get_option('plugin_wp_realtime_sitemap_settings')); $values = $this->_formValidDefaults($args); $infotext = $this->_formInfoText($args); if (isset($values) && is_array($values)) { $optionFormat = ''; $output = ' ' . $infotext; } else { $output = '$values not set or not an array.'; } echo $output; } function _formTextInput($args) { // Get current options from the database. extract(get_option('plugin_wp_realtime_sitemap_settings')); $infotext = $this->_formInfoText($args); if (array_key_exists('dbfield', $args) && isset($infotext)) { echo ' ' . $infotext; } else { echo 'no dbfield in array found or infotext not been set'; } } function _formValidate($inputs) { $plugin_wp_realtime_sitemap_settings = get_option('plugin_wp_realtime_sitemap_settings'); $validInputs = array( // PAGE SETTINGS 'page_sort_column' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_sort_column'))), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'page_sort_order' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_sort_order'))), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'page_exclude' => array( 'valid' => array(), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Exclude', 'wp-realtime-sitemap') . ': ' . __('This must be comment seperated for it to be valid, please try again.', 'wp-realtime-sitemap'), ), 'page_depth' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_depth'))), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Hierarchy Depth', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'page_show_date' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_show_date'))), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Display Date', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), /* 'page_number' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'page_number'))), 'default' => '', 'errormsg' => __('Page Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'), ), */ // POST SETTINGS 'post_orderby' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_orderby'))), 'default' => '', 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'post_order' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_order'))), 'default' => '', 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'post_exclude' => array( 'valid' => array(), 'default' => '', 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Exclude', 'wp-realtime-sitemap') . ': ' . __('This must be comment seperated list of IDs for it to be valid, please try again.', 'wp-realtime-sitemap'), ), 'post_show_date' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_show_date'))), 'default' => '', 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Display Date', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'post_numberposts' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'post_numberposts'))), 'default' => '', 'errormsg' => __('Post Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers are accepted as valid inputs.', 'wp-realtime-sitemap'), ), // ARCHIVE SETTINGS 'archive_type' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_type'))), 'default' => '', 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Archive Type', 'wp-realtime-sitemap') . ': ' . __('', 'wp-realtime-sitemap'), ), 'archive_limit' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_limit'))), 'default' => '', 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'archive_show_post_count' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'archive_show_post_count'))), 'default' => '', 'errormsg' => __('Archive Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('', 'wp-realtime-sitemap'), ), // CATEGORY SETTINGS 'category_tagcloud' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_tagcloud'))), 'default' => '', 'errormsg' => 'category_tagcloud', ), 'category_orderby' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_orderby'))), 'default' => '', 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'category_order' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_order'))), 'default' => '', 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'category_show_post_count' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_show_post_count'))), 'default' => '', 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'category_hide_empty' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_hide_empty'))), 'default' => '', 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Hide Empty', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'category_exclude' => array( 'valid' => array(), 'default' => '', 'errormsg' => 'category_exclude', ), 'category_number' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'category_number'))), 'default' => '', 'errormsg' => __('Category Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'), ), // TAG SETTINGS 'tags_tagcloud' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_tagcloud'))), 'default' => '', 'errormsg' => 'tags_tagcloud', ), 'tags_orderby' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_orderby'))), 'default' => '', 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'tags_order' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_order'))), 'default' => '', 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'tags_show_post_count' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_show_post_count'))), 'default' => '', 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Post Count', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'tags_hide_empty' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_hide_empty'))), 'default' => '', 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Order By', 'wp-realtime-sitemap') . ': ' . __('The option choosen is not valid, please try again.', 'wp-realtime-sitemap'), ), 'tags_number' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'tags_number'))), 'default' => '', 'errormsg' => __('Tag Settings', 'wp-realtime-sitemap') . ' > ' . __('Limit', 'wp-realtime-sitemap') . ': ' . __('Only integers or -1 are accepted as valid inputs.', 'wp-realtime-sitemap'), ), // HEADER SETTINGS // DISPLAY SETTINGS 'show_pages' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_pages'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Pages', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'show_posts' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_posts'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Posts', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'show_custom_post_types' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_custom_post_types'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Custom Post Types', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'show_archives' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_archives'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Archives', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'show_categories' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_categories'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Categories', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), 'show_tags' => array( 'valid' => array_keys($this->_formValidDefaults(array('dbfield' => 'show_tags'))), 'default' => '', 'errormsg' => __('Display Settings', 'wp-realtime-sitemap') . ' > ' . __('Show Tags', 'wp-realtime-sitemap') . ': ' . __('Only Yes/On or No/Off are accepted as valid inputs.', 'wp-realtime-sitemap'), ), ); // PAGE SETTINGS if(!in_array($inputs['page_sort_column'], $validInputs['page_sort_column']['valid'])) { $plugin_wp_realtime_sitemap_settings['page_sort_column'] = $validInputs['page_sort_column']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_sort_column']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['page_sort_column'] = $inputs['page_sort_column']; } if(!in_array($inputs['page_sort_order'], $validInputs['page_sort_order']['valid'])) { $plugin_wp_realtime_sitemap_settings['page_sort_order'] = $validInputs['page_sort_order']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_sort_order']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['page_sort_order'] = $inputs['page_sort_order']; } $plugin_wp_realtime_sitemap_settings['page_exclude'] = $inputs['page_exclude']; if(!is_numeric($inputs['page_depth'])) { $plugin_wp_realtime_sitemap_settings['page_depth'] = $validInputs['page_depth']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_depth']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['page_depth'] = $inputs['page_depth']; } if(!in_array($inputs['page_show_date'], $validInputs['page_show_date']['valid'])) { $plugin_wp_realtime_sitemap_settings['page_show_date'] = $validInputs['page_show_date']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_show_date']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['page_show_date'] = $inputs['page_show_date']; } /* if(!is_numeric($inputs['page_number']) && !empty($inputs['page_number'])) { $plugin_wp_realtime_sitemap_settings['page_number'] = $validInputs['page_number']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['page_number']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['page_number'] = $inputs['page_number']; } */ // POST SETTINGS if(!in_array($inputs['post_order'], $validInputs['post_order']['valid'])) { $plugin_wp_realtime_sitemap_settings['post_order'] = $validInputs['post_order']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_order']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['post_order'] = $inputs['post_order']; } if(!in_array($inputs['post_orderby'], $validInputs['post_orderby']['valid'])) { $plugin_wp_realtime_sitemap_settings['post_orderby'] = $validInputs['post_orderby']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_orderby']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['post_orderby'] = $inputs['post_orderby']; } $plugin_wp_realtime_sitemap_settings['post_exclude'] = $inputs['post_exclude']; if(!in_array($inputs['post_show_date'], $validInputs['post_show_date']['valid'])) { $plugin_wp_realtime_sitemap_settings['post_show_date'] = $validInputs['post_show_date']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_show_date']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['post_show_date'] = $inputs['post_show_date']; } if(!is_numeric($inputs['post_numberposts'])) { $plugin_wp_realtime_sitemap_settings['post_numberposts'] = $validInputs['post_numberposts']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['post_numberposts']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['post_numberposts'] = $inputs['post_numberposts']; } // ARCHIVE SETTINGS if(!in_array($inputs['archive_type'], $validInputs['archive_type']['valid'])) { $plugin_wp_realtime_sitemap_settings['archive_type'] = $validInputs['archive_type']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_type']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['archive_type'] = $inputs['archive_type']; } if(!is_numeric($inputs['archive_limit']) && !empty($inputs['archive_limit'])) { $plugin_wp_realtime_sitemap_settings['archive_limit'] = $validInputs['archive_limit']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_limit']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['archive_limit'] = $inputs['archive_limit']; } if(!in_array($inputs['archive_show_post_count'], $validInputs['archive_show_post_count']['valid'])) { $plugin_wp_realtime_sitemap_settings['archiveshow_post_count'] = $validInputs['archive_show_post_count']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['archive_show_post_count']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['archive_show_post_count'] = $inputs['archive_show_post_count']; } // CATEGORY SETTINGS if(!in_array($inputs['category_tagcloud'], $validInputs['category_tagcloud']['valid'])) { $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $validInputs['category_tagcloud']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_tagcloud']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_tagcloud'] = $inputs['category_tagcloud']; } if(!in_array($inputs['category_orderby'], $validInputs['category_orderby']['valid'])) { $plugin_wp_realtime_sitemap_settings['category_orderby'] = $validInputs['category_orderby']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_orderby']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_orderby'] = $inputs['category_orderby']; } if(!in_array($inputs['category_order'], $validInputs['category_order']['valid'])) { $plugin_wp_realtime_sitemap_settings['category_order'] = $validInputs['category_order']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_order']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_order'] = $inputs['category_order']; } if(!in_array($inputs['category_show_post_count'], $validInputs['category_show_post_count']['valid'])) { $plugin_wp_realtime_sitemap_settings['category_show_post_count'] = $validInputs['category_show_post_count']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_show_post_count']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_show_post_count'] = $inputs['category_show_post_count']; } if(!in_array($inputs['category_hide_empty'], $validInputs['category_hide_empty']['valid'])) { $plugin_wp_realtime_sitemap_settings['category_hide_empty'] = $validInputs['category_hide_empty']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_hide_empty']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_hide_empty'] = $inputs['category_hide_empty']; } $plugin_wp_realtime_sitemap_settings['category_exclude'] = $inputs['category_exclude']; if(!is_numeric($inputs['category_depth'])) { $plugin_wp_realtime_sitemap_settings['category_depth'] = $validInputs['category_depth']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_depth']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_depth'] = $inputs['category_depth']; } if(!is_numeric($inputs['category_number'])) { $plugin_wp_realtime_sitemap_settings['category_number'] = $validInputs['category_number']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['category_number']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['category_number'] = $inputs['category_number']; } // TAG SETTINGS if(!in_array($inputs['tags_tagcloud'], $validInputs['tags_tagcloud']['valid'])) { $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $validInputs['tags_tagcloud']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_tagcloud']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_tagcloud'] = $inputs['tags_tagcloud']; } if(!in_array($inputs['tags_orderby'], $validInputs['tags_orderby']['valid'])) { $plugin_wp_realtime_sitemap_settings['tags_orderby'] = $validInputs['tags_orderby']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_orderby']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_orderby'] = $inputs['tags_orderby']; } if(!in_array($inputs['tags_order'], $validInputs['tags_order']['valid'])) { $plugin_wp_realtime_sitemap_settings['tags_order'] = $validInputs['tags_order']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_order']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_order'] = $inputs['tags_order']; } if(!in_array($inputs['tags_show_post_count'], $validInputs['tags_show_post_count']['valid'])) { $plugin_wp_realtime_sitemap_settings['tags_show_post_count'] = $validInputs['tags_show_post_count']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_show_post_count']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_show_post_count'] = $inputs['tags_show_post_count']; } if(!in_array($inputs['tags_hide_empty'], $validInputs['tags_hide_empty']['valid'])) { $plugin_wp_realtime_sitemap_settings['tags_hide_empty'] = $validInputs['tags_hide_empty']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_hide_empty']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_hide_empty'] = $inputs['tags_hide_empty']; } $plugin_wp_realtime_sitemap_settings['tags_exclude'] = $inputs['tags_exclude']; if(!is_numeric($inputs['tags_number'])) { $plugin_wp_realtime_sitemap_settings['tags_number'] = $validInputs['tags_number']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['tags_number']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['tags_number'] = $inputs['tags_number']; } // HEADER SETTINGS $plugin_wp_realtime_sitemap_settings['pages_header'] = mysql_real_escape_string($inputs['pages_header']); $plugin_wp_realtime_sitemap_settings['posts_header'] = mysql_real_escape_string($inputs['posts_header']); $plugin_wp_realtime_sitemap_settings['archives_header'] = mysql_real_escape_string($inputs['archives_header']); $plugin_wp_realtime_sitemap_settings['categories_header'] = mysql_real_escape_string($inputs['categories_header']); $plugin_wp_realtime_sitemap_settings['tags_header'] = mysql_real_escape_string($inputs['tags_header']); // DISPLAY SETTINGS if(!in_array($inputs['show_pages'], $validInputs['show_pages']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_pages'] = $validInputs['show_pages']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_pages']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_pages'] = $inputs['show_pages']; } if(!in_array($inputs['show_posts'], $validInputs['show_posts']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_posts'] = $validInputs['show_posts']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_posts']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_posts'] = $inputs['show_posts']; } if(!in_array($inputs['show_custom_post_types'], $validInputs['show_custom_post_types']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $validInputs['show_custom_post_types']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_custom_post_types']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_custom_post_types'] = $inputs['show_custom_post_types']; } if(!in_array($inputs['show_archives'], $validInputs['show_archives']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_archives'] = $validInputs['show_archives']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_archives']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_archives'] = $inputs['show_archives']; } if(!in_array($inputs['show_categories'], $validInputs['show_categories']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_categories'] = $validInputs['show_categories']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_categories']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_categories'] = $inputs['show_categories']; } if(!in_array($inputs['show_tags'], $validInputs['show_tags']['valid'])) { $plugin_wp_realtime_sitemap_settings['show_tags'] = $validInputs['show_tags']['default']; add_settings_error('plugin_wp_realtime_sitemap_settings', 'settings_updated', $validInputs['show_tags']['errormsg']); } else { $plugin_wp_realtime_sitemap_settings['show_tags'] = $inputs['show_tags']; } return $plugin_wp_realtime_sitemap_settings; } function _optionsForm() { // check user has access to change settings for this plugin. if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.', 'wp-realtime-sitemap') ); } $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); ?>

Donate

If you like this plugin and find it useful, help keep this plugin free and actively develop by clicking the donate button or send me a gift from my Amazon Wishlist. Also dont forget to follow me on Twitter.

Donate with PayPal Amazon WishList Twitter

ThemeFuse Original WP Themes

If you are interested in buying an original wp theme I would recommend ThemeFuse. They make some amazing wp themes, that have a cool 1 click auto install feature and excellent after care support services. Check out some of their themes!


'all'), $atts)); // Pages: Yes/No? if (($all_options['show_pages'] != 'No' && $all_options['show_pages'] != 'Off') && ($show == 'pages' || $show == 'all')) { $pages_header = (empty($pages_header)) ? __('Pages') : $pages_header; $pages = '

' . $pages_header . '

'; $pages .= '
'; } // Posts: Yes/No? if (($all_options['show_posts'] != 'No' && $all_options['show_posts'] != 'Off') && ($show == 'posts' || $show == 'all')) { $posts = ''; // Set options for post query $theposts = get_posts(array( 'numberposts' => $post_numberposts, 'orderby' => $post_orderby, 'order' => $post_order, 'exclude' => $post_exclude, 'post_type' => 'post', )); if (count($theposts) > 0) { foreach($theposts as $post) { setup_postdata($post); $extra = ''; if ($post_show_date == 'Yes') $extra = ' ' . get_the_date() . ''; $posts .= '
  • ' . get_the_title() . '' . $extra . '
  • '; } wp_reset_postdata(); $posts = '

    ' . __('Posts', 'wp-realtime-sitemap') . '

    '; } } // Custom Post Types: Yes/No? if (($all_options['show_custom_post_types'] != 'No' && $all_options['show_custom_post_types'] != 'Off') && ($show == 'customposts' || $show == 'all')) { $custom_post_types = array(); $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); foreach ($post_types as $post_type) { $custom_post_type_posts = ''; // Set options for post query $theposts = get_posts(array( 'numberposts' => $post_numberposts, 'orderby' => $post_orderby, 'order' => $post_order, 'exclude' => $post_exclude, 'post_type' => $post_type->name, )); if (count($theposts) > 0) { foreach((array)$theposts as $post) { setup_postdata($post); $extra = ''; if ($post_show_date == 'Yes') $extra = ' ' . get_the_date() . ''; $custom_post_type_posts .= '
  • ' . get_the_title() . '' . $extra . '
  • '; } wp_reset_postdata(); $custom_post_types[$post_type->name] = '

    ' . $post_type->labels->name . '

    '; } } } // Archives: Yes/No? if (($all_options['show_archives'] != 'No' && $all_options['show_archives'] != 'Off') && ($show == 'archives' || $show == 'all')) { $archives_header = (empty($archives_header)) ? __('Archives') : $archives_header; $archives = '

    ' . $archives_header . '

    '; $archives .= '
    '; } // Categories: Yes/No? if (($all_options['show_categories'] != 'No' && $all_options['show_categories'] != 'Off') && ($show == 'categories' || $show == 'all')) { $categories_header = (empty($categories_header)) ? __('Categories') : $categories_header; $categories = '

    ' . $categories_header . '

    '; // Tag Cloud: Yes/No? if ($all_options['category_tagcloud'] != 'No' && $all_options['category_tagcloud'] != 'Off') { $categories .= '

    ' . wp_tag_cloud(array('number' => $category_number, 'format' => 'flat', 'orderby' => $category_orderby, 'order' => $category_order, 'taxonomy' => 'category', 'echo' => '0')) . '

    '; } else { $categories .= ''; } $categories .= '
    '; } // Tags: Yes/No? if (($all_options['show_tags'] != 'No' && $all_options['show_tags'] != 'Off') && ($show == 'tags' || $show == 'all')) { $tags_header = (empty($tags_header)) ? __('Tags', 'wp-realtime-sitemap') : $tags_header; $tags = '

    ' . $tags_header . '

    '; // Tag Cloud: Yes/No? if ($all_options['tags_tagcloud'] != 'No' && $all_options['tags_tagcloud'] != 'Off') { $tags .= '

    ' . wp_tag_cloud(array('number' => $tags_number, 'format' => 'flat', 'orderby' => $tags_orderby, 'order' => $tags_order, 'taxonomy' => 'category', 'echo' => '0')) . '

    '; } else { $tags .= ''; } $tags .= '
    '; } if ($show == 'pages') { return $pages; } if ($show == 'posts') { return $posts; } if ($show == 'custom-posts') { return implode('', $custom_post_types); } if ($show == 'archives') { return $archives; } if ($show == 'categories') { return $categories; } if ($show == 'tags') { return $tags; } if ($show == 'all') { $custom_post_types = implode('', $custom_post_types); return $pages . $posts . $custom_post_types . $archives . $categories . $tags; } } } function installSettings() { global $wpdb , $wp_roles, $wp_version; // Check for capability if (!current_user_can('activate_plugins')) return; $options = get_option('plugin_wp_realtime_sitemap_settings'); // set the default settings, if we didn't upgrade if (empty($options)) $this->_defaultSettings(); } function _defaultSettings () { $defaults = array( 'page_sort_column' => 'post_date', 'page_sort_order' => 'DESC', 'page_exclude' => '', 'page_depth' => '0', 'page_show_date' => '', // 'page_number' => '', 'post_orderby' => 'post_date', 'post_order' => 'DESC', 'post_exclude' => '', 'post_show_date' => 'Yes', 'post_numberposts' => '-1', 'archive_type' => 'monthly', 'archive_limit' => '', 'archive_show_post_count' => false, 'category_tagcloud' => 'No', 'category_orderby' => 'name', 'category_order' => 'name', 'category_show_post_count' => false, 'category_hide_empty' => true, 'category_exclude' => '', 'category_number' => '0', 'category_depth' => '0', 'tags_tagcloud' => 'No', 'tags_orderby' => 'name', 'tags_order' => 'name', 'tags_show_post_count' => false, 'tags_hide_empty' => true, 'tags_exclude' => '', 'tags_number' => '0', 'pages_header' => '', 'posts_header' => '', 'archives_header' => '', 'categories_header' => '', 'tags_header' => '', 'show_pages' => 'Yes', 'show_posts' => 'Yes', 'show_custom_post_types' => 'No', 'show_archives' => 'Yes', 'show_categories' => 'Yes', 'show_tags' => 'No', ); update_option('plugin_wp_realtime_sitemap_settings', $defaults); } function unInstallSettings() { global $wpdb , $wp_roles, $wp_version; delete_option('plugin_wp_realtime_sitemap_settings'); // Delete old unused database entries - v1.0 delete_option('wp_realtime_sitemap_orderby'); delete_option('wp_realtime_sitemap_private'); delete_option('wp_realtime_sitemap_pages'); delete_option('wp_realtime_sitemap_posts'); delete_option('wp_realtime_sitemap_tags'); delete_option('wp_realtime_sitemap_archives'); delete_option('wp_realtime_sitemap_displayorder'); // Delete old unused database entries - v1.1 delete_option('wp_realtime_sitemap_orderby'); delete_option('wp_realtime_sitemap_showprivate'); delete_option('wp_realtime_sitemap_showpages'); delete_option('wp_realtime_sitemap_showposts'); delete_option('wp_realtime_sitemap_showarchives'); delete_option('wp_realtime_sitemap_showcategories'); delete_option('wp_realtime_sitemap_showcategoriesastc'); delete_option('wp_realtime_sitemap_showtags'); delete_option('wp_realtime_sitemap_showtagsastc'); delete_option('wp_realtime_sitemap_displayorder'); } } } if( class_exists('WPRealtimeSitemap') ) $wpRealtimeSitemap = new WPRealtimeSitemap(); ?>