unserialize() public static method

アンシリアライズ base64_decode が前提
public static unserialize ( mixed $value ) : mixed
$value mixed 対象文字列
return mixed
Esempio n. 1
0
 /**
  * ウィジェットエリアを表示する
  *
  * @param $no ウィジェットエリアNO
  * @param array $options オプション
  *  `subDir` (boolean) エレメントのパスについてプレフィックスによるサブディレクトリを追加するかどうか
  *  ※ その他のパラメータについては、View::element() を参照
  */
 public function show($no, $options = array())
 {
     $options = array_merge(array('subDir' => true), $options);
     $WidgetArea = ClassRegistry::init('WidgetArea');
     $widgetArea = $WidgetArea->find('first', array('conditions' => array('WidgetArea.id' => $no)));
     if (empty($widgetArea['WidgetArea']['widgets'])) {
         return;
     }
     $widgets = BcUtil::unserialize($widgetArea['WidgetArea']['widgets']);
     usort($widgets, array('BcWidgetAreaHelper', '_widgetSort'));
     foreach ($widgets as $key => $widget) {
         $key = key($widget);
         if ($widget[$key]['status']) {
             $params = array();
             $plugin = '';
             $params['widget'] = true;
             if (empty($_SESSION['Auth']['User']) && !isset($cache)) {
                 $params['cache'] = '+1 month';
             }
             $params = am($params, $widget[$key]);
             $params[$no . '_' . $widget[$key]['id']] = $no . '_' . $widget[$key]['id'];
             // 同じタイプのウィジェットでキャッシュを特定する為に必要
             if (!empty($params['plugin'])) {
                 $plugin = Inflector::camelize($params['plugin']) . '.';
                 unset($params['plugin']);
             }
             $this->_View->BcBaser->element($plugin . 'widgets/' . $widget[$key]['element'], $params, $options);
         }
     }
 }
Esempio n. 2
0
/**
 * [ADMIN] ユーザー一覧 検索ボックス
 *
 * baserCMS :  Based Website Development Project <http://basercms.net>
 * Copyright 2008 - 2015, baserCMS Users Community <http://sites.google.com/site/baserusers/>
 *
 * @copyright		Copyright 2008 - 2015, baserCMS Users Community
 * @link			http://basercms.net baserCMS Project
 * @package			Baser.View
 * @since			baserCMS v 2.0.0
 * @license			http://basercms.net/license/index.html
 */
$priorities = array('0.1' => '0.1', '0.2' => '0.2', '0.3' => '0.3', '0.4' => '0.4', '0.5' => '0.5', '0.6' => '0.6', '0.7' => '0.7', '0.8' => '0.8', '0.9' => '0.9', '1.0' => '1.0');
$categories = am(array('none' => 'カテゴリなし'), BcUtil::unserialize($this->BcBaser->siteConfig['content_categories']));
$types = BcUtil::unserialize($this->BcBaser->siteConfig['content_types']);
?>

<?php 
echo $this->BcForm->create('Content', array('url' => array('action' => 'index')));
echo $this->BcForm->hidden('Content.open', array('value' => true));
?>
<p>
	<span><?php 
echo $this->BcForm->label('Content.type', 'タイプ');
?>
 <?php 
echo $this->BcForm->input('Content.type', array('type' => 'select', 'options' => $types, 'empty' => '指定なし'));
?>
</span>
	<span><?php 
Esempio n. 3
0
 /**
  * アイキャッチサイズフィールドの値をフォーム用に変換する
  * 
  * @param array $data
  * @return array 
  */
 public function constructEyeCatchSize($data)
 {
     $eyeCatchSize = BcUtil::unserialize($data['BlogContent']['eye_catch_size']);
     $data['BlogContent']['eye_catch_size_thumb_width'] = $eyeCatchSize['thumb_width'];
     $data['BlogContent']['eye_catch_size_thumb_height'] = $eyeCatchSize['thumb_height'];
     $data['BlogContent']['eye_catch_size_mobile_thumb_width'] = $eyeCatchSize['mobile_thumb_width'];
     $data['BlogContent']['eye_catch_size_mobile_thumb_height'] = $eyeCatchSize['mobile_thumb_height'];
     return $data;
 }
<div class="widget widget-site-search widgetsite-search-<?php 
    echo $id;
    ?>
">
<?php 
}
?>
		<?php 
echo $this->BcForm->create('Content', array('type' => 'get', 'action' => 'search', 'url' => $url));
?>
		<?php 
if (BcUtil::unserialize($this->BcBaser->siteConfig['content_categories'])) {
    ?>
		<div class="form-group form-group-sm">
			<?php 
    echo $this->BcForm->input('Content.c', array('type' => 'select', 'options' => BcUtil::unserialize($this->BcBaser->siteConfig['content_categories']), 'empty' => 'カテゴリー: 指定しない ', 'class' => 'form-control'));
    ?>
		<!-- /.form-group --></div>
		<?php 
}
?>
		<div class="form-inline">
			<div class="form-group form-group-sm">
				<?php 
echo $this->BcForm->input('Content.q', array('class' => 'form-control'));
?>
				<?php 
echo $this->BcForm->submit('検索', array('div' => false, 'class' => 'btn btn-default btn-sm'));
?>
			<!-- /.form-group --></div>
		<!-- /.form-inline --></div>
Esempio n. 5
0
 /**
  * baserマーケットのテーマデータを取得する
  */
 public function admin_ajax_get_market_themes()
 {
     $baserThemes = array();
     $cachePath = 'views' . DS . 'baser_market_themes.rss';
     if (Configure::read('debug') > 0) {
         clearCache('baser_market_themes', 'views', '.rss');
     }
     $baserThemes = cache($cachePath);
     if (!$baserThemes) {
         $Xml = new Xml();
         try {
             $baserThemes = $Xml->build(Configure::read('BcApp.marketThemeRss'));
         } catch (Exception $ex) {
         }
         if ($baserThemes) {
             $baserThemes = $Xml->toArray($baserThemes->channel);
             $baserThemes = $baserThemes['channel']['item'];
             cache($cachePath, BcUtil::serialize($baserThemes));
             chmod(CACHE . $cachePath, 0666);
         } else {
             $baserThemes = array();
         }
     } else {
         $baserThemes = BcUtil::unserialize($baserThemes);
     }
     $this->set('baserThemes', $baserThemes);
 }
Esempio n. 6
0
 /**
  * シリアライズ / アンシリアライズ
  */
 public function testSerialize()
 {
     // BcUtil::serialize()でシリアライズした場合
     $serialized = BcUtil::serialize('hoge');
     $result = BcUtil::unserialize($serialized);
     $this->assertEquals('hoge', $result, 'BcUtil::serialize()で正しくシリアライズ/アンシリアライズできません');
     // serialize()のみでシリアライズした場合
     $serialized = serialize('hoge');
     $result = BcUtil::unserialize($serialized);
     $this->assertEquals('hoge', $result, 'serializeのみで正しくシリアライズ/アンシリアライズできません');
 }
Esempio n. 7
0
 /**
  * ウィジェットを並び替えた上で取得する
  * 
  * @param int $id
  * @return array $widgets
  * @access public
  */
 public function get_widgets($id)
 {
     $widgetArea = $this->WidgetArea->read(null, $id);
     if (!empty($widgetArea['WidgetArea']['widgets'])) {
         $widgets = BcUtil::unserialize($widgetArea['WidgetArea']['widgets']);
         usort($widgets, 'widgetSort');
         return $widgets;
     }
 }
Esempio n. 8
0
 /**
  * SimplePieでフィードを取得する
  *
  * @param string RSSのURL
  * @param string キャッシュ保持期間
  * @return array RSSデータ
  */
 protected function _getFeed($url, $cacheExpires = null)
 {
     if (!$url) {
         return false;
     }
     if (Configure::read('Cache.check') == false || Configure::read('debug') > 0) {
         // キャッシュをクリア
         clearCache($this->_createCacheHash('', $url), 'views', '.rss');
     }
     // キャッシュを取得
     $cachePath = $this->cacheFolder . DS . $this->_createCacheHash('.rss', $url);
     $rssData = cache($cachePath, null, $cacheExpires);
     if (empty($rssData)) {
         $SimplePie = new SimplePie();
         $SimplePie->set_feed_url($url);
         $SimplePie->enable_cache(false);
         // 一旦デバッグモードをオフに
         $debug = Configure::read('debug');
         Configure::write('debug', 0);
         $ret = $SimplePie->init();
         Configure::write('debug', $debug);
         if (!$ret) {
             return false;
         }
         $rssData = $this->_convertSimplePie($SimplePie->get_items());
         // ログインしてなければキャッシュを作成
         if (!isset($_SESSION['Auth'][Configure::read('BcAuthPrefix.admin.sessionKey')])) {
             cache($cachePath, BcUtil::serialize($rssData));
             chmod(CACHE . $cachePath, 0666);
         }
         if ($rssData) {
             return $rssData;
         } else {
             return false;
         }
     } else {
         return BcUtil::unserialize($rssData);
     }
 }
Esempio n. 9
0
 /**
  * よく使う項目の初期データをユーザーに適用する
  * 
  * @param type $userId
  * @param type $userGroupId
  */
 public function applyDefaultFavorites($userId, $userGroupId)
 {
     $result = true;
     $defaultFavorites = $this->UserGroup->field('default_favorites', array('UserGroup.id' => $userGroupId));
     if ($defaultFavorites) {
         $defaultFavorites = BcUtil::unserialize($defaultFavorites);
         if ($defaultFavorites) {
             $this->deleteFavorites($userId);
             foreach ($defaultFavorites as $favorites) {
                 $favorites['user_id'] = $userId;
                 $favorites['sort'] = $this->Favorite->getMax('sort', array('Favorite.user_id' => $userId)) + 1;
                 $this->Favorite->create($favorites);
                 if (!$this->Favorite->save()) {
                     $result = false;
                 }
             }
         }
     }
     return $result;
 }
Esempio n. 10
0
<?php 
echo $this->BcForm->end();
?>

<?php 
if ($this->request->action == 'admin_edit') {
    ?>
	<div class="section">
		<div class="panel-box corner10">
			<h2>「よく使う項目」の初期データ</h2>
			<p>
				<small>このグループに新しいユーザーを登録した際、次の「よく使う項目」が登録されます。	</small>
			</p>
			<?php 
    $favorites = BcUtil::unserialize($this->request->data['UserGroup']['default_favorites']);
    ?>
			<?php 
    if ($favorites) {
        ?>
			<ul class="clearfix">
				<?php 
        foreach ($favorites as $favorite) {
            ?>
					<li style="float:left"><?php 
            $this->BcBaser->link($favorite['name'], $favorite['url']);
            ?>
</li>
				<?php 
        }
        ?>
 /**
  * ウィジェットを並び替えた上で取得する
  *
  * @param int $id
  * @return array $widgets
  * @deprecated 4.1.0 since 4.0.0 BcWidgetAreaHelper::showWidgets() に移行
  */
 public function get_widgets($id)
 {
     trigger_error(deprecatedMessage('メソッド:WidgetAreaController::get_widgets()', '4.0.0', '4.1.0', 'このメソッドは非推奨となりました。BcWidgetAreaHelper::showWidgets() に移行してください。'), E_USER_DEPRECATED);
     $widgetArea = $this->WidgetArea->read(null, $id);
     if (!empty($widgetArea['WidgetArea']['widgets'])) {
         $widgets = BcUtil::unserialize($widgetArea['WidgetArea']['widgets']);
         usort($widgets, 'widgetSort');
         return $widgets;
     } else {
         return [];
     }
 }