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


PHP cmsCore::loadModel方法代码示例

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


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

示例1: f_pages

function f_pages(&$text)
{
    if (mb_strpos($text, 'pagebreak') === false) {
        return true;
    }
    $seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    $seolink = preg_replace('/[^a-zа-я-яёіїєґА-ЯЁІЇЄҐ0-9_\\/\\-]/ui', '', $seolink);
    if (!$seolink) {
        return true;
    }
    $regex = '/{(pagebreak)\\s*(.*?)}/iu';
    $pages = preg_split($regex, $text);
    $n = count($pages);
    if ($n <= 1) {
        return true;
    } else {
        $page = cmsCore::request('page', 'int', 1);
        $text = $pages[$page - 1];
        if (!$text) {
            cmsCore::error404();
        }
        cmsCore::loadModel('content');
        $text .= cmsPage::getPagebar($n, $page, 1, cms_model_content::getArticleURL(null, $seolink, '%page%'));
        return true;
    }
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:26,代码来源:filter.php

示例2: mod_bestcontent

function mod_bestcontent($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['shownum'])) {
        $cfg['shownum'] = 5;
    }
    if (!isset($cfg['subs'])) {
        $cfg['subs'] = 1;
    }
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    $inDB->where("con.canrate = 1");
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            //выбираем из категории
            $model->whereCatIs($cfg['cat_id']);
        } else {
            //выбираем из категории и подкатегорий
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.rating', 'DESC');
    $inDB->limitPage(1, $cfg['shownum']);
    $content_list = $model->getArticlesList();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('articles', $content_list)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:34,代码来源:module.php

示例3: mod_pogoda_current

function mod_pogoda_current($mod, $cfg)
{
    $inCore = cmsCore::getInstance();
    //Загрузка настроек компонента
    $component = $inCore->loadComponentConfig('pogoda');
    $component["name_en"] = $component["name_en"] ? $component["name_en"] . '_' : '';
    // Проверяем включен ли компонент и установлен ли city_id
    if (!$component['component_enabled'] || !$component['city_id']) {
        return false;
    }
    cmsCore::loadModel('pogoda');
    $model = new cms_model_pogoda();
    $model->setTable('current');
    $dbWeather = $model->getWeather();
    $xml = simplexml_load_string($dbWeather["xml"]);
    if (!$xml) {
        return true;
    }
    $current = array();
    $current["temperature"] = round($xml->temperature["value"]) . ' &#176;C';
    $current["weather"]["value"] = $xml->weather["value"];
    $current["weather"]["icon"] = $xml->weather["icon"];
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('current', $current)->display($cfg['tpl']);
    return true;
}
开发者ID:roman-burachenko,项目名称:icms1_com_pogoda,代码行数:25,代码来源:module.php

示例4: search_blogs

function search_blogs($query, $look)
{
    $inDB = cmsDatabase::getInstance();
    $searchModel = cms_model_search::initModel();
    global $_LANG;
    $sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.owner owner, cat.user_id user_id, cat.seolink as bloglink\n\t\t\tFROM cms_blog_posts con\n\t\t\tINNER JOIN cms_blogs cat ON cat.id = con.blog_id AND cat.allow_who = 'all' AND cat.owner = 'user'\n\t\t\tWHERE MATCH(con.title, con.content) AGAINST ('{$query}' IN BOOLEAN MODE) AND con.published = 1 LIMIT 100";
    $result = $inDB->query($sql);
    if ($inDB->num_rows($result)) {
        cmsCore::loadLanguage('components/blogs');
        cmsCore::loadModel('blogs');
        $model = new cms_model_blogs();
        while ($item = $inDB->fetch_assoc($result)) {
            $result_array = array();
            $result_array['link'] = $model->getPostURL($item['bloglink'], $item['seolink']);
            $result_array['place'] = $_LANG['BLOG'] . ' &laquo;' . $item['cat_title'] . '&raquo;';
            $result_array['placelink'] = $model->getBlogURL($item['bloglink']);
            $result_array['description'] = $searchModel->getProposalWithSearchWord($item['content_html']);
            $result_array['title'] = $item['title'];
            $result_array['pubdate'] = $item['pubdate'];
            $result_array['session_id'] = session_id();
            $searchModel->addResult($result_array);
        }
    }
    return;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:25,代码来源:psearch.php

示例5: mod_category

function mod_category($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['category_id'])) {
        $cfg['category_id'] = 0;
    }
    if (!isset($cfg['show_subcats'])) {
        $cfg['show_subcats'] = 1;
    }
    if (!isset($cfg['expand_all'])) {
        $cfg['expand_all'] = 1;
    }
    $rootcat = $inDB->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) {
        return false;
    }
    $subcats_list = $model->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    if (!$subcats_list) {
        return false;
    }
    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->assign('current_seolink', $current_seolink)->assign('subcats_list', $subcats_list)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:26,代码来源:module.php

示例6: mod_forum

function mod_forum($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('shownum' => 4, 'cat_id' => 0, 'forum_id' => 0, 'subs' => 0, 'show_hidden' => 0, 'show_pinned' => 0, 'showtext' => 1, 'showforum' => 0, 'order' => 'pubdate');
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadModel('forum');
    $model = new cms_model_forum();
    $inDB->addJoin('INNER JOIN cms_forums f ON f.id = t.forum_id');
    $inDB->addSelect('f.title as forum_title');
    if ($cfg['cat_id']) {
        $model->whereForumCatIs($cfg['cat_id']);
    }
    if ($cfg['forum_id']) {
        if ($cfg['subs']) {
            $forum = $model->getForum($cfg['forum_id']);
            if (!$forum) {
                return false;
            }
            $model->whereThisAndNestedForum($forum['NSLeft'], $forum['NSRight']);
        } else {
            $model->whereForumIs($cfg['forum_id']);
        }
    }
    if (!$cfg['show_hidden']) {
        $model->wherePublicThreads();
    }
    if ($cfg['show_pinned']) {
        $model->wherePinnedThreads();
    }
    $inDB->orderBy('t.' . $cfg['order'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $threads = $model->getThreads();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('threads', $threads)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:35,代码来源:module.php

示例7: mod_blogs

function mod_blogs($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('sort' => 'pubdate', 'owner' => 'user', 'shownum' => 5, 'minrate' => 0, 'blog_id' => 0, 'showrss' => 1);
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadClass('blog');
    $inBlog = cmsBlogs::getInstance();
    $inBlog->owner = $cfg['owner'];
    if ($cfg['owner'] == 'club') {
        cmsCore::loadModel('clubs');
        $model = new cms_model_clubs();
        $inDB->addSelect('b.user_id as bloglink');
    } else {
        cmsCore::loadModel('blogs');
        $model = new cms_model_blogs();
    }
    // получаем аватары владельцев
    $inDB->addSelect('up.imageurl');
    $inDB->addJoin('LEFT JOIN cms_user_profiles up ON up.user_id = u.id');
    $inBlog->whereOnlyPublic();
    if ($cfg['minrate']) {
        $inBlog->ratingGreaterThan($cfg['minrate']);
    }
    if ($cfg['blog_id']) {
        $inBlog->whereBlogIs($cfg['blog_id']);
    }
    $inDB->orderBy('p.' . $cfg['sort'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $posts = $inBlog->getPosts(false, $model);
    if (!$posts) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_blogs')->assign('posts', $posts)->assign('cfg', $cfg)->display('mod_blogs.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:35,代码来源:module.php

示例8: f_banners

function f_banners(&$text)
{
    $phrase = 'БАННЕР';
    if (mb_strpos($text, $phrase) === false) {
        return true;
    }
    if (!cmsCore::getInstance()->isComponentEnable('banners')) {
        return true;
    }
    $regex = '/{(' . $phrase . '=)\\s*(.*?)}/i';
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    if (!$matches) {
        return true;
    }
    cmsCore::loadModel('banners');
    foreach ($matches as $elm) {
        $elm[0] = str_replace('{', '', $elm[0]);
        $elm[0] = str_replace('}', '', $elm[0]);
        mb_parse_str($elm[0], $args);
        $position = @$args[$phrase];
        if ($position) {
            $output = cms_model_banners::getBannerHTML($position);
        } else {
            $output = '';
        }
        $text = str_replace('{' . $phrase . '=' . $position . '}', $output, $text);
    }
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:30,代码来源:filter.php

示例9: mod_clubs

function mod_clubs($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['count'])) {
        $cfg['count'] = 5;
    }
    if (!isset($cfg['type'])) {
        $cfg['type'] = 'id';
    }
    if (!isset($cfg['vip_on_top'])) {
        $cfg['vip_on_top'] = 1;
    }
    cmsCore::loadModel('clubs');
    $model = new cms_model_clubs();
    if ($cfg['vip_on_top']) {
        $inDB->orderBy('is_vip', 'DESC, c.' . $cfg['type'] . ' DESC');
    } else {
        $inDB->orderBy('c.' . $cfg['type'], 'DESC');
    }
    $inDB->limit($cfg['count']);
    $clubs = $model->getClubs();
    if (!$clubs) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_clubs')->assign('clubs', $clubs)->display('mod_clubs.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:27,代码来源:module.php

示例10: mod_dt_newsslider

function mod_dt_newsslider($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            $model->whereCatIs($cfg['cat_id']);
        } else {
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.ordering', 'ASC');
    $inDB->limit($cfg['newscount']);
    $slider_list = $model->getArticlesList();
    if (!$slider_list) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_dt_newsslider')->assign('slider', $slider_list)->assign('cfg', $cfg)->assign('module_id', $module_id)->display('mod_dt_newsslider.tpl');
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:28,代码来源:module.php

示例11: rss_blogs

function rss_blogs($item_id, $cfg) {
    if (!cmsCore::getInstance()->isComponentEnable('blogs')) { return false; }

    $inDB = cmsDatabase::getInstance();

    global $_LANG;

    cmsCore::loadModel('blogs');
    $model = new cms_model_blogs();

    cmsCore::loadClass('blog');
    $inBlog = cmsBlogs::getInstance();
    $inBlog->owner = 'user';

    $channel = array();
    $items   = array();

    // Формируем канал
    if ($item_id) {
        $blog = $inBlog->getBlog($item_id);
        if (!$blog) { return false; }

        //Если доступа к блогу нет, возвращаемся
        if (!cmsUser::checkUserContentAccess($blog['allow_who'], $blog['user_id'])) {
            return false;
        }

        $inBlog->whereBlogIs($blog['id']);

        $channel['title']       = $blog['title'];
        $channel['description'] = $_LANG['NEW_POSTS_IN_BLOGS'];
        $channel['link']        = HOST . $model->getBlogURL($blog['seolink']);
    } else {
        $channel['title']       = $_LANG['NEW_POSTS_IN_BLOGS'];
        $channel['description'] = $_LANG['NEW_POSTS_IN_BLOGS'];
        $channel['link']        = HOST .'/blogs';
    }

    // В RSS всегда только публичные посты
    $inBlog->whereOnlyPublic();

    $inDB->orderBy('p.pubdate', 'DESC');

    $inDB->limit($cfg['maxitems']);

    $posts = $inBlog->getPosts(false, $model, true);

    if ($posts) {
        foreach($posts as $post){
            $post['link']        = HOST . $post['url'];
            $post['description'] = mb_substr(strip_tags($post['content_html']), 0, 350). '...';
            $post['comments'] = $post['link'].'#c';
            $post['category'] = $post['blog_title'];
            $items[] = $post;
        }
    }

    return array('channel' => $channel, 'items' => $items);
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:59,代码来源:prss.php

示例12: rss_board

function rss_board($item_id, $cfg){

    if(!cmsCore::getInstance()->isComponentEnable('board')) { return false; }

	$inDB = cmsDatabase::getInstance();

    cmsCore::loadModel('board');
    $model = new cms_model_board();

    global $_LANG;

	$channel = array();
	$items   = array();

	if ($item_id && preg_match('/^([0-9]+)$/ui', $item_id)) {

		$cat = $model->getCategory($item_id);
		if(!$cat) { return false; }

		$model->whereCatIs($cat['id']);

		$channel['title']       = $cat['title'];
		$channel['description'] = preg_replace ("'&([a-z]{2,5});'iu", '', $cat['description']);
		$channel['link']        = HOST.'/board/'.$cat['id'];

	} else {

		$channel['title'] = $_LANG['BOARD'];
		$channel['description'] = $_LANG['BOARD'];
		$channel['link'] = HOST;

	}

	$inDB->orderBy('pubdate', 'DESC');

	$inDB->limit($cfg['maxitems']);

	$advs = $model->getAdverts(false, false, false, true);

	if($advs){
		foreach($advs as $item){

			$item['link']     = HOST.'/board/read'.$item['id'].'.html';
			$item['comments'] = $item['link'].'#c';
			$item['category'] = $item['cat_title'];
			$item['description'] = mb_substr(strip_tags($item['content']), 0, 250). '...';
			$image_file = PATH.'/images/board/small/'.$item['file'];
			$image_url  = HOST.'/images/board/small/'.$item['file'];
			$item['image'] = file_exists($image_file) ? $image_url : '';
			$item['size']  = round(filesize($image_file));
			$items[] = $item;

		}
	}

	return array('channel' => $channel,
				 'items' => $items);

}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:59,代码来源:prss.php

示例13: mod_about

function mod_about($module_id, $cfg)
{
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $articles = $model->getArticlesList3(true, '47');
    cmsPage::initTemplate('modules', 'module_about.tpl')->assign('articles', $articles)->display('module_about.tpl');
    return true;
}
开发者ID:vityapro,项目名称:cms,代码行数:8,代码来源:module.php

示例14: mod_search

function mod_search($module_id, $cfg)
{
    cmsCore::loadModel('search');
    cmsCore::loadLanguage('components/search');
    $model = cms_model_search::initModel();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('enable_components', $model->getEnableComponentsWithSupportSearch())->display($cfg['tpl']);
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:8,代码来源:module.php

示例15: rss_comments

function rss_comments($item_id, $cfg)
{
    if (!cmsCore::getInstance()->isComponentEnable('comments')) {
        return false;
    }
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    cmsCore::loadModel('comments');
    $model = new cms_model_comments();
    $channel = array();
    $items = array();
    if ($item_id) {
        // Выделяем назначение и id назначения
        $target_array = explode('-', $item_id);
        $target_str = $target_array[0];
        $target_id = (int) $target_array[1];
        $target = $inDB->get_fields('cms_comment_targets', "target='{$target_str}'", '*');
        if (!$target) {
            return false;
        }
        if (cmsCore::loadModel($target['component'])) {
            $model_class = 'cms_model_' . $target['component'];
            if (class_exists($model_class)) {
                $target_model = new $model_class();
            }
        }
        if (!isset($target_model)) {
            return false;
        }
        $target_data = $target_model->getCommentTarget($target_str, $target_id);
        if (!$target_data) {
            return false;
        }
        $model->whereTargetIs($target_str, $target_id);
        $channel['title'] = $target_data['title'];
        $channel['description'] = $target['title'];
        $channel['link'] = HOST . $target_data['link'];
    } else {
        $channel['title'] = $_LANG['COMMENTS_ON_SITE'];
        $channel['description'] = $_LANG['COMMENTS_ON_SITE'];
        $channel['link'] = HOST . '/comments';
    }
    $model->whereIsShow();
    $inDB->orderBy('c.pubdate', 'DESC');
    $inDB->limit($cfg['maxitems']);
    $comments = $model->getComments(true, false, true);
    if ($comments) {
        foreach ($comments as $comment) {
            $comment['title'] = $comment['content'];
            $comment['link'] = HOST . $comment['target_link'] . '#c' . $comment['id'];
            $comment['comments'] = HOST . $comment['target_link'] . '#c' . $comment['id'];
            $comment['category'] = $target_data['title'];
            $items[] = $comment;
        }
    }
    return array('channel' => $channel, 'items' => $items);
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:57,代码来源:prss.php


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