当前位置: 首页>>代码示例>>PHP>>正文


PHP newCategory函数代码示例

本文整理汇总了PHP中newCategory函数的典型用法代码示例。如果您正苦于以下问题:PHP newCategory函数的具体用法?PHP newCategory怎么用?PHP newCategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了newCategory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: printCustomMenu


//.........这里部分代码省略.........
            }
            if ($open[$indent]) {
                // close an open LI if it exists
                echo "</li>\n";
                $open[$indent]--;
            }
            echo str_pad("\t", $indent - 1, "\t");
            $open[$indent] += $item['include_li'];
            $parents[$indent] = $item['id'];
            if ($counter) {
                switch ($item['type']) {
                    case 'album':
                        $albumobj = newAlbum($item['link']);
                        $numimages = $albumobj->getNumImages();
                        $numsubalbums = $albumobj->getNumAlbums();
                        $itemcounter = ' <span style="white-space:nowrap;"><small>(';
                        if ($numsubalbums != 0) {
                            $itemcounter .= sprintf(ngettext('%u album', '%u albums', $numsubalbums), $numsubalbums);
                        }
                        if ($numimages != 0) {
                            if ($numsubalbums != 0) {
                                $itemcounter .= ' ';
                            }
                            $itemcounter .= sprintf(ngettext('%u image', '%u images', $numimages), $numimages);
                        }
                        $itemcounter .= ')</small></span>';
                        break;
                    case 'category':
                        if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) {
                            $published = "all";
                        } else {
                            $published = "published";
                        }
                        $catobj = newCategory($item['link']);
                        $catcount = count($catobj->getArticles(0, $published));
                        $itemcounter = "<small> (" . $catcount . ")</small>";
                        break;
                }
            }
            if ($item['id'] == $pageid && !is_null($pageid)) {
                if ($level == 1) {
                    // top level
                    $class = $css_class_topactive;
                } else {
                    $class = $css_class_active;
                }
                echo '<li class="menu_' . trim($item['type'] . ' ' . $class) . '">' . $itemtitle . $itemcounter;
            } else {
                if (strpos($sortorder, $item['sort_order']) === 0) {
                    // we are in the heritage chain
                    $class = ' ' . $css_class_active . '-' . ($mylevel - $level);
                } else {
                    $class = '';
                }
                if ($item['include_li']) {
                    echo '<li class="menu_' . $item['type'] . $class . '">';
                }
                if ($item['span_id'] || $item['span_class']) {
                    echo '<span';
                    if ($item['span_id']) {
                        echo ' id="' . $item['span_id'] . '"';
                    }
                    if ($item['span_class']) {
                        echo ' class="' . $item['span_class'] . '"';
                    }
                    echo '>';
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:67,代码来源:menu_manager.php

示例2: list

            $published = 'published';
            break;
        case 'sticky':
            $published = 'sticky';
    }
} else {
    $published = 'all';
}
$sortorder = 'publishdate';
$direction = true;
if (isset($_GET['sortorder'])) {
    list($sortorder, $sortdirection) = explode('-', $_GET['sortorder']);
    $direction = $sortdirection && $sortdirection == 'desc';
}
if (isset($_GET['category'])) {
    $catobj = newCategory(sanitize($_GET['category']));
} else {
    $catobj = NULL;
}
$resultU = $_zp_CMS->getArticles(0, 'unpublished', false, $sortorder, $direction, false, $catobj);
$result = $_zp_CMS->getArticles(0, $published, false, $sortorder, $direction, false, $catobj);
foreach ($result as $key => $article) {
    $article = newArticle($article['titlelink']);
    if (!$article->isMyItem(ZENPAGE_NEWS_RIGHTS) || $cur_author && $cur_author != $article->getAuthor()) {
        unset($result[$key]);
    }
}
foreach ($resultU as $key => $article) {
    $article = newArticle($article['titlelink']);
    if (!$article->isMyItem(ZENPAGE_NEWS_RIGHTS) || $cur_author && $cur_author != $article->getAuthor()) {
        unset($resultU[$key]);
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:admin-news.php

示例3: sprintf

					<?php 
if (count($publish_images_list) > 0) {
    echo sprintf(ngettext('%u album with unpublished images', '%u albums with unpublished images', $c), $c);
} else {
    echo gettext('No images meet the criteria.');
}
?>
				</fieldset>
				<?php 
if (class_exists('CMS')) {
    $visible = $report == 'categories';
    $items = $_zp_CMS->getAllCategories(false);
    $output = '';
    $c = 0;
    foreach ($items as $key => $item) {
        $itemobj = newCategory($item['titlelink']);
        if (!$itemobj->getShow()) {
            $c++;
            $output .= '<li><label><input type="checkbox" name="' . $item['titlelink'] . '" value="' . $item['titlelink'] . '" class="catcheck" />' . $itemobj->getTitle() . '</label>';
            if ($desc = shortenContent($itemobj->getDesc(), 50, '...')) {
                $output .= ' "' . strip_tags($desc) . '"';
            }
            $output .= ' <a href="' . html_encode($itemobj->getLink()) . '" title="' . html_encode($itemobj->getTitle()) . '">(' . gettext('View') . ')</a> <a href="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/admin-edit.php?newscategory&titlelink=' . html_encode($itemobj->getTitlelink()) . '">(' . gettext('Edit') . ')</a></li>';
        }
    }
    ?>
					<br class="clearall" />
					<fieldset class="smallbox">
						<legend><?php 
    if ($c > 0) {
        reveal('catbox', $visible);
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:publishContent.php

示例4: newArticle

        // an image type object
    } else {
        // a simple link
        $args['album'] = $args['image'] = $imagef = $imageb = $image = $alt1 = $title1 = NULL;
        if (isset($args['news'])) {
            $obj = newArticle($args['news']);
            $title = gettext('<em>news article</em>: %s');
            $token = gettext('title with link to news article');
        }
        if (isset($args['pages'])) {
            $obj = newPage($args['pages']);
            $title = gettext('<em>page</em>: %s');
            $token = gettext('title with link to page');
        }
        if (isset($args['news_categories'])) {
            $obj = newCategory($args['news_categories']);
            $title = gettext('<em>category</em>: %s');
            $token = gettext('title with link to category');
        }
    }
    $link = $obj->getLink();
    $title1 = getBare($obj->getTitle());
    if ($image && $obj->table == 'images') {
        $link2 = $obj->album->getLink();
    } else {
        $link2 = $alt2 = $title2 = false;
    }
    ?>
			<script type="text/javascript">
				// <!-- <![CDATA[
				var link = '<?php 
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:pasteobj.php

示例5: getSitemapNewsCategories

/**
 * Gets links to Zenpage news categories incl. pagination
 *
 * @return string
 */
function getSitemapNewsCategories()
{
    global $_zp_CMS, $sitemap_number;
    //TODO not splitted into several sitemaps yet
    if ($sitemap_number == 1) {
        $data = '';
        $sitemap_locales = generateLanguageList();
        $changefreq = getOption('sitemap_changefreq_newscats');
        $newscats = $_zp_CMS->getAllCategories();
        if ($newscats) {
            $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
            $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
            foreach ($newscats as $newscat) {
                $catobj = newCategory($newscat['titlelink']);
                if (!$catobj->isProtected()) {
                    $base = $catobj->getLink();
                    switch (SITEMAP_LOCALE_TYPE) {
                        case 1:
                            foreach ($sitemap_locales as $locale) {
                                $url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base);
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        case 2:
                            foreach ($sitemap_locales as $locale) {
                                $url = dynamic_locale::fullHostPath($locale) . $base;
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        default:
                            $url = FULLHOSTPATH . $base;
                            $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            break;
                    }
                    // getting pages for the categories
                    $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
                    $articlecount = count($catobj->getArticles());
                    $catpages = ceil($articlecount / $zenpage_articles_per_page);
                    if ($catpages > 1) {
                        for ($x = 2; $x <= $catpages; $x++) {
                            $base = $catobj->getLink($x);
                            switch (SITEMAP_LOCALE_TYPE) {
                                case 1:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base);
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                case 2:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = dynamic_locale::fullHostPath($locale) . $base;
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                default:
                                    $url = FULLHOSTPATH . $base;
                                    $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    break;
                            }
                        }
                    }
                }
            }
            $data .= sitemap_echonl('</urlset>');
            // End off the <urlset> tag
        }
        return $data;
    }
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:74,代码来源:sitemap-extended.php

示例6: getItemNews

 /**
  * Gets the feed item data in a Zenpage news feed
  *
  * @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
  * @return array
  */
 protected function getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = newArticle($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = newCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $desc = $obj->getContent($this->locale);
     $desc = str_replace('//<![CDATA[', '', $desc);
     $desc = str_replace('//]]>', '', $desc);
     $feeditem['desc'] = shortenContent($desc, getOption('externalFeed_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($obj->getPublishDate()));
     return $feeditem;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:35,代码来源:externalFeed.php

示例7: XSRFdefender

    }
}
if (isset($_GET['delete'])) {
    XSRFdefender('delete_category');
    $reports[] = deleteZenpageObj(newCategory(sanitize($_GET['delete'])));
}
if (isset($_GET['hitcounter'])) {
    XSRFdefender('hitcounter');
    $x = $_zp_CMS->getCategory(sanitize_numeric($_GET['id']));
    $obj = newCategory($x['titlelink']);
    $obj->set('hitcounter', 0);
    $obj->save();
}
if (isset($_GET['publish'])) {
    XSRFdefender('update');
    $obj = newCategory(sanitize($_GET['titlelink']));
    $obj->setShow(sanitize_numeric($_GET['publish']));
    $obj->save();
}
if (isset($_GET['save'])) {
    XSRFdefender('save_categories');
    updateCategory($reports, true);
}
/*
 * Here we should restart if any action processing has occurred to be sure that everything is
 * in its proper state. But that would require significant rewrite of the handling and
 * reporting code so is impractical. Instead we will presume that all that needs to be restarted
 * is the CMS object.
 */
$_zp_CMS = new CMS();
printAdminHeader('news', 'categories');
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:admin-categories.php

示例8: foreach

    {
        $locallist = $obj->getAlbums();
        foreach ($locallist as $folder) {
            $album = newAlbum($folder);
            if (!$album->isDynamic() && $album->checkAccess()) {
                $albumlist[] = $album->getID();
                self::getAllAccessibleAlbums($album, $albumlist);
            }
        }
    }
}
global $plugin_is_filter;
enableExtension('galleryArticles', $plugin_is_filter);
$obj = new Combi();
$combi = $obj->getOldCombiNews();
$cat = newCategory('combinews', true);
$cat->setTitle(gettext('combiNews'));
$cat->setDesc(gettext('Auto category for ported combi-news articles.'));
$cat->save();
foreach ($combi as $article) {
    switch ($article['type']) {
        case 'images':
            $obj = newImage(array('folder' => $article['albumname'], 'filename' => $article['titlelink']), false);
            break;
        case 'albums':
            $obj = newAlbum($article['albumname'], false);
            break;
        default:
            $obj = NULL;
            break;
    }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:combiNews.php

示例9: getItemNews

 /**
  * Gets the feed item data in a Zenpage news feed
  *
  * @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
  * @return array
  */
 protected function getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = newArticle($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = newCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $feeditem['desc'] = shortenContent($obj->getContent($this->locale), getOption('RSS_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = PROTOCOL . '://' . $this->host . $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($item['date']));
     return $feeditem;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:32,代码来源:rss.php

示例10: zpRewriteURL

/**
 * Creates a "REWRITE" url given the query parameters that represent the link
 *
 * @param type $query
 * @return string
 */
function zpRewriteURL($query)
{
    $redirectURL = '';
    if (isset($query['p'])) {
        sanitize($query);
        switch ($query['p']) {
            case 'news':
                $redirectURL = _NEWS_;
                if (isset($query['category'])) {
                    $obj = newCategory(rtrim($query['category'], '/'), false);
                    if (!$obj->loaded) {
                        return '';
                    }
                    $redirectURL = $obj->getLink();
                    unset($query['category']);
                } else {
                    if (isset($query['date'])) {
                        $redirectURL = _NEWS_ARCHIVE_ . '/' . rtrim($query['date'], '/') . '/';
                        unset($query['date']);
                    }
                }
                if (isset($query['title'])) {
                    $obj = newArticle(rtrim($query['title'], '/'), false);
                    if (!$obj->loaded) {
                        return '';
                    }
                    $redirectURL = $obj->getLink();
                    unset($query['title']);
                }
                break;
            case 'pages':
                if (isset($query['title'])) {
                    $obj = newPage(rtrim($query['title'], '/'), false);
                    if (!$obj->loaded) {
                        return '';
                    }
                    $redirectURL = $obj->getLink();
                    unset($query['title']);
                }
                break;
            case 'search':
                $redirectURL = _SEARCH_;
                if (isset($query['date'])) {
                    $redirectURL = _ARCHIVE_ . '/' . rtrim($query['date'], '/') . '/';
                    unset($query['date']);
                } else {
                    if (isset($query['searchfields']) && $query['searchfields'] == 'tags') {
                        $redirectURL = _TAGS_;
                        unset($query['searchfields']);
                    }
                }
                if (isset($query['words'])) {
                    if (!preg_match('/^[0-9A-F]+\\.[0-9A-F]+$/i', $query['words'])) {
                        $query['words'] = SearchEngine::encode($query['words']);
                    }
                    $redirectURL .= '/' . $query['words'] . '/';
                    unset($query['words']);
                }
                break;
            default:
                $redirectURL = getCustomPageURL(rtrim($query['p'], '/'));
                break;
        }
        unset($query['p']);
        if (isset($query['page'])) {
            $redirectURL = rtrim($redirectURL, '/') . '/' . rtrim($query['page'], '/');
            unset($query['page']);
        }
    } else {
        if (isset($query['album'])) {
            if (isset($query['image'])) {
                $obj = newImage(array('folder' => $query['album'], 'filename' => $query['image']), NULL, true);
                unset($query['image']);
            } else {
                $obj = newAlbum($query['album'], NULL, true);
            }
            if (is_object($obj) && !$obj->exists) {
                return '';
            }
            unset($query['album']);
            $redirectURL = preg_replace('~^' . WEBPATH . '/~', '', $obj->getLink(@$query['page']));
            unset($query['page']);
        } else {
            if (isset($query['page'])) {
                //index page
                $redirectURL = _PAGE_ . '/' . rtrim($query['page'], '/');
                unset($query['page']);
            }
        }
    }
    if ($redirectURL && !empty($query)) {
        $redirectURL .= '?' . http_build_query($query);
    }
    return $redirectURL;
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:functions-controller.php

示例11: inSubNewsCategoryOf

 /**
  * Checks if an article is in a sub category of $catlink
  *
  * @param string $catlink The titlelink of a category
  * @return bool
  */
 function inSubNewsCategoryOf($catlink)
 {
     if (!empty($catlink)) {
         $categories = $this->getCategories();
         $count = 0;
         foreach ($categories as $cat) {
             $catobj = newCategory($cat['titlelink']);
             $parentid = $catobj->getParentID();
             $parentcats = $catobj->getParents();
             foreach ($parentcats as $parentcat) {
                 if ($catlink == $parentcat) {
                     $count = 1;
                     break;
                 }
             }
         }
         return $count == 1;
     } else {
         return false;
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:27,代码来源:class-news.php

示例12: selected

/**
* Prints all available articles or categories in Zenpage
*
* @param string $current

 set to category selected (if any)
*
* @return string
*/
function printNewsCategorySelector($current)
{
    global $_zp_gallery, $_zp_CMS;
    ?>
	<select id="categoryselector" name="categoryselect">
		<?php 
    $cats = $_zp_CMS->getAllCategories(false);
    foreach ($cats as $cat) {
        if ($cat['titlelink'] == $current) {
            $selected = ' selected="selected"';
        } else {
            $selected = '';
        }
        $catobj = newCategory($cat['titlelink']);
        //This is much easier than hacking the nested list function to work with this
        $getparents = $catobj->getParents();
        $levelmark = '';
        foreach ($getparents as $parent) {
            $levelmark .= '» ';
        }
        echo "<option value = '" . html_encode($catobj->getTitlelink()) . "'" . $selected . '>';
        echo $levelmark . $catobj->getTitle() . "</option>";
    }
    ?>
	</select>
	<?php 
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:36,代码来源:menu_manager-admin-functions.php

示例13: getNewsPagesStatistic

/**
 * returns an array of how many pages, articles, categories and news or pages comments we got.
 *
 * @param string $option What the statistic should be shown of: "news", "pages", "categories"
 */
function getNewsPagesStatistic($option)
{
    global $_zp_CMS;
    switch ($option) {
        case "news":
            $items = $_zp_CMS->getArticles();
            $type = gettext("Articles");
            break;
        case "pages":
            $items = $_zp_CMS->getPages(false);
            $type = gettext("Pages");
            break;
        case "categories":
            $type = gettext("Categories");
            $items = $_zp_CMS->getAllCategories(false);
            break;
    }
    $total = count($items);
    $pub = 0;
    foreach ($items as $item) {
        switch ($option) {
            case "news":
                $itemobj = newArticle($item['titlelink']);
                break;
            case "pages":
                $itemobj = newPage($item['titlelink']);
                break;
            case "categories":
                $itemobj = newCategory($item['titlelink']);
                break;
        }
        if ($itemobj->getShow() == 1) {
            $pub++;
        }
    }
    $unpub = $total - $pub;
    return array($total, $type, $unpub);
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:43,代码来源:admin-functions.php

示例14: getLayoutSelector

/**
 * Worker function for creating layout selectors. Returns the HTML
 *
 * @param object $obj
 * @param string $type
 * @param string $text
 * @param string$secondary
 */
function getLayoutSelector($obj, $type, $text, $prefix = '', $secondary = false)
{
    global $_zp_gallery;
    $selectdefault = '';
    $selected = '';
    $files = array();
    $list = array();
    $getlayout = '';
    $table = $obj->table;
    $path = SERVERPATH . '/' . THEMEFOLDER . '/' . $_zp_gallery->getCurrentTheme() . '/';
    $defaultlayout = '';
    $defaulttext = gettext('default');
    switch ($table) {
        case 'albums':
            if ($secondary) {
                //	the selector for the image default of the album
                $filesmask = 'image';
            } else {
                $filesmask = 'album';
            }
            $child = $obj->getParentID();
            $defaulttext = gettext('inherited');
            break;
        case 'images':
            $filesmask = 'image';
            $album = $obj->album;
            $child = $album->getID();
            $defaulttext = gettext('album default');
            break;
        case 'pages':
            $filesmask = 'pages';
            $child = $obj->getParentID();
            $defaulttext = gettext('inherited');
            break;
        case 'news':
            $child = false;
            $categories = $obj->getCategories();
            if ($categories) {
                foreach ($categories as $cat) {
                    $cat = newCategory($cat['titlelink']);
                    $getlayout = getSelectedLayout($cat, 'multiple_layouts_news_categories');
                    if ($getlayout && $getlayout['data']) {
                        //	in at least one news category with an alternate page
                        $defaulttext = gettext('inherited');
                        $defaultlayout = gettext('from category');
                        break;
                    }
                }
            }
            $filesmask = 'news';
            break;
        case 'news_categories':
            $child = $obj->getParentID();
            $defaulttext = gettext('inherited');
            $filesmask = 'news';
            break;
    }
    $curdir = getcwd();
    chdir($path);
    $files = safe_glob($filesmask . '*.php');
    chdir($curdir);
    if ($child) {
        $defaultlayout = checkParentLayouts($obj, $type);
        $defaultlayout = $defaultlayout['data'];
    }
    if ($defaultlayout) {
        $defaultlayout = stripSuffix($defaultlayout);
    } else {
        $defaultlayout = $filesmask;
    }
    if ($obj->transient) {
        $getlayout = false;
    } else {
        $getlayout = query_single_row("SELECT * FROM " . prefix('plugin_storage') . ' WHERE `aux` = ' . $obj->getID() . ' AND `type` = "' . $type . '"');
    }
    if (!$child && ($key = array_search($filesmask . '.php', $files)) !== false) {
        unset($files[$key]);
    }
    foreach ($files as $file) {
        $file = filesystemToInternal($file);
        $list[stripSuffix($file)] = $file;
    }
    ksort($list);
    $html = $text;
    if (count($files) != 0) {
        $html .= '<select id="' . $type . $prefix . '" name="' . $prefix . $type . '">' . "\n";
        if (is_array($getlayout)) {
            $selectedlayout = $getlayout['data'];
        } else {
            $selectedlayout = '';
        }
        $html .= '<option value=""' . ($selectedlayout == '' ? ' selected="selected"' : '') . ' style="background-color:LightGray" >*' . $defaulttext . '* (' . $defaultlayout . ')</option>' . "\n";
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:multiple_layouts.php

示例15: checkforGuest

 /**
  * Checks if user is allowed to access news category
  * @param $hint
  * @param $show
  */
 function checkforGuest(&$hint = NULL, &$show = NULL)
 {
     if (!parent::checkForGuest()) {
         return false;
     }
     $obj = $this;
     $hash = $this->getPassword();
     while (empty($hash) && !is_null($obj)) {
         $parentID = $obj->getParentID();
         if (empty($parentID)) {
             $obj = NULL;
         } else {
             $sql = 'SELECT `titlelink` FROM ' . prefix('news_categories') . ' WHERE `id`=' . $parentID;
             $result = query_single_row($sql);
             $obj = newCategory($result['titlelink']);
             $hash = $obj->getPassword();
         }
     }
     if (empty($hash)) {
         // no password required
         return 'zp_public_access';
     } else {
         $authType = "zp_category_auth_" . $this->getID();
         $saved_auth = zp_getCookie($authType);
         if ($saved_auth == $hash) {
             return $authType;
         } else {
             $user = $this->getUser();
             if (!empty($user)) {
                 $show = true;
             }
             $hint = $this->getPasswordHint();
             return false;
         }
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:41,代码来源:class-category.php


注:本文中的newCategory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。