コード例 #1
0
 /**
  * @param $profile_id | $extension_id, $options
  * @return Extension_DevblocksStorageEngine
  */
 static function getStorageService()
 {
     $args = func_get_args();
     if (empty($args)) {
         return false;
     }
     $profile = $args[0];
     $params = array();
     // Handle $profile polymorphism
     if ($profile instanceof Model_DevblocksStorageProfile) {
         $extension = $profile->extension_id;
         $params = $profile->params;
     } else {
         if (is_numeric($profile)) {
             $storage_profile = DAO_DevblocksStorageProfile::get($profile);
             $extension = $storage_profile->extension_id;
             $params = $storage_profile->params;
         } else {
             if (is_string($profile)) {
                 $extension = $profile;
                 if (isset($args[1]) && is_array($args[1])) {
                     $params = $args[1];
                 }
             }
         }
     }
     return _DevblocksStorageManager::getEngine($extension, $params);
 }
コード例 #2
0
ファイル: Plugin.php プロジェクト: jstanden/devblocks
 function saveConfig(Model_DevblocksStorageProfile $profile)
 {
     @($access_key = DevblocksPlatform::importGPC($_POST['access_key'], 'string', ''));
     @($secret_key = DevblocksPlatform::importGPC($_POST['secret_key'], 'string', ''));
     @($bucket = DevblocksPlatform::importGPC($_POST['bucket'], 'string', ''));
     $fields = array(DAO_DevblocksStorageProfile::PARAMS_JSON => json_encode(array('access_key' => $access_key, 'secret_key' => $secret_key, 'bucket' => $bucket)));
     DAO_DevblocksStorageProfile::update($profile->id, $fields);
 }