当前位置: 首页>>代码示例>>PHP>>正文


PHP SmartyWrap类代码示例

本文整理汇总了PHP中SmartyWrap的典型用法代码示例。如果您正苦于以下问题:PHP SmartyWrap类的具体用法?PHP SmartyWrap怎么用?PHP SmartyWrap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SmartyWrap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runAllModules

 public static function runAllModules($lexems, $definitions)
 {
     $adsModules = Config::get('global.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) {
                 SmartyWrap::assign('adsProvider', $adsModule);
                 SmartyWrap::assign('adsProviderParams', $result);
                 break;
             }
         }
     }
 }
开发者ID:florinp,项目名称:dexonline,代码行数:17,代码来源:adsModule.php

示例2: util_getRequestParameter

$submitButton = util_getRequestParameter('submitButton');
if ($deleteId) {
    $mt = MeaningTag::get_by_id($deleteId);
    $mtms = MeaningTagMap::get_all_by_meaningTagId($mt->id);
    if (count($mtms)) {
        FlashMessage::add("Nu pot șterge eticheta «{$mt->value}», deoarece unele sensuri o folosesc.", 'error');
    } else {
        $mt->delete();
        FlashMessage::add("Am șters eticheta «{$mt->value}».", 'info');
    }
    util_redirect('etichete-sensuri');
}
if ($submitButton) {
    util_assertModerator(PRIV_ADMIN);
    $values = explode(',', $value);
    foreach ($values as $value) {
        $value = trim($value);
        if ($value && !MeaningTag::get_by_value($value)) {
            $mt = Model::factory('MeaningTag')->create();
            $mt->value = $value;
            $mt->save();
        }
    }
    FlashMessage::add('Etichetele au fost salvate.', 'info');
    util_redirect('etichete-sensuri');
}
$meaningTags = Model::factory('MeaningTag')->order_by_asc('value')->find_many();
SmartyWrap::assign('meaningTags', $meaningTags);
SmartyWrap::assign('page_title', 'Etichete pentru sensuri');
SmartyWrap::display('etichete-sensuri.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:30,代码来源:etichete-sensuri.php

示例3: session_getUser

<?php

require_once "../phplib/util.php";
$user = session_getUser();
if (!$user) {
    util_redirect('auth/login');
}
SmartyWrap::assign('bookmarks', UserWordBookmarkDisplayObject::getByUser($user->id));
SmartyWrap::display('cuvinte-favorite.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:9,代码来源:cuvinte-favorite.php

示例4: foreach

    // Exercise the fields we'll need later in the view.
    // TODO: this code replicates code from search.php
    $hasUnrecommendedForms = false;
    foreach ($filtered_lexems as $l) {
        foreach ($l->getLexemModels() as $lm) {
            $lm->getModelType();
            $lm->getSourceNames();
            $map = $lm->loadInflectedFormMap();
            $lm->addLocInfo();
            foreach ($map as $ifs) {
                foreach ($ifs as $if) {
                    $hasUnrecommendedForms |= !$if->recommended;
                }
            }
        }
    }
    SmartyWrap::assign('hasUnrecommendedForms', $hasUnrecommendedForms);
    SmartyWrap::assign('lexems', $filtered_lexems);
    SmartyWrap::assign('showParadigm', true);
    SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
    SmartyWrap::assign('onlyParadigm', !$ajax);
} else {
    FlashMessage::add("Niciun rezultat pentru {$cuv}.");
    SmartyWrap::assign('page_title', "Eroare");
}
if ($ajax) {
    SmartyWrap::displayWithoutSkin('bits/multiParadigm.ihtml');
} else {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.ihtml');
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:paradigm.php

示例5: array

// $lmMatrix[$i][$j] = lexem model (with inflected forms) for lexem $i and model $j
$lmMatrix = array();
foreach ($lexems as $l) {
    $lm = $l->getFirstLexemModel();
    $lmArray = array();
    foreach ($models as $m) {
        // Force a reload
        $lm = LexemModel::get_by_id($lm->id);
        $lm->modelType = $m->modelType;
        $lm->modelNumber = $m->number;
        $lm->generateInflectedFormMap();
        $lmArray[] = $lm;
    }
    $lmMatrix[] = $lmArray;
}
// Load the definitions for each lexem
$searchResults = array();
foreach ($lexems as $l) {
    $definitions = Definition::loadByLexemId($l->id);
    $searchResults[] = SearchResult::mapDefinitionArray($definitions);
}
SmartyWrap::assign('suffix', $suffix);
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('models', $models);
SmartyWrap::assign('modelTypes', $modelTypes);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign('lmMatrix', $lmMatrix);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::addCss('paradigm');
SmartyWrap::displayAdminPage('admin/bulkLabel.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:30,代码来源:bulkLabel.php

示例6: array

        if (isset($_POST['hiddenText'])) {
            if ($_POST['hiddenText'] == '') {
                return '';
            } else {
                $search = array();
                $replace = array();
                $buffer = $_POST['hiddenText'];
                foreach ($_POST as $key => $value) {
                    if (is_numeric($key)) {
                        $search[] = '/@@' . $key . '@@/i';
                        $replace[] = $value;
                    }
                }
                return preg_replace($search, $replace, $buffer);
            }
        } else {
            return '';
        }
    }
}
if (strstr($_SERVER['SCRIPT_NAME'], 'diacritice.php')) {
    $obj = new DiacriticsFixer();
    if (isset($_POST['text']) && $_POST['text'] != '') {
        SmartyWrap::assign('textarea', '<div id="textInput">' . $obj->fix($_POST['text']) . '</div>');
        SmartyWrap::assign('hiddenText', '<input type="hidden" name="hiddenText" value="' . $obj->getHiddenText() . '">');
    } else {
        SmartyWrap::assign('textarea', '<textarea name="text" id="textInput" placeholder="introduceți textul aici">' . $obj->replaceDiacritics() . '</textarea>');
        SmartyWrap::assign('hiddenText', '<input type="hidden" name="hiddenText" value="">');
    }
    SmartyWrap::display('diacritics_fix/diacritics_fix.tpl');
}
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:diacritice.php

示例7: util_assertModerator

<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Lexeme neasociate');
$lexems = Lexem::loadUnassociated();
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('sectionTitle', 'Lexeme neasociate');
SmartyWrap::assign('sectionCount', count($lexems));
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/lexemList.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:12,代码来源:viewUnassociatedLexems.php

示例8:

    $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'] = LDiff::htmlDiff($row['OldInternalRep'], $row['NewInternalRep']);
        $changeSet['changesCount']++;
    }
    if ($changeSet['changesCount'] > 0) {
        $changeSets[] = $changeSet;
    }
}
SmartyWrap::assign('def', $def);
SmartyWrap::assign('changeSets', $changeSets);
SmartyWrap::display('istoria-definitiei.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:30,代码来源:istoria-definitiei.php

示例9: ini_set

<?php

require_once "../../phplib/util.php";
ini_set('max_execution_time', '3600');
util_assertModerator(PRIV_LOC);
util_assertNotMirror();
DebugInfo::disable();
$modelType = util_getRequestParameter('modelType');
$modelNumber = util_getRequestParameter('modelNumber');
$deleteButton = util_getRequestParameter('deleteButton');
$model = Model::factory('FlexModel')->where('modelType', $modelType)->where('number', $modelNumber)->find_one();
$lexemModels = LexemModel::loadByCanonicalModel($modelType, $modelNumber);
if ($deleteButton) {
    foreach ($lexemModels as $lm) {
        $lm->modelType = 'T';
        $lm->modelNumber = '1';
        $lm->restriction = '';
        $lm->save();
        $lm->regenerateParadigm();
    }
    $model->delete();
    util_redirect('../admin/index.php');
}
RecentLink::createOrUpdate("Ștergere model: {$model}");
SmartyWrap::assign('modelType', $modelType);
SmartyWrap::assign('modelNumber', $modelNumber);
SmartyWrap::assign('lexemModels', $lexemModels);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/deleteModel.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:29,代码来源:deleteModel.php

示例10: userCache_get

                    SmartyWrap::assign('def', $def);
                    SmartyWrap::assign('lexemIds', $lexemIds);
                    SmartyWrap::assign('user', userCache_get($def->userId));
                    SmartyWrap::displayWithoutSkin('xml/update3Definitions.tpl');
                }
                print "</Definitions>\n";
            } else {
                if ($export == 'lexems') {
                    $lexemDbResult = db_execute("select * from Lexem where modDate >= '{$timestamp}' order by modDate, id");
                    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                    print "<Lexems>\n";
                    print "<NumResults>" . $lexemDbResult->rowCount() . "</NumResults>\n";
                    foreach ($lexemDbResult as $dbRow) {
                        $lexem = Model::factory('Lexem')->create($dbRow);
                        SmartyWrap::assign('lexem', $lexem);
                        SmartyWrap::displayWithoutSkin('xml/update3Lexems.tpl');
                    }
                    print "</Lexems>\n";
                }
            }
        }
    }
}
/****************************************************************************/
function userCache_init()
{
    $GLOBALS['USER'] = array();
}
function userCache_get($key)
{
    if (array_key_exists($key, $GLOBALS['USER'])) {
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:update3.php

示例11: foreach

    $where[] = "structStatus = {$structStatus}";
}
// Process the $nick argument
if ($nick) {
    $user = User::get_by_nick($nick);
    if ($user) {
        $joins['definition'] = true;
        $where[] = "userId = {$user->id}";
    }
}
// Assemble the query
$query = Model::factory('Lexem')->table_alias('l')->select('l.*')->distinct()->order_by_asc('formNoAccent')->limit(10000);
// ... and joins
foreach ($joins as $join => $ignored) {
    switch ($join) {
        case 'definition':
            $query = $query->join('LexemDefinitionMap', 'l.id = ldm.lexemId', 'ldm')->join('Definition', 'ldm.definitionId = d.id', 'd');
            break;
        case 'lexemModel':
            $query = $query->join('LexemModel', 'l.id = lm.lexemId', 'lm');
    }
}
// ... and where clauses
foreach ($where as $clause) {
    $query = $query->where_raw("({$clause})");
}
$lexems = $query->find_many();
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/lexemSearch.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:30,代码来源:lexemSearch.php

示例12: util_redirect

                    }
                }
            }
        }
    }
    util_redirect("placeAccents.php");
}
$chars = array();
$searchResults = array();
$lexems = Model::factory('Lexem')->raw_query("select * from Lexem where form not rlike '\\'' and not noAccent order by rand() limit 10")->find_many();
foreach ($lexems as $l) {
    $charArray = array();
    $form = mb_strtoupper($l->form);
    $len = mb_strlen($form);
    for ($i = 0; $i < $len; $i++) {
        $c = StringUtil::getCharAt($form, $i);
        $charArray[] = ctype_space($c) ? '&nbsp;' : $c;
    }
    $chars[$l->id] = $charArray;
    $definitions = Definition::loadByLexemId($l->id);
    $searchResults[$l->id] = SearchResult::mapDefinitionArray($definitions);
}
RecentLink::createOrUpdate('Plasare accente');
SmartyWrap::assign('sectionTitle', 'Plasare accente');
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('chars', $chars);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign("allStatuses", util_getAllStatuses());
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/placeAccents.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:30,代码来源:placeAccents.php

示例13: util_getRequestParameter

$token = util_getRequestParameter('token');
$identity = util_getRequestParameter('identity');
$pt = PasswordToken::get_by_token($token);
$data = FileCache::get($identity);
if (!$pt) {
    FlashMessage::add('Ați introdus un cod de recuperare incorect.');
} else {
    if ($pt->createDate < time() - 24 * 3600) {
        FlashMessage::add('Codul de recuperare introdus a expirat.');
    } else {
        if (!$data) {
            FlashMessage::add('Ați introdus o identitate incorectă.');
        } else {
            $user = User::get_by_id($pt->userId);
            if (!$user) {
                FlashMessage::add('Ați introdus un cod de recuperare incorect.');
            } else {
                if ($user->identity) {
                    FlashMessage::add('Acest cont a fost deja revendicat de o identitate OpenID.');
                } else {
                    FlashMessage::add('Contul dumneavoastră a fost recuperat și unificat cu identitatea OpenID.', 'info');
                    session_login($user, $data);
                }
            }
        }
    }
}
SmartyWrap::assign('page_title', 'Recuperarea parolei');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::display('auth/passwordRecoveryWrongData.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:30,代码来源:recuperare-parola.php

示例14: util_getRequestParameter

<?php

require_once "../phplib/util.php";
$type = util_getRequestParameter('t');
if ($type == 'rss') {
    $articles = WikiArticle::getRss();
    $results = array();
    foreach ($articles as $a) {
        $results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle()));
    }
    header("Content-type: application/rss+xml");
    SmartyWrap::assign('rss_title', 'Articole lingvistice - dexonline');
    SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/');
    SmartyWrap::assign('rss_description', 'Articole pe teme lingvistice de la dexonline');
    SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
    SmartyWrap::assign('results', $results);
    SmartyWrap::displayWithoutSkin('xml/rss.tpl');
    exit;
}
SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles());
SmartyWrap::display('articole.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:21,代码来源:articole.php

示例15: session_getUser

<?php

require_once "../phplib/util.php";
$user = session_getUser();
if (!$user) {
    util_redirect('auth/login');
}
SmartyWrap::assign('page_title', 'Cuvinte favorite');
SmartyWrap::assign('bookmarks', UserWordBookmarkDisplayObject::getByUser($user->id));
SmartyWrap::display('cuvinte-favorite.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:10,代码来源:cuvinte-favorite.php


注:本文中的SmartyWrap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。