本文整理汇总了PHP中wcf\system\WCF::getTPL方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::getTPL方法的具体用法?PHP WCF::getTPL怎么用?PHP WCF::getTPL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\system\WCF
的用法示例。
在下文中一共展示了WCF::getTPL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormElement
/**
* @see wcf\system\option\IOptionType::getFormElement()
*/
public function getFormElement(Option $option, $value) {
WCF::getTPL()->assign(array(
'option' => $option,
'value' => $value
));
return WCF::getTPL()->fetch('textareaOptionType');
}
示例2: getParsedTag
public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
{
//get id attribute
$fileID = 0;
if (isset($openingTag['attributes'][0])) {
$fileID = $openingTag['attributes'][0];
}
$file = new File($fileID);
if ($file === null) {
return '';
}
if (preg_match('~(image/*)+~', $file->fileType)) {
$this->isImage = true;
}
if ($this->isImage && isset($openingTag['attributes'][1])) {
$this->align = $openingTag['attributes'][1];
}
if ($this->isImage && isset($openingTag['attributes'][2])) {
$this->width = $openingTag['attributes'][2];
}
if ($this->isImage && isset($openingTag['attributes'][3])) {
$this->caption = $openingTag['attributes'][3];
}
WCF::getTPL()->assign(array('_file' => $file, '_align' => $this->align, '_width' => $this->width, '_isImage' => $this->isImage, '_caption' => $this->caption));
return WCF::getTPL()->fetch('cmsFileBBCodeTag', 'cms');
}
示例3: getFormElement
/**
* @see wcf\system\option\IOptionType::getFormElement()
*/
public function getFormElement(Option $option, $value)
{
$useRequestData = count($_POST) ? true : false;
I18nHandler::getInstance()->assignVariables($useRequestData);
WCF::getTPL()->assign(array('option' => $option, 'value' => $value));
return WCF::getTPL()->fetch('textareaI18nOptionType');
}
示例4: install
/**
* @see wcf\system\package\plugin\IPackageInstallationPlugin::install()
*/
public function install() {
parent::install();
// extract files.tar to temp folder
$sourceFile = $this->installation->getArchive()->extractTar($this->instruction['value'], 'acptemplates_');
// create file handler
$fileHandler = new ACPTemplatesFileHandler($this->installation);
// extract content of files.tar
$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
try {
$fileInstaller = $this->installation->extractFiles($packageDir.'acp/templates/', $sourceFile, $fileHandler);
}
catch (SystemException $e) {
WCF::getTPL()->assign(array(
'exception' => $e
));
WCF::getTPL()->display('packageInstallationFileInstallationFailed');
exit;
}
// delete temporary sourceArchive
@unlink($sourceFile);
}
示例5: execute
/**
* @see \wcf\system\event\IEventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
// try {
// $request = new HTTPRequest(self::FEED_URL);
// $request->execute();
// $feedData = $request->getReply();
// $feedData = $feedData['body'];
// }
// catch (SystemException $e) {
// // log error
// $e->getExceptionID();
// return;
// }
// if (!$xml = simplexml_load_string($feedData)) {
// return;
// }
$feed = array();
// $i = 10;
// foreach ($xml->channel[0]->item as $item) {
// if ($i -- == 0) {
// break;
// }
// $feed[] = array(
// 'title' => (string) $item->title,
// 'description' => (string) $item->description,
// 'link' => (string) $item->guid,
// 'time' => strtotime((string) $item->pubDate)
// );
// }
WCF::getTPL()->assign(array('codequakeNewsFeed' => $feed));
}
示例6: assignVariables
/**
* @see wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'availableUpdates' => $this->availableUpdates
));
}
示例7: assignVariables
/**
* Assignes the acl values to the template.
*
* @param integer $objectTypeID
*/
public function assignVariables($objectTypeID)
{
if (WCF::getTPL()->get('aclValues') === null) {
WCF::getTPL()->assign('aclValues', array());
}
if (!$this->assignVariablesDisabled && isset($_POST['aclValues'])) {
$values = $_POST['aclValues'];
$data = $this->getPermissions($objectTypeID, array(), null, true);
foreach ($values as $type => $optionData) {
if ($type === 'user') {
$users = User::getUsers(array_keys($optionData));
}
$values[$type] = array('label' => array(), 'option' => array());
foreach ($optionData as $typeID => $optionValues) {
foreach ($optionValues as $optionID => $optionValue) {
if (!isset($data['options'][$optionID])) {
unset($optionValues[$optionID]);
}
}
if (empty($optionValues)) {
continue;
}
$values[$type]['option'][$typeID] = $optionValues;
if ($type === 'group') {
$values[$type]['label'][$typeID] = UserGroup::getGroupByID($typeID)->getName();
} else {
$values[$type]['label'][$typeID] = $users[$typeID]->username;
}
}
}
$values['options'] = $data['options'];
$values['categories'] = $data['categories'];
WCF::getTPL()->append('aclValues', array($objectTypeID => $values));
}
}
示例8: getGroupedUserList
/**
* @see \wcf\data\IGroupedUserListAction::getGroupedUserList()
*/
public function getGroupedUserList()
{
$year = $month = $day = 0;
$value = explode('-', $this->parameters['date']);
if (isset($value[0])) {
$year = intval($value[0]);
}
if (isset($value[1])) {
$month = intval($value[1]);
}
if (isset($value[2])) {
$day = intval($value[2]);
}
// get users
$users = array();
$userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
if (isset($userOptions['birthday'])) {
$birthdayUserOption = $userOptions['birthday'];
$userIDs = UserBirthdayCache::getInstance()->getBirthdays($month, $day);
$userList = new UserProfileList();
$userList->setObjectIDs($userIDs);
$userList->readObjects();
foreach ($userList->getObjects() as $user) {
$birthdayUserOption->setUser($user->getDecoratedObject());
if (!$user->isProtected() && $birthdayUserOption->isVisible() && $user->getAge($year) >= 0) {
$users[] = $user;
}
}
}
WCF::getTPL()->assign(array('users' => $users, 'year' => $year));
return array('pageCount' => 1, 'template' => WCF::getTPL()->fetch('userBirthdayList'));
}
示例9: getFormElement
/**
* @see \wcf\system\captcha\ICaptchaHandler::getFormElement()
*/
public function getFormElement()
{
if ($this->question === null) {
$this->readCaptchaQuestion();
}
return WCF::getTPL()->fetch('captchaQuestion', 'wcf', array('captchaQuestion' => $this->captchaQuestion, 'captchaQuestionAnswered' => WCF::getSession()->getVar('captchaQuestionSolved_' . $this->captchaQuestion) !== null, 'captchaQuestionObject' => $this->question));
}
示例10: getFormElement
/**
* @see wcf\system\option\IOptionType::getFormElement()
*/
public function getFormElement(Option $option, $value)
{
// get options
$options = $this->parseEnableOptions($option);
WCF::getTPL()->assign(array('disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $option->parseSelectOptions(), 'value' => $value));
return WCF::getTPL()->fetch('selectOptionType');
}
示例11: loadBoxes
/**
* Loads the active dashboard boxes for the given object type and page.
*
* @param string $objectType
* @param \wcf\page\IPage $page
*/
public function loadBoxes($objectType, IPage $page)
{
$objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.dashboardContainer', $objectType);
if ($objectTypeObj === null) {
throw new SystemException("Unable to find object type '" . $objectType . "' for definition 'com.woltlab.wcf.user.dashboardContainer'");
}
$boxIDs = array();
if (isset($this->pageCache[$objectTypeObj->objectTypeID]) && is_array($this->pageCache[$objectTypeObj->objectTypeID])) {
foreach ($this->pageCache[$objectTypeObj->objectTypeID] as $boxID) {
$boxIDs[] = $boxID;
}
}
$contentTemplate = $sidebarTemplate = '';
foreach ($boxIDs as $boxID) {
$className = $this->boxCache[$boxID]->className;
if (!ClassUtil::isInstanceOf($className, 'wcf\\system\\dashboard\\box\\IDashboardBox')) {
throw new SystemException("'" . $className . "' does not implement 'wcf\\system\\dashboard\\box\\IDashboardBox'");
}
$boxObject = new $className();
$boxObject->init($this->boxCache[$boxID], $page);
if ($this->boxCache[$boxID]->boxType == 'content') {
$contentTemplate .= $boxObject->getTemplate();
} else {
$sidebarTemplate .= $boxObject->getTemplate();
}
}
WCF::getTPL()->assign(array('__boxContent' => $contentTemplate, '__boxSidebar' => $sidebarTemplate));
}
示例12: getFormElement
/**
* @see \wcf\system\option\IOptionType::getFormElement()
*/
public function getFormElement(Option $option, $value)
{
$nodeTree = new PageNodeTree();
$nodeList = $nodeTree->getIterator();
WCF::getTPL()->assign(array('nodeList' => $nodeList, 'option' => $option, 'value' => !is_array($value) ? explode("\n", $value) : $value));
return WCF::getTPL()->fetch('pageMultiSelectOptionType', 'cms');
}
示例13: assignVariables
/**
* @see \wcf\page\IPage::assignVariables()
*/
public function assignVariables()
{
parent::assignVariables();
// get phpinfo() output
ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();
// parse output
$info = preg_replace('%^.*<body>(.*)</body>.*$%s', '$1', $info);
// style fixes
// remove first table
$info = preg_replace('%<table.*?</table>(<br />)?%s', '', $info, 1);
// float logos
$info = preg_replace('%<img([^>]*)>%s', '<img style="float:right" \\1>', $info, 1);
// fix tables
$info = preg_replace('%<h2>(.*?)</h2>\\s*<table( border="0" cellpadding="3" width="600")?>%', '<div class="tabularBox tabularBoxTitle marginTop"><header><h2>\\1</h2></header><table class="table" style="table-layout:fixed;">', $info);
$info = preg_replace('%<table( border="0" cellpadding="3" width="600")?>%', '<div class="tabularBox marginTop"><table class="table" style="table-layout:fixed;">', $info);
$info = preg_replace('%<tr><td class="e">(\\w+ )<\\/td><\\/tr>%', '<tr><td class="e">\\1</td><td></td></tr>', $info);
$info = str_replace('</table>', '</table></div>', $info);
// fix display of disable_functions & disable_classes
$info = preg_replace_callback('%<td class="e">disable_(?P<t>functions|classes)</td><td class="v">(?P<l>.*?)</td><td class="v">(?P<m>.*?)</td>%s', function ($match) {
$ret = '<td class="e">disable_' . $match['t'] . '</td>';
$ret .= '<td class="v">' . str_replace(' ', ', ', rtrim(wordwrap(str_replace(',', ' ', $match['l'])))) . '</td>';
$ret .= '<td class="v">' . str_replace(' ', ', ', rtrim(wordwrap(str_replace(',', ' ', $match['m'])))) . '</td>';
return $ret;
}, $info);
WCF::getTPL()->assign(array('phpInfo' => $info));
}
示例14: assignVariables
/**
* @see wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'deletedPackageUpdateServerID' => $this->deletedPackageUpdateServerID
));
}
示例15: assignVariables
/**
* @see wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'languages' => $this->objectList->getObjects()
));
}