Esempio n. 1
0
 /**
  * コンテンツIDを取得する
  * 一つのプラグインで複数のコンテンツを実装する際に利用する。
  *
  * @return int $pluginNo
  * @access public
  */
 public function getContentId()
 {
     // 管理画面の場合には取得しない
     if (!empty($this->request->params['admin'])) {
         return null;
     }
     if (!isset($this->request->url)) {
         return null;
     }
     $contentName = '';
     $url = preg_replace('/^\\//', '', $this->request->url);
     if (!$url) {
         return null;
     }
     // コンテンツ名取得
     $request = new CakeRequest($url);
     $pureUrl = getPureUrl($request);
     $aryPureUrl = explode('/', $pureUrl);
     $contentName = $aryPureUrl[0];
     // プラグインと同じ名前のコンテンツ名の場合に正常に動作しないので
     // とりあえずコメントアウト
     /* if( Inflector::camelize($url) == $this->name){
     	  return null;
     	  } */
     $pluginContent = $this->PluginContent->findByName($contentName);
     if ($pluginContent) {
         return $pluginContent['PluginContent']['content_id'];
     } else {
         return null;
     }
 }
Esempio n. 2
0
}
/**
 * Object::cakeError() の為、router.php が読み込まれた事をマークしておく
 * BaserAppModel::cakeError で利用
 */
Configure::write('BcRequest.routerLoaded', true);
// プラグインの基底クラス読み込み
// bootstrapで読み込むの場合、継承元のクラスが読み込まれていない為エラーとなる。
App::uses('BaserPluginApp', 'Controller');
App::uses('BaserPluginAppModel', 'Model');
$request = null;
if (!empty(self::$_requests[0])) {
    $request = self::$_requests[0];
}
// パラメータ取得
$parameter = getPureUrl($request);
Configure::write('BcRequest.pureUrl', $parameter);
// requestAction の場合、bootstrapが実行されないので、urlParamを書き換える
$agent = Configure::read('BcRequest.agent');
$agentAlias = Configure::read('BcRequest.agentAlias');
$agentPrefix = Configure::read('BcRequest.agentPrefix');
$authPrefixes = Configure::read('BcAuthPrefix');
if (BC_INSTALLED && !$isUpdater && !$isMaintenance) {
    $pluginMatch = array();
    $plugins = CakePlugin::loaded();
    if ($plugins) {
        foreach ($plugins as $key => $value) {
            $plugins[$key] = Inflector::underscore($value);
        }
        $pluginMatch = array('plugin' => implode('|', $plugins));
    }