本文整理汇总了PHP中messages::set_message方法的典型用法代码示例。如果您正苦于以下问题:PHP messages::set_message方法的具体用法?PHP messages::set_message怎么用?PHP messages::set_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages
的用法示例。
在下文中一共展示了messages::set_message方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_current_message
public function test_get_current_message()
{
$m = new messages();
//No message has been set
$this->assertEquals('', $m->get_current_message());
//Set a message and check if it's ok
$m->set_message('general-ok-0');
$this->assertEquals('Command OK', $m->get_current_message());
}
示例2: add_content
public static function add_content($content_id, $content_name)
{
ob_start();
if (file_exists(config::get_config('tpl_config')['bloks_folder'] . '/' . $content_name . '.php')) {
require config::get_config('tpl_config')['bloks_folder'] . '/' . $content_name . '.php';
} else {
messages::set_message('20', 'alert-danger');
}
self::$content[$content_id] = ob_get_contents();
ob_end_clean();
}
示例3: set
public function set($params, $options = null)
{
//var_dump($params);
$last_id = 0;
if ($options != null) {
$this->options = $options;
}
$this->prepared = $this->pdo->prepare($this->query_builder->get_query(), $this->options);
$this->pdo->beginTransaction();
var_dump($this->prepared);
if (!$this->prepared) {
$this->pdo->rollBack();
messages::set_message('30', 'alert-danger');
return $last_id;
}
$this->prepared->execute($params);
$last_id = $this->pdo->lastInsertId();
$this->pdo->commit();
return $last_id;
}
示例4: call
public static function call($route, $params = null)
{
self::$route = $route;
self::$params = $params;
if (!class_exists(self::$route[0] . '_controller')) {
self::$route[0] = config::get_config('app_config')['default_controller'] . '_controller';
messages::set_message('00', 'alert-danger');
} else {
self::$route[0] = self::$route[0] . '_controller';
}
if (!isset(self::$route[1])) {
self::$route[1] = config::get_config('app_config')['default_action'];
}
if (method_exists(self::$route[0], self::$route[1])) {
self::$route[1] = self::$route[1];
} else {
self::$route[1] = config::get_config('app_config')['default_action'];
messages::set_message('01', 'alert-danger');
}
call_user_func_array(self::$route, self::$params);
}
示例5: process_command
/**
* This method process the command given by the user and call the right action to be applied.
* @param Array $command
* @param string $canvas_string
* @return string
*/
public function process_command()
{
//Obj to handle messages
$messages = new messages();
if ($this->values_ok) {
switch (strtoupper($this->command_array[0])) {
//Create a Canvas
case 'C':
if (count($this->command_array) == 3) {
$command = $this->command_array;
$this->canvas = new canvas($command[1], $command[2]);
$messages->set_message('general-ok-0');
} else {
$messages->set_message('general-error-0');
$messages->is_reload();
}
break;
//Print a Line
//Print a Line
case 'L':
if (!$this->canvas->get_canvas_state()) {
$messages->set_message('line-error-1');
} elseif (count($this->command_array) == 5) {
$command = $this->command_array;
$this->canvas->draw_line(array($command[1], $command[2]), array($command[3], $command[4]), $messages);
$messages->set_message('general-ok-0');
} else {
$messages->set_message('general-error-0');
}
break;
//Print a Rectangle
//Print a Rectangle
case 'R':
if (!$this->canvas->get_canvas_state()) {
$messages->set_message('rec-error-0');
} elseif (count($this->command_array) == 5) {
$command = $this->command_array;
$this->canvas->draw_rectangle(array($command[1], $command[2]), array($command[3], $command[4]));
$messages->set_message('general-ok-0');
} else {
$messages->set_message('general-error-0');
}
break;
//Bucket fill action
//Bucket fill action
case 'B':
if (!$this->canvas->get_canvas_state()) {
$messages->set_message('line-error-1');
} elseif (count($this->command_array) == 4) {
$command = $this->command_array;
$this->canvas->bucket_fill(array($command[1], $command[2]), $command[3]);
$messages->set_message('general-ok-0');
} else {
$messages->set_message('general-error-0');
}
break;
//Restart the app
//Restart the app
case 'Q':
$messages->set_message('general-ok-0');
$messages->is_reload();
break;
default:
break;
}
} else {
return false;
}
return $this->canvas->get_canvas_string($messages) . '<br/>' . $messages->get_current_message();
}