public static function getTopPanelHTML($selectedSection = 'site') { $tickerClass = !empty($_COOKIE['_berta_newsticker_hidden']) ? 'xHidden' : ''; $tickerColorClass = empty($_COOKIE['_berta_newsticker_hilight']) ? 'xNewsTickerRed' : 'xNewsTickerGrey'; $newsTickerContent = false; // $_SESSION['_berta_newsticker'] = false; // for testing... //$_SESSION['_berta_newsticker_numtries'] = 0; // for testing... if (!empty(self::$options['newsticker_update_uri'])) { if (!empty($_SESSION['_berta_newsticker'])) { $newsTickerContent = $_SESSION['_berta_newsticker']; } elseif ((empty($_SESSION['_berta_newsticker_numtries']) || $_SESSION['_berta_newsticker_numtries'] < 5) && ini_get('allow_url_fopen')) { $remoteResult = false; reset(self::$options['newsticker_update_uri']); while ((!$remoteResult || empty($remoteResult['content'])) && (list(, $remoteURL) = each(self::$options['newsticker_update_uri']))) { $remoteResult = BertaUtils::getRemoteFile($remoteURL, 5); } //var_dump($remoteResult ); //$options['newsticker_update_uri_alt']); if ($remoteResult && isset($remoteResult['content'])) { $newsTickerContent = $_SESSION['_berta_newsticker'] = $remoteResult['content']; setcookie('_berta_newsticker', $remoteResult['content']); } $_SESSION['_berta_newsticker_numtries'] = !empty($_SESSION['_berta_newsticker_numtries']) ? ++$_SESSION['_berta_newsticker_numtries'] : 1; } } if (!$newsTickerContent) { $tickerClass = 'xHidden'; } $m0 = I18n::_('close this'); $m1 = I18n::_('my site'); $m2 = I18n::_('sections'); $m3 = I18n::_('settings'); $m4 = I18n::_('template design'); $m5 = I18n::_('profile'); $m6 = I18n::_('sign out'); $m1Class = $selectedSection == 'site' ? ' class="selected"' : ''; $m2Class = $selectedSection == 'sections' ? ' class="selected"' : ''; $m3Class = $selectedSection == 'settings' ? ' class="selected"' : ''; $m4Class = $selectedSection == 'template' ? ' class="selected"' : ''; $m5Class = $selectedSection == 'profile' ? ' selected' : ''; $str = <<<DOC \t\t\t<div id="xTopPanelContainer" class="xPanel"> \t\t\t\t<div id="xTopPanel"> \t\t\t\t\t \t\t\t\t\t<div id="xNewsTickerContainer" class="{$tickerClass}"> \t\t\t\t\t\t<div class="news-ticker-background {$tickerColorClass}"></div> \t\t\t\t\t\t<div class="news-ticker-content">{$newsTickerContent}</div> \t\t\t\t\t\t<a href="#" class="close">{$m0}</a> \t\t\t\t\t\t<br class="clear" /> \t\t\t\t\t</div> \t\t\t\t\t<ul id="xEditorMenu"> \t\t\t\t\t\t<li id="xEditorMenuBg"></li> \t\t\t\t\t\t<li{$m1Class}><a href=".">{$m1}</a></li><li>|</li> \t\t\t\t\t\t<li{$m2Class}><a href="sections.php">{$m2}</a></li><li>|</li> \t\t\t\t\t\t<li{$m3Class}><a href="settings.php">{$m3}</a></li><li>|</li> \t\t\t\t\t\t<li{$m4Class}><a href="settings.php?mode=template">{$m4}</a></li> \t\t\t\t\t\t<li class="last{$m5Class}"><a href="profile.php">{$m5}</a> | <a href="logout.php">{$m6}</a></li> \t\t\t\t\t</ul> \t\t\t\t</div> \t\t\t</div> DOC; return $str; }
public static function getTopPanelHTML($selectedSection = 'site') { global $shopEnabled; $site = !empty($_REQUEST['site']) ? $_REQUEST['site'] : false; $newsTickerContent = false; if (!empty(self::$options['remote_update_uri'])) { if (!empty($_SESSION['_berta_newsticker'])) { $newsTickerContent = $_SESSION['_berta_newsticker']; } elseif ((empty($_SESSION['_berta_newsticker_numtries']) || $_SESSION['_berta_newsticker_numtries'] < 5) && ini_get('allow_url_fopen')) { $remoteResult = false; reset(self::$options['remote_update_uri']); while ((!$remoteResult || empty($remoteResult['content'])) && (list(, $remoteURL) = each(self::$options['remote_update_uri']))) { $remoteResult = BertaUtils::getRemoteFile($remoteURL, 'newsticker', 5); } //var_dump($remoteResult ); //$options['newsticker_update_uri_alt']); if ($remoteResult && isset($remoteResult['content'])) { $newsTickerContent = $_SESSION['_berta_newsticker'] = $remoteResult['content']; setcookie('_berta_newsticker', $remoteResult['content']); } else { $newsTickerContent = $_SESSION['_berta_newsticker'] = I18n::_('To enable Berta\'s news ticker, your computer needs to be connected to the internet!'); setcookie('_berta_newsticker', $newsTickerContent); } $_SESSION['_berta_newsticker_numtries'] = !empty($_SESSION['_berta_newsticker_numtries']) ? ++$_SESSION['_berta_newsticker_numtries'] : 1; } } $m1 = I18n::_('my site'); $m2 = I18n::_('sections'); $m3 = I18n::_('settings'); $m4 = I18n::_('design'); $m5 = I18n::_('account'); $m6 = I18n::_('log out'); if ($shopEnabled) { $m7 = I18n::_('shop'); $m7Class = $selectedSection == 'shop' ? ' class="selected"' : ''; $shopItem = '<li' . $m7Class . ' id="xSections"><a href="shopsettings.php' . ($site ? '?site=' . $site : '') . '">' . $m7 . '</a></li><li>|</li>'; } else { $shopItem = ''; } $m8 = I18n::_('multisite'); $m9 = I18n::_('seo'); $m10 = I18n::_('upgrade'); $m1Class = $selectedSection == 'site' ? ' class="selected"' : ''; $m2Class = $selectedSection == 'sections' ? ' class="selected"' : ''; $m3Class = $selectedSection == 'settings' ? ' class="selected"' : ''; $m4Class = $selectedSection == 'template' ? ' class="selected"' : ''; $m5Class = $selectedSection == 'profile' ? ' class="selected"' : ''; $m1_link = $site ? '.?site=' . $site : '.'; $m2_link = 'sections.php' . ($site ? '?site=' . $site : ''); $m3_link = 'settings.php' . ($site ? '?site=' . $site : ''); $m4_link = 'settings.php?mode=template' . ($site ? '&site=' . $site : ''); $m5_link = self::$options['HOSTING_PROFILE'] ? self::$options['HOSTING_PROFILE'] : 'profile.php'; $m5_target = self::$options['HOSTING_PROFILE'] ? '_blank' : '_self'; $m9_link = 'seo.php' . ($site ? '?site=' . $site : ''); $m8Class = $selectedSection == 'multisite' ? ' class="selected"' : ''; $m9Class = $selectedSection == 'seo' ? ' class="selected"' : ''; if (self::$options['HOSTING_PROFILE'] && !self::$options['HOSTING_PLAN']) { //trial user $upgradeItem = '<li id="xUpgrade"><a href="' . self::$options['HOSTING_PROFILE'] . '" target="_blank">' . $m10 . '</a></li><li>|</li>'; } else { $upgradeItem = ''; } if (!self::$options['MULTISITE_DISABLED']) { $multisiteItem = '<li' . $m8Class . ' id="xMultisite"><a href="multisite.php">' . $m8 . '</a></li><li>|</li>'; } else { $multisiteItem = ''; } $helpdeskItem = self::$options['HOSTING_PROFILE'] ? '<li id="xHelpDesk"><a href="http://support.berta.me" target="_blank">helpdesk</a></li><li>|</li>' : ''; $str_start = <<<DOC \t\t\t<div id="xTopPanelContainer" class="xPanel"> \t\t\t\t<div id="xTopPanelSlideIn"><span title="show menu">▼</span></div> \t\t\t\t<div id="xTopPanel"> \t\t\t\t\t<ul id="xEditorMenu"> \t\t\t\t\t\t<li id="xTopPanelSlideOut"><span title="hide menu">▲</span></li> \t\t\t\t\t\t<li{$m1Class} id="xMySite"><a href="{$m1_link}">{$m1}</a></li><li>|</li> \t\t\t\t\t\t<li{$m2Class} id="xSections"><a href="{$m2_link}">{$m2}</a></li><li>|</li> \t\t\t\t\t\t<li{$m4Class} id="xTemplateDesign"><a href="{$m4_link}">{$m4}</a></li><li>|</li> <li{$m3Class} id="xSettings"><a href="{$m3_link}">{$m3}</a></li><li>|</li> {$multisiteItem} {$shopItem} \t\t\t\t\t\t<li{$m9Class} id="xSeo"><a href="{$m9_link}">{$m9}</a></li><li>|</li> \t\t\t\t\t\t{$helpdeskItem} <li{$m5Class}><a href="{$m5_link}" target="{$m5_target}">{$m5}</a></li><li>|</li> {$upgradeItem} \t\t\t\t\t\t<li><a href="logout.php">{$m6}</a></li> \t\t\t\t\t</ul> DOC; $str_ticker = ''; if ($newsTickerContent) { $str_ticker = <<<DOC \t\t\t\t<div id="xNewsTickerContainer"> \t\t\t\t\t<div class="news-ticker-content">{$newsTickerContent}</div> \t\t\t\t\t<a href="#" class="close">X</a> \t\t\t\t\t<br class="clear" /> \t\t\t\t</div> DOC; } $str_end = <<<DOC \t\t\t\t</div> \t\t\t</div> DOC; $str = $str_start . (empty($_COOKIE['_berta_newsticker_hidden']) ? $str_ticker : '') . $str_end; return $str; }