コード例 #1
0
ファイル: mobileTheme.php プロジェクト: Simounet/zenphoto
    /**
     *
     * places a link on the theme page to switch to or from the mobile theme
     * @param string $text link text
     */
    static function controlLink($text = NULL, $before = NULL, $after = Null)
    {
        $detect = new mobile();
        if ($detect->isMobile()) {
            if (zp_getCookie('mobileTheme_disable')) {
                if (is_null($text)) {
                    $text = gettext('View the mobile gallery');
                }
                $enable = 'on';
            } else {
                if (is_null($text)) {
                    $text = gettext('View the normal gallery');
                }
                $enable = 'off';
            }
            if ($before) {
                echo '<span class="beforetext">' . html_encode($before) . '</span>';
            }
            if (MOD_REWRITE) {
                $link = '?mobileTheme=' . $enable;
            } else {
                global $_zp_gallery_page, $_zp_current_images, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_category, $_zp_current_zenpage_page;
                switch ($_zp_gallery_page) {
                    case 'index.php':
                        $link = 'index.php?mobileTheme=' . $enable;
                        break;
                    case 'gallery.php':
                        $link = 'index.php?p=gallery&amp;mobileTheme=' . $enable;
                        break;
                    case 'album.php':
                        $link = pathurlencode($_zp_current_album->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'image.php':
                        $link = pathurlencode($_zp_current_image->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'news.php':
                        if (is_NewsArticle()) {
                            $link = html_encode($_zp_current_zenpage_news->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        } else {
                            if (is_NewsCategory()) {
                                $link = html_encode($_zp_current_category->getLink(null)) . '&amp;mobileTheme=' . $enable;
                            } else {
                                $link = html_encode(getNewsIndexURL()) . '&amp;mobileTheme=' . $enable;
                            }
                        }
                        break;
                    case 'pages.php':
                        $link = html_encode($_zp_current_zenpage_page->getLink()) . '&amp;mobileTheme=' . $enable;
                        break;
                    default:
                        $link = html_encode($_zp_gallery_page) . '?mobileTheme=' . $enable;
                        break;
                }
            }
            ?>
			<span class="mobileThemeControlLink">
				
				<a href="<?php 
            echo $link;
            ?>
" rel="external">
					<?php 
            echo html_encode($text);
            ?>
				</a>
			</span>
			<?php 
            if ($after) {
                echo '<span class="aftertext">' . html_encode($after) . '</span>';
            }
        }
    }
コード例 #2
0
ファイル: mobileTheme.php プロジェクト: rb26/zenphoto
    /**
     *
     * places a link on the theme page to switch to or from the mobile theme
     * @param string $text link text
     */
    static function controlLink($text = NULL, $before = NULL, $after = Null)
    {
        $detect = new mobile();
        if ($detect->isMobile()) {
            if (zp_getCookie('mobileTheme_disable')) {
                if (is_null($text)) {
                    $text = gettext('View the mobile gallery');
                }
                $enable = 'on';
            } else {
                if (is_null($text)) {
                    $text = gettext('View the normal gallery');
                }
                $enable = 'off';
            }
            if ($before) {
                echo '<span class="beforetext">' . html_encode($before) . '</span>';
            }
            ?>
			<span class="mobileThemeControlLink">
				<a href="?mobileTheme=<?php 
            echo $enable;
            ?>
" rel="external">
					<?php 
            echo html_encode($text);
            ?>
				</a>
			</span>
			<?php 
            if ($after) {
                echo '<span class="aftertext">' . html_encode($after) . '</span>';
            }
        }
    }