本文整理汇总了PHP中modX::setPlaceholder方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::setPlaceholder方法的具体用法?PHP modX::setPlaceholder怎么用?PHP modX::setPlaceholder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::setPlaceholder方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPermissions
/**
* Checks user permissions to view the results
*
* @param array $rows
*
* @return array
*/
public function checkPermissions($rows = array())
{
$permissions = array();
if (!empty($this->config['checkPermissions'])) {
$tmp = array_map('trim', explode(',', $this->config['checkPermissions']));
foreach ($tmp as $v) {
$permissions[$v] = true;
}
} else {
return $rows;
}
$total = $this->modx->getPlaceholder($this->config['totalVar']);
foreach ($rows as $key => $row) {
/** @var modAccessibleObject $object */
$object = $this->modx->newObject($this->config['class']);
$object->_fields['id'] = $row['id'];
if ($object instanceof modAccessibleObject && !$object->checkPolicy($permissions)) {
unset($rows[$key]);
$this->addTime($this->config['class'] . ' #' . $row['id'] . ' was excluded from results, because you do not have enough permissions');
$total--;
}
}
$this->addTime('Checked for permissions "' . implode(',', array_keys($permissions)) . '"');
$this->modx->setPlaceholder($this->config['totalVar'], $total);
return $rows;
}
示例2: setSuccessMessage
/**
* Sets the success message placeholders
*
* @param string $message
* @return void
*/
public function setSuccessMessage($message = '')
{
$successMsg = $this->modx->getOption('successMessage', $this->config, $message);
$this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'success', true);
if (!empty($successMsg)) {
$smPlaceholder = $this->modx->getOption('successMessagePlaceholder', $this->config, $this->config['placeholderPrefix'] . 'successMessage');
$this->modx->setPlaceholder($smPlaceholder, $successMsg);
}
}
示例3: output
/**
* Either return a value or set to placeholder, depending on setting
*
* @param string $output
* @param boolean $toPlaceholder
* @return string
*/
public function output($output = '', $toPlaceholder = false)
{
if (!empty($toPlaceholder)) {
$this->modx->setPlaceholder($toPlaceholder, $output);
return '';
} else {
return $output;
}
}
示例4: clearCache
protected function clearCache()
{
$this->modx->cacheManager->delete('system_settings/config', array('cache_key' => ''));
$results = array();
$partitions = array('menu' => array());
$this->modx->cacheManager->refresh($partitions, $results);
$this->modx->setPlaceholder('+' . $this->config->getLowCaseName() . '.core_path', $this->packageCorePath);
$this->modx->setPlaceholder('+' . $this->config->getLowCaseName() . '.assets_path', $this->packageAssetsPath);
$this->modx->setPlaceholder('+' . $this->config->getLowCaseName() . '.assets_url', $this->packageAssetsUrl);
}
示例5: processErrors
/**
* Process the errors that have occurred and setup the appropriate placeholders
* @return void
*/
public function processErrors()
{
$this->modx->toPlaceholders($this->getErrors(), $this->config['placeholderPrefix'] . 'error');
$bulkErrTpl = $this->getOption('validationErrorBulkTpl');
$errs = array();
foreach ($this->getRawErrors() as $field => $err) {
$errs[] = str_replace(array('[[+field]]', '[[+error]]'), array($field, $err), $bulkErrTpl);
}
$errs = implode($this->getOption('validationErrorBulkSeparator'), $errs);
$validationErrorMessage = str_replace('[[+errors]]', $errs, $this->getOption('validationErrorMessage'));
$this->modx->setPlaceholder($this->getOption('placeholderPrefix') . 'validation_error', true);
$this->modx->setPlaceholder($this->getOption('placeholderPrefix') . 'validation_error_message', $validationErrorMessage);
}
示例6: processErrors
/**
* Process any errors returned by the hooks and set them to placeholders
* @return void
*/
public function processErrors()
{
$errors = array();
$placeholderErrors = $this->getErrors();
foreach ($placeholderErrors as $key => $error) {
$errors[$key] = str_replace('[[+error]]', $error, $this->config['errTpl']);
}
$this->modx->toPlaceholders($errors, $this->config['placeholderPrefix'] . 'error');
$errorMsg = $this->getErrorMessage();
if (!empty($errorMsg)) {
$this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'error_message', $errorMsg);
}
}
示例7: processErrors
/**
* Process the errors that have occurred and setup the appropriate placeholders
* @return void
*/
public function processErrors()
{
$this->modx->toPlaceholders($this->getErrors(), $this->config['placeholderPrefix'] . 'error');
$errs = array();
foreach ($this->getRawErrors() as $field => $err) {
$err = $field . ': ' . $err;
$errs[] = str_replace('[[+error]]', $err, $this->config['validationErrorBulkTpl']);
}
$errs = implode($this->config['validationErrorBulkSeparator'], $errs);
$validationErrorMessage = str_replace('[[+errors]]', $errs, $this->config['validationErrorMessage']);
$this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'validation_error', true);
$this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'validation_error_message', $validationErrorMessage);
}
示例8: getLatestCommentsCall
/**
* Get the call for the latest comments
*
* @param string $placeholderPrefix
* @return string
*/
public function getLatestCommentsCall($placeholderPrefix = '')
{
$settings = $this->getContainerSettings();
$output = '[[!QuipLatestComments?
&type=`family`
&family=`b' . $this->get('id') . '`
&tpl=`' . $this->xpdo->getOption('latestCommentsTpl', $settings, 'quipLatestComment') . '`
&limit=`' . $this->xpdo->getOption('latestCommentsLimit', $settings, 10) . '`
&bodyLimit=`' . $this->xpdo->getOption('latestCommentsBodyLimit', $settings, 300) . '`
&rowCss=`' . $this->xpdo->getOption('latestCommentsRowCss', $settings, 'quip-latest-comment') . '`
&altRowCss=`' . $this->xpdo->getOption('latestCommentsAltRowCss', $settings, 'quip-latest-comment-alt') . '`
]]';
$this->xpdo->setPlaceholder($placeholderPrefix . 'latest_comments', $output);
return $output;
}
示例9: render
/**
* Render the controller.
*
* @return string
*/
public function render()
{
if ($this->modx->getOption('discuss.debug', null, true)) {
$this->modx->setLogTarget('ECHO');
$this->startDebugTimer();
}
foreach ($this->config as $k => $v) {
$this->setPlaceholder('controller.' . $k, $v);
}
foreach ($this->discuss->config as $k => $v) {
$this->setPlaceholder('discuss.config.' . $k, $v);
}
$this->initialize();
$allowed = $this->checkPermissions();
if ($allowed !== true) {
if (is_string($allowed)) {
$this->modx->sendRedirect($allowed);
} else {
$this->discuss->sendUnauthorizedPage();
}
}
$sessionPlace = $this->getSessionPlace();
if (!empty($sessionPlace)) {
$this->discuss->setSessionPlace($sessionPlace);
}
$this->handleActions();
$this->process();
if ($this->discuss->user->isLoggedIn) {
$this->getUserTop();
}
if ($this->getOption('showStatistics', true)) {
$this->getStatistics();
}
$title = $this->getPageTitle();
if (!empty($title)) {
$this->modx->setPlaceholder('discuss.pagetitle', $title);
}
$this->_renderBreadcrumbs();
$this->_renderModules();
$tpl = $this->getOption('pageTpl', false);
$tpl = $tpl ? $this->discuss->config['pagesPath'] . $tpl . '.tpl' : $this->config['tpl'];
$output = $this->_renderTemplate($tpl, $this->placeholders);
$output = $this->afterRender($output);
return $this->_output($output);
}
示例10: render
/**
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
*
* @param array $scriptProperties
* @return string - The HTML to be embedded in the user's form.
*/
public function render($scriptProperties = array())
{
if (empty($this->config[FormItReCaptcha::OPT_PUBLIC_KEY])) {
return $this->error($this->modx->lexicon('recaptcha.no_api_key'));
}
/* use ssl or not */
$server = !empty($this->config[FormItReCaptcha::OPT_USE_SSL]) ? FormItReCaptcha::API_SECURE_SERVER : FormItReCaptcha::API_SERVER;
$opt = $this->getOptions($scriptProperties);
$html = '<script type="text/javascript">var RecaptchaOptions = ' . $this->modx->toJSON($opt) . ';</script><script type="text/javascript" src="' . $server . 'challenge?k=' . $this->config[FormItReCaptcha::OPT_PUBLIC_KEY] . '"></script>
<noscript><div>
<object data="' . $server . 'noscript?k=' . $this->config[FormItReCaptcha::OPT_PUBLIC_KEY] . '" height="' . $opt['height'] . '" width="' . $opt['width'] . '" style="width: ' . $opt['width'] . 'px; height: ' . $opt['height'] . 'px;"></object>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/></div>
</noscript>';
$this->modx->setPlaceholder('formit.recaptcha_html', $html);
$this->modx->setPlaceholder($scriptProperties['placeholderPrefix'] . 'recaptcha_html', $html);
return $html;
}
示例11: setPlaceholder
/**
* @param $key
* @param $value
*/
public function setPlaceholder($key, $value)
{
$this->modx->setPlaceholder($key, $value);
}
示例12: isModerator
/**
* See if a user is a moderator of a board
* @param int $boardId
* @return bool
*/
public function isModerator($boardId)
{
if (!array_key_exists($boardId, $this->moderatorships)) {
if ($this->xpdo->discuss->user->isGlobalModerator() || $this->xpdo->discuss->user->isAdmin()) {
$isModerator = true;
} else {
$moderator = $this->xpdo->getCount('disModerator', array('user' => $this->get('id'), 'board' => $boardId));
$isModerator = $moderator > 0;
}
$this->moderatorships[$boardId] = $isModerator;
$this->xpdo->setPlaceholder('discuss.user.isModerator', $isModerator);
}
return $this->moderatorships[$boardId];
}
示例13: die
if ($homeResource instanceof modResource) {
$modx->resource = $homeResource;
} else {
echo "\nNo Resource\n";
}
}
}
if (!$modx->user->hasSessionContext('mgr')) {
die('Unauthorized Access');
}
require_once $modx->getOption('ce.core_path', NULL, $modx->getOption('core_path') . 'components/classextender/') . 'model/classextender/classextender.class.php';
// include 'classextender.class.php';
$modx->lexicon->load('classextender:default');
$props =& $scriptProperties;
$ce = new ClassExtender($modx, $props);
if (!$ce instanceof ClassExtender) {
die($this->modx->lexicon('ce.no_class_extender'));
}
$ce->init();
$output .= $ce->displayForm();
if ($ce->hasError()) {
$modx->setPlaceholder('ce_results', $ce->getOutput());
return '[[+ce_results]]';
}
if (isset($_POST['submitVar']) && $_POST['submitVar'] == 'submitVar') {
$ce->process();
$cm = $modx->getCacheManager();
$cm->refresh();
}
$modx->setPlaceholder('ce_results', $ce->getOutput());
return $output;