public function begin($title = 'CMS - PopUp', $szAddToHead = '') { $szHTTP_ROOT = \Extasy\CMS::getWWWRoot(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?> </title> <?php CMSDesign::getInstance()->layout->initialScriptsAndCSS(); ?> <?php echo $szAddToHead; ?> </head> <body class="PopupBody"> <table style="width:100%"> <tr> <td> <?php }
/** * Возвращает код ссылки в стиле для редактирования * @param string $link */ public function editLink($link = '#') { $strings = CMS_Strings::getInstance(); $szEdit = $strings->getMessage('CMS_EDIT'); $szHTTP_ROOT = \Extasy\CMS::getWWWRoot(); return '<nobr><img alt="' . $szEdit . '" src="' . CMS::getResourcesUrl() . 'extasy/pic/icons/edit.gif" /><a href="' . $link . '">' . $szEdit . '</a></nobr>'; }
/** * Генерирует файл сайтмапа */ public static function generate() { $register = new SystemRegister('System/Sitemap'); if ($register->get('sitemap.xml')->value == 0) { return; } // Получаем все url сайта $sql = 'SELECT * FROM `' . SITEMAP_TABLE . '` where `visible`="1"'; $aSitemap = DB::query($sql); // $xmlDocument = new DOMDocument('1.0', 'utf-8'); // $urlset = $xmlDocument->createElement('urlset'); $urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9'); foreach ($aSitemap as $row) { $url = $xmlDocument->createElement('url'); $loc = $xmlDocument->createElement('loc'); $lastmod = $xmlDocument->createElement('lastmod'); $changefreq = $xmlDocument->createElement('changefreq'); $priority = $xmlDocument->createElement('priority'); $loc->nodeValue = \Extasy\CMS::getWWWRoot() . substr($row['full_url'], 1); $lastmod->nodeValue = $row['date_updated']; $changefreq->nodeValue = $row['sitemap_xml_change']; $priority->nodeValue = $row['sitemap_xml_priority']; $url->appendChild($loc); $url->appendChild($lastmod); $url->appendChild($changefreq); $url->appendChild($priority); $urlset->appendChild($url); } $xmlDocument->appendChild($urlset); // Пишем в папку xml $xmlContents = $xmlDocument->saveXML(); file_put_contents(FILE_PATH . 'sitemap.xml', $xmlContents); }
/** * * @param DomDocument $index * @param DomDocument $sitemap */ protected function storeSitemap($index, $sitemap) { // Записываем текущий файл $name = sprintf('sitemap_list_%d.xml', $index->getElementsByTagName('sitemap')->length); $result = $sitemap->saveXML(); file_put_contents(FILE_PATH . $name, $result); // // $sitemapEl = $index->createElement('sitemap'); $loc = $index->createElement('loc', 'http:' . \Extasy\CMS::getWWWRoot() . 'files/' . $name); $lastMod = $index->createElement('lastmod', date('Y-m-d')); $sitemapEl->appendChild($loc); $sitemapEl->appendChild($lastMod); $index->getElementsByTagName('sitemapindex')->item('0')->appendChild($sitemapEl); }
/** * * @return resource */ protected function getCurl() { $url = $this->url->getValue(); $urlInfo = parse_url($url); if (empty($urlInfo['host'])) { $url = \Extasy\CMS::getWWWRoot() . substr($url, 1); } $ch = curl_init(); curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_URL => $url)); if (!empty($this->method->getValue())) { curl_setopt($ch, CURLOPT_POST, true); $parameters = trim($this->parameters->getValue()); if (!empty($parameters)) { $postFields = json_decode($parameters, JSON_OBJECT_AS_ARRAY); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); } } return $ch; }
public function main() { $this->jump(\Extasy\CMS::getWWWRoot()); }