本文整理汇总了PHP中smarty_assign函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_assign函数的具体用法?PHP smarty_assign怎么用?PHP smarty_assign使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_assign函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDebugInfo
public static function getDebugInfo()
{
$enabled = self::$enabled && session_getUserNick() == pref_getDebugUser();
smarty_assign('debug_enabled', $enabled);
if ($enabled) {
smarty_assign('debug_messages', self::$debugInfo);
smarty_assign('debug_runningTimeMillis', self::getRunningTimeInMillis());
smarty_assign('debug_ormQueryLog', ORM::get_query_log());
}
}
示例2: runAllModules
public static function runAllModules($lexems, $definitions)
{
$adsModules = pref_getServerPreference('adsModulesH');
if ($adsModules) {
foreach ($adsModules as $adsModule) {
require_once util_getRootPath() . "phplib/ads/{$adsModule}/{$adsModule}AdsModule.php";
$className = ucfirst($adsModule) . 'AdsModule';
$module = new $className();
$result = $module->run(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
if ($result) {
smarty_assign('adsProvider', $adsModule);
smarty_assign('adsProviderParams', $result);
break;
}
}
}
}
示例3: smarty_displayPageWithSkin
function smarty_displayPageWithSkin($templateName)
{
$skin = session_getSkin();
smarty_assign('contentTemplateName', "{$skin}/{$templateName}");
smarty_display();
}
示例4: log_userLog
} else {
// Create a new lexem.
$lexem = Lexem::create($lexemName, 'T', '1', '');
$lexem->save();
$lexem->regenerateParadigm();
LexemDefinitionMap::associate($lexem->id, $definition->id);
log_userLog("Created lexem {$lexem->id} ({$lexem->form})");
}
}
}
FlashMessage::add('Definiția a fost trimisă. Un moderator o va examina în scurt timp. Vă mulțumim!', 'info');
util_redirect('contribuie');
}
} else {
smarty_assign('sourceId', session_getDefaultContribSourceId());
}
smarty_assign('contribSources', Model::factory('Source')->where('canContribute', true)->order_by_asc('displayOrder')->find_many());
smarty_assign('page_title', 'Contribuie cu definiții');
smarty_assign('suggestNoBanner', true);
smarty_displayCommonPageWithSkin('contribuie.ihtml');
/**************************************************************************/
function deleteEmptyElements(&$v)
{
$result = array();
foreach ($v as $elem) {
if (!empty($elem)) {
$result[] = $elem;
}
}
return $result;
}
示例5: util_getRequestParameter
<?php
require_once "../phplib/util.php";
$submitButton = util_getRequestParameter('submitButton');
if ($submitButton) {
util_assertModerator(PRIV_ADMIN);
$order = 1;
$ids = util_getRequestParameter("ids");
foreach ($ids as $id) {
$src = Source::get_by_id($id);
$src->displayOrder = $order++;
$src->save();
}
FlashMessage::add('Ordinea a fost salvată.', 'info');
util_redirect('surse');
}
$sources = util_isModerator(PRIV_VIEW_HIDDEN) ? Model::factory('Source')->order_by_asc('displayOrder')->find_many() : Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
smarty_assign('sources', $sources);
smarty_assign('page_title', 'Surse');
smarty_displayCommonPageWithSkin('surse.ihtml');
示例6: smarty_assign
$lexems[] = $l;
$paradigms[] = $paradigm;
}
smarty_assign('modelsToDisplay', $modelsToDisplay);
smarty_assign('lexems', $lexems);
smarty_assign('paradigms', $paradigms);
} else {
smarty_assign('selectedLocVersion', $locVersions[0]->name);
// LocVersion::changeDatabase($locVersion);
}
$modelTypes = ModelType::loadCanonical();
$models = FlexModel::loadByType($modelType ? $modelType : $modelTypes[0]->code);
smarty_assign('page_title', 'Modele de flexiune');
smarty_assign('locVersions', $locVersions);
smarty_assign('modelTypes', $modelTypes);
smarty_assign('models', $models);
smarty_displayCommonPageWithSkin('modele-flexiune.ihtml');
/*************************************************************************/
/**
* Load the forms to display for a model when a lexem already exists. This code is specific to each LOC version.
*/
function getExistingForms($lexemId, $locVersion)
{
if ($locVersion >= '5.0') {
return InflectedForm::loadByLexemIdMapByInflectionRank($lexemId);
} else {
return InflectedForm::loadByLexemIdMapByInflectionId($lexemId);
}
}
function getNewForms($lexem, $locVersion)
{
示例7: util_assertModerator
<?php
require_once "../../phplib/util.php";
util_assertModerator(PRIV_WOTD);
util_assertNotMirror();
RecentLink::createOrUpdate('Word of the Day - Imagini');
smarty_assign('sectionTitle', 'Imagini pentru cuvântul zilei');
smarty_displayWithoutSkin('admin/wotdImages.ihtml');
示例8: util_assertNotLoggedIn
<?php
require_once "../phplib/util.php";
require_once "../phplib/userPreferences.php";
util_assertNotLoggedIn();
$sendButton = util_getRequestParameter('send');
if ($sendButton) {
$userPrefs = util_getRequestCheckboxArray('userPrefs', ',');
$skin = util_getRequestParameter('skin');
session_setAnonymousPrefs($userPrefs);
if (session_isValidSkin($skin)) {
session_setSkin($skin);
}
FlashMessage::add('Preferințele au fost salvate.', 'info');
util_redirect('preferinte');
} else {
$userPrefs = session_getAnonymousPrefs();
$skin = session_getSkin();
}
foreach (preg_split('/,/', $userPrefs) as $pref) {
if (isset($userPreferencesSet[$pref])) {
$userPreferencesSet[$pref]['checked'] = true;
}
}
smarty_assign('userPrefs', $userPreferencesSet);
smarty_assign('skin', $skin);
smarty_assign('availableSkins', pref_getServerPreference('skins'));
smarty_assign('page_title', 'Preferințe');
smarty_displayCommonPageWithSkin('preferinte.ihtml');
示例9: smarty_assign
smarty_assign('inflections', $inflections);
smarty_assign('inflectionMap', Inflection::mapById($inflections));
smarty_assign('modelType', $modelType);
smarty_assign('modelNumber', $modelNumber);
smarty_assign('newModelNumber', $newModelNumber);
smarty_assign('exponent', $exponent);
smarty_assign('newExponent', $newExponent);
smarty_assign('description', $model->description);
smarty_assign('newDescription', $newDescription);
smarty_assign('participleNumber', $participleNumber);
smarty_assign('newParticipleNumber', $newParticipleNumber);
smarty_assign('newForms', $newForms);
smarty_assign('inputValues', $inputValues);
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_assign('wasPreviewed', $previewButton);
smarty_assign('errorMessage', $errorMessage);
smarty_displayWithoutSkin('flex/editModel.ihtml');
/****************************************************************************/
/**
* $a, $b: arrays of ($form, $isLoc, $recommended) tuples. Only compares the forms.
*/
function equalArrays($a, $b)
{
if (count($a) != count($b)) {
return false;
}
foreach ($a as $key => $tuple) {
if ($a[$key]['form'] != $b[$key]['form']) {
return false;
}
}
示例10: util_getRequestParameter
$skin = util_getRequestParameter('skin');
$user = session_getUser();
if (!$user) {
util_redirect('auth/login');
}
if ($sendButton) {
$user->detailsVisible = $detailsVisible ? 1 : 0;
$user->preferences = $userPrefs;
if (session_isValidSkin($skin)) {
$user->skin = $skin;
}
$user->save();
session_setVariable('user', $user);
FlashMessage::add('Informațiile au fost salvate.', 'info');
} else {
$detailsVisible = $user->detailsVisible;
$skin = session_getSkin();
$userPrefs = $user->preferences;
}
foreach (preg_split('/,/', $userPrefs) as $pref) {
if (isset($userPreferencesSet[$pref])) {
$userPreferencesSet[$pref]['checked'] = true;
}
}
smarty_assign('detailsVisible', $detailsVisible);
smarty_assign('userPrefs', $userPreferencesSet);
smarty_assign('skin', $skin);
smarty_assign('availableSkins', pref_getServerPreference('skins'));
smarty_assign('privilegeNames', $PRIV_NAMES);
smarty_assign('page_title', 'Contul meu');
smarty_displayCommonPageWithSkin('auth/contul-meu.ihtml');
示例11: date
WordOfTheDay::updateTodaysWord();
$wotd = WordOfTheDay::get_by_displayDate($mysqlDate);
}
$archive = WordOfTheDay::getArchiveWotD(date('Y', $timestamp), date('m', $timestamp));
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Definition::get_by_id($defId);
$searchResults = SearchResult::mapDefinitionArray(array($def));
setlocale(LC_ALL, 'ro_RO');
$roDate = strftime("%e %B %Y", $timestamp);
$pageTitle = sprintf("Cuvântul zilei: %s (%s)", $def->lexicon, $roDate);
if ($mysqlDate > WOTD_BIG_BANG) {
smarty_assign('prevday', date('Y/m/d', $timestamp - 86400));
}
if ($mysqlDate < $today) {
smarty_assign('nextday', date('Y/m/d', $timestamp + 86400));
}
smarty_assign('imageUrl', $wotd->getImageUrl());
smarty_assign('timestamp', $timestamp);
smarty_assign('archive', $archive);
smarty_assign('mysqlDate', $mysqlDate);
smarty_assign('page_title', $pageTitle);
smarty_assign('page_keywords', "Cuvântul zilei, {$def->lexicon}, dexonline, DEX online, {$pageTitle}");
smarty_assign('page_description', "{$pageTitle} de la dexonline");
smarty_assign('searchResult', array_pop($searchResults));
if ($type == 'url') {
smarty_assign('today', $today);
smarty_assign('title', $def->lexicon);
smarty_displayWithoutSkin('common/bits/wotdurl.ihtml');
} else {
smarty_displayCommonPageWithSkin('wotd.ihtml');
}
示例12: tempnam
// Compress the directory
OS::executeAndAssert("zip -r0 compressed.zip *");
// Move the resulting file to another temp location so it lives a little longer
$outputFile = tempnam('/tmp', 'compress_');
@unlink($outputFile);
rename("{$workDir}/compressed.zip", $outputFile);
OS::executeAndAssert("rm -rf {$workDir}");
header('Content-disposition: attachment; filename=comprimate.zip');
header('Content-Type: application/zip');
readfile($outputFile);
exit;
}
}
}
}
smarty_assign('sectionTitle', 'Comprimare imagini');
smarty_displayWithoutSkin('admin/wotdCompressImages.ihtml');
/**************************************************************************/
function recursiveScan($path, $logFile)
{
global $IGNORED_DIRS, $EXTENSIONS, $beforeBytes, $afterBytes;
$files = scandir($path);
foreach ($files as $file) {
if (in_array($file, $IGNORED_DIRS)) {
continue;
}
$full = "{$path}/{$file}";
if (is_dir($full)) {
recursiveScan($full, $logFile);
} else {
$extension = pathinfo(strtolower($full), PATHINFO_EXTENSION);
示例13: smarty_assign
<?php
require_once "../phplib/util.php";
require_once "../phplib/ads/adsModule.php";
// Display a custom ad 50% of the times
if (rand(0, 99) < 50) {
AdsModule::runAllModules(null, null);
}
smarty_assign('page_title', 'Dicționar explicativ al limbii române');
smarty_assign('onHomePage', '1');
smarty_assign('letters', preg_split('//u', 'aăâbcdefghiîjklmnopqrsștțuvwxyz'));
smarty_assign('words_total', util_formatNumber(Definition::getWordCount(), 0));
smarty_assign('words_last_month', util_formatNumber(Definition::getWordCountLastMonth(), 0));
/* WotD part */
$wotd = WordOfTheDay::getTodaysWord();
if (!$wotd) {
WordOfTheDay::updateTodaysWord();
$wotd = WordOfTheDay::getTodaysWord();
}
$wotd->ensureThumbnail();
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
smarty_assign('thumbUrl', $wotd->getThumbUrl());
smarty_assign('title', $def->lexicon);
smarty_assign('today', date('Y/m/d'));
smarty_displayPageWithSkin('index.ihtml');
示例14: util_assertModerator
<?php
require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Lexeme cu comentarii');
smarty_assign('sectionTitle', 'Lexeme cu comentarii');
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_assign('lexems', Model::factory('Lexem')->where_not_equal('comment', '')->order_by_asc('formNoAccent')->find_many());
smarty_displayWithoutSkin('flex/viewLexemsWithComments.ihtml');
示例15: htmlDiff
$changeSet = $row;
$changeSet['changesCount'] = 0;
if ($row['OldUserId'] !== $row['NewUserId']) {
$changeSet['changesCount']++;
}
if ($row['OldSourceId'] !== $row['NewSourceId']) {
$changeSet['changesCount']++;
}
if ($row['OldStatus'] !== $row['NewStatus']) {
$changeSet['OldStatusName'] = $statuses[$row['OldStatus']];
$changeSet['NewStatusName'] = $statuses[$row['NewStatus']];
$changeSet['changesCount']++;
}
if ($row['OldLexicon'] !== $row['NewLexicon']) {
$changeSet['changesCount']++;
}
if ($row['OldModUserId'] !== $row['NewModUserId']) {
$changeSet['changesCount']++;
}
if ($row['OldInternalRep'] !== $row['NewInternalRep']) {
$changeSet['diff'] = htmlDiff($row['OldInternalRep'], $row['NewInternalRep']);
$changeSet['changesCount']++;
}
if ($changeSet['changesCount'] > 0) {
$changeSets[] = $changeSet;
}
}
smarty_assign('page_title', 'Istoria definiției ' . $def->lexicon);
smarty_assign('def', $def);
smarty_assign('changeSets', $changeSets);
smarty_displayCommonPageWithSkin('istoria-definitiei.ihtml');