public function test_strrpos() { $this->assert_equal(MultiByte::strrpos($this->test_strings['lowercase'], $this->test_strings['strpos']), 2); $this->assert_equal(MultiByte::strrpos($this->test_strings['international'], 'n'), 38); // the string is 48 BYTES long, only 38 characters long }
/** * Write the default options */ private function create_default_options() { // Create the default options Options::set('installed', true); Options::set('title', $this->handler_vars['blog_title']); Options::set('base_url', MultiByte::substr($_SERVER['REQUEST_URI'], 0, MultiByte::strrpos($_SERVER['REQUEST_URI'], '/') + 1)); Options::set('pagination', '5'); Options::set('atom_entries', '5'); Options::set('theme_name', 'k2'); Options::set('theme_dir', 'k2'); Options::set('comments_require_id', 1); Options::set('locale', $this->handler_vars['locale']); Options::set('timezone', 'UTC'); Options::set('dateformat', 'Y-m-d'); Options::set('timeformat', 'g:i a'); // generate a random-ish number to use as the salt for // a SHA1 hash that will serve as the unique identifier for // this installation. Also for use in cookies Options::set('GUID', sha1(Options::get('base_url') . Utils::nonce())); // Let's prepare the EventLog here, as well EventLog::register_type('default', 'habari'); EventLog::register_type('user', 'habari'); EventLog::register_type('authentication', 'habari'); EventLog::register_type('content', 'habari'); EventLog::register_type('comment', 'habari'); // Add the cronjob to truncate the log so that it doesn't get too big CronTab::add_daily_cron('truncate_log', array('Utils', 'truncate_log'), _t('Truncate the log table')); return true; }