* xml_sitemap_url -> Filters the URL used in the sitemap reference in robots.txt * (receives an ARRAY and MUST return one; can be multiple urls) * and for the home URL in the sitemap (receives a STRING and MUST) * return one) itself. Useful for multi language plugins or other * plugins that affect the blogs main URL... See pre-defined filter * XMLSitemapFeed::qtranslate() in XMLSitemapFeed.class.php as an * example. * ACTIONS * [ none at this point, but feel free to request, suggest or code one :) ] * */ /* -------------------- * CONSTANTS * -------------------- */ define('XMLSF_VERSION', '3.9.1'); define('XMLSF_MEMORY_LIMIT', '128M'); if (file_exists(dirname(__FILE__) . '/xml-sitemap-feed')) { define('XMLSF_PLUGIN_DIR', dirname(__FILE__) . '/xml-sitemap-feed'); } else { define('XMLSF_PLUGIN_DIR', dirname(__FILE__)); } /* ----------------- * CLASS * ----------------- */ if (class_exists('XMLSitemapFeed') || (include XMLSF_PLUGIN_DIR . '/XMLSitemapFeed.class.php')) { XMLSitemapFeed::go(); } /* ------------------------------------- * MISSING WORDPRESS FUNCTIONS * ------------------------------------- */ include_once XMLSF_PLUGIN_DIR . '/hacks.php';
/** * CONSTRUCTOR */ function __construct() { $sitemaps = parent::get_sitemaps(); $prefix = parent::prefix(); // sitemaps register_setting('reading', $prefix . 'sitemaps', array($this, 'sanitize_sitemaps_settings')); add_settings_field($prefix . 'sitemaps', __('Enable XML sitemaps', 'xml-sitemap-feed'), array($this, 'sitemaps_settings_field'), 'reading'); // robots rules only when permalinks are set $rules = get_option('rewrite_rules'); if (get_option('permalink_structure') && isset($rules['robots\\.txt$'])) { register_setting('reading', $prefix . 'robots', array($this, 'sanitize_robots_settings')); add_settings_field($prefix . 'robots', __('Additional robots.txt rules', 'xml-sitemap-feed'), array($this, 'robots_settings_field'), 'reading'); } // ACTION LINK add_filter('plugin_action_links_' . XMLSF_PLUGIN_BASENAME, array($this, 'add_action_link')); // stop here if blog is not public if (!get_option('blog_public')) { return; } if (is_multisite()) { add_settings_field($prefix . 'reset', __('Reset XML sitemaps', 'xml-sitemap-feed'), array($this, 'reset_settings_field'), 'reading'); } if (isset($sitemaps['sitemap-news'])) { // XML SITEMAP SETTINGS add_settings_section('news_sitemap_section', '<a name="xmlnf"></a>' . __('Google News Sitemap', 'xml-sitemap-feed'), array($this, 'news_sitemap_settings'), 'reading'); // tags register_setting('reading', $prefix . 'news_tags', array($this, 'sanitize_news_tags_settings')); add_settings_field($prefix . 'news_name', '<label for="xmlsf_news_name">' . __('Publication name', 'xml-sitemap-feed') . '</label>', array($this, 'news_name_field'), 'reading', 'news_sitemap_section'); add_settings_field($prefix . 'news_post_type', __('Include post types', 'xml-sitemap-feed'), array($this, 'news_post_type_field'), 'reading', 'news_sitemap_section'); add_settings_field($prefix . 'news_categories', translate('Categories'), array($this, 'news_categories_field'), 'reading', 'news_sitemap_section'); add_settings_field($prefix . 'news_image', translate('Images'), array($this, 'news_image_field'), 'reading', 'news_sitemap_section'); add_settings_field($prefix . 'news_labels', __('Source labels', 'xml-sitemap-feed'), array($this, 'news_labels_field'), 'reading', 'news_sitemap_section'); // post meta box add_action('add_meta_boxes', array($this, 'add_meta_box_news')); } if (isset($sitemaps['sitemap'])) { // XML SITEMAP SETTINGS add_settings_section('xml_sitemap_section', '<a name="xmlsf"></a>' . __('XML Sitemap', 'xml-sitemap-feed'), array($this, 'xml_sitemap_settings'), 'reading'); // post_types register_setting('reading', $prefix . 'post_types', array($this, 'sanitize_post_types_settings')); add_settings_field($prefix . 'post_types', __('Include post types', 'xml-sitemap-feed'), array($this, 'post_types_settings_field'), 'reading', 'xml_sitemap_section'); // taxonomies register_setting('reading', $prefix . 'taxonomies', array($this, 'sanitize_taxonomies_settings')); add_settings_field($prefix . 'taxonomies', __('Include taxonomies', 'xml-sitemap-feed'), array($this, 'taxonomies_settings_field'), 'reading', 'xml_sitemap_section'); // custom domains register_setting('reading', $prefix . 'domains', array($this, 'sanitize_domains_settings')); add_settings_field($prefix . 'domains', __('Allowed domains', 'xml-sitemap-feed'), array($this, 'domains_settings_field'), 'reading', 'xml_sitemap_section'); // custom urls register_setting('reading', $prefix . 'urls', array($this, 'sanitize_urls_settings')); add_settings_field($prefix . 'urls', __('Include custom URLs', 'xml-sitemap-feed'), array($this, 'urls_settings_field'), 'reading', 'xml_sitemap_section'); // custom sitemaps register_setting('reading', $prefix . 'custom_sitemaps', array($this, 'sanitize_custom_sitemaps_settings')); add_settings_field($prefix . 'custom_sitemaps', __('Include custom XML Sitemaps', 'xml-sitemap-feed'), array($this, 'custom_sitemaps_settings_field'), 'reading', 'xml_sitemap_section'); // post meta box add_action('add_meta_boxes', array($this, 'add_meta_box')); } if (isset($sitemaps['sitemap']) || isset($sitemaps['sitemap-news'])) { register_setting('writing', $prefix . 'ping', array($this, 'sanitize_ping_settings')); add_settings_field($prefix . 'ping', translate('Update Services'), array($this, 'ping_settings_field'), 'writing'); // save post meta box settings add_action('save_post', array($this, 'save_metadata')); } }