本文整理汇总了PHP中Config::need方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::need方法的具体用法?PHP Config::need怎么用?PHP Config::need使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::need方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRightholders
function getRightholders()
{
$cond = new Conditions();
$per_page = 0;
if (isset($this->params['per_page'])) {
$per_page = (int) $this->params['per_page'];
}
$per_page = $per_page > 0 ? $per_page : 1;
$pagingName = isset($this->params['paging_parameter_name']) ? $this->params['paging_parameter_name'] : 'p';
$where = '';
$order = 'ORDER BY `id` DESC ';
$group_by = '';
$query = 'SELECT COUNT(1) FROM `rightholders` ' . $where . ' ' . $group_by . '';
$count = Database::sql2single($query);
$cond->setPaging($count, $per_page, $pagingName);
$limit = $cond->getLimit();
$limit = ' LIMIT ' . $limit;
$query = 'SELECT * FROM `rightholders`' . $where . ' ' . $group_by . ' ' . $order . ' ' . $limit;
$data = Database::sql2array($query);
foreach ($data as &$row) {
$row['path'] = Config::need('www_path') . '/admin/rightholders/' . $row['id'];
}
$this->data['rightholders'] = $data;
$this->data['rightholders']['title'] = 'Правообладатели';
$this->data['rightholders']['count'] = $count;
$this->data['conditions'] = $cond->getConditions();
}
示例2: write
function write()
{
global $current_user;
/*@var $current_user CurrentUser*/
$current_user->can_throw('books_edit');
$id = isset(Request::$post['id']) ? Request::$post['id'] : 0;
$id = max(0, (int) $id);
$row = Database::sql2row('SELECT * FROM genre WHERE `id`=' . $id);
if (!$row) {
return;
}
if (!$id) {
throw new Exception('Illegal id');
}
$description = prepare_review(isset(Request::$post['description']) ? Request::$post['description'] : '');
if (!$description) {
throw new Exception('Empty description');
}
$description = prepare_review($description);
$query = 'UPDATE `genre` SET `description`=' . Database::escape($description) . ' WHERE `id`=' . $id;
Database::query($query);
ob_end_clean();
header('Location:' . Config::need('www_path') . '/genres/' . $row['name']);
$current_user->gainActionPoints('genres_edit', $id, BiberLog::TargetType_genre);
exit;
}
示例3: __construct
function __construct()
{
$link = mysql_connect(Config::need('dbserver'), Config::need('dbuser'), Config::need('dbpass'));
mysql_select_db(Config::need('dbname'), $link);
mysql_query('SET NAMES utf8', $link);
$this->link = $link;
}
示例4: _create
public function _create($data)
{
$item = new $this->className(0);
$createdId = $item->_create($data);
header('Location:' . Config::need('www_path') . '/banners/' . $createdId);
exit;
}
示例5: process
public static function process($moduleName) {
$filename = Config::need('writemodules_path') . '/' . $moduleName . '.php';
if (!is_readable($filename)) {
throw new Exception('no module#' . $moduleName . ' can accept writing', Error::E_WRITEMODULE_MISSED);
}
$module = new $moduleName;
$module->write();
}
示例6: getInstance
public static function getInstance() {
if (!self::$instance) {
$s = new Mongo(Config::need('mongohost'));
self::$instance = $s->ls2;
//self::getInstance()->events->remove();
//self::getInstance()->walls->remove();
}
return self::$instance;
}
示例7: process
public function process()
{
global $current_user;
/* @var $current_user CurrentUser */
XMLClass::$pageNode = XMLClass::createNodeFromObject($this->pageSettings, false, 'page', false);
XMLClass::appendNode(XMLClass::$pageNode, $this->pageName);
XMLClass::$pageNode->setAttribute('current_url', Request::$url);
XMLClass::$pageNode->setAttribute('page_url', Config::need('www_path') . '/' . Request::$pageName . '/');
XMLClass::$pageNode->setAttribute('prefix', Config::need('www_path') . '/');
if ($current_user->authorized) {
XMLClass::$CurrentUserNode = XMLClass::createNodeFromObject($current_user->getXMLInfo(), false, 'current_user', false);
} else {
XMLClass::$CurrentUserNode = XMLClass::createNodeFromObject(array(), false, 'current_user', false);
}
XMLClass::$pageNode->appendChild(XMLClass::$CurrentUserNode);
// втыкаем модули страницы
$role = $current_user->getRole();
if (isset($this->pageSettings['modules']) && is_array($this->pageSettings['modules'])) {
foreach ($this->pageSettings['modules'] as $moduleName => $additionalSettings) {
if (isset($additionalSettings['roles'][$role])) {
$this->processModule($moduleName, $additionalSettings);
}
}
}
// xml дерево создано, теперь генерируем xslt шаблон
// выдаем html
//Request::$responseType = 'xml';
switch (Request::$responseType) {
case 'xml':
case 'xmlc':
return XMLClass::dumpToBrowser();
break;
case 'xsl':
case 'xslc':
$xslTemplateClass = new XSLClass($this->pageSettings['xslt']);
$xslTemplateClass->setTemplates($this->xsltFiles);
return $xslTemplateClass->dumpToBrowser();
break;
case 'html':
$xslTemplateClass = new XSLClass($this->pageSettings['xslt']);
$xslTemplateClass->setTemplates($this->xsltFiles);
$html = $xslTemplateClass->getHTML(XMLClass::$xml);
if ($xslTemplateClass->fetched_from_cache) {
// чтобы знать, что файл из кеша
Log::logHtml('xslt template GOT from cache');
}
if ($xslTemplateClass->puted_into_cache) {
// чтобы знать, что файл из кеша
Log::logHtml('xslt template PUT to cache');
}
return $html;
break;
default:
return XMLClass::dumpToBrowser();
break;
}
}
示例8: getShort
function getShort()
{
$avatar = Config::need('www_path') . '/static/upload/author_images/' . ceil($this->data['id'] / 500) . '/' . $this->data['id'] . '.jpg';
$avatar_small = Config::need('www_path') . '/static/upload/author_images/' . ceil($this->data['id'] / 500) . '/' . $this->data['id'] . '_small.jpg';
if (!$this->data['has_pic']) {
$avatar = Config::need('www_path') . '/static/default/img/avatar.jpg';
$avatar_small = Config::need('www_path') . '/static/default/img/avatar_small.jpg';
}
return array('id' => $this->data['id'], 'username' => $this->data['username'], 'path' => Config::need('www_path') . '/profile/' . $this->data['username'], 'avatar' => $avatar, 'avatar_small' => $avatar_small);
}
示例9: prepareTemplates
public static function prepareTemplates()
{
$arr = array('body', 'body_plain', 'footer', 'footer_plain', 'header', 'header_plain');
$templates = array();
foreach ($arr as $template) {
$template_body = file_get_contents(Config::need('base_path') . 'email_templates' . DIRECTORY_SEPARATOR . $template . '.php');
$templates[$template] = $template_body;
}
self::$templates = $templates;
}
示例10: getPeriodItem
public function getPeriodItem($year, $j, $period)
{
$out['n'] = $j;
if (isset($this->books[$year][$j])) {
$out['bid'] = $this->books[$year][$j];
$out['path'] = Config::need('www_path') . '/book/' . $this->books[$year][$j];
} else {
$out['path'] = Config::need('www_path') . '/book/new?year=' . $year . '&n=' . $j . '&m=' . $this->id;
}
return $out;
}
示例11: getContentFilePath
function getContentFilePath($id, $pf = '') {
if ($pf == 'medium') {
$ext = 'gif';
} else {
$ext = 'gif';
}
if ($pf)
$pf = '_' . $pf;
$filename = Config::need('static_path') . DIRECTORY_SEPARATOR . 'upload/pictures/' . $id . $pf . '.' . $ext;
return $filename;
}
示例12: getHTML
public function getHTML($xml) {
global $current_user;
Log::timingplus('XSLTProcessor');
$xslTemplate = new DOMDocument();
$xslProcessor = new XSLTProcessor();
$filename = Config::need('xslt_files_path') . DIRECTORY_SEPARATOR . $current_user->getTheme() . DIRECTORY_SEPARATOR . $this->xsltFileName;
$xslTemplate->load($filename, LIBXML_NOENT | LIBXML_DTDLOAD);
$xslProcessor->importStyleSheet($xslTemplate);
$html = $xslProcessor->transformToXML($xml);
Log::timingplus('XSLTProcessor');
return $html;
}
示例13: _upsert
function _upsert($data)
{
$q = array();
foreach ($data as $field => $value) {
$q[] = '`' . $field . '`=' . Database::escape($value);
}
if (count($q)) {
Database::query('INSERT INTO `feature_groups` SET ' . implode(',', $q) . ' ON DUPLICATE KEY UPDATE ' . implode(',', $q));
}
@ob_end_clean();
header('Location: ' . Config::need('www_path') . '/features');
exit(0);
}
示例14: saveSettings
function saveSettings()
{
require_once $filename = dirname(Config::need('xslt_files_path')) . '/localconfig.php';
global $local_config;
$query = 'SELECT * FROM `settings`';
$arr = Database::sql2array($query);
$local_config['-----------------'] = '-----------------';
foreach ($arr as $setting) {
$local_config[$setting['name']] = $setting['value'];
}
$s = var_export($local_config, true);
file_put_contents($filename, '<?php $local_config = ' . $s . ";\n" . '//some settings generated by setting module');
}
示例15: add_album_relation_link
function add_album_relation_link()
{
$album_id = $_POST['album_id'];
$role = $_POST['role'];
Database::query('INSERT INTO `album_invites` SET
`album_id`=' . $album_id . ',
`inviter_user_id `=' . CurrentUser::$id . ',
`family_role`=' . $role);
$uniqid = Database::lastInsertId();
$data = array();
$data['link'] = 'http://' . Config::need('www_domain') . '/invite/' . $album_id . '/' . $role . '/' . md5($uniqid);
return $data;
}