public function initialize() { $php_min = '5.3'; if (!is_php($php_min)) { throw new Exception('CI_Parser_lex: Requires PHP ' . $php_min . ' or above.'); } $this->ci = get_instance(); // Default configuration options. $this->config = array('cumulative_noparse' => false, 'scope_glue' => '.', 'allow_php' => false, 'full_path' => false); if ($this->ci->config->load('parser_lex', TRUE, TRUE)) { $defaults = $this->ci->config->item('parser_lex'); if (array_key_exists('allowed_functions', $defaults)) { unset($defaults['allowed_functions']); } if (array_key_exists('allowed_globals', $defaults)) { unset($defaults['allowed_globals']); } if (array_key_exists('disabled_config_settings', $defaults)) { unset($defaults['disabled_config_settings']); } $this->config = array_merge($this->config, $defaults); } // Injecting configuration options directly. if (isset($this->_parent) && !empty($this->_parent->params) && is_array($this->_parent->params)) { $this->config = array_merge($this->config, $this->_parent->params); if (array_key_exists('parser_driver', $this->config)) { unset($this->config['parser_driver']); } } log_message('info', 'CI_Parser_lex Class Initialized'); }
function preg_error_message($code = null) { if ($code === null) { $code = preg_last_error(); } $code = (int) $code; switch ($code) { case PREG_NO_ERROR: $result = 'PCRE: No error, probably invalid regular expression.'; break; case PREG_INTERNAL_ERROR: $result = 'PCRE: Internal error.'; break; case PREG_BACKTRACK_LIMIT_ERROR: $result = 'PCRE: Backtrack limit has been exhausted.'; break; case PREG_RECURSION_LIMIT_ERROR: $result = 'PCRE: Recursion limit has been exhausted.'; break; case PREG_BAD_UTF8_ERROR: $result = 'PCRE: Malformed UTF-8 data.'; break; default: if (is_php('5.3') && $code == PREG_BAD_UTF8_OFFSET_ERROR) { $result = 'PCRE: Did not end at a valid UTF-8 codepoint.'; } elseif (is_php('7') && $code == PREG_JIT_STACKLIMIT_ERROR) { $result = 'PCRE: Failed because of limited JIT stack space.'; } else { $result = 'PCRE: Error ' . $code . '.'; } break; } return $result; }
function __construct($params) { parent::__construct($params); // clause and character used for LIKE escape sequences if (strpos($this->hostname, 'mysql') !== FALSE) { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; //Prior to this version, the charset can't be set in the dsn if (is_php('5.3.6')) { $this->hostname .= ";charset={$this->char_set}"; } //Set the charset with the connection options $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; } elseif (strpos($this->hostname, 'odbc') !== FALSE) { $this->_like_escape_str = " {escape '%s'} "; $this->_like_escape_chr = '!'; } else { $this->_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } /** * @link http://stackoverflow.com/questions/11054618/codeigniter-pdo-database-driver-not-working */ // empty($this->database) OR $this->hostname .= ';dbname='.$this->database; $this->hostname = 'mysql:dbname=' . $this->database . ';host=' . $this->hostname; $this->trans_enabled = FALSE; $this->_random_keyword = ' RND(' . time() . ')'; // database specific random keyword }
/** * Tests for file writability 测试文件可写性 * * is_writable() returns TRUE on Windows servers when you really can't write to * the file, based on the read-only attribute. is_writable() is also unreliable * on Unix servers if safe_mode is on. *is_writable()返回TRUE在Windows服务器上,当你真的不能写入文件,根据只读属性。is_writable()也在Unix服务器如果safe_mode是不可靠的。 * * @link https://bugs.php.net/bug.php?id=54709 * @param string * @return bool */ function is_really_writable($file) { // If we're on a Unix server with safe_mode off we call is_writable 如果我们在Unix服务器safe_mode我们称之为is_writable if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') or !ini_get('safe_mode'))) { return is_writable($file); } /* For Windows servers and safe_mode "on" installations we'll actually * write a file then read it. Bah... * Windows服务器和safe_mode”在“安装我们会写一个文件然后读它。呸…… */ if (is_dir($file)) { $file = rtrim($file, '/') . '/' . md5(mt_rand()); if (($fp = @fopen($file, 'ab')) === FALSE) { return FALSE; } fclose($fp); @chmod($file, 0777); @unlink($file); return TRUE; } elseif (!is_file($file) or ($fp = @fopen($file, 'ab')) === FALSE) { return FALSE; } fclose($fp); return TRUE; }
public function __construct() { $php_required = '5.5'; if (is_php($php_required)) { require_once APPPATH . 'third_party/guzzle/autoloader.php'; } }
protected function _load() { if ($this->_isLoaded) { return; } static $types = array('model', 'modelProperty', 'controller', 'controlSet', 'control'); $modulePath = kanon::getBasePath() . '/modules/' . $this->_name; if (is_file($modulePath . '/module.php') && is_php($modulePath . '/module.php')) { include $modulePath . '/module.php'; $this->_autoload = $autoload; foreach ($this->_autoload as $class => $filename) { $classFilename = $modulePath . '/' . $filename; if (is_file($classFilename) && is_php($classFilename)) { require_once $classFilename; $type = ''; $r = new ReflectionClass($class); foreach ($types as $checkType) { if ($r->isSubclassOf($checkType)) { $type = $checkType; } } $this->_classes[$type][$class] = $filename; } } } $this->_isLoaded = true; }
function index() { if (!isset($this->user->level) || $this->user->level['admin'] == 0) { redirect('admin/unauthorized/admin/1'); } if ($this->user->email == '') { $this->session->set_flashdata('notification', __("Please set your email", $this->template['module'])); redirect('admin/member/edit'); } // Get News // Get News if Php version smaller than 5.3.0 $news = array(); $news2 = array(); if (!is_php('5.3.0')) { $this->load->library('Simplepie'); $this->simplepie->set_feed_url('http://ci-cms.blogspot.com/feeds/posts/default/-/news'); $this->simplepie->set_cache_location('./cache'); $this->simplepie->init(); $this->simplepie->handle_content_type(); $news = $this->simplepie->get_items(); // Get Development News $this->simplepie2 = new SimplePie(); $this->simplepie2->set_feed_url('http://bitbucket.org/hery/ci-cms/rss?token=ffaaafc0111cc8100198a44b5c263671'); $this->simplepie2->set_cache_location('./cache'); $this->simplepie2->init(); $this->simplepie2->handle_content_type(); $news2 = $this->simplepie2->get_items(); } // Save news if avaliable $this->template['cicms_news'] = $news; $this->template['cicms2_news'] = $news2; $this->layout->load($this->template, 'index'); }
/** * Constructor * * Calls the initialize() function */ function Controller() { parent::CI_Base(); // Assign all the class objects that were instantiated by the // bootstrap file (CodeIgniter.php) to local class variables // so that CI can run as one big super object. foreach (is_loaded() as $var => $class) { $this->{$var} =& load_class($class); } // In PHP 5 the Loader class is run as a discreet // class. In PHP 4 it extends the Controller @PHP4 if (is_php('5.0.0') == TRUE) { $this->load =& load_class('Loader', 'core'); $this->load->_base_classes =& is_loaded(); $this->load->_ci_autoloader(); } else { $this->_ci_autoloader(); // sync up the objects since PHP4 was working from a copy foreach (array_keys(get_object_vars($this)) as $attribute) { if (is_object($this->{$attribute})) { $this->load->{$attribute} =& $this->{$attribute}; } } } log_message('debug', "Controller Class Initialized"); }
public function index() { $php_required = '5.5'; $this->load->helper('url'); $result = null; $status_code = null; $content_type = null; $code_example = <<<EOT \$user_id = 1; \$this->load->helper('url'); \$client = new GuzzleHttp\\Client(); \$res = \$client->get(site_url('playground/rest/server-api-example/users/id/'.\$user_id.'/format/json'), ['auth' => ['admin', '1234']]); \$result = (string) \$res->getBody(); \$status_code = \$res->getStatusCode(); \$content_type = \$res->getHeader('content-type'); \$content_type = is_array(\$content_type) ? \$content_type[0] : \$content_type; EOT; if (is_php($php_required)) { eval($code_example); } $this->template->set(compact('php_required', 'code_example', 'result', 'status_code', 'content_type'))->build('rest/guzzle'); }
function __construct($params) { parent::__construct($params); // clause and character used for LIKE escape sequences if (strpos($this->hostname, 'mysql') !== FALSE) { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; //Prior to this version, the charset can't be set in the dsn if (is_php('5.3.6')) { $this->hostname .= ";charset={$this->char_set}"; } //Set the charset with the connection options $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; } elseif (strpos($this->hostname, 'odbc') !== FALSE) { $this->_like_escape_str = " {escape '%s'} "; $this->_like_escape_chr = '!'; } else { $this->_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } empty($this->database) or $this->hostname .= ';dbname=' . $this->database; $this->trans_enabled = FALSE; $this->_random_keyword = ' RND(' . time() . ')'; // database specific random keyword }
public function __construct($config = array()) { $this->_is_ci_3 = (bool) ((int) CI_VERSION >= 3); $this->CI = get_instance(); $this->CI->load->helper('email'); $this->CI->load->helper('html'); if (!is_array($config)) { $config = array(); } if (isset($config['useragent'])) { $useragent = trim($config['useragent']); $mailer_engine = strtolower($useragent); if (strpos($mailer_engine, 'phpmailer') !== false) { $this->mailer_engine = 'phpmailer'; } elseif (strpos($mailer_engine, 'codeigniter') !== false) { $this->mailer_engine = 'codeigniter'; } else { unset($config['useragent']); // An invalid setting; } } if (isset($config['charset'])) { $charset = trim($config['charset']); if ($charset != '') { $this->charset = $charset; unset($config['charset']); // We don't need this anymore. } } else { $charset = trim(config_item('charset')); if ($charset != '') { $this->charset = $charset; } } $this->charset = strtoupper($this->charset); if ($this->mailer_engine == 'phpmailer') { //// If your system uses class autoloading feature, //// then the following require statement would not be needed. //if (!class_exists('PHPMailer', false)) { // require_once COMMONPATH.'third_party/phpmailer/PHPMailerAutoload.php'; //} //// $this->phpmailer = new PHPMailer(); $this->phpmailer->PluginDir = COMMONPATH . 'third_party/phpmailer/'; // Added by Ivan Tcholakov, 16-FEB-2015. $this->phpmailer->setLanguage($this->CI->lang->custom_code('phpmailer')); $this->_copy_property_to_phpmailer('charset'); } if (count($config) > 0) { $this->initialize($config); } else { $this->_smtp_auth = ($this->smtp_user == '' and $this->smtp_pass == '') ? FALSE : TRUE; if ($this->mailer_engine == 'phpmailer') { $this->_copy_property_to_phpmailer('_smtp_auth'); } } $this->_safe_mode = !is_php('5.4') && ini_get('safe_mode'); log_message('info', 'Email Class Initialized (Engine: ' . $this->mailer_engine . ')'); }
/** * 启动 */ public static function start() { /* * ------------------------------------------------------ * 设置时区 * ------------------------------------------------------ */ date_default_timezone_set("Asia/Shanghai"); /* * ------------------------------------------------------ * 安全程序:关掉魔法引号,过滤全局变量 * ------------------------------------------------------ */ if (!is_php('5.4')) { ini_set('magic_quotes_runtime', 0); if ((bool) ini_get('register_globals')) { $_protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', '_COOKIE', 'GLOBALS', 'HTTP_RAW_POST_DATA', '_protected', '_registered'); $_registered = ini_get('variables_order'); foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal) { if (strpos($_registered, $key) === FALSE) { continue; } foreach (array_keys(${$superglobal}) as $var) { if (isset($GLOBALS[$var]) && !in_array($var, $_protected, TRUE)) { $GLOBALS[$var] = NULL; } } } } } /* * ------------------------------------------------------ * 异常处理,错误处理等,记录错误日志 * ------------------------------------------------------ */ register_shutdown_function("_finish_handle"); set_exception_handler("_exception_handle"); set_error_handler("_error_handle"); /* * ------------------------------------------------------ * 注册自动加载方法 * ------------------------------------------------------ */ spl_autoload_register("Loader::autoload"); Loader::setClassDir((array) AppHelper::Instance()->config("APP_AUTOLOAD_PATH")); Loader::setSuffix((array) AppHelper::Instance()->config("CLASS_FILE_SUFFIX")); /* * ------------------------------------------------------ * ini 设置 * ------------------------------------------------------ */ //默认字符编码为UTF-8 ini_set('default_charset', 'UTF-8'); //日志初始 log_message(LOG_INFO, "初始处理完毕", \Utils\UtilFactory::getLogHandle()); //运行核心程序 log_message(LOG_INFO, "运行核心程序................"); CommandHandler::run(); }
/** * Persistent database connection * * @return object */ public function db_pconnect() { // Persistent connection support was added in PHP 5.3.0 if (!is_php('5.3')) { return $this->db_connect(); } return $this->port != '' ? @mysqli_connect('p:' . $this->hostname, $this->username, $this->password, $this->database, $this->port) : @mysqli_connect('p:' . $this->hostname, $this->username, $this->password, $this->database); }
public function index() { $php_min = '5.3'; if (!is_php($php_min)) { $this->output->set_output('PHP ' . $php_min . ' is required for Lex parser.'); return; } $this->template->build('lex_parser_layout_test'); }
public function index() { $videos = array('https://www.youtube.com/watch?v=NRhVcTTMlrM', 'http://vimeo.com/60743823', 'http://www.dailymotion.com/video/x9kdze', 'http://vbox7.com/play:25c4115f2d'); $system_requirements_ok = is_php('5.3.2'); if ($system_requirements_ok) { $this->load->library('multiplayer'); } $this->template->set('videos', $videos)->set('system_requirements_ok', $system_requirements_ok)->build('multiplayer'); }
function XMLParserLib() { //根据版本不同载入不同的xml解析类 if (!is_php('5.0.0')) { require_once FCPATH . APPPATH . 'libraries/XMLParser/xmlParser4.php'; } else { require_once FCPATH . APPPATH . 'libraries/XMLParser/xmlParser5.php'; } }
public function page_2() { $this->registry->set('pjax_subnavbar_active', 'page_2'); $video = 'https://www.youtube.com/watch?v=QTXyXuqfBLA'; $php_required = '5.3.2'; if (is_php($php_required)) { $this->load->library('multiplayer'); } $this->template->set('video', $video)->set('php_required', $php_required)->append_title('Pjax - Test Page 2')->set_breadcrumb('Pjax', site_url('playground/pjax'))->set_breadcrumb('Pjax - Test Page 2', site_url('playground/pjax/page-2'))->build('pjax/page_2'); }
/** * Fixes a bug in PHP 5.2.9 where sort flags defaulted * to SORT_REGULAR, resulting in some very odd removal * behavior. And since we have now started using it, * we stupidly need to compat the whole thing. -pk */ function ee_array_unique(array $arr, $sort_flags = SORT_STRING) { // 5.2.9 introduced both the flags and the bug if (is_php('5.2.9')) { return array_unique($arr, $sort_flags); } // before 5.2.9 sort_string was the default if ($sort_flags === SORT_STRING) { return array_unique($arr); } // no point uniquing an array of 1 or nil if (count($arr) < 2) { return $arr; } // to be in parity with php's solution, // we need to keep the original key positions $key_pos = array_flip(array_keys($arr)); $ret_arr = $arr; asort($arr, $sort_flags); $last_kept = reset($arr); $last_kept_k = key($arr); next($arr); // skip ahead while (list($k, $v) = each($arr)) { if ($sort_flags === SORT_NUMERIC) { $keep = (bool) ((double) $last_kept - (double) $v); } else { $keep = $last_kept != $v; } if ($keep) { $last_kept = $v; $last_kept_k = $k; } else { // This is the mind boggling and in my opinion buggy part of // the algorithm php uses. We unset any duplicates that follow // the first value. Which is fine thinking narrowly about unique // array values. // However, it's extremely unintuitive when thinking about php // arrays, where duplicate keys override earlier keys. // It also makes this algorithm unstable, so that moving a boolean // true value to different spots in the array vastly changes the // output. $unset = $k; if ($key_pos[$last_kept_k] > $key_pos[$k]) { $unset = $last_kept_k; $last_kept = $v; $last_kept_k = $k; } unset($arr[$unset]); unset($ret_arr[$unset]); } } unset($arr); return $ret_arr; }
public function index() { $php_min = '5.3'; if (!is_php($php_min)) { $this->output->set_output('PHP ' . $php_min . ' is required for Lex parser.'); return; } $countries = $this->_get_country_data(); $countries_10 = array_slice($countries, 0, 10); $this->template->set('br', '<br />')->set('hr', '<hr />')->set('name', 'John')->set('array_1', array('one', 'two', 'three'))->set('array_2', array('one', 'two', 'three', array('four', 'five')))->set('string_123', 'one, two, three')->set('json_123', json_encode(array('one', 'two', 'three')))->set('very_long_text', 'Very long text. Very long text. Very long text. Very long text.')->set('value_0', 0)->set('value_1', 1)->set('value_2', 2)->set('value_3', 3)->set('boolean_true', true)->set('value_null', null)->set('string_10', '10')->set('object_123', (object) array('one', 'two', 'three'))->set('dog', "I'll \"walk\" the <b>dog</b> now.")->set('dog_entities', htmlentities("I'll \"walk\" the <b>dog</b> now.", ENT_QUOTES, 'UTF-8'))->set('countries', $countries)->set('countries_10', $countries_10)->set('with_a_new_line', "a new\nline")->set('my_image', image_url('playground.jpg'))->set('string_markdown', 'Formatted **text**')->set('string_textile', 'Formatted _text_')->set('dangerous_value', 'A dangerous value <script>alert("Hi, I am dangerous.")</script>')->build('lex_parser'); }
/** * array_replace(), array_replace_recursive() tests * * Borrowed from PHP's own tests * * @depends test_bootstrap */ public function test_array_replace_recursive() { if (is_php('5.3')) { return $this->markTestSkipped('array_replace() and array_replace_recursive() are already available on PHP 5.3'); } $array1 = array(0 => 'dontclobber', '1' => 'unclobbered', 'test2' => 0.0, 'test3' => array('testarray2' => TRUE, 1 => array('testsubarray1' => 'dontclobber2', 'testsubarray2' => 'dontclobber3'))); $array2 = array(1 => 'clobbered', 'test3' => array('testarray2' => FALSE), 'test4' => array('clobbered3' => array(0, 1, 2))); // array_replace() $this->assertEquals(array(0 => 'dontclobber', 1 => 'clobbered', 'test2' => 0.0, 'test3' => array('testarray2' => FALSE), 'test4' => array('clobbered3' => array(0, 1, 2))), array_replace($array1, $array2)); // array_replace_recursive() $this->assertEquals(array(0 => 'dontclobber', 1 => 'clobbered', 'test2' => 0.0, 'test3' => array('testarray2' => FALSE, 1 => array('testsubarray1' => 'dontclobber2', 'testsubarray2' => 'dontclobber3')), 'test4' => array('clobbered3' => array(0, 1, 2))), array_replace_recursive($array1, $array2)); }
function composerRequire54058c9d5fd9edc6c7a76b6c9c5c789d($file) { // This tweak allowes installed Guzzle 6 (requires PHP 5.5) // not to cause source parsing error on lower PHP versions. if (!is_php('5.5')) { if (strpos($file, 'guzzlehttp/') !== false) { return; } } // require $file; }
public function index() { $php_min = '5.3'; if (!is_php($php_min)) { $this->output->set_output('PHP ' . $php_min . ' is required for Lex parser.'); return; } $countries = $this->_get_country_data(); $countries_10 = array_slice($countries, 0, 10); $lex_parser_layout_test = $this->curl->create(site_url('playground/lex-parser-layout-test'))->get()->execute(); $this->template->set('br', '<br />')->set('hr', '<hr />')->set('name', 'John')->set('array_1', array('one', 'two', 'three'))->set('array_2', array('one', 'two', 'three', array('four', 'five')))->set('string_123', 'one, two, three')->set('json_123', json_encode(array('one', 'two', 'three')))->set('very_long_text', 'Very long text. Very long text. Very long text. Very long text.')->set('value_0', 0)->set('value_1', 1)->set('value_2', 2)->set('value_3', 3)->set('boolean_true', true)->set('value_null', null)->set('string_10', '10')->set('object_123', (object) array('one', 'two', 'three'))->set('float_value', 250.5)->set('dog', "I'll \"walk\" the <b>dog</b> now.")->set('dog_entities', htmlentities("I'll \"walk\" the <b>dog</b> now.", ENT_QUOTES, 'UTF-8'))->set('countries', $countries)->set('countries_10', $countries_10)->set('with_a_new_line', "a new\nline")->set('my_image', image_url('playground.jpg'))->set('string_markdown', 'Formatted **text**')->set('string_textile', 'Formatted _text_')->set('dangerous_value', 'A dangerous value <script>alert("Hi, I am dangerous.")</script>')->set('my_blog', array('posts' => array(array('title' => 'Blog Post One'), array('title' => 'Blog Post Two'))))->set('lex_parser_layout_test', $lex_parser_layout_test)->set_partial('lex_partial', 'lex_partial')->set_metadata('description', 'Lex parser testing page')->set_metadata('keywords', 'CodeIgniter Lex Template Parser')->build('lex_parser'); }
/** * Non-persistent database connection * * @param bool * @return object */ public function db_connect($persistent = FALSE) { /* Prior to PHP 5.3.6, even if the charset was supplied in the DSN * on connect - it was ignored. This is a work-around for the issue. * * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php */ if (!is_php('5.3.6') && !empty($this->char_set)) { $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $this->char_set . (empty($this->dbcollat) ? '' : ' COLLATE ' . $this->dbcollat); } return parent::db_connect($persistent); }
public function common_functions() { echo is_php('5.3'); echo is_really_writable('file.php'); echo config_item('key'); echo set_status_header('200', 'text'); echo remove_invisible_characters('Java\\0script'); echo html_escape(array()); echo get_mimes(); echo is_https(); echo is_cli(); echo function_usable('eval'); }
/** * Create a PDF * * The minimum required to create a PDF is some HTML provided as a string. * This is easily done in CI by providing the contents of a view. * * Example: * ------------------------------------------------------ * $this->load->helper('pdf_creation'); * $html = $this->load->view( * 'pdf_template', * ( isset( $view_data ) ) ? $view_data : '', * TRUE * ); * pdf_create( $html ); * ------------------------------------------------------ * * @param string HTML to be used for making a PDF * @param array Configuration options */ function pdf_create($html, $config = array()) { $defaults = array('output_type' => 'stream', 'filename' => microtime(TRUE) . '.pdf', 'upload_dir' => FCPATH . 'upload_directory/pdfs/', 'load_html' => TRUE, 'html_encoding' => '', 'load_html_file' => FALSE, 'output_compression' => 1, 'set_base_path' => FALSE, 'set_paper' => FALSE, 'paper_size' => 'letter', 'paper_orientation' => 'portrait', 'stream_compression' => 1, 'stream_attachment' => 1); // Set options from defaults and incoming config array $options = array_merge($defaults, $config); // Remove any previously created headers if (is_php('5.3.0') && $options['output_type'] == 'stream') { header_remove(); } // Load dompdf require_once "dompdf/dompdf_config.inc.php"; // Create a dompdf object $dompdf = new DOMPDF(); // Set supplied base path if ($options['set_base_path'] !== FALSE) { $dompdf->set_base_path($options['set_base_path']); } // Set supplied paper if ($options['set_paper'] !== FALSE) { $dompdf->set_paper($options['paper_size'], $options['paper_orientation']); } // Load the HTML that will be turned into a PDF if ($options['load_html_file'] !== FALSE) { // Loads an HTML file $dompdf->load_html_file($html); } else { // Loads an HTML string $dompdf->load_html($html, $options['html_encoding']); } // Create the PDF $dompdf->render(); // If destination is the browser if ($options['output_type'] == 'stream') { $dompdf->stream($options['filename'], array('compress' => $options['stream_compression'], 'Attachment' => $options['stream_attachment'])); } else { if ($options['output_type'] == 'string') { return $dompdf->output($options['output_compression']); } else { // Get an instance of CI $CI =& get_instance(); // Create upload directories if they don't exist if (!is_dir($options['upload_path'])) { mkdir($options['upload_path'], 0777, TRUE); } // Load the CI file helper $CI->load->helper('file'); // Save the file write_file($options['upload_path'] . $options['filename'], $dompdf->output()); } } }
/** * Persistent database connection * * @return object */ public function db_pconnect() { // Persistent connection support was added in PHP 5.3.0 if (!is_php('5.3')) { return $this->db_connect(); } // Use MySQL client compression? if ($this->compress === TRUE) { $port = empty($this->port) ? NULL : $this->port; $mysqli = mysqli_init(); $mysqli->real_connect('p:' . $this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); return $mysqli; } return empty($this->port) ? @new mysqli('p:' . $this->hostname, $this->username, $this->password, $this->database) : @new mysqli('p:' . $this->hostname, $this->username, $this->password, $this->database, $this->port); }
function composerRequiredc3d756b09e56e386c98d22248d033e5($fileIdentifier, $file) { // This tweak allowes installed Guzzle 6 (requires PHP 5.5) // not to cause source parsing error on lower PHP versions. if (!is_php('5.5')) { if (strpos($file, 'guzzlehttp/') !== false) { return; } } // if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; } }
function composerRequire54058c9d5fd9edc6c7a76b6c9c5c789d($fileIdentifier, $file) { // This tweak allowes installed Guzzle 6 (requires PHP 5.5) // not to cause source parsing error on lower PHP versions. if (!is_php('5.5')) { if (strpos($file, 'guzzlehttp/') !== false) { return; } } // if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; } }
public function __construct($config = array()) { $this->_is_ci_3 = (bool) ((int) CI_VERSION >= 3); $this->CI = get_instance(); $this->CI->load->helper('email'); $this->CI->load->helper('html'); if (!is_array($config)) { $config = array(); } $this->_safe_mode = !is_php('5.4') && ini_get('safe_mode'); if (!isset($config['charset'])) { $config['charset'] = config_item('charset'); } $this->initialize($config); log_message('info', 'MY_Email Class Initialized (Engine: ' . $this->mailer_engine . ')'); }
public function __construct() { parent::__construct(); $this->load->helper('url'); $this->registry->set('nav', 'playground'); if (!is_php('5.4')) { $this->error_message = 'PHP 5.4 is required for this demo to run.'; } if ($this->error_message == '') { try { $this->load->library('facebook'); } catch (Exception $ex) { $this->error_message = $ex->getMessage(); } } }