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


PHP cmsCore::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $this->config = cmsCore::getInstance()->loadComponentConfig('photos');
     cmsCore::loadLib('karma');
     cmsCore::loadLanguage('components/photos');
 }
开发者ID:deltas1,项目名称:icms1,代码行数:7,代码来源:model.php

示例2: 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

示例3: subscribes

function subscribes(){

    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();

    $do = $inCore->do;

//========================================================================================================================//
//========================================================================================================================//
    if ($do=='view'){

        $subscribe  = cmsCore::request('subscribe', 'int', 0);
        $target     = cmsCore::request('target', 'str', '');
        $target_id  = cmsCore::request('target_id', 'int', 0);

        if (!$target_id || !$target){
            cmsCore::error404();
        }

        if ($inUser->id){
            cmsUser::subscribe($inUser->id,  $target, $target_id, $subscribe);
        }

        if(cmsCore::isAjax()){
            cmsCore::jsonOutput(array('subscribe'=>$subscribe));
        } else {
            cmsCore::redirectBack();
        }

    }

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

示例4: install_package

function install_package()
{
    $core = cmsCore::getInstance();
    $remove_table_indexes = array('tags' => array('tag'));
    $add_table_indexes = array('tags_bind' => array('target_controller' => array('target_controller', 'target_subject', 'tag_id')));
    $add_unique_table_indexes = array('tags' => array('tag' => array('tag', 'frequency'), 'frequency' => array('frequency', 'tag')));
    // удаляем ненужные индексы
    foreach ($remove_table_indexes as $table => $ri) {
        foreach ($ri as $index_name) {
            $core->db->dropIndex($table, $index_name);
        }
    }
    // добавляем нужные
    foreach ($add_table_indexes as $table => $indexes) {
        foreach ($indexes as $index_name => $fields) {
            $core->db->addIndex($table, $fields, $index_name);
        }
    }
    // добавляем нужные уникальные
    foreach ($add_unique_table_indexes as $table => $indexes) {
        foreach ($indexes as $index_name => $fields) {
            $core->db->addIndex($table, $fields, $index_name, 'UNIQUE');
        }
    }
}
开发者ID:uralmax89,项目名称:icms2,代码行数:25,代码来源:install.php

示例5: __construct

 public function __construct() {
     $this->config = cmsCore::getInstance()->loadComponentConfig('sitemap');
     
     $this->getComponentsWithSupportSitemap();
     
     include_once(PATH .'/components/sitemap/sitemap.class.php');
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:7,代码来源:model.php

示例6: upgrade_component_calendar

function upgrade_component_calendar()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inDB->query("ALTER TABLE  `cms_events` ADD  `hide` INT NOT NULL ;");
    return true;
}
开发者ID:roman-burachenko,项目名称:icms-calendar,代码行数:7,代码来源:install.php

示例7: mod_calendar_eventview

function mod_calendar_eventview($module_id)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $DB = cmsDatabase::getInstance();
    $cfg = $inCore->loadComponentConfig('calendar');
    if ($inUser->id != 0 and $cfg['calendar_module'] == "user") {
        //Запрос к БД
        $sql = "\r\n\tSELECT cms_events.* ,\r\n\tcms_events_category.tx,\r\n\tcms_events_category.bg\r\n\tFROM cms_events \r\n\tLEFT JOIN cms_events_signup ON cms_events.id=cms_events_signup.event_id \r\n\tLEFT JOIN cms_events_category ON cms_events.category_id = cms_events_category.id\r\n\tWHERE \r\n\tcms_events.start_time > " . time() . " AND \r\n\tcms_events.author_id = " . $inUser->id . " OR \r\n\tcms_events_signup.user_id = " . $inUser->id . " AND \r\n\tcms_events.author_id <> " . $inUser->id . " AND \r\n\tcms_events.start_time > " . time() . " \r\n\tGROUP BY cms_events.id ORDER BY cms_events.start_time ASC LIMIT " . $cfg['calendar_module_count'];
    } else {
        $sql = "SELECT cms_events.*,\r\n\t    cms_events_category.tx,\r\n\t    cms_events_category.bg\r\n\t    FROM cms_events\r\n\t    LEFT JOIN cms_events_category ON cms_events.category_id = cms_events_category.id\t    \r\n\t    WHERE cms_events.`type` = 'public' \r\n\t    AND cms_events.start_time > " . time() . " \r\n\t    ORDER BY cms_events.start_time ASC LIMIT " . $cfg['calendar_module_count'];
    }
    $result = $DB->query($sql);
    if ($DB->error()) {
        return false;
    }
    $events = array();
    while ($event = $DB->fetch_assoc($result)) {
        if ($event['author_id'] == $inUser->id) {
            $event['time'] == "";
        }
        if ($event['category_id'] == 0) {
            $event['bg'] = '#C3BCB9';
            $event['tx'] = '#000000';
        }
        $events[] = $event;
    }
    $smarty = $inCore->initSmarty('modules', 'mod_calendar_eventview.tpl');
    $smarty->assign('events', $events);
    $smarty->display('mod_calendar_eventview.tpl');
    return true;
}
开发者ID:ratmir-by,项目名称:icms-calendar,代码行数:32,代码来源:module.php

示例8: __construct

 function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $inCore = cmsCore::getInstance();
     $cfg = $inCore->loadComponentConfig('pogoda');
     $this->city_id = $cfg['city_id'];
 }
开发者ID:roman-burachenko,项目名称:icms1_com_pogoda,代码行数:7,代码来源:model.php

示例9: mod_menu

function mod_menu($mod, $cfg)
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $menuid = $inCore->menuId();
    $full_menu = $inCore->getMenuStruct();
    $current_uri = '/' . $inCore->getUri();
    if (!isset($cfg['menu'])) {
        $menu = 'mainmenu';
    } else {
        $menu = $cfg['menu'];
    }
    if (!isset($cfg['show_home'])) {
        $cfg['show_home'] = 1;
    }
    if (!isset($cfg['is_sub_menu'])) {
        $cfg['is_sub_menu'] = 0;
    }
    // текущий пункт меню
    $currentmenu = isset($full_menu[$menuid]) ? $full_menu[$menuid] : array();
    // результирующий массив меню
    $items = array();
    // id корня меню если обычный вывод меню, $menuid если режим подменю
    if ($cfg['is_sub_menu']) {
        // в подменю не должно быть ссылки на главную
        $cfg['show_home'] = 0;
        // на главной или нет активного пункта меню
        if ($menuid == 1 || !$currentmenu) {
            return false;
        }
        foreach ($full_menu as $item) {
            if ($item['NSLeft'] > $currentmenu['NSLeft'] && $item['NSRight'] < $currentmenu['NSRight'] && in_array($menu, $item['menu']) && ($item['is_lax'] || cmsCore::checkContentAccess($item['access_list'], false)) && $item['published']) {
                $item['link'] = cmsUser::stringReplaceUserProperties($item['link']);
                $item['title'] = cmsUser::stringReplaceUserProperties($item['title'], true);
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    } else {
        foreach ($full_menu as $item) {
            if (in_array($menu, $item['menu']) && ($item['is_lax'] || cmsCore::checkContentAccess($item['access_list'], false)) && $item['published']) {
                $item['link'] = cmsUser::stringReplaceUserProperties($item['link']);
                $item['title'] = cmsUser::stringReplaceUserProperties($item['title'], true);
                $items[] = $item;
                // массивы для сортировки
                $nsl[] = $item['NSLeft'];
                $ord[] = $item['ordering'];
            }
        }
    }
    if (!$items) {
        return false;
    }
    // сортируем массив
    array_multisort($nsl, SORT_ASC, $ord, SORT_ASC, $items);
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('menuid', $menuid)->assign('currentmenu', $currentmenu)->assign('current_uri', $current_uri)->assign('menu', $menu)->assign('items', $items)->assign('last_level', 0)->assign('user_id', $inUser->id)->assign('is_admin', $inUser->is_admin)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:r2git,项目名称:icms1,代码行数:60,代码来源:module.php

示例10: execute

 public function execute($event, $user)
 {
     parent::execute();
     $inCore = cmsCore::getInstance();
     $inUser = cmsUser::getInstance();
     $inCore->loadModel('usermaps');
     $model = new cms_model_usermaps();
     $catalogs = array();
     $user_id = $user['id'];
     $limit = $this->config['Количество объектов'];
     $steep = $this->config['Квадрат поиска в метрах'];
     $have_point = $model->getUserPlace($user_id);
     if ($have_point) {
         $points = $model->getArround($have_point['id']);
     }
     ob_start();
     if ($have_point and $inUser->id == $user_id) {
         $smarty = $this->inCore->initSmarty('plugins', 'p_places_sosedi.tpl');
         $smarty->assign('total', count($points));
         $smarty->assign('points', $points);
         $smarty->display('p_places_sosedi.tpl');
     }
     $html = ob_get_clean();
     return $html;
 }
开发者ID:kovalevsc,项目名称:icms-usermaps,代码行数:25,代码来源:plugin.php

示例11: polls

function polls()
{
    $model = new cms_model_polls();
    global $_LANG;
    $do = cmsCore::getInstance()->do;
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view') {
        $answer = cmsCore::request('answer', 'str', '');
        $poll_id = cmsCore::request('poll_id', 'int');
        if (!$answer || !$poll_id) {
            if (cmsCore::isAjax()) {
                cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SELECT_THE_OPTION']));
            } else {
                cmsCore::error404();
            }
        }
        $poll = $model->getPoll($poll_id);
        if (!$poll) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if ($model->isUserVoted($poll_id)) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::halt();
        }
        $model->votePoll($poll, $answer);
        cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['VOTE_ACCEPTED']));
    }
}
开发者ID:4uva4ek,项目名称:svato,代码行数:31,代码来源:frontend.php

示例12: 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

示例13: __construct

 public function __construct()
 {
     cmsCore::loadClass('page');
     $this->inCore = cmsCore::getInstance();
     $this->inDB = cmsDatabase::getInstance();
     $this->inPage = cmsPage::getInstance();
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:7,代码来源:plugin.class.php

示例14: photomap

 public function photomap($photo)
 {
     $inCore = cmsCore::getInstance();
     $inUser = cmsUser::getInstance();
     $type = "photo";
     if ($photo['user_id'] == $inUser->id) {
         $is_author = TRUE;
     }
     $sql = mysql_query("SELECT * FROM cms_places_events WHERE `object_id` = '" . $photo['id'] . "' AND `object_type` = '{$type}'");
     $cfg = $inCore->loadComponentConfig('usermaps');
     ob_start();
     if (mysql_num_rows($sql) == 1 or $is_author) {
         $point = mysql_fetch_assoc($sql);
         if ($point['x'] == "" or $point['y'] == "") {
             $center = $cfg['maps_center'];
             $have_point = FALSE;
         } else {
             $center = '"' . $point['x'] . '","' . $point['y'] . '"';
             $have_point = TRUE;
         }
         $smarty = $this->inCore->initSmarty('plugins', 'p_places_imagesonmap.tpl');
         $smarty->assign('is_author', $is_author);
         $smarty->assign('photo_id', $photo['id']);
         $smarty->assign('photo_type', $type);
         $smarty->assign('center', $center);
         $smarty->assign('cfg', $cfg);
         $smarty->assign('have_point', $have_point);
         $smarty->display('p_places_imagesonmap.tpl');
     }
     $html = ob_get_clean();
     return $html;
 }
开发者ID:kovalevsc,项目名称:icms-usermaps,代码行数:32,代码来源:plugin.php

示例15: routeAction

 public function routeAction($action_name)
 {
     if (!is_numeric($action_name)) {
         return $action_name;
     }
     $group_id = $action_name;
     $group = $this->model->getGroup($group_id);
     if (!$group) {
         cmsCore::error404();
     }
     $core = cmsCore::getInstance();
     $user = cmsUser::getInstance();
     $this->current_params = $core->uri_params;
     $this->current_params[0] = $group;
     $membership = $this->model->getMembership($group['id'], $user->id);
     $is_member = $membership !== false;
     if ($group['is_closed'] && !$is_member && !$user->is_admin && (empty($core->uri_params[0]) || $core->uri_params[0] != 'join')) {
         return 'group_closed';
     }
     if (!$core->uri_params) {
         return 'group';
     }
     $action_name = $core->uri_params[0];
     $action_name = 'group_' . $action_name;
     return $action_name;
 }
开发者ID:asphix,项目名称:icms2,代码行数:26,代码来源:frontend.php


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