本文整理汇总了PHP中plugin::get_sms_providers方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::get_sms_providers方法的具体用法?PHP plugin::get_sms_providers怎么用?PHP plugin::get_sms_providers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::get_sms_providers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms
/**
* Handles SMS Settings
*/
function sms()
{
$this->template->content = new View('admin/sms');
$this->template->content->title = Kohana::lang('ui_admin.settings');
// setup and initialize form field names
$form = array
(
'sms_provider' => '',
'sms_no1' => '',
'sms_no2' => '',
'sms_no3' => ''
);
// Copy the form as errors, so the errors will be stored with keys
// corresponding to the form field names
$errors = $form;
$form_error = FALSE;
$form_saved = FALSE;
// check, has the form been submitted, if so, setup validation
if ($_POST)
{
// Instantiate Validation, use $post, so we don't overwrite $_POST
// fields with our own things
$post = new Validation($_POST);
// Add some filters
$post->pre_filter('trim', TRUE);
// Add some rules, the input field, followed by a list of checks, carried out in order
$post->add_rules('sms_provider', 'length[1,100]');
$post->add_rules('sms_no1', 'numeric', 'length[1,30]');
$post->add_rules('sms_no2', 'numeric', 'length[1,30]');
$post->add_rules('sms_no3', 'numeric', 'length[1,30]');
// Test to see if things passed the rule checks
if ($post->validate())
{
// Yes! everything is valid
$settings = new Settings_Model(1);
$settings->sms_provider = $post->sms_provider;
$settings->sms_no1 = $post->sms_no1;
$settings->sms_no2 = $post->sms_no2;
$settings->sms_no3 = $post->sms_no3;
$settings->date_modify = date("Y-m-d H:i:s",time());
$settings->save();
// Delete Settings Cache
$this->cache->delete('settings');
$this->cache->delete_tag('settings');
// Everything is A-Okay!
$form_saved = TRUE;
// repopulate the form fields
$form = arr::overwrite($form, $post->as_array());
}
// No! We have validation errors, we need to show the form again,
// with the errors
else
{
// repopulate the form fields
$form = arr::overwrite($form, $post->as_array());
// populate the error fields, if any
$errors = arr::overwrite($errors, $post->errors('settings'));
$form_error = TRUE;
}
}
else
{
// Retrieve Current Settings
$settings = ORM::factory('settings', 1);
$form = array
(
'sms_provider' => $settings->sms_provider,
'sms_no1' => $settings->sms_no1,
'sms_no2' => $settings->sms_no2,
'sms_no3' => $settings->sms_no3
);
}
$this->template->content->form = $form;
$this->template->content->errors = $errors;
$this->template->content->form_error = $form_error;
$this->template->content->form_saved = $form_saved;
$this->template->content->sms_provider_array = array_merge(
array("" => "-- Select One --"),
plugin::get_sms_providers()
);
}
示例2: sms
/**
* Handles SMS Settings
*/
public function sms()
{
$this->template->content = new View('admin/settings/sms');
$this->template->content->title = Kohana::lang('ui_admin.settings');
// setup and initialize form field names
$form = array('sms_provider' => '', 'sms_no1' => '', 'sms_no2' => '', 'sms_no3' => '', 'sms_alert_url' => '');
// Copy the form as errors, so the errors will be stored with keys
// corresponding to the form field names
$errors = $form;
$form_error = FALSE;
$form_saved = FALSE;
// check, has the form been submitted, if so, setup validation
if ($_POST) {
// Instantiate Validation, use $post, so we don't overwrite $_POST
// fields with our own things
$post = new Validation($_POST);
// Add some filters
$post->pre_filter('trim', TRUE);
// Add some rules, the input field, followed by a list of checks, carried out in order
$post->add_rules('sms_provider', 'length[1,100]');
$post->add_rules('sms_no1', 'numeric', 'length[1,30]');
$post->add_rules('sms_no2', 'numeric', 'length[1,30]');
$post->add_rules('sms_no3', 'numeric', 'length[1,30]');
$post->add_rules('sms_alert_url', 'required', 'between[0,1]');
// HT: new setting for url on sms
// Test to see if things passed the rule checks
if ($post->validate()) {
if (!Settings_Model::get_setting('sms_alert_url')) {
Settings_Model::save_setting('sms_alert_url', $post->sms_alert_url);
}
// Yes! everything is valid
Settings_Model::save_all($post);
// Delete Settings Cache
$this->cache->delete('settings');
$this->cache->delete_tag('settings');
// Everything is A-Okay!
$form_saved = TRUE;
// repopulate the form fields
$form = arr::overwrite($form, $post->as_array());
} else {
// repopulate the form fields
$form = arr::overwrite($form, $post->as_array());
// populate the error fields, if any
$errors = arr::overwrite($errors, $post->errors('settings'));
$form_error = TRUE;
}
} else {
$settings = Settings_Model::get_settings(array_keys($form));
$settings['sms_alert_url'] = isset($settings['sms_alert_url']) ? $settings['sms_alert_url'] : 0;
// HT: might not be in database so calling manually return NULL if not exist
// Retrieve Current Settings
$form = array('sms_provider' => $settings['sms_provider'], 'sms_no1' => $settings['sms_no1'], 'sms_no2' => $settings['sms_no2'], 'sms_no3' => $settings['sms_no3'], 'sms_alert_url' => $settings['sms_alert_url']);
}
$this->template->content->form = $form;
$this->template->content->errors = $errors;
$this->template->content->form_error = $form_error;
$this->template->content->form_saved = $form_saved;
$this->template->content->alert_url_array = array('1' => Kohana::lang('ui_admin.yes'), '0' => Kohana::lang('ui_admin.no'));
$this->template->content->sms_provider_array = array_merge(array("" => "-- Select One --"), plugin::get_sms_providers());
}