/** * Get singleton instance * * @access public * @return object Singleton instance */ public static function getInstance() { // optionally create new instance if (!self::$instance) { self::$instance = new KocujSitemapPluginCache(); } // exit return self::$instance; }
/** * Get sitemap to display * * @access public * @param string $title Sitemap title - default: empty * @param string $class Sitemap class - default: empty * @return string Sitemap to display */ public function getSitemap($title = '', $class = '') { // declare global global $classKocujSitemapAdmin; // get arguments if (empty($title)) { KocujSitemapPluginMultiLang::getInstance()->beforeGetBlogName(); $title = apply_filters('kocujsitemap_defaulttitle', KocujSitemapPluginMultiLang::getInstance()->getTranslatedBlogName(), get_locale()); KocujSitemapPluginMultiLang::getInstance()->afterGetBlogName(); } if (empty($class)) { $class = apply_filters('kocujsitemap_defaultclass', ''); } $title = apply_filters('kocujsitemap_linktitle', $title, 0, 'home', get_locale()); // initialize $output = ''; // load cache if (!KocujSitemapPluginCache::getInstance()->loadCache($title, $output, get_locale())) { KocujSitemapPluginCache::getInstance()->createCache(); if (!KocujSitemapPluginCache::getInstance()->loadCache($title, $output, get_locale())) { return ''; } } // optionally set footer $footer = ''; $value = $classKocujSitemapAdmin->getConfigClass()->getOption('PoweredBy'); if (!empty($value)) { $footer = '<div class="kocujsitemapfooter">' . sprintf(__('Powered by %s plugin', 'kocuj-sitemap'), '<a href="http://kocujsitemap.wpplugin.kocuj.pl/" rel="external">Kocuj Sitemap</a>') . '</div>'; } // show begin and end if (!empty($output)) { $classText = ''; if (!empty($class)) { $classText = ' ' . $class; } $html5 = $classKocujSitemapAdmin->getConfigClass()->getOption('UseHTML5'); if (!empty($html5)) { $tagBegin = KocujSitemapPluginHTML5::getInstance()->getTagNavBegin('', 'kocujsitemap' . $classText); $tagEnd = KocujSitemapPluginHTML5::getInstance()->getTagNavEnd(); } else { $tagBegin = '<div class="kocujsitemap' . $classText . '">'; $tagEnd = '</div>'; } $output = $tagBegin . $output . $footer . $tagEnd; } // exit return $output; }
/** * Cron * * @access public * @return void */ public function cron() { // create cache KocujSitemapPluginCache::getInstance()->createCache(); }