/** * Get all enabled providers, with their configuration data. * @return Array */ protected function getAllProviders($enabled = false) { if ($enabled) { // Returns all *enabled* providers. return \DataProvider::get_enabled_providers(); } else { // Returns all providers, even if they are disabled. return \DataProvider::get_providers(); } }
protected function getRules() { return ['user_id' => [[[$this->user_repo, 'exists'], [':value']]], 'type' => [['not_empty'], ['max_length', [':value', 255]], ['in_array', [':value', [Contact::EMAIL, Contact::PHONE, Contact::TWITTER]]]], 'data_provider' => [['in_array', [':value', array_keys(\DataProvider::get_providers())]]], 'contact' => [['not_empty'], ['max_length', [':value', 255]], [[$this, 'valid_contact'], [':value', ':data', ':validation']]]]; }
protected function getRules() { return ['direction' => [['not_empty'], ['in_array', [':value', [\Message_Direction::INCOMING]]]], 'message' => [['not_empty']], 'datetime' => [['date']], 'type' => [['not_empty'], ['max_length', [':value', 255]], ['in_array', [':value', ['sms', 'ivr', 'email', 'twitter']]]], 'data_provider' => [['in_array', [':value', array_keys(\DataProvider::get_providers())]]], 'data_provider_message_id' => [['max_length', [':value', 511]]], 'status' => [['not_empty'], ['in_array', [':value', [\Message_Status::RECEIVED]]]], 'parent_id' => [['numeric'], [[$this->repo, 'parentExists'], [':value']]], 'post_id' => [['numeric']], 'contact_id' => [['numeric']]]; }
/** * Rules for the tag model * * @return array Rules */ public function rules() { return array('id' => array(array('numeric')), 'user_id' => array(array('numeric'), array(array($this, 'fk_exists'), array('User', ':field', ':value'))), 'data_provider' => array(array('array_key_exists', array(':value', DataProvider::get_providers()))), 'type' => array(array('not_empty'), array('in_array', array(':value', array(self::EMAIL, self::PHONE, self::TWITTER)))), 'contact' => array(array('not_empty'), array('max_length', array(':value', 255)), array(array($this, 'valid_contact'), array(':validation', ':field')))); }
/** * Rules for the tag model * * @return array Rules */ public function rules() { return array('id' => array(array('numeric')), 'title' => array(array(array($this, 'valid_title'), array(':validation', ':field'))), 'message' => array(array('not_empty')), 'datetime' => array(array('date')), 'type' => array(array('not_empty'), array('max_length', array(':value', 255)), array('in_array', array(':value', array('sms', 'email', 'twitter')))), 'data_provider' => array(array('array_key_exists', array(':value', DataProvider::get_providers()))), 'data_provider_message_id' => array(array('max_length', array(':value', 511))), 'status' => array(array('not_empty'), array('in_array', array(':value', array(Message_Status::PENDING, Message_Status::PENDING_POLL, Message_Status::RECEIVED, Message_Status::EXPIRED, Message_Status::CANCELLED, Message_Status::FAILED, Message_Status::UNKNOWN, Message_Status::SENT))), array(array($this, 'valid_status'), array(':value', ':original_values'))), 'direction' => array(array('not_empty'), array('in_array', array(':value', array(Message_Direction::INCOMING, Message_Direction::OUTGOING))), array(array($this, 'valid_direction'), array(':field', ':value', ':original_values'))), 'parent_id' => array(array('numeric'), array(array($this, 'parent_exists'), array(':field', ':value'))), 'post_id' => array(array('numeric'), array(array($this, 'fk_exists'), array('Post', ':field', ':value'))), 'contact_id' => array(array('numeric'), array(array($this, 'fk_exists'), array('Contact', ':field', ':value')))); }