/**
  * コンストラクタ。
  * コンシューマキー、及びコンシューマ秘密鍵はプロパティファイルに定義することも可能です。
  * 
  * config/global_properties.yml の設定例:
  * <code>
  * twitter:
  *   # コンシューマキー。
  *   consumerKey:
  *   
  *   # コンシューマ秘密鍵。
  *   consumerSecret:
  * </code>
  * @see Mars_OAuthProvider::__construct()
  * @author Naomichi Yamakita <*****@*****.**>
  */
 protected function __construct($consumerKey = NULL, $consumerSecret = NULL)
 {
     $config = Mars_Config::loadProperties('twitter');
     if ($consumerKey === NULL) {
         $consumerKey = array_find($config, 'consumerKey');
     }
     if ($consumerSecret === NULL) {
         $consumerSecret = array_find($config, 'consumerSecret');
     }
     parent::__construct($consumerKey, $consumerSecret);
 }
 /**
  * コンストラクタ。
  * コンシューマキー、及びコンシューマ秘密鍵はプロパティファイルに定義することも可能です。
  * 
  * config/global_properties.yml の設定例:
  * <code>
  * mixiGraph:
  *   # コンシューマキー。
  *   consumerKey:
  *   
  *   # コンシューマ秘密鍵。
  *   consumerSecret:
  * </code>
  * @see Mars_OAuthProvider::__construct()
  * @author Naomichi Yamakita <*****@*****.**>
  */
 protected function __construct($consumerKey = NULL, $consumerSecret = NULL)
 {
     $config = Mars_Config::loadProperties('mixiGraph');
     if ($consumerKey === NULL) {
         $consumerKey = array_find($config, 'consumerKey');
     }
     if ($consumerSecret === NULL) {
         $consumerSecret = array_find($config, 'consumerSecret');
     }
     $this->_userAgent = $this->request->getUserAgent();
     parent::__construct($consumerKey, $consumerSecret);
 }
 /**
  * コンストラクタ。
  * コンシューマキー、及びコンシューマ秘密鍵はコンストラクタの引数、またはプロパティファイルに定義することが可能です。
  * (プロパティファイルの設定例は {@link Mars_MixiMobileApp} クラスの API を参照)
  * 
  * @param string $consumerKey コンシューマキー。
  * @param string $consumerSecret コンシューマ秘密鍵。
  * @author Naomichi Yamakita <*****@*****.**>
  */
 protected function __construct($consumerKey = NULL, $consumerSecret = NULL)
 {
     $config = Mars_Config::loadProperties('mixi');
     if ($consumerKey === NULL) {
         $consumerKey = array_find($config, 'consumerKey');
     }
     if ($consumerSecret === NULL) {
         $consumerSecret = array_find($config, 'consumerSecret');
     }
     parent::__construct($consumerKey, $consumerSecret);
     $this->_consumer = new OAuthConsumer($consumerKey, $consumerSecret);
     $this->_hasZlib = extension_loaded('zlib');
 }
예제 #4
0
 /**
  * コンテンツに含まれる外部 CSS、埋め込み CSS を読み込みます。
  *
  * @author Naomichi Yamakita <*****@*****.**>
  */
 private function loadCSS()
 {
     $nodes = $this->_xpath->query('//link[@rel="stylesheet" or @type="text/css"] | //style[@type="text/css"]');
     $isCSSMinify = Mars_Config::loadHelpers('html.cssMinify');
     foreach ($nodes as $node) {
         if ($node->tagName == 'link' && ($href = $node->attributes->getNamedItem('href'))) {
             $path = $href->nodeValue;
             if (($pos = strpos($path, '?')) !== FALSE) {
                 $path = substr($path, 0, $pos);
             }
             if ($isCSSMinify) {
                 $path = str_replace('/min', '', $path);
             }
             if (strpos($path, '/common/base') === FALSE) {
                 $data = read_file('webroot' . $path);
             } else {
                 $data = read_file(MARS_ROOT_DIR . '/webapps/cpanel/webroot' . $path);
             }
         } else {
             if ($node->tagName == 'style') {
                 $data = $node->nodeValue;
             }
         }
         $this->parseCSS($data);
         if ($parent = $node->parentNode) {
             $parent->removeChild($node);
         }
     }
 }
 /**
  * テーブルの未使用領域を解放し、データファイルを最適化します。
  * MySQLController::optimizeTable() を実行するには、MySQL のプロセスがあらかじめ終了している必要があります。
  *
  * @author Naomichi Yamakita <*****@*****.**>
  * @see http://dev.mysql.com/doc/refman/4.1/ja/optimisation.html
  */
 public function optimizeTable()
 {
     // MySQLController::checkTable() で統計を更新するため、ここでは OPTIMIZE TABLE を使用しない
     $command = sprintf('%s/bin/myisamchk -r %s/%s/', self::MYSQL_ROOT_DIR, self::MYSQL_DATA_DIR, $dbName);
     // "Deleted blocks" がおおよそ 100000 以上となるテーブルを対象とする
     $optimizeTables = Mars_Config::loadProperties('database.optimizeTables');
     pcntl_setpriority(20);
     foreach ($optimizeTables as $table) {
         $start = microtime(TRUE);
         shell_exec(sprintf('%s%s.MYI', $command, $table));
         $second = microtime(TRUE) - $start;
         file_put_contents('/home/mysql/isambench', sprintf("%s:%s\n", $table, $second), FILE_APPEND);
     }
 }
 /**
  * @author Naomichi Yamakita <*****@*****.**>
  */
 private function buildLaunchURI($type, $queryData)
 {
     if ($type === Mars_MixiApp::AGENT_TYPE_PC || $type == Mars_MixiApp::AGENT_TYPE_SMARTPHONE) {
         $buffer = NULL;
         if (sizeof($queryData)) {
             $buffer = '&' . http_build_query($queryData, '', '&');
         }
         $uri = sprintf('http://mixi.jp/run_appli.pl?id=%s%s', Mars_MixiMobileApp::getApplicationId(), $buffer);
     } else {
         if (!isset($queryData['action'])) {
             $queryData['action'] = Mars_Config::loadSetup('action.default');
         }
         $uri = Mars_MixiMobileApp::buildForwardActionURI($queryData, TRUE);
     }
     return $uri;
 }
 /**
  * コンストラクタ。
  *
  * @author Naomichi Yamakita <*****@*****.**>
  */
 public function __construct()
 {
     $helperConfig = Mars_Config::load(Mars_Config::YAML_GLOBAL_HELPERS, 'html');
     $this->_contentsBaseURI = Mars_Config::loadProperties('mixi.contentsBaseURI');
     parent::__construct($helperConfig);
 }
 /**
  * @author Naomichi Yamakita <*****@*****.**>
  */
 public function getReplicationStatus()
 {
     $replication = Mars_Config::loadProperties('database.replication');
     return $replication;
 }
 /**
  * 現在アプリにアクセスしているユーザの ID を取得します。
  * デバッグモードが有効かつ ID が見つからない場合は、global_properties.yml からデバッグ用アプリ ID の取得を試みます。
  * 
  * プロパティ設定例:
  * <code>
  * mixi:
  *   debug:
  *     ownerId: ...
  * </code>
  * <i>{@link getApplicationId()} メソッドの項も参照。</i>
  * 
  * @link http://developer.mixi.co.jp/appli/spec/mob/for_partners/transmitted_information SAP サーバに送信される情報
  * @return string 現在のアプリ ID を返します。
  * @see Mars_MixiMobileApp::getApplicationId()
  * @author Naomichi Yamakita <*****@*****.**>
  */
 public static function getOwnerId()
 {
     $ownerId = Mars_DIContainerFactory::getContainer()->getRequest()->getQuery('opensocial_owner_id');
     if ($ownerId === NULL && is_output_debug()) {
         $ownerId = Mars_Config::loadProperties('mixi.debug.ownerId');
     }
     return $ownerId;
 }