/** Get set of default e-mail headers * @return array */ public static function get_default_headers() { if (!isset(self::$default_headers['X-Mailer'])) { self::$default_headers["X-Mailer"] = \System\Status::introduce(); } return self::$default_headers; }
/** Make a get request to URL * @param string $url Requested URL * @return array */ public static function get($url, $head = false) { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, \System\Status::introduce()); curl_setopt($ch, CURLOPT_HEADER, 1); if ($head) { curl_setopt($ch, CURLOPT_NOBODY, true); } $content = curl_exec($ch); $dataray = array("status" => curl_getinfo($ch, CURLINFO_HTTP_CODE)); curl_close($ch); if ($dataray['status'] === \System\Http\Response::NO_RESPONSE) { throw new \System\Error\Connection(sprintf('Remote server was not found for URL "%s".', $url)); } if ($dataray['status'] === \System\Http\Response::FORBIDDEN) { throw new \System\Error\Offcom(sprintf('Access to URL "%s" was denied', $url)); } if ($dataray['status'] === \System\Http\Response::PAGE_NOT_FOUND) { throw new \System\Error\Offcom(sprintf('Requested URL "%s" was not found', $url)); } isset($content[1]) && ($dataray['content'] = $content); return new Response($dataray); } else { throw new \System\Error\Internal('Please allow CURL extension for System\\Offcom\\Request class'); } }
public static function cmd_config() { \System\Init::full(); \Helper\Cli::out_flist(array("list" => array("Framework" => \System\Status::introduce(), "Environment" => \System\Settings::get_env()))); \Helper\Cli::out(); \Helper\Cli::out("Loaded config files"); \Helper\Cli::sep(); \Helper\Cli::out_flist(array("list" => \System\Settings::get_loaded_files(), "margin" => 2, "show_keys" => false)); }
/** Render HTML meta tag section * @return $this */ public function render_meta() { $this->content_for("meta", array("name" => 'generator', "content" => \System\Status::introduce())); $this->content_for("meta", array("http-equiv" => 'content-type', "content" => 'text/html; charset=utf-8')); $this->content_for("meta", array("charset" => 'utf-8')); $meta = $this->get_content_from("meta"); foreach ($meta as $name => $value) { if ($value) { $this->content_for("head", '<meta' . \System\Template\Tag::html_attrs('meta', $value) . '>'); } } return $this; }