예제 #1
0
 /**
  * @return array
  * @throws DreamFactory\Platform\Exceptions\BadRequestException
  */
 protected function _parseRequest()
 {
     $_resourceId = strtolower(trim(FilterInput::request('resource', null, FILTER_SANITIZE_STRING)));
     $_id = FilterInput::request('id', null, FILTER_SANITIZE_STRING);
     if (empty($_resourceId) || empty($_resourceId) && empty($_id)) {
         throw new BadRequestException(404, 'Not found.');
     }
     //	Handle a plural request
     if (false !== ($_tempId = Inflector::isPlural($_resourceId, true))) {
         $_resourceId = $_tempId;
     }
     $this->setModelClass('DreamFactory\\Platform\\Yii\\Models\\' . Inflector::deneutralize($_resourceId));
     return array($_resourceId, $_id);
 }
예제 #2
0
 /**
  * Loads the default schema for the provider of type.
  *
  * @param int $type
  *
  * @return array|null
  */
 public static function loadDefaultSchema($type = ProviderConfigTypes::OAUTH)
 {
     $_schema = null;
     $_typeName = ProviderConfigTypes::nameOf($type);
     $_fileName = __DIR__ . '/Schemas/' . Inflector::neutralize($_typeName) . '.schema.php';
     if (file_exists($_fileName) && is_readable($_fileName)) {
         /** @noinspection PhpIncludeInspection */
         $_schema = @(include $_fileName);
         if (!empty($_schema)) {
             $_schema = array_merge(array('provider_type' => array('type' => 'text', 'class' => 'uneditable-input', 'label' => 'Provider Type', 'value' => str_ireplace('oauth', 'OAuth', ucfirst(Inflector::deneutralize(strtolower($_typeName)))))), $_schema);
         }
     }
     return $_schema;
 }
예제 #3
0
파일: SeedEvent.php 프로젝트: kisma/kisma
 /**
  * @param array $data
  *
  * @return $this
  */
 public function fromArray($data = array())
 {
     foreach ($data as $_key => $_value) {
         //  Event ID cannot be changed
         if ('event_id' != $_key) {
             if (method_exists($this, 'set' . ($_key = Inflector::deneutralize($_key)))) {
                 $this->{'set' . $_key}($_value);
             }
         }
     }
     //  Special propagation stopper
     if (isset($data['stop_propagation']) && false !== $data['stop_propagation']) {
         $this->stopPropagation();
     }
     return $this;
 }