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


PHP BackendModel::addNumber方法代码示例

本文整理汇总了PHP中BackendModel::addNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::addNumber方法的具体用法?PHP BackendModel::addNumber怎么用?PHP BackendModel::addNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackendModel的用法示例。


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

示例1: getURLForCategory

    /**
     * Retrieve the unique URL for a category
     *
     * @param string $url
     * @param int[optional] $id The id of the category to ignore.
     * @return string
     */
    public static function getURLForCategory($url, $id = null)
    {
        $url = SpoonFilter::urlise((string) $url);
        $db = BackendModel::getDB();
        // new category
        if ($id === null) {
            if ((bool) $db->getVar('SELECT 1
				 FROM faq_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ?
				 LIMIT 1', array(BL::getWorkingLanguage(), $url))) {
                $url = BackendModel::addNumber($url);
                return self::getURLForCategory($url);
            }
        } else {
            if ((bool) $db->getVar('SELECT 1
				 FROM faq_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ? AND i.id != ?
				 LIMIT 1', array(BL::getWorkingLanguage(), $url, $id))) {
                $url = BackendModel::addNumber($url);
                return self::getURLForCategory($url, $id);
            }
        }
        return $url;
    }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:33,代码来源:model.php

示例2: getURLForCategory

    /**
     * Retrieve the unique URL for a category
     *
     * @return	string
     * @param	string $URL			The string wheron the URL will be based.
     * @param	int[optional] $id	The id of the category to ignore.
     */
    public static function getURLForCategory($URL, $id = null)
    {
        // redefine URL
        $URL = SpoonFilter::urlise((string) $URL);
        // get db
        $db = BackendModel::getDB();
        // new category
        if ($id === null) {
            // get number of categories with this URL
            $number = (int) $db->getVar('SELECT COUNT(i.id)
											FROM blog_categories AS i
											INNER JOIN meta AS m ON i.meta_id = m.id
											WHERE i.language = ? AND m.url = ?', array(BL::getWorkingLanguage(), $URL));
            // already exists
            if ($number != 0) {
                // add number
                $URL = BackendModel::addNumber($URL);
                // try again
                return self::getURLForCategory($URL);
            }
        } else {
            // get number of items with this URL
            $number = (int) $db->getVar('SELECT COUNT(i.id)
											FROM blog_categories AS i
											INNER JOIN meta AS m ON i.meta_id = m.id
											WHERE i.language = ? AND m.url = ? AND i.id != ?', array(BL::getWorkingLanguage(), $URL, $id));
            // already exists
            if ($number != 0) {
                // add number
                $URL = BackendModel::addNumber($URL);
                // try again
                return self::getURLForCategory($URL, $id);
            }
        }
        // return the unique URL!
        return $URL;
    }
开发者ID:netconstructor,项目名称:forkcms,代码行数:44,代码来源:model.php

示例3: getURLForCategory

    /**
     * Retrieve the unique URL for a category
     *
     * @param string $url
     * @param int[optional] $id The id of the category to ignore.
     * @return string
     */
    public static function getURLForCategory($url, $id = null)
    {
        $url = SpoonFilter::urlise((string) $url);
        $db = BackendModel::getDB();
        // new category
        if ($id === null) {
            // get number of categories with this URL
            $number = (int) $db->getVar('SELECT COUNT(i.id)
				 FROM faq_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ?', array(BL::getWorkingLanguage(), $url));
            // already exists
            if ($number != 0) {
                $url = BackendModel::addNumber($url);
                return self::getURLForCategory($url);
            }
        } else {
            // get number of items with this URL
            $number = (int) $db->getVar('SELECT COUNT(i.id)
				 FROM faq_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ? AND i.id != ?', array(BL::getWorkingLanguage(), $url, $id));
            // already exists
            if ($number != 0) {
                $url = BackendModel::addNumber($url);
                return self::getURLForCategory($url, $id);
            }
        }
        return $url;
    }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:37,代码来源:model.php

示例4: getURL

    /**
     * Get a unique URL for a tag
     *
     * @param string $URL The URL to use as a base.
     * @param int[optional] $id The ID to ignore.
     * @return string
     */
    public static function getURL($URL, $id = null)
    {
        $URL = SpoonFilter::urlise((string) $URL);
        $language = BL::getWorkingLanguage();
        // get db
        $db = BackendModel::getDB();
        // no specific id
        if ($id === null) {
            // get number of tags with the specified url
            $number = (int) $db->getVar('SELECT COUNT(i.id)
				 FROM tags AS i
				 WHERE i.url = ? AND i.language = ?', array($URL, $language));
            // there are items so, call this method again.
            if ($number != 0) {
                // add a number
                $URL = BackendModel::addNumber($URL);
                // recall this method, but with a new url
                $URL = self::getURL($URL, $id);
            }
        } else {
            // redefine
            $id = (int) $id;
            // get number of tags with the specified url
            $number = (int) $db->getVar('SELECT COUNT(i.id)
				 FROM tags AS i
				 WHERE i.url = ? AND i.language = ? AND i.id != ?', array($URL, $language, $id));
            // there are items so, call this method again.
            if ($number != 0) {
                // add a number
                $URL = BackendModel::addNumber($URL);
                // recall this method, but with a new url
                $URL = self::getURL($URL, $id);
            }
        }
        return $URL;
    }
开发者ID:richsage,项目名称:forkcms,代码行数:43,代码来源:model.php

示例5: getURLForCategory

    /**
     * Retrieve the unique URL for a category
     *
     * @param string $URL The string wheron the URL will be based.
     * @param int[optional] $id The id of the category to ignore.
     * @return string
     */
    public static function getURLForCategory($URL, $id = null)
    {
        // redefine URL
        $URL = (string) $URL;
        // get db
        $db = BackendModel::getDB();
        // new category
        if ($id === null) {
            // already exists
            if ((bool) $db->getVar('SELECT 1
				 FROM blog_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ?
				 LIMIT 1', array(BL::getWorkingLanguage(), $URL))) {
                $URL = BackendModel::addNumber($URL);
                return self::getURLForCategory($URL);
            }
        } else {
            // already exists
            if ((bool) $db->getVar('SELECT 1
				 FROM blog_categories AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.language = ? AND m.url = ? AND i.id != ?
				 LIMIT 1', array(BL::getWorkingLanguage(), $URL, $id))) {
                $URL = BackendModel::addNumber($URL);
                return self::getURLForCategory($URL, $id);
            }
        }
        return $URL;
    }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:37,代码来源:model.php

示例6: getUrl

    /**
     * Retrieve a unique URL for a profile based on the display name.
     *
     * @return	string						The unique URL.
     * @param	string $displayName			The display name to base on.
     * @param	int[optional] $id			The id of the profile to ignore.
     */
    public static function getUrl($displayName, $id = null)
    {
        // decode specialchars
        $displayName = SpoonFilter::htmlspecialcharsDecode((string) $displayName);
        // urlise
        $url = SpoonFilter::urlise((string) $displayName);
        // get db
        $db = BackendModel::getDB();
        // new item
        if ($id === null) {
            // get number of profiles with this URL
            $number = (int) $db->getVar('SELECT COUNT(p.id)
											FROM profiles AS p
											WHERE p.url = ?', (string) $url);
            // already exists
            if ($number != 0) {
                // add number
                $url = BackendModel::addNumber($url);
                // try again
                return self::getURL($url);
            }
        } else {
            // get number of profiles with this URL
            $number = (int) $db->getVar('SELECT COUNT(p.id)
											FROM profiles AS p
											WHERE p.url = ? AND p.id != ?', array((string) $url, (int) $id));
            // already exists
            if ($number != 0) {
                // add number
                $url = BackendModel::addNumber($url);
                // try again
                return self::getURL($url, $id);
            }
        }
        // cough up new url
        return $url;
    }
开发者ID:netconstructor,项目名称:forkcms,代码行数:44,代码来源:model.php

示例7: getURL

    /**
     * Get an unique URL for a page
     *
     * @param string $URL The URL to base on.
     * @param int[optional] $id The id to ignore.
     * @param int[optional] $parentId The parent for the page to create an url for.
     * @param bool[optional] $isAction Is this page an action.
     * @return string
     */
    public static function getURL($URL, $id = null, $parentId = 0, $isAction = false)
    {
        $URL = (string) $URL;
        $parentIds = array((int) $parentId);
        // 0, 1, 2, 3, 4 are all toplevels, so we should place them on the same level
        if ($parentId == 0 || $parentId == 1 || $parentId == 2 || $parentId == 3 || $parentId == 4) {
            $parentIds = array(0, 1, 2, 3, 4);
        }
        // get db
        $db = BackendModel::getDB();
        // no specific id
        if ($id === null) {
            // no items?
            if ((bool) $db->getVar('SELECT 1
				 FROM pages AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.parent_id IN(' . implode(',', $parentIds) . ') AND i.status = ? AND m.url = ? AND i.language = ?
				 LIMIT 1', array('active', $URL, BL::getWorkingLanguage()))) {
                // add a number
                $URL = BackendModel::addNumber($URL);
                // recall this method, but with a new URL
                return self::getURL($URL, null, $parentId, $isAction);
            }
        } else {
            // there are items so, call this method again.
            if ((bool) $db->getVar('SELECT 1
				 FROM pages AS i
				 INNER JOIN meta AS m ON i.meta_id = m.id
				 WHERE i.parent_id IN(' . implode(',', $parentIds) . ') AND i.status = ? AND m.url = ? AND i.id != ? AND i.language = ?
				 LIMIT 1', array('active', $URL, $id, BL::getWorkingLanguage()))) {
                // add a number
                $URL = BackendModel::addNumber($URL);
                // recall this method, but with a new URL
                return self::getURL($URL, $id, $parentId, $isAction);
            }
        }
        // get full URL
        $fullURL = self::getFullUrl($parentId) . '/' . $URL;
        // get info about parent page
        $parentPageInfo = self::get($parentId, null, BL::getWorkingLanguage());
        // does the parent have extra's?
        if ($parentPageInfo['has_extra'] == 'Y' && !$isAction) {
            // set locale
            FrontendLanguage::setLocale(BackendLanguage::getWorkingLanguage(), true);
            // get all onsite action
            $actions = FrontendLanguage::getActions();
            // if the new URL conflicts with an action we should rebuild the URL
            if (in_array($URL, $actions)) {
                // add a number
                $URL = BackendModel::addNumber($URL);
                // recall this method, but with a new URL
                return self::getURL($URL, $id, $parentId, $isAction);
            }
        }
        // check if folder exists
        if (SpoonDirectory::exists(PATH_WWW . '/' . $fullURL)) {
            // add a number
            $URL = BackendModel::addNumber($URL);
            // recall this method, but with a new URL
            return self::getURL($URL, $id, $parentId, $isAction);
        }
        // check if it is an appliation
        if (in_array(trim($fullURL, '/'), array_keys(ApplicationRouting::getRoutes()))) {
            // add a number
            $URL = BackendModel::addNumber($URL);
            // recall this method, but with a new URL
            return self::getURL($URL, $id, $parentId, $isAction);
        }
        // return the unique URL!
        return $URL;
    }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:80,代码来源:model.php


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