本文整理汇总了PHP中ArrayAdapter::inst方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayAdapter::inst方法的具体用法?PHP ArrayAdapter::inst怎么用?PHP ArrayAdapter::inst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayAdapter
的用法示例。
在下文中一共展示了ArrayAdapter::inst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_ctrl_button
function smarty_function_ctrl_button($params, Smarty_Internal_Template &$template)
{
$adapter = ArrayAdapter::inst($params);
$data = array();
if ($adapter->has('states')) {
$type = 'states';
$data['states'] = explode(' ', $adapter->str('states'));
} else {
$data['hoverable'] = $adapter->bool('hoverable');
$data['gray'] = $adapter->bool('gray');
$data['popup'] = $adapter->bool('popup');
$data['blank'] = $adapter->bool('blank');
$data['title'] = $adapter->str('title');
$data['href'] = $adapter->str('href');
$data['action'] = $adapter->str('action');
$data['class'] = $adapter->str('class');
$data['name'] = $adapter->str(array('name', 'img', 'action'));
$type = $adapter->str('type');
$type = $type ? $type : 'button';
}
/* @var $buttonTpl Smarty_Internal_Template */
$buttonTpl = $template->smarty->createTemplate("discussion/controls/{$type}.tpl");
$buttonTpl->assign($data);
$buttonTpl->display();
}
示例2: smarty_function_linkup_js
function smarty_function_linkup_js($params, Smarty_Internal_Template &$smarty)
{
$params = ArrayAdapter::inst($params);
$dir = $params->str('dir');
$name = $params->str('name');
$di = DirManager::resources('scripts')->getDirItem($dir, $name, 'js');
echo $di->isFile() ? PsHtml::linkJs($di) : '';
}
示例3: smarty_function_progress
function smarty_function_progress($params, Smarty_Internal_Template &$smarty)
{
$PA = ArrayAdapter::inst($params);
$params['total'] = $PA->int('total');
$params['current'] = $PA->int('current');
$params['title'] = $PA->has('title') ? $PA->str('title') : 'Прогресс';
PSSmarty::template('common/progress.tpl', $params)->display();
}
示例4: smarty_function_versein
function smarty_function_versein($params, Smarty_Internal_Template &$template)
{
$params = ArrayAdapter::inst($params);
$poetIdent = $params->str('poet');
$verseIdent = $params->str('verse');
$verse = PoetsManager::inst()->getVerse($poetIdent, $verseIdent);
echo $verse->getContent();
}
示例5: smarty_function_video
function smarty_function_video($params, Smarty_Internal_Template &$smarty)
{
$params = ArrayAdapter::inst($params);
MmediaManager::getInstance()->insertVideo($params->str('dir'), $params->str('name'));
if (PostFetchingContext::getInstance()->isSetted()) {
PostFetchingContext::getInstance()->setHasVideo();
}
}
示例6: smarty_function_linkup_css
function smarty_function_linkup_css($params, Smarty_Internal_Template &$smarty)
{
$params = ArrayAdapter::inst($params);
$dir = $params->str('dir');
$name = $params->str('name');
$media = $params->str('media');
$di = DirManager::resources('css')->getDirItem($dir, $name, 'css');
echo $di->isFile() ? PsHtml::linkCss($di, $media) : '';
}
示例7: smarty_function_versein
function smarty_function_versein($params, Smarty_Internal_Template &$template)
{
$params = ArrayAdapter::inst($params);
$poetIdent = $params->str('poet');
$verseIdent = $params->str('verse');
$verse = PoetsManager::inst()->getVerse($poetIdent, $verseIdent);
echo $verse->getContent();
FoldedContextWatcher::getInstance()->setDependsOnEntity($verse->getFoldedEntity());
}
示例8: smarty_block_verse
function smarty_block_verse($params, $content, Smarty_Internal_Template &$template)
{
if (!$content) {
return;
}
$params = ArrayAdapter::inst($params);
$content = trim($content);
$name = $params->str('name');
$year = $params->str('year');
$double = $params->bool('double');
/*
* Обработка содержимого
*/
$verses = array();
if ($double) {
$versesTmp = array();
$strings = explode("\n", $content);
$verse = '';
$break = 0;
foreach ($strings as $str) {
$str = trim($str);
if (!$str) {
if ($verse) {
$verse .= "\n";
++$break;
}
} else {
if ($break > 1) {
$versesTmp[] = $verse;
$verse = $str;
} else {
$verse .= "\n{$str}";
}
$break = 0;
}
}
if ($verse) {
$versesTmp[] = $verse;
}
$double = count($versesTmp) > 1;
if ($double) {
for ($index = 0; $index < count($versesTmp); $index = $index + 2) {
$v1 = nl2br(trim($versesTmp[$index]));
$v2 = array_key_exists($index + 1, $versesTmp) ? nl2br(trim($versesTmp[$index + 1])) : '';
$verses[] = array($v1, $v2);
}
}
}
/* @var $verseTpl Smarty_Internal_Template */
$verseTpl = $template->smarty->createTemplate('common/verse.tpl');
$verseTpl->assign('b_double', $double);
$verseTpl->assign('c_name', $name);
$verseTpl->assign('c_body', nl2br($content));
$verseTpl->assign('verses', $verses);
$verseTpl->assign('c_year', $year);
$verseTpl->display();
}
示例9: smarty_block_hidden
function smarty_block_hidden($params, $content, Smarty_Internal_Template &$template)
{
if (!$content) {
return;
}
$params = ArrayAdapter::inst($params);
$name = $params->str(array('name', 'text'));
$toggle = $params->bool('toggle');
$content = trim($content);
$tpl = $template->smarty->createTemplate('common/hidden_text.tpl');
$tpl->assign('name', $name ? $name : 'показать');
$tpl->assign('toggle', $toggle);
$tpl->assign('body', $content);
$tpl->display();
}
示例10: __construct
private function __construct($id)
{
$this->id = 1 * $id;
$this->BEAN = MosaicImgBean::inst();
$params = ArrayAdapter::inst($this->BEAN->getImgInfo($this->id));
$this->width = $params->int('w');
$this->height = $params->int('h');
$this->cellsXcnt = $params->int('cx');
$this->cellsYcnt = $params->int('cy');
$this->cellWidth = $params->int('cw');
$this->cellHeight = $params->int('ch');
$this->cellsTotal = $this->cellsXcnt * $this->cellsYcnt;
$this->LOGGER = PsLogger::inst(__CLASS__);
$this->PROFILER = PsProfiler::inst(__CLASS__);
$this->tryResyncImg();
}
示例11: init
public final function init(ArrayAdapter $params)
{
//Стандартные параметры
$this->name = $params->str('name', 'Акция');
$this->isActive = $params->bool('active', true);
$this->isByDate = $params->hasNoEmpty('to');
if ($this->isByDate) {
$this->secondsLeft = strtotime($params->str('to')) - time();
$this->isActive = $this->isActive && $this->secondsLeft > 0;
}
//Параметры акции (только те, что начинаются с data_)
$this->params = ArrayAdapter::inst($params->getByKeyPrefix('data_', true));
//Полный идентификатор акции
$this->stockIdent = $this->sign($this->params->getData());
//Вызовем инициализацию класса-наследника
$this->onInit($this->params);
}
示例12: smarty_block_sortable
function smarty_block_sortable($params, $content, Smarty_Internal_Template &$smarty)
{
if (!$content) {
return;
//---
}
$params = ArrayAdapter::inst($params);
$sep = $params->str('sep');
$strings = explode("\n", trim($content));
$res = array();
foreach ($strings as $str) {
if (isEmpty($str)) {
continue;
}
$items = explode('||', $str);
$res[] = array('l' => trim($items[0]), 'r' => trim($items[1]), 's' => $sep);
}
PSSmarty::template('common/sortable.tpl', array('strings' => $res))->display();
}
示例13: __construct
public function __construct($mandatory = true, $fileFormParam = FORM_PARAM_FILE)
{
if (!array_key_exists($fileFormParam, $_FILES)) {
check_condition(!$mandatory, "Ключ [{$fileFormParam}] не найден в массиве файлов");
return;
//---
}
$this->params = ArrayAdapter::inst($_FILES[$fileFormParam]);
$code = $this->params->int('error');
if (!$mandatory && $code == UPLOAD_ERR_NO_FILE) {
return;
//---
}
check_condition($code == UPLOAD_ERR_OK, $this->getErrorDescription($code));
$tmpName = $this->params->str('tmp_name');
check_condition(is_uploaded_file($tmpName), 'Файл не является загруженным');
$size = $this->params->int('size');
check_condition($size > 0 && $size <= UPLOAD_MAX_FILE_SIZE, "Недопустимый размер загружаемого файла: {$size} байт.");
$this->valid = true;
}
示例14: smarty_block_partition
function smarty_block_partition($params, $content, Smarty_Internal_Template &$smarty)
{
if (!$content) {
return;
}
$type = PostFetchingContext::getInstance()->getFoldedEntity()->getFolding()->getFoldingSubType();
$aa = ArrayAdapter::inst(explode(':', $content));
$MAKROS = $aa->str(0);
$VALUE = $aa->str(1);
switch ($type) {
case POST_TYPE_TRAINING:
//УПРАЖНЕНИЯ
switch ($MAKROS) {
case 'PLAN':
echo '<h3>План урока:</h3>';
break;
case 'VIDEO':
echo '<h3>Видео урок:</h3>';
break;
case 'CONSPECT':
echo '<h3>Конспект занятия:</h3>';
break;
case 'TASKS':
if (!$VALUE) {
echo '<h3>Контрольные вопросы и задачи:</h3>';
} else {
echo "<h3 class=\"section\">{$VALUE}</h4>";
}
break;
case 'FINAL':
echo '<h3>Заключение:</h3>';
break;
default:
echo "<h3>{$content}</h3>";
break;
}
break;
default:
check_condition(false, __FUNCTION__ . ' function cannot be used with post type ' . $type);
}
}
示例15: smarty_block_table
function smarty_block_table($params, $content, Smarty_Internal_Template &$smarty)
{
if (!$content) {
return;
//---
}
$params = ArrayAdapter::inst($params);
$strings = explode("\n", trim($content));
$res = array();
foreach ($strings as $str) {
$items = explode('||', $str);
if (isEmpty($items)) {
continue;
}
$processed = array();
foreach ($items as $item) {
$processed[] = explode('::', trim($item));
}
$res[] = $processed;
}
PSSmarty::template('common/table.tpl', array('items' => $res, 'class' => $params->str('class')))->display();
}