本文整理汇总了PHP中Engine类的典型用法代码示例。如果您正苦于以下问题:PHP Engine类的具体用法?PHP Engine怎么用?PHP Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Engine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saludo
public function saludo($nombre)
{
// View::set("name", $nombre);
// View::set("title", "Custom MVC");
// View::render("front\\home");
$templates = new Engine('../src/App/Views/front/');
echo $templates->render('error', ['name' => 'Jonathan']);
}
示例2: ensureCorrectGear
public function ensureCorrectGear(Engine $engine, $speed)
{
$engineSize = $engine->getSize();
$turbo = $engine->isTurbo();
// Some complicated code to determine correct gear
// setting based on $engineSize, $turbo, $speed etc.
// ... omitted ...
return "Working out correct gear at {$speed}mph for a SPORT gearbox";
}
示例3: testEngineExecute
/**
* @expectedException Exception
*/
public function testEngineExecute()
{
$arrConf = array('true' => array('InitContext', 'CommonParamChecker'), 'sourceFlag in [3]' => array('SdkParamChecker'));
$phase = new PhaseParamCheck($arrConf);
$phase = new Phase('paramCheck', $phase->actions);
$engine = new Engine();
$result = $engine->executeSinglePhase($phase);
$this->assertEquals(false, $result);
}
示例4: GetQuestionByArrayId
public function GetQuestionByArrayId($aArrayId, $aOrder = null)
{
if (!is_array($aArrayId) || count($aArrayId) == 0) {
return array();
}
if (!is_array($aOrder)) {
$aOrder = array($aOrder);
}
$sOrder = '';
foreach ($aOrder as $key => $value) {
$value = (string) $value;
if (!in_array($key, array('question_id', 'question_category_id', 'question_date_add', 'question_user_ip'))) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
$sql = "SELECT * FROM " . Config::Get('db.table.receptiondesk_questions') . " WHERE question_id IN(?a) ORDER BY { FIELD(question_id,?a) }";
if ($sOrder != '') {
$sql .= $sOrder;
}
$aQuestion = array();
if ($aRows = $this->oDb->select($sql, $aArrayId, $sOrder == '' ? $aArrayId : DBSIMPLE_SKIP)) {
foreach ($aRows as $aRow) {
$aQuestion[] = Engine::GetEntity('PluginReceptiondesk_ModuleQuestion_EntityQuestion', $aRow);
}
}
return $aQuestion;
}
示例5: _smarty_include
function _smarty_include($params)
{
if (isset($params['smarty_include_tpl_file'])) {
$params['smarty_include_tpl_file'] = Engine::getInstance()->Plugin_GetDelegate('template', $params['smarty_include_tpl_file']);
}
parent::_smarty_include($params);
}
示例6: GetSubscribes
public function GetSubscribes($aFilter, $aOrder, &$iCount, $iCurrPage, $iPerPage)
{
$aOrderAllow = array('id', 'date_add', 'status');
$sOrder = '';
foreach ($aOrder as $key => $value) {
if (!in_array($key, $aOrderAllow)) {
unset($aOrder[$key]);
} elseif (in_array($value, array('asc', 'desc'))) {
$sOrder .= " {$key} {$value},";
}
}
$sOrder = trim($sOrder, ',');
if ($sOrder == '') {
$sOrder = ' id desc ';
}
if (isset($aFilter['exclude_mail']) and !is_array($aFilter['exclude_mail'])) {
$aFilter['exclude_mail'] = array($aFilter['exclude_mail']);
}
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . Config::Get('db.table.subscribe') . "\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\n\t\t\t\t\t{ AND target_type = ? }\n\t\t\t\t\t{ AND target_id = ?d }\n\t\t\t\t\t{ AND mail = ? }\n\t\t\t\t\t{ AND mail not IN (?a) }\n\t\t\t\t\t{ AND `key` = ? }\n\t\t\t\t\t{ AND status = ?d }\n\t\t\t\tORDER by {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t";
$aResult = array();
if ($aRows = $this->oDb->selectPage($iCount, $sql, isset($aFilter['target_type']) ? $aFilter['target_type'] : DBSIMPLE_SKIP, isset($aFilter['target_id']) ? $aFilter['target_id'] : DBSIMPLE_SKIP, isset($aFilter['mail']) ? $aFilter['mail'] : DBSIMPLE_SKIP, (isset($aFilter['exclude_mail']) and count($aFilter['exclude_mail'])) ? $aFilter['exclude_mail'] : DBSIMPLE_SKIP, isset($aFilter['key']) ? $aFilter['key'] : DBSIMPLE_SKIP, isset($aFilter['status']) ? $aFilter['status'] : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage)) {
foreach ($aRows as $aRow) {
$aResult[] = Engine::GetEntity('Subscribe', $aRow);
}
}
return $aResult;
}
示例7: UpdateImage
/**
* Edit image
*
* @param PluginLsgallery_ModuleImage_EntityImage $oImage
* @return boolean
*/
public function UpdateImage($oImage)
{
$oImageOld = $this->GetImageById($oImage->getId());
$oImage->setDateEdit();
/* @var $oAlbum PluginLsgallery_ModuleAlbum_EntityAlbum */
$oAlbum = $this->PluginLsgallery_Album_GetAlbumById($oImage->getAlbumId());
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("image_update"));
$this->Cache_Delete("image_{$oImage->getId()}");
$this->oMapper->UpdateImage($oImage);
if ($oImage->getImageTags() != $oImageOld->getImageTags()) {
/**
* Обновляем теги
*/
$aTags = explode(',', $oImage->getImageTags());
$this->DeleteImageTagsByImageId($oImage->getId());
if ($oAlbum->getType() == PluginLsgallery_ModuleAlbum_EntityAlbum::TYPE_OPEN) {
foreach ($aTags as $sTag) {
$oTag = Engine::GetEntity('PluginLsgallery_ModuleImage_EntityImageTag');
$oTag->setImageId($oImage->getId());
$oTag->setAlbumId($oImage->getAlbumId());
$oTag->setText(trim($sTag));
$this->oMapper->AddImageTag($oTag);
}
}
}
return true;
}
示例8: Init
public function Init()
{
$this->oMapper = Engine::GetMapper(__CLASS__);
//get me my DB link baby
$this->oUserCurrent = $this->User_GetUserCurrent();
//do I need this?
}
示例9: run
public function run($template)
{
if (file_exists(TEMP_CONFIG_FILE)) {
Engine::getConfig()->setConfigFilename(TEMP_CONFIG_FILE);
Engine::getConfig()->open();
}
}
示例10: Exec
/**
* Запуск обработки
*/
public function Exec()
{
$sEntity = $this->GetParam('entity');
$oTarget = $this->GetParam('target');
$sTargetType = $this->GetParam('target_type');
if (!$oTarget) {
$oTarget = Engine::GetEntity($sEntity);
}
$aBehaviors = $oTarget->GetBehaviors();
foreach ($aBehaviors as $oBehavior) {
if ($oBehavior instanceof ModuleCategory_BehaviorEntity) {
/**
* Если в параметрах был тип, то переопределяем значение. Это необходимо для корректной работы, когда тип динамический.
*/
if ($sTargetType) {
$oBehavior->setParam('target_type', $sTargetType);
}
/**
* Нужное нам поведение - получаем список текущих категорий
*/
$this->Viewer_Assign('categoriesSelected', $oBehavior->getCategories(), true);
/**
* Загружаем параметры
*/
$aParams = $oBehavior->getParams();
$this->Viewer_Assign('params', $aParams, true);
/**
* Загружаем список доступных категорий
*/
$this->Viewer_Assign('categories', $this->Category_GetCategoriesTreeByTargetType($oBehavior->getCategoryTargetType()), true);
break;
}
}
$this->SetTemplate('component@field.category');
}
示例11: EventAjaxSet
protected function EventAjaxSet()
{
if (!F::isPost('url')) {
return false;
}
if (!$this->CheckSeopackFields()) {
return false;
}
$sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url'));
if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($sUrl))) {
$oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack');
$oSeopack->setUrl($sUrl);
}
if (F::GetRequest('title_auto') && F::GetRequest('description_auto') && F::GetRequest('keywords_auto')) {
$oSeopack->Delete();
E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok'));
return;
}
$oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title')));
$oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description')));
$oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords')));
if ($oSeopack->Save()) {
if ($oSeopack->getTitle()) {
E::ModuleViewer()->AssignAjax('title', $oSeopack->getTitle());
}
E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok'));
}
return;
}
示例12: smarty_function_show_blocks
/**
* Показывает блоки определенно группы
*
* @param unknown_type $params
* @param unknown_type $smarty
* @return unknown
*/
function smarty_function_show_blocks($aParams, &$oSmarty)
{
if (!array_key_exists('group', $aParams)) {
trigger_error("show_blocks: missing 'group' parameter", E_USER_WARNING);
return;
}
$sGroup = $aParams['group'];
$aBlocks = Engine::getInstance()->Viewer_GetBlocks(true);
$sResult = '';
if (isset($aBlocks[$sGroup]) and is_array($aBlocks[$sGroup])) {
$oSmarty->loadPlugin('smarty_insert_block');
foreach ($aBlocks[$sGroup] as $aBlock) {
if ($aBlock['type'] == 'block') {
$sResult .= smarty_insert_block(array('block' => $aBlock['name'], 'params' => isset($aBlock['params']) ? $aBlock['params'] : array()), $oSmarty);
} elseif ($aBlock['type'] == 'template') {
$sResult .= $oSmarty->getSubTemplate($aBlock['name'], $oSmarty->cache_id, $oSmarty->compile_id, null, null, array('params' => isset($aBlock['params']) ? $aBlock['params'] : array()), Smarty::SCOPE_LOCAL);
}
}
}
if (!empty($aParams['assign'])) {
$oSmarty->assign($aParams['assign'], $sResult);
} else {
return $sResult;
}
}
示例13: GetTopicsByArrayId
public function GetTopicsByArrayId($aArrayId)
{
$oUserCurrent = PluginLib_ModuleUser::GetUserCurrent();
$sAccessWhere = $oUserCurrent->isAdministrator() ? '' : ' AND ' . PluginAccesstotopic_ModuleAccess::GetAccessWhereStatment($oUserCurrent->getId());
if (!is_array($aArrayId) or count($aArrayId) == 0) {
return array();
}
$sql = 'SELECT
t.*,
tc.*
FROM
' . Config::Get('db.table.topic') . ' as t
JOIN ' . Config::Get('db.table.topic_content') . ' as tc ON t.topic_id=tc.topic_id
WHERE
t.topic_id IN(?a)
' . $sAccessWhere . '
ORDER BY FIELD(t.topic_id,?a) ';
$aTopics = array();
if ($aRows = $this->oDb->select($sql, $aArrayId, $aArrayId)) {
foreach ($aRows as $aTopic) {
$aTopics[] = Engine::GetEntity('Topic', $aTopic);
}
}
return $aTopics;
}
示例14: _createTopic
/**
* Create topic with default values
*
* @param int $iBlogId
* @param int $iUserId
* @param string $sTitle
* @param string $sText
* @param string $sTags
* @param string $sDate
*
* @return ModuleTopic_EntityTopic
*/
private function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate)
{
$this->aActivePlugins = $this->oEngine->Plugin_GetActivePlugins();
$oTopic = Engine::GetEntity('Topic');
/* @var $oTopic ModuleTopic_EntityTopic */
$oTopic->setBlogId($iBlogId);
$oTopic->setUserId($iUserId);
$oTopic->setUserIp('127.0.0.1');
$oTopic->setForbidComment(false);
$oTopic->setType('topic');
$oTopic->setTitle($sTitle);
$oTopic->setPublishIndex(true);
$oTopic->setPublish(true);
$oTopic->setPublishDraft(true);
$oTopic->setDateAdd($sDate);
$oTopic->setTextSource($sText);
list($sTextShort, $sTextNew, $sTextCut) = $this->oEngine->Text_Cut($oTopic->getTextSource());
$oTopic->setCutText($sTextCut);
$oTopic->setText($this->oEngine->Text_Parser($sTextNew));
$oTopic->setTextShort($this->oEngine->Text_Parser($sTextShort));
$oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle()));
$oTopic->setTags($sTags);
//with active plugin l10n added a field topic_lang
if (in_array('l10n', $this->aActivePlugins)) {
$oTopic->setTopicLang(Config::Get('lang.current'));
}
// @todo refact this
$oTopic->_setValidateScenario('topic');
$oTopic->_Validate();
$this->oEngine->Topic_AddTopic($oTopic);
return $oTopic;
}
示例15: isMatch
public function isMatch($URL)
{
//Check if we're forcing a new URL
$forcingNewAnalysis = $URL == $this->getNewAnalysisURL();
//Are they matching the URL?
$isMatchingURL = $URL == $this->getURL() || $forcingNewAnalysis;
//Are they logged in?
$isLoggedIn = $this->user->isLoggedIn();
if ($isMatchingURL && $isLoggedIn) {
//Only start considering if it's a match here as we need to query the database after this.
$dbh = Engine::getDatabase();
//If this user exists in the database, they have used our application
//before and an analysis would have been created on authentication
$this->userExists = $dbh->query("SELECT * FROM Users WHERE User_ID=" . $this->user->id)->fetch(PDO::FETCH_ASSOC) != null;
if (!$forcingNewAnalysis && $this->userExists) {
ob_clean();
header("Location: " . Engine::getRemoteAbsolutePath((new Account())->getURL()));
exit;
}
if (!$this->userExists) {
$dbh->exec("INSERT INTO Users (User_ID, Name, Email) VALUES ('" . User::instance()->id . "', '" . User::instance()->name . "', '" . User::instance()->email . "')");
}
//Otherwise, we are a new user and we don't need to force a new analysis
return true;
} else {
if ($isMatchingURL && !$isLoggedIn) {
//Go back home as we're not authenticated.
require 'login.php';
} else {
//Wasn't a match at all.
return false;
}
}
}