/** * This method returns or outputs messages using the L10N library * You can pass a rich string with %s, %i, etc, sending extra parameters * If the boolean flag $echo is sent, it prints it to the output, otherwise, * only returns it * * @param String $k * @param Bolean $echo * @param mixed... extra parameter to be treated in the string * @return String */ public static function write($k, $echo = true) { $msg = Mind::$l10n->getMessage($k); if (!$msg) { $msg = Mind::message("L10N: Message {$k} does not exist", '[Fail]', false); } $args = func_get_args(); $parms = ""; if (sizeof($args) > 2) { for ($i = 2; $i < sizeof($args); $i++) { $parms .= ', "' . $args[$i] . '"'; } $parms = '"' . $msg . '"' . $parms; eval("\$print= sprintf(" . $parms . ");"); } else { $print = $msg; } $count = 1; while (strlen($print) >= _CONSOLE_LINE_LENGTH_ && strpos($print, '..') > -1) { $print = preg_replace("/\\.\\./", '.', $print, $count); } if ($echo) { echo $print; } return $msg; }
private function runStep2() { if (!($db = new SQLiteDatabase(_MINDSRC_ . '/mind3rd/SQLite/mind'))) { Mind::message('Database', '[Fail]'); return false; } Mind::message('Database', '[OK]'); return true; }
public function __construct() { $this->messages['programRequired'] = Mind::message("API: You must send the program name, to execute", '[Fail]', false); $this->messages['loginRequired'] = Mind::message("Auth: Both login and password are required", '[Fail]', false); $this->messages['passwordRequired'] = "I need a password for this user, please: "; $this->messages['autenticated'] = Mind::message("\nMain: %s autenticated", "[OK]", false); //"\n[OK] %s autenticated\n"; $this->messages['not_allowed'] = Mind::message("\nMain: You have not autenticated your credentials yet", '[Fail]', false); $this->messages['not_allowed_tip'] = "Try calling the command\n auth < login >\nA password will be required.\n"; $this->messages['no_such_file'] = Mind::message("\nMain: No such command '%s'", "[Fail]", false); $this->messages['auth_fail'] = Mind::message("\nAuth: Wrong user or password", "[Fail]", false); $this->messages['bye'] = "Logging out...\n"; $this->messages['http_invalid_requisition'] = <<<MESSAGE Invalid HTTP requisition. You *must* send some POST data acoording your request, and also a variable "program" by post, with the name of the program you want to run. MESSAGE; }