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


PHP iaLanguage::exists方法代码示例

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


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

示例1: output

 public function output()
 {
     $outputValues = $this->getValues();
     switch ($this->getRequestType()) {
         case self::REQUEST_JSON:
             header('Content-Type: application/json');
             $iaUtil = $this->iaCore->factory('util');
             if (isset($outputValues[self::JSON_MAGIC_KEY]) && 1 == count($outputValues)) {
                 $outputValues = array_values($outputValues[self::JSON_MAGIC_KEY]);
             }
             echo $iaUtil->jsonEncode($outputValues);
             break;
         case self::REQUEST_HTML:
             header('Content-Type: text/html');
             $iaSmarty =& $this->iaSmarty;
             foreach ($outputValues as $key => $value) {
                 $iaSmarty->assign($key, $value);
             }
             // set page notifications
             $messages = $this->getMessages();
             $notifications = array();
             foreach (array(self::ERROR, self::SUCCESS, self::ALERT, self::SYSTEM) as $type) {
                 empty($messages[$type]) || ($notifications[$type] = is_array($messages[$type]) ? $messages[$type] : array($messages[$type]));
             }
             $pageName = $this->name();
             if (iaCore::ACCESS_ADMIN == $this->iaCore->getAccessType()) {
                 $adminActions = self::PAGE_ERROR == $pageName ? array() : $this->_getAdminToolbarActions();
                 $this->set('toolbarActions', $adminActions);
             }
             $iaSmarty->assign('member', iaUsers::hasIdentity() ? iaUsers::getIdentity(true) : array());
             // define smarty super global $core
             $core = array('actions' => $this->_setActions(), 'config' => $this->iaCore->getConfig(), 'customConfig' => $this->iaCore->getCustomConfig(), 'language' => $this->iaCore->languages[$this->language], 'languages' => $this->iaCore->languages, 'notifications' => $notifications, 'packages' => $this->iaCore->packagesData, 'page' => array('breadcrumb' => iaBreadcrumb::render(), 'info' => $this->getParams(), 'nonProtocolUrl' => $this->assetsUrl, 'name' => $pageName, 'title' => $this->get('caption', $this->get('title', 'Subrion CMS'))), 'providers' => iaUsers::getAuthProviders());
             if (iaCore::ACCESS_FRONT == $this->iaCore->getAccessType()) {
                 // get meta-description
                 $value = $this->get('description');
                 $metaDescription = empty($value) && iaLanguage::exists('page_metadescr_' . $pageName) ? iaLanguage::get('page_metadescr_' . $pageName) : $value;
                 $core['page']['meta-description'] = iaSanitize::html($metaDescription);
                 // get meta-keywords
                 $value = $this->get('keywords');
                 $metaKeywords = empty($value) && iaLanguage::exists('page_metakeyword_' . $pageName) ? iaLanguage::get('page_metakeyword_' . $pageName) : $value;
                 $core['page']['meta-keywords'] = iaSanitize::html($metaKeywords);
                 $this->_logStatistics();
                 header('X-Powered-CMS: Subrion CMS');
             }
             $iaSmarty->assignByRef('core', $core);
             $this->iaCore->startHook('phpCoreDisplayBeforeShowBody');
             $content = '';
             if ($this->get('body', self::NONE) != self::NONE) {
                 $content = $iaSmarty->fetch($this->_retrieveTemplatePath($this->get('body')));
             }
             if ($this->_layoutEnabled) {
                 $iaSmarty->assign('_content_', $content);
                 $content = $iaSmarty->fetch('layout' . self::TEMPLATE_FILENAME_EXT);
             }
             echo $content;
             break;
         case self::REQUEST_XML:
             header('Content-Type: text/xml');
             function htmldecode($text)
             {
                 $text = html_entity_decode($text);
                 $text = htmlspecialchars($text);
                 return $text;
             }
             function xmlEncode(array $array, &$parentObject)
             {
                 static $section;
                 foreach ($array as $key => $value) {
                     switch (true) {
                         case is_array($array[key($array)]):
                             if (!is_numeric($key)) {
                                 $node = $parentObject->addChild($key);
                                 xmlEncode($value, $node);
                             } else {
                                 $node = $parentObject->addChild($section);
                                 foreach ($value as $k => $v) {
                                     $node->addChild($k, htmldecode($v));
                                 }
                             }
                             break;
                         case is_array($value):
                             $section = $key;
                             xmlEncode($value, $parentObject);
                             break;
                         default:
                             $parentObject->addChild($key, htmldecode($value));
                     }
                 }
             }
             $xmlObject = new SimpleXMLElement('<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"></rss>');
             xmlEncode($outputValues, $xmlObject);
             echo $xmlObject->asXML();
             break;
         default:
             header('HTTP/1.1 501');
             exit;
     }
 }
开发者ID:UzielSilva,项目名称:subrion,代码行数:98,代码来源:ia.core.view.php

示例2: delete

 public function delete($id, $log = true)
 {
     $iaDb =& $this->iaDb;
     $row = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id));
     $title = self::LANG_PATTERN_TITLE . $id;
     $title = iaLanguage::exists($title) ? iaLanguage::get($title) : $row['title'];
     $this->iaCore->startHook('beforeBlockDelete', array('block' => &$row));
     $result = parent::delete($id);
     if ($result) {
         $iaDb->delete('`object_type` = :object && `object` = :id', self::getPagesTable(), array('id' => $id, 'object' => 'blocks'));
         $iaDb->delete('`key` = :title OR `key` = :content', iaLanguage::getTable(), array('title' => self::LANG_PATTERN_TITLE . $id, 'content' => self::LANG_PATTERN_CONTENT . $id));
         if ($log) {
             $this->iaCore->factory('log')->write(iaLog::ACTION_DELETE, array('item' => 'block', 'name' => $title, 'id' => $id));
         }
     }
     $this->iaCore->startHook('afterBlockDelete', array('block' => &$row));
     return $result;
 }
开发者ID:intelliants,项目名称:subrion,代码行数:18,代码来源:ia.admin.block.php


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