本文整理汇总了PHP中cmsCore::loadClass方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::loadClass方法的具体用法?PHP cmsCore::loadClass怎么用?PHP cmsCore::loadClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::loadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: __construct
public function __construct()
{
cmsCore::loadClass('page');
$this->inCore = cmsCore::getInstance();
$this->inDB = cmsDatabase::getInstance();
$this->inPage = cmsPage::getInstance();
}
示例3: __construct
public function __construct()
{
$this->inDB = cmsDatabase::getInstance();
$this->config = cmsCore::getInstance()->loadComponentConfig('actions');
cmsCore::loadClass('actions');
cmsCore::loadLanguage('components/users');
}
示例4: insertForm
function insertForm($form_title){
cmsCore::loadClass('form');
return cmsForm::displayForm(trim($form_title), array(), false);
}
示例5: updateCommentsCount
public function updateCommentsCount($target, $target_id) {
if ($target != 'blog') { return false; }
cmsCore::loadClass('blog');
return cmsBlogs::updateCommentsCount($target, $target_id);
}
示例6: 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);
}
示例7: __construct
public function __construct()
{
cmsCore::loadClass('page');
$this->inCore = cmsCore::getInstance();
$this->inDB = cmsDatabase::getInstance();
$this->inPage = cmsPage::getInstance();
$this->config = array_merge($this->config, $this->inCore->loadPluginConfig(get_called_class()));
}
示例8: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
$model = new cms_model_files();
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'html', '');
if (mb_strpos($fileurl, '-') === 0) {
$fileurl = htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-')));
}
$fileurl = cmsCore::strClear($fileurl);
if (!$fileurl || mb_strstr($fileurl, '..') || strpos($fileurl, '.') === 0) {
cmsCore::error404();
}
if (strpos($fileurl, 'http') === 0) {
$model->increaseDownloadCount($fileurl);
cmsCore::redirect($fileurl);
} elseif (file_exists(PATH . $fileurl)) {
$model->increaseDownloadCount($fileurl);
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
} else {
cmsCore::halt($_LANG['FILE_NOT_FOUND']);
}
}
//============================================================================//
if ($do == 'redirect') {
$url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
if (mb_strpos($url, '-') === 0) {
$url = htmlspecialchars_decode(base64_decode(ltrim($url, '-')));
}
$url = cmsCore::strClear($url);
if (!$url || mb_strstr($url, '..') || strpos($url, '.') === 0) {
cmsCore::error404();
}
// кириллические домены
$url_host = parse_url($url, PHP_URL_HOST);
if (preg_match('/^[а-яё]+/iu', $url_host)) {
cmsCore::loadClass('idna_convert');
$IDN = new idna_convert();
$host = $IDN->encode($url_host);
$url = str_ireplace($url_host, $host, $url);
}
cmsCore::redirect($url);
}
//============================================================================//
}
示例9: uploadCategoryIcon
function uploadCategoryIcon($file='') {
cmsCore::loadClass('upload_photo');
$inUploadPhoto = cmsUploadPhoto::getInstance();
$inUploadPhoto->upload_dir = PATH.'/upload/forum/';
$inUploadPhoto->dir_medium = 'cat_icons/';
$inUploadPhoto->medium_size_w = 32;
$inUploadPhoto->medium_size_h = 32;
$inUploadPhoto->only_medium = true;
$inUploadPhoto->is_watermark = false;
$files = $inUploadPhoto->uploadPhoto($file);
$icon = $files['filename'] ? $files['filename'] : $file;
return $icon;
}
示例10: initUploadClass
/**
* Возвращает объект класса для загрузки изображений
* @return obj
*/
public function initUploadClass($album)
{
cmsCore::loadClass('upload_photo');
$inUploadPhoto = cmsUploadPhoto::getInstance();
// Выставляем конфигурационные параметры
$inUploadPhoto->upload_dir = PATH . '/images/photos/';
$inUploadPhoto->small_size_w = $album['thumb1'];
$inUploadPhoto->medium_size_w = $album['thumb2'];
$inUploadPhoto->thumbsqr = $album['thumbsqr'];
$inUploadPhoto->is_watermark = $this->config['watermark'];
$inUploadPhoto->is_saveorig = $this->config['saveorig'];
return $inUploadPhoto;
}
示例11: viewBloges
public function viewBloges($user_id)
{
$inDB = cmsDatabase::getInstance();
cmsCore::loadClass('blog');
cmsCore::loadModel('blogs');
$inBlog = cmsBlogs::getInstance();
$model = new cms_model_blogs();
$model->whereUserIs($user_id);
$total = $inBlog->getPostsCount($inUser->is_admin);
$inDB->orderBy('p.pubdate', 'DESC');
$inDB->limitPage(1, (int) $this->config['PU_LIMIT']);
$posts = $inBlog->getPosts($inUser->is_admin, $model);
ob_start();
cmsPage::initTemplate('plugins', 'p_bloges.tpl')->assign('posts', $posts)->display('p_bloges.tpl');
return ob_get_clean();
}
示例12: uploadCategoryIcon
function uploadCategoryIcon($file = '')
{
// Загружаем класс загрузки фото
cmsCore::loadClass('upload_photo');
$inUploadPhoto = cmsUploadPhoto::getInstance();
// Выставляем конфигурационные параметры
$inUploadPhoto->upload_dir = PATH . '/upload/board/';
$inUploadPhoto->dir_medium = 'cat_icons/';
$inUploadPhoto->medium_size_w = 32;
$inUploadPhoto->medium_size_h = 32;
$inUploadPhoto->only_medium = true;
$inUploadPhoto->is_watermark = false;
// Процесс загрузки фото
$files = $inUploadPhoto->uploadPhoto($file);
$icon = $files['filename'] ? $files['filename'] : $file;
return $icon;
}
示例13: mod_photo
function mod_photo($module_id, $cfg)
{
cmsCore::loadClass('photo');
$inPhoto = cmsPhoto::getInstance();
$inDB = cmsDatabase::getInstance();
$default_cfg = array('is_full' => 1, 'showmore' => 1, 'album_id' => 0, 'whatphoto' => 'all', 'shownum' => 5, 'maxcols' => 2, 'sort' => 'pubdate', 'showclubs' => 0, 'is_subs' => 1);
$cfg = array_merge($default_cfg, $cfg);
// выбираем категории фото
$inDB->addJoin('INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.published = 1');
$inDB->addSelect('a.title as cat_title, a.NSDiffer');
// если категория задана, выбираем из нее
if ($cfg['album_id']) {
// Если выбирать нужно включая вложенные
if ($cfg['is_subs']) {
// получаем категорию
$album = $inDB->getNsCategory('cms_photo_albums', $cfg['album_id']);
if (!$album) {
return false;
}
$inPhoto->whereThisAndNestedCats($album['NSLeft'], $album['NSRight']);
} else {
$inPhoto->whereAlbumIs($cfg['album_id']);
}
}
// если фото клубов не нужны
if (!$cfg['showclubs']) {
$inDB->where("f.owner = 'photos'");
}
// Задаем период
$inPhoto->wherePeriodIs($cfg['whatphoto']);
//устанавливаем сортировку
$inDB->orderBy('f.' . $cfg['sort'], 'DESC');
//устанавливаем номер текущей страницы и кол-во фото на странице
$inDB->limit($cfg['shownum']);
// получаем фото
$photos = $inPhoto->getPhotos(false, $cfg['is_full']);
if (!$photos) {
return false;
}
cmsPage::initTemplate('modules', 'mod_photo')->assign('photos', $photos)->assign('cfg', $cfg)->display('mod_photo.tpl');
return true;
}
示例14: loadUserGeo
/**
* Загружает в свойства данные местоположения пользователя
*/
public function loadUserGeo()
{
if ($this->geo_is_loaded) {
return true;
}
$inCore = cmsCore::getInstance();
$geo_cfg = $inCore->loadComponentConfig('geo');
if ($geo_cfg['component_enabled'] && $geo_cfg['autodetect'] && cmsCore::loadClass($geo_cfg['class']) && class_exists('cms' . $geo_cfg['class'])) {
$geo_data = call_user_func(array('cms' . $geo_cfg['class'], 'getInfo'), $this->ip);
if ($geo_data) {
foreach ($geo_data as $k => $v) {
$this->geo[$k] = $v;
}
// если пользователь город не указал или это гость
if (!$this->city) {
$this->city = isset($this->geo['city']) ? $this->geo['city'] : '';
}
$this->geo_is_loaded = true;
return true;
}
}
return false;
}
示例15: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'str', '');
if (!$fileurl) {
cmsCore::error404();
}
$fileurl = mb_strpos($fileurl, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-'))) : $fileurl;
if (mb_strstr($fileurl, '..')) {
cmsCore::error404();
}
if (mb_strstr($fileurl, 'http:/')) {
if (!mb_strstr($fileurl, 'http://')) {
$fileurl = str_replace('http:/', 'http://', $fileurl);
}
}
$downloads = cmsCore::fileDownloadCount($fileurl);
if ($downloads == 0) {
$sql = "INSERT INTO cms_downloads (fileurl, hits) VALUES ('{$fileurl}', '1')";
$inDB->query($sql);
} else {
$sql = "UPDATE cms_downloads SET hits = hits + 1 WHERE fileurl = '{$fileurl}'";
$inDB->query($sql);
}
if (mb_strstr($fileurl, 'http:/')) {
cmsCore::redirect($fileurl);
}
if (file_exists(PATH . $fileurl)) {
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
} else {
cmsCore::halt($_LANG['FILE_NOT_FOUND']);
}
}
//============================================================================//
if ($do == 'redirect') {
$url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
if (!$url) {
cmsCore::error404();
}
$url = mb_strpos($url, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($url, '-'))) : $url;
if (mb_strstr($url, '..')) {
cmsCore::error404();
}
if (mb_strstr($url, 'http:/')) {
if (!mb_strstr($url, 'http://')) {
$url = str_replace('http:/', 'http://', $url);
}
}
if (mb_strstr($url, 'https:/')) {
if (!mb_strstr($url, 'https://')) {
$url = str_replace('https:/', 'https://', $url);
}
}
// кириллические домены
$url_host = parse_url($url, PHP_URL_HOST);
if (preg_match('/^[а-яё]+/iu', $url_host)) {
cmsCore::loadClass('idna_convert');
$IDN = new idna_convert();
$host = $IDN->encode($url_host);
$url = str_ireplace($url_host, $host, $url);
}
cmsCore::redirect($url);
}
//============================================================================//
}