public static function ping($se) { $se = strtolower($se); if (!isset(self::$ses[$se])) { return false; } $cfg = new AimySitemapConfigHelper(); $sm_url = JUri::root() . $cfg->get('xml_path', '/sitemap.xml'); $req_url = sprintf(self::$ses[$se], urlencode($sm_url)); $u = new AimySitemapUri($req_url); $resp = null; AimySitemapHttpClient::set_ua_name('AimySitemapNotifier/3.16.0'); $resp = AimySitemapHttpClient::get_url($u); if (is_array($resp) && isset($resp['head']) && $resp['head']['code'] == '200') { AimySitemapLogger::debug("Notifier: Sending ping to {$se}: OK"); return true; } AimySitemapLogger::debug("Notifier: Sending ping to {$se}: FAILED ({$req_url})"); return false; }
public static function unlink_file_if_exists() { require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_aimysitemap' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'message.php'; $cfg = new AimySitemapConfigHelper(); $msg = new AimySitemapMessageHelper(); $rel_path = $cfg->get('xml_path'); if (empty($rel_path)) { return false; } $full_path = JPATH_ROOT . '/' . $rel_path; if (!JFile::exists($full_path)) { return false; } if (JFile::delete($full_path) === true) { $msg->message(JText::_('AIMY_SM_MSG_XML_FILE_REMOVED')); return true; } $msg->error(JText::_('AIMY_SM_MSG_XML_FILE_ERR_REMOVE')); return false; }
public static function get_once($key, $default = null) { $cfg = new AimySitemapConfigHelper(); return $cfg->get($key, $default); }
private function set_ping_cfg() { $cfg = new AimySitemapConfigHelper(); $this->ping_cfg = array('ses' => array('Google' => $cfg->get('notify_google'), 'Bing' => $cfg->get('notify_bing')), 'url' => JUri::root() . $cfg->get('xml_path')); }