本文整理汇总了PHP中Utility::hardDecode方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::hardDecode方法的具体用法?PHP Utility::hardDecode怎么用?PHP Utility::hardDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::hardDecode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndexing
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndexing()
{
ini_set('max_execution_time', 0);
ob_start();
$index = new Zend_Search_Lucene(Yii::getPathOfAlias($this->_indexFilesPath), true);
$criteria = new CDbCriteria();
$criteria->compare('t.publish', 1);
$criteria->order = 'album_id DESC';
//$criteria->limit = 10;
$model = Albums::model()->findAll($criteria);
foreach ($model as $key => $item) {
if ($item->media_id != 0) {
$images = Yii::app()->request->baseUrl . '/public/album/' . $item->album_id . '/' . $item->cover->media;
} else {
$images = '';
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', CHtml::encode($item->album_id), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('media', CHtml::encode($images), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', CHtml::encode($item->title), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('body', CHtml::encode(Utility::hardDecode(Utility::softDecode($item->body))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('url', CHtml::encode(Utility::getProtocol() . '://' . Yii::app()->request->serverName . Yii::app()->createUrl('album/site/view', array('id' => $item->album_id, 't' => Utility::getUrlTitle($item->title)))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', CHtml::encode(Utility::dateFormat($item->creation_date, true) . ' WIB'), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('creation', CHtml::encode($item->user->displayname), 'utf-8'));
$index->addDocument($doc);
}
echo 'Album Lucene index created';
$index->commit();
$this->redirect(Yii::app()->createUrl('article/search/indexing'));
ob_end_flush();
}
示例2: actionPage
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionPage($id)
{
$model = OmmuPages::model()->findByPk($id, array());
$this->pageTitle = Phrase::trans($model->name, 2);
$this->pageDescription = Utility::shortText(Utility::hardDecode(Phrase::trans($model->desc, 2)), 300);
$this->pageMeta = '';
$this->pageImage = $model->media != '' && $model->media_show == 1 ? Yii::app()->request->baseUrl . '/public/page/' . $model->media : '';
$this->render('application.webs.maintenance.front_page', array('model' => $model));
}
示例3:
<?php
if ($model->media != '') {
$images = Yii::app()->request->baseUrl . '/public/page/' . $model->media;
} else {
$images = Yii::app()->request->baseUrl . '/public/page/page_default.png';
}
?>
<div class="clearfix">
<div class="sep">
<img src="<?php
echo Utility::getTimThumb($images, 300, 300, 1);
?>
" alt="<?php
echo Phrase::trans($model->name, 2);
?>
">
<?php
echo Phrase::trans($model->quote, 2);
?>
</div>
<div class="sep"><?php
echo Phrase::trans($model->name, 2) != Utility::hardDecode(Phrase::trans($model->desc, 2)) ? Utility::cleanImageContent(Phrase::trans($model->desc, 2)) : '';
?>
</div>
</div>
示例4: array
?>
">
<?php
if ($results[$i]->media != '') {
?>
<img src="<?php
echo Utility::getTimThumb($results[$i]->media, 200, 120, 1);
?>
" alt="<?php
echo CHtml::encode($results[$i]->title);
?>
">
<?php
}
if ($i == 0) {
echo CHtml::link(Utility::hardDecode(Utility::softDecode($results[$i]->title)), CHtml::encode($results[$i]->url), array('class' => 'title'));
} else {
echo CHtml::link($query->highlightMatches($results[$i]->title), CHtml::encode($results[$i]->url), array('class' => 'title'));
}
echo $results[$i]->body != '' ? $query->highlightMatches(CHtml::encode(Utility::shortText($results[$i]->body, 300))) : '';
?>
<div><i class="fa fa-link"></i><?php
echo CHtml::link($query->highlightMatches(CHtml::encode($results[$i]->url)), CHtml::encode($results[$i]->url));
?>
</div>
</div>
<?php
}
}
?>
</div>
示例5: beforeRender
/**
* Meta description and keyword generate
*/
protected function beforeRender($view)
{
$model = OmmuSettings::model()->findByPk(1, array('select' => 'site_title, site_keywords, site_description'));
if (!Yii::app()->request->isAjaxRequest) {
if (parent::beforeRender($view)) {
// Ommu custom description and keyword
if (!empty($this->pageDescription)) {
$description = $this->pageDescription;
} else {
$description = $model->site_description;
}
Yii::app()->clientScript->registerMetaTag(Utility::hardDecode($description), 'description');
if (!empty($this->pageMeta)) {
$keywords = $model->site_keywords . ',' . $this->pageMeta;
} else {
$keywords = $model->site_keywords;
}
Yii::app()->clientScript->registerMetaTag(Utility::hardDecode($keywords), 'keywords');
/**
* Facebook open graph and all custom metatags
* @title
* @description
* @image
*/
// title
Yii::app()->meta->googlePlusTags['name'] = Yii::app()->meta->facebookTags['og:title'] = Yii::app()->meta->twitterTags['twitter:title'] = CHtml::encode($this->pageTitle) . ' | ' . $model->site_title;
// description
Yii::app()->meta->googlePlusTags['description'] = Yii::app()->meta->facebookTags['og:description'] = Yii::app()->meta->twitterTags['twitter:description'] = ucfirst(strtolower($description));
// image
if (!empty($this->pageImage)) {
Yii::app()->meta->facebookTags['og:image'] = Yii::app()->meta->googlePlusTags['image'] = Yii::app()->meta->twitterTags['twitter:image:src'] = Utility::getProtocol() . '://' . Yii::app()->request->serverName . $this->pageImage;
}
// language
$this->lang = Utility::getLanguage();
Yii::app()->setLanguage($this->lang);
}
} else {
$this->pageDescription = $this->pageDescription != '' ? ucfirst(strtolower($this->pageDescription)) : $model->site_description;
$this->pageMeta = $this->pageMeta != '' ? $model->site_keywords . ', ' . $this->pageMeta : $model->site_keywords;
}
$this->pageTitle = $this->pageTitle != '' ? $this->pageTitle : 'Titlenya Lupa..';
return true;
}
示例6: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id = null, $static = null)
{
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
Utility::applyCurrentTheme($this->module);
//$this->pageGuest = true;
if ($id == null) {
$criteria = new CDbCriteria();
$criteria->condition = 'publish = :publish';
$criteria->params = array(':publish' => 1);
$criteria->order = 'creation_date DESC';
$dataProvider = new CActiveDataProvider('OmmuPages', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
$this->pageTitle = '';
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('application.webs.page.front_index', array('dataProvider' => $dataProvider));
} else {
if ($static == null) {
$model = $this->loadModel($id);
$title = Phrase::trans($model->name, 2);
$description = Phrase::trans($model->desc, 2);
$image = $model->media != '' && $model->media_show == 1 ? Yii::app()->request->baseUrl . '/public/page/' . $model->media : '';
} else {
$server = Utility::getConnected(Yii::app()->params['server_options']['bpad']);
if ($server != 'neither-connected') {
if (in_array($server, Yii::app()->params['server_options']['localhost'])) {
$server = $server . '/bpadportal';
}
$url = $server . preg_replace('(' . Yii::app()->request->baseUrl . ')', '', Yii::app()->createUrl('api/page/detail'));
$item = array('id' => $id);
$items = http_build_query($item);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch,CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $items);
$output = curl_exec($ch);
$model = json_decode($output);
}
$title = $model->success == '0' ? 'Page not found' : $model->title;
$description = $model->success == '0' ? '' : $model->description;
$image = $model->success == '0' ? '' : $model->media_image != '-' ? $model->media_image : '';
}
if ($static == null && $model == null || $static != null && $model->success == '0') {
throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
}
$this->pageTitleShow = true;
$this->pageTitle = $title;
$this->pageDescription = Utility::shortText(Utility::hardDecode($description), 200);
$this->pageMeta = '';
$this->pageImage = $image;
$this->render('application.webs.page.front_view', array('model' => $model, 'a' => $static));
}
}
示例7: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$setting = ArticleSetting::model()->findByPk(1, array('select' => 'meta_keyword'));
$model = $this->loadModel($id);
Articles::model()->updateByPk($id, array('view' => $model->view + 1));
//Random Article
$criteria = new CDbCriteria();
$criteria->condition = 'publish = :publish AND published_date <= curdate() AND article_id <> :id';
$criteria->params = array(':publish' => 1, ':id' => $id);
$criteria->order = 'RAND()';
$criteria->addInCondition('cat_id', $model->cat_id);
$criteria->limit = 4;
$random = Articles::model()->findAll($criteria);
$this->pageTitle = $model->title;
$this->pageDescription = Utility::shortText(Utility::hardDecode($model->body), 300);
$this->pageMeta = ArticleTag::getKeyword($setting->meta_keyword, $id);
if ($model->media_id != 0 && $model->cover->media != '') {
if (in_array($model->article_type, array('1', '3'))) {
$media = Yii::app()->request->baseUrl . '/public/article/' . $id . '/' . $model->cover->media;
} else {
if ($model->article_type == 2) {
$media = 'http://www.youtube.com/watch?v=' . $model->cover->media;
}
}
$this->pageImage = $media;
}
$this->render('front_view', array('model' => $model, 'random' => $random));
}
示例8: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$setting = AlbumSetting::model()->findByPk(1, array('select' => 'meta_keyword'));
$model = $this->loadModel($id);
Albums::model()->updateByPk($id, array('view' => $model->view + 1));
$photo = AlbumPhoto::model()->findAll(array('condition' => 'album_id = :id', 'params' => array(':id' => $model->album_id), 'order' => 'media_id DESC'));
$this->pageTitleShow = true;
$this->pageTitle = $model->title;
$this->pageDescription = Utility::shortText(Utility::hardDecode($model->body), 300);
$this->pageMeta = $setting->meta_keyword;
$this->render('front_view', array('model' => $model, 'photo' => $photo));
}
示例9: array
</span><?php
}
?>
</div>
<?php
//end.Tools
?>
</div>
<a class="title" href="<?php
echo Yii::app()->createUrl('article/' . $controller . '/view', array('id' => $val->article_id, 't' => Utility::getUrlTitle($val->title)));
?>
" title="<?php
echo $val->title;
?>
"><?php
echo $val->title;
?>
</a><br/>
<p><?php
echo Utility::shortText(Utility::hardDecode($val->body), 300, ' ...');
?>
</p>
</div>
<?php
}
?>
</div>
</div>
<?php
}
//end.Inspiration
示例10: array
echo Yii::app()->controller->createUrl('view', array('id' => $data->article_id, 't' => Utility::getUrlTitle($data->title)));
?>
" title="<?php
echo $data->title;
?>
"><?php
echo Utility::hardDecode($data->title);
?>
</a>
<div class="meta">
<i class="fa fa-calendar-check-o"></i><?php
echo Utility::dateFormat($data->published_date);
?>
<?php
if ($data->media_file != '') {
?>
<i class="fa fa-download"></i><?php
echo $data->download;
}
?>
<i class="fa fa-eye"></i><?php
echo $data->view;
?>
</div>
<p><?php
echo Utility::shortText(Utility::hardDecode($data->body), 100);
?>
</p>
</div>
<?php
}
示例11: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$setting = AlbumSetting::model()->findByPk(1, array('select' => 'meta_keyword'));
$model = $this->loadModel($id);
Albums::model()->updateByPk($id, array('view' => $model->view + 1));
$photo = AlbumPhoto::model()->findAll(array('condition' => 'album_id = :id', 'params' => array(':id' => $model->album_id), 'order' => 'media_id DESC'));
//Random Article
$criteria = new CDbCriteria();
$criteria->condition = 'publish = :publish AND album_id <> :id';
$criteria->params = array(':publish' => 1, ':id' => $id);
$criteria->order = 'RAND()';
$criteria->limit = 4;
$random = Albums::model()->findAll($criteria);
$this->pageTitleShow = true;
$this->pageTitle = $model->title;
$this->pageDescription = Utility::shortText(Utility::hardDecode($model->body), 300);
$this->pageMeta = $setting->meta_keyword;
if ($model->media_id != 0 && $model->cover->media != '') {
$media = Yii::app()->request->baseUrl . '/public/album/' . $id . '/' . $model->cover->media;
$this->pageImage = $media;
}
$this->render('front_view', array('model' => $model, 'photo' => $photo, 'random' => $random));
}
示例12: actionIndexing
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndexing()
{
ini_set('max_execution_time', 0);
ob_start();
$index = new Zend_Search_Lucene(Yii::getPathOfAlias($this->_indexFilesPath), true);
$criteria = new CDbCriteria();
$now = new CDbExpression("NOW()");
$criteria->compare('t.publish', 1);
$criteria->compare('date(published_date) <', $now);
$criteria->order = 'article_id DESC';
//$criteria->limit = 10;
$model = Articles::model()->findAll($criteria);
foreach ($model as $key => $item) {
if ($item->media_id != 0) {
$images = Yii::app()->request->baseUrl . '/public/article/' . $item->article_id . '/' . $item->cover->media;
} else {
$images = '';
}
if (in_array($item->cat_id, array(2, 3, 5, 6, 7, 18))) {
$url = Yii::app()->createUrl('article/news/site/view', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
} else {
if (in_array($item->cat_id, array(9))) {
$url = Yii::app()->createUrl('article/site/view', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
} else {
if (in_array($item->cat_id, array(10, 15, 16))) {
$url = Yii::app()->createUrl('article/archive/site/view', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
} else {
if (in_array($item->cat_id, array(23, 24, 25))) {
$url = Yii::app()->createUrl('article/newspaper/site/view', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
} else {
if (in_array($item->cat_id, array(13, 14, 20, 21))) {
$url = Yii::app()->createUrl('article/regulation/site/download', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
} else {
if (in_array($item->cat_id, array(19))) {
$url = Yii::app()->createUrl('article/announcement/site/download', array('id' => $item->article_id, 't' => Utility::getUrlTitle($item->title)));
}
}
}
}
}
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', CHtml::encode($item->article_id), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Keyword('category', CHtml::encode(Phrase::trans($item->cat->name, 2)), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('media', CHtml::encode($images), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', CHtml::encode($item->title), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('body', CHtml::encode(Utility::hardDecode(Utility::softDecode($item->body))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('url', CHtml::encode(Utility::getProtocol() . '://' . Yii::app()->request->serverName . $url), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', CHtml::encode(Utility::dateFormat($item->published_date, true) . ' WIB'), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('creation', CHtml::encode($item->user->displayname), 'utf-8'));
$index->addDocument($doc);
}
echo 'Artkel Lucene index created';
$index->commit();
$this->redirect(Yii::app()->createUrl('video/search/indexing'));
ob_end_flush();
}
示例13: searchIndexing
/**
* Albums get information
*/
public function searchIndexing($index)
{
Yii::import('application.modules.album.models.*');
$criteria = new CDbCriteria();
$criteria->compare('t.publish', 1);
$criteria->order = 'album_id DESC';
//$criteria->limit = 10;
$model = Albums::model()->findAll($criteria);
foreach ($model as $key => $item) {
if ($item->media_id != 0) {
$images = Yii::app()->request->baseUrl . '/public/album/' . $item->album_id . '/' . $item->cover->media;
} else {
$images = '';
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', CHtml::encode($item->album_id), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('media', CHtml::encode($images), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', CHtml::encode($item->title), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('body', CHtml::encode(Utility::hardDecode(Utility::softDecode($item->body))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('url', CHtml::encode(Utility::getProtocol() . '://' . Yii::app()->request->serverName . Yii::app()->createUrl('album/site/view', array('id' => $item->album_id, 't' => Utility::getUrlTitle($item->title)))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', CHtml::encode(Utility::dateFormat($item->creation_date, true) . ' WIB'), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('creation', CHtml::encode($item->user->displayname), 'utf-8'));
$index->addDocument($doc);
}
return true;
}