本文整理汇总了PHP中Publisher::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Publisher::getConfig方法的具体用法?PHP Publisher::getConfig怎么用?PHP Publisher::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::getConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeUpload
/**
* @param string $post_field
* @param array $allowed_mimetypes
* @param array $errors
*
* @return bool
*/
public function storeUpload($post_field, $allowed_mimetypes = array(), &$errors)
{
$itemid = $this->getVar('itemid');
if (empty($allowed_mimetypes)) {
$allowed_mimetypes = $this->publisher->getMimetypeHandler()->getArrayByType();
}
$maxfilesize = $this->publisher->getConfig('maximum_filesize');
$maxfilewidth = $this->publisher->getConfig('maximum_image_width');
$maxfileheight = $this->publisher->getConfig('maximum_image_height');
if (!is_dir(PublisherUtils::getUploadDir())) {
mkdir(PublisherUtils::getUploadDir(), 0757);
}
$uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir() . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($post_field)) {
$uploader->setTargetFileName($itemid . "_" . $uploader->getMediaName());
if ($uploader->upload()) {
$this->setVar('filename', $uploader->getSavedFileName());
if ($this->getVar('name') == '') {
$this->setVar('name', $this->getNameFromFilename());
}
$this->setVar('mimetype', $uploader->getMediaType());
return true;
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
}
示例2: createMetaKeywords
/**
* @return string
*/
public function createMetaKeywords()
{
$keywords = $this->findMetaKeywords($this->_original_title . " " . $this->_description, $this->_minChar);
$moduleKeywords = $this->publisher->getConfig('seo_meta_keywords');
if ($moduleKeywords != '') {
$moduleKeywords = explode(",", $moduleKeywords);
$keywords = array_merge($keywords, array_map('trim', $moduleKeywords));
}
$ret = implode(',', $keywords);
return $ret;
}
示例3: setVarsFromRequest
/**
* The name says it all
*/
public function setVarsFromRequest()
{
$xoops = Xoops::getInstance();
//Required fields
if (isset($_REQUEST['categoryid'])) {
$this->setVar('categoryid', Request::getInt('categoryid'));
}
if (isset($_REQUEST['title'])) {
$this->setVar('title', Request::getString('title'));
}
if (isset($_REQUEST['body'])) {
$this->setVar('body', Request::getText('body'));
}
//Not required fields
if (isset($_REQUEST['summary'])) {
$this->setVar('summary', Request::getText('summary'));
}
if (isset($_REQUEST['subtitle'])) {
$this->setVar('subtitle', Request::getString('subtitle'));
}
if (isset($_REQUEST['item_tag'])) {
$this->setVar('item_tag', Request::getString('item_tag'));
}
if (isset($_REQUEST['image_featured'])) {
$image_item = Request::getArray('image_item');
$image_featured = Request::getString('image_featured');
//Todo: get a better image class for xoops!
//Image hack
$image_item_ids = array();
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
$qb->select('i.image_id', 'i.image_name')->fromPrefix('image', 'i')->orderBy('i.image_id');
$result = $qb->execute();
while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
$image_name = $myrow['image_name'];
$id = $myrow['image_id'];
if ($image_name == $image_featured) {
$this->setVar('image', $id);
}
if (in_array($image_name, $image_item)) {
$image_item_ids[] = $id;
}
}
$this->setVar('images', implode('|', $image_item_ids));
}
if (isset($_REQUEST['uid'])) {
$this->setVar('uid', Request::getInt('uid'));
} elseif ($this->isNew()) {
$this->setVar('uid', $xoops->isUser() ? $xoops->user->getVar('uid') : 0);
}
if (isset($_REQUEST['author_alias'])) {
$this->setVar('author_alias', Request::getString('author_alias'));
if ($this->getVar('author_alias') != '') {
$this->setVar('uid', 0);
}
}
if (isset($_REQUEST['datesub'])) {
$this->setVar('datesub', strtotime($_REQUEST['datesub']['date']) + $_REQUEST['datesub']['time']);
} elseif ($this->isNew()) {
$this->setVar('datesub', time());
}
if (isset($_REQUEST['item_short_url'])) {
$this->setVar('short_url', Request::getString('item_short_url'));
}
if (isset($_REQUEST['item_meta_keywords'])) {
$this->setVar('meta_keywords', Request::getString('item_meta_keywords'));
}
if (isset($_REQUEST['item_meta_description'])) {
$this->setVar('meta_description', Request::getString('item_meta_description'));
}
if (isset($_REQUEST['weight'])) {
$this->setVar('weight', Request::getInt('weight'));
}
if (isset($_REQUEST['allowcomments'])) {
$this->setVar('cancomment', Request::getInt('allowcomments'));
} elseif ($this->isNew()) {
$this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments'));
}
if (isset($_REQUEST['status'])) {
$this->setVar('status', Request::getInt('status'));
} elseif ($this->isNew()) {
$this->setVar('status', $this->publisher->getConfig('submit_status'));
}
if (isset($_REQUEST['dohtml'])) {
$this->setVar('dohtml', Request::getInt('dohtml'));
} elseif ($this->isNew()) {
$this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml'));
}
if (isset($_REQUEST['dosmiley'])) {
$this->setVar('dosmiley', Request::getInt('dosmiley'));
} elseif ($this->isNew()) {
$this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley'));
}
if (isset($_REQUEST['doxcode'])) {
$this->setVar('doxcode', Request::getInt('doxcode'));
} elseif ($this->isNew()) {
$this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode'));
}
//.........这里部分代码省略.........