Beispiel #1
0
 function testCutoff()
 {
     $result = CoreUtils::cutoff('This is a long string', 10);
     self::assertEquals(10, CoreUtils::length($result));
     self::assertEquals('This is a…', $result);
 }
Beispiel #2
0
 /**
  * Returns the HTML code of the navigation in the header
  *
  * @param bool $disabled
  *
  * @return string
  */
 static function getNavigationHTML($disabled = false)
 {
     if (!empty($GLOBALS['NavHTML'])) {
         return $GLOBALS['NavHTML'];
     }
     global $do;
     // Navigation items
     if (!$disabled) {
         $NavItems = array('latest' => array('/', 'Latest episode'), 'eps' => array('/episodes', 'Episodes'));
         if ($do === 'episodes') {
             global $Episodes, $Pagination;
             if (isset($Episodes)) {
                 $NavItems['eps'][1] .= " - Page {$Pagination->page}";
             }
         }
         global $CurrentEpisode;
         if (($do === 'episode' || $do === 's' || $do === 'movie') && !empty($CurrentEpisode)) {
             if ($CurrentEpisode->isMovie) {
                 $NavItems['eps'][1] = 'Movies';
             }
             if ($CurrentEpisode->isLatest()) {
                 $NavItems['latest'][0] = $_SERVER['REQUEST_URI'];
             } else {
                 $NavItems['eps']['subitem'] = CoreUtils::cutoff($GLOBALS['heading'], Episodes::TITLE_CUTOFF);
             }
         }
         global $Color, $EQG;
         $NavItems['colorguide'] = array("/cg" . (!empty($EQG) ? '/eqg' : ''), (!empty($EQG) ? 'EQG ' : '') . "{$Color} Guide");
         if ($do === 'colorguide') {
             global $Tags, $Changes, $Ponies, $Pagination, $Appearance, $Map;
             if (!empty($Appearance)) {
                 $NavItems['colorguide']['subitem'] = (isset($Map) ? "Sprite {$Color}s - " : '') . CoreUtils::escapeHTML($Appearance['label']);
             } else {
                 if (isset($Ponies)) {
                     $NavItems['colorguide'][1] .= " - Page {$Pagination->page}";
                 } else {
                     if ($GLOBALS['data'] === 'full') {
                         $NavItems['colorguide']['subitem'] = 'Full List';
                     } else {
                         if (isset($Tags)) {
                             $pagePrefix = 'Tags';
                         } else {
                             if (isset($Changes)) {
                                 $pagePrefix = "Major {$Color} Changes";
                             }
                         }
                         $NavItems['colorguide']['subitem'] = (isset($pagePrefix) ? "{$pagePrefix} - " : '') . "Page {$Pagination->page}";
                     }
                 }
             }
         }
         if ($GLOBALS['signedIn']) {
             $NavItems['u'] = array("/@{$GLOBALS['currentUser']->name}", 'Account');
         }
         if ($do === 'user' || Permission::sufficient('staff')) {
             global $User, $sameUser;
             $NavItems['users'] = array('/users', 'Users', Permission::sufficient('staff'));
             if (!empty($User) && empty($sameUser)) {
                 $NavItems['users']['subitem'] = $User->name;
             }
         }
         if (Permission::sufficient('staff')) {
             $NavItems['admin'] = array('/admin', 'Admin');
             global $task;
             if ($task === 'logs') {
                 global $Pagination;
                 $NavItems['admin']['subitem'] = "Logs - Page {$Pagination->page}";
             }
         }
         $NavItems[] = array('/about', 'About');
     } else {
         $NavItems = array(array(true, 'HTTP 503', false, 'subitem' => 'Service Temporarily Unavailable'));
     }
     $GLOBALS['NavHTML'] = '';
     foreach ($NavItems as $item) {
         $sublink = '';
         if (isset($item['subitem'])) {
             list($class, $sublink) = self::_processHeaderLink(array(true, $item['subitem']));
             $sublink = " › {$sublink}";
             $link = self::_processHeaderLink($item, HTML_ONLY);
         } else {
             if (isset($item[2]) && !$item[2]) {
                 continue;
             } else {
                 list($class, $link) = self::_processHeaderLink($item);
             }
         }
         $GLOBALS['NavHTML'] .= "<li{$class}>{$link}{$sublink}</li>";
     }
     $GLOBALS['NavHTML'] .= '<li><a href="http://mlp-vectorclub.deviantart.com/" target="_blank">MLP-VectorClub</a></li>';
     return $GLOBALS['NavHTML'];
 }
Beispiel #3
0
    ?>
			</div>
		</div>
		<div class="next-ep"><?php 
    if (!empty($NextEpisode)) {
        $NextEpisodeTitle = $NextEpisode->formatTitle(AS_ARRAY, null, false);
        ?>
			<div>
				<a href="<?php 
        echo $NextEpisode->formatURL();
        ?>
" class="ep-button btn typcn typcn-media-fast-forward"><span class="id"><?php 
        echo $NextEpisodeTitle['id'];
        ?>
: </span><?php 
        echo CoreUtils::cutoff(Episodes::removeTitlePrefix($NextEpisodeTitle['title']), Episodes::TITLE_CUTOFF);
        ?>
<span class="typcn typcn-media-fast-forward"></span></a>
			</div>
<?php 
    } else {
        echo "&nbsp;";
    }
    ?>
</div>
	</div>
	<?php 
    echo Episodes::getVideosHTML($CurrentEpisode);
    ?>
	<section class="about-res">
		<h2>What Vector Reservations Are<?php