public function action_index() { $this->template->title = __('Contact'); $this->template->content = View::factory('page/contact')->bind('errors', $errors); // Validate the required fields $data = Validate::factory($_POST)->filter('name', 'trim')->rule('name', 'not_empty')->filter('email', 'trim')->rule('email', 'not_empty')->rule('email', 'email')->filter('message', 'trim')->filter('message', 'Security::xss_clean')->filter('message', 'strip_tags')->rule('message', 'not_empty'); if ($data->check()) { // Load Swift Mailer require Kohana::find_file('vendor', 'swiftmailer/lib/swift_required'); $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); // Get the email config $config = Kohana::config('site.contact'); $recipient = $config['recipient']; $subject = $config['subject']; // Create an email message $message = Swift_Message::newInstance()->setSubject(__($subject, array(':name' => $data['name'])))->setFrom(array($data['email'] => $data['name']))->setTo($recipient)->addPart($data['message'], 'text/plain'); // Send the message Swift_Mailer::newInstance($transport)->send($message); // Set the activity and flash message Activity::set(Activity::SUCCESS, __('Message sent from :email', array(':email' => $data['email']))); Message::set(Message::SUCCESS, __('Message successfully sent.')); // Redirect to prevent POST refresh $this->request->redirect($this->request->uri); } if ($errors = $data->errors('contact')) { // Set the error flash message Message::set(Message::ERROR, __('Please correct the errors.')); } $_POST = $data->as_array(); }
/** * Returns the translation table for a given language. * * @param string language to load * @return array */ public static function load($lang) { if (!isset(I18n::$_cache[$lang])) { // Separate the language and locale list($language, $locale) = explode('-', strtolower($lang), 2); // Start a new translation table $table = array(); // Add the non-specific language strings if ($files = Kohana::find_file('i18n', $language)) { foreach ($files as $file) { // Merge the language strings into the translation table $table = array_merge($table, require $file); } } // Add the locale-specific language strings if ($files = Kohana::find_file('i18n', $language . '/' . $locale)) { foreach ($files as $file) { // Merge the locale strings into the translation table $table = array_merge($table, require $file); } } // Cache the translation table locally I18n::$_cache[$lang] = $table; } return I18n::$_cache[$lang]; }
public function before() { parent::before(); // Borrowed from userguide if (isset($_GET['lang'])) { $lang = $_GET['lang']; // Make sure the translations is valid $translations = Kohana::message('langify', 'translations'); if (in_array($lang, array_keys($translations))) { // Set the language cookie Cookie::set('langify_language', $lang, Date::YEAR); } // Reload the page $this->request->redirect($this->request->uri()); } // Set the translation language I18n::$lang = Cookie::get('langify_language', Kohana::config('langify')->lang); // Borrowed from Vendo // Automaticly load a view class based on action. $view_name = $this->view_prefix . Request::current()->action(); if (Kohana::find_file('classes', strtolower(str_replace('_', '/', $view_name)))) { $this->view = new $view_name(); $this->view->set('version', $this->version); } }
/** * @param $filename */ public function __construct($filename) { //\Route::name(\Request::current()->uri()); $path = \Kohana::find_file('views', $filename, 'tpl'); $this->_filename = $path && ($f_path = str_replace('.tpl', '', $path)) ? $f_path : ''; $this->_instance = self::init(); }
protected function render_markdown_template($content) { require Kohana::find_file('vendor', 'Markdown'); $this->template->content = $content->render(FALSE, 'Markdown'); $this->template->title = implode(' | ', $this->template->title); $this->template->render(TRUE); }
public function index() { define('DEBUG', true); // an array of file extensions to accept $accepted_extensions = array("png", "jpg", "gif"); // http://your-web-site.domain/base/url $base_url = url::base() . Kohana::config('upload.relative_directory', TRUE) . "jwysiwyg"; // the root path of the upload directory on the server $uploads_dir = Kohana::config('upload.directory', TRUE) . "jwysiwyg"; // the root path that the files are available from the webserver $uploads_access_dir = Kohana::config('upload.directory', TRUE) . "jwysiwyg"; if (!file_exists($uploads_access_dir)) { mkdir($uploads_access_dir, 0775); } if (DEBUG) { if (!file_exists($uploads_access_dir)) { $error = 'Folder "' . $uploads_access_dir . '" doesn\'t exists.'; header('Content-type: text/html; charset=UTF-8'); print '{"error":"config.php: ' . htmlentities($error) . '","success":false}'; exit; } } $capabilities = array("move" => false, "rename" => true, "remove" => true, "mkdir" => false, "upload" => true); if (extension_loaded('mbstring')) { mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); } require_once Kohana::find_file('libraries/jwysiwyg', 'common', TRUE); require_once Kohana::find_file('libraries/jwysiwyg', 'handlers', TRUE); ResponseRouter::getInstance()->run(); }
function test_autoload($class) { $file = str_replace('_', '/', $class); if ($file = Kohana::find_file('tests/classes', $file)) { require_once $file; } }
/** * Send The SMS Message Using Default Provider * * @param to mixed The destination address. * @param from mixed The source/sender address * @param text mixed The text content of the message * @return mixed/bool (returns TRUE if sent FALSE or other text for fail) */ public static function send($to = NULL, $from = NULL, $message = NULL) { if (!$to or !$message) { return "Missing Recipients and/or Message"; } // 1. Do we have an SMS Provider? $provider = Kohana::config("settings.sms_provider"); if ($provider) { // 2. Does the plugin exist, and if so, is it active? $plugin = ORM::factory("plugin")->where("plugin_name", $provider)->where("plugin_active", 1)->find(); // Plugin loaded if ($plugin->loaded) { // 3. Does this plugin have the SMS Library in place? // SMS libaries should be suffixed with "_Sms_Provider" $class = ucfirst($provider) . '_Sms_Provider'; if (Kohana::find_file('libraries', $class)) { $provider = new $class(); // Sanity check - Ensure all SMS providers are sub-classes of Sms_Provider_Core if (!$provider instanceof Sms_Provider_Core) { throw new Kohana_Exception('All SMS Provider libraries must be be sub-classes of Sms_Provider_Core'); } // Proceed $response = $provider->send($to, $from, $message); // Return return $response; } } } return "No SMS Sending Provider In System"; }
public function __construct(array $config) { parent::__construct($config); Kohana::load(Kohana::find_file('vendors', 'sphinxapi')); $this->_client = new SphinxClient(); $this->_client->SetServer($this->config('host'), $this->config('port')); }
public function before() { if (Kohana::find_file('views', $this->main_template)) { $this->main_template = View::factory($this->main_template); $system_settings = ORM::factory('Systemsetting')->where('name', 'IN', array('language', 'title', 'keywords', 'description', 'copyright'))->find_all()->as_array('name', 'value'); $language_parts = explode('-', $system_settings['language']); $this->main_template->head_style = ''; $this->main_template->html_lang = $language_parts[0]; /* Print language as ISO: from "en-us" only "en", described at: http://www.w3schools.com/Tags/ref_language_codes.asp */ $this->main_template->title = $system_settings['title']; $this->main_template->meta_keywords = $system_settings['keywords']; $this->main_template->meta_description = $system_settings['description']; $this->main_template->meta_copyright = $system_settings['copyright']; $this->main_template->content = ''; } $dir = strtolower($this->request->directory()) . "/" . str_replace('_', '/', strtolower($this->request->controller())); $file = $this->request->action(); if (Kohana::find_file('views/' . $dir, $file)) { $this->template = View::factory($dir . '/' . $file); $this->template->data = array(); $this->template->data["errors"] = array(); $this->template->data["values"] = array(); } parent::before(); }
public function save() { if (!$_POST) { die; } $this->rsp = Response::instance(); if (!valid::email($_POST['email'])) { $this->rsp->msg = 'Invalid Email!'; $this->rsp->send(); } elseif ($this->owner->unique_key_exists($_POST['email'])) { $this->rsp->msg = 'Email already exists!'; $this->rsp->send(); } $pw = text::random('alnum', 8); $this->owner->email = $_POST['email']; $this->owner->password = $pw; $this->owner->save(); $replyto = 'unknown'; $body = "Hi there, thanks for saving your progess over at http://pluspanda.com \r\n" . "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda"; # to do FIX THE HEADERS. $subject = 'Your Pluspanda account information =)'; $headers = "From: welcome@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['email'], $subject, $body, $headers); # add to mailing list. include Kohana::find_file('vendor/mailchimp', 'MCAPI'); $config = Kohana::config('mailchimp'); $mailchimp = new MCAPI($config['apikey']); $mailchimp->listSubscribe($config['list_id'], $_POST['email'], '', 'text', FALSE, TRUE, TRUE, FALSE); $this->rsp->status = 'success'; $this->rsp->msg = 'Thanks, Account Saved!'; $this->rsp->send(); }
public function action_captcha() { Session::instance(); $path = Kohana::find_file('vendor', 'cool-php-captcha-0.3.1/captcha'); require_once $path; $captcha = new SimpleCaptcha(); // OPTIONAL Change configuration... $captcha->wordsFile = 'words/en.php'; $captcha->session_var = 'captcha'; $captcha->imageFormat = 'png'; $captcha->lineWidth = 3; //$captcha->scale = 3; $captcha->blur = true; $captcha->resourcesPath = APPPATH . "vendor/cool-php-captcha-0.3.1/resources"; // OPTIONAL Simple autodetect language example /* if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $langs = array('en', 'es'); $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); if (in_array($lang, $langs)) { $captcha->wordsFile = "words/$lang.php"; } } */ // Image generation ob_start(); $captcha->CreateImage(); $content = ob_get_contents(); ob_end_clean(); $this->response->headers('Content-type', 'image/png'); $this->response->send_headers(); $this->response->body($content); }
/** * sends an email using our configs * @param string/array $to array(array('name'=>'chema','email'=>'chema@'),) * @param [type] $to_name [description] * @param [type] $subject [description] * @param [type] $body [description] * @param [type] $reply [description] * @param [type] $replyName [description] * @param [type] $file [description] * @return boolean */ public static function send($to, $to_name = '', $subject, $body, $reply, $replyName, $file = NULL) { require_once Kohana::find_file('vendor', 'php-mailer/phpmailer', 'php'); $body = Text::bb2html($body, TRUE); //get the template from the html email boilerplate $body = View::factory('email', array('title' => $subject, 'content' => nl2br($body)))->render(); $mail = new PHPMailer(); $mail->CharSet = Kohana::$charset; if (core::config('email.smtp_active') == TRUE) { $mail->IsSMTP(); //SMTP HOST config if (core::config('email.smtp_host') != "") { $mail->Host = core::config('email.smtp_host'); // sets custom SMTP server } //SMTP PORT config if (core::config('email.smtp_port') != "") { $mail->Port = core::config('email.smtp_port'); // set a custom SMTP port } //SMTP AUTH config if (core::config('email.smtp_auth') == TRUE) { $mail->SMTPAuth = TRUE; // enable SMTP authentication $mail->Username = core::config('email.smtp_user'); // SMTP username $mail->Password = core::config('email.smtp_pass'); // SMTP password if (core::config('email.smtp_ssl') == TRUE) { $mail->SMTPSecure = "ssl"; // sets the prefix to the server } } } $mail->From = core::config('email.notify_email'); $mail->FromName = "no-reply " . core::config('general.site_name'); $mail->Subject = $subject; $mail->MsgHTML($body); if ($file !== NULL) { $mail->AddAttachment($file['tmp_name'], $file['name']); } $mail->AddReplyTo($reply, $replyName); //they answer here if (is_array($to)) { foreach ($to as $contact) { $mail->AddBCC($contact['email'], $contact['name']); } } else { $mail->AddAddress($to, $to_name); } $mail->IsHTML(TRUE); // send as HTML if (!$mail->Send()) { //to see if we return a message or a value bolean Alert::set(Alert::ALERT, "Mailer Error: " . $mail->ErrorInfo); return FALSE; } else { return TRUE; } }
/** * Serve the file to the browser AND cache it for direct access if in STAGING OR PRODUCTION. */ public function action_index() { $file = $this->request->param('file'); $ext = pathinfo($file, PATHINFO_EXTENSION); $path = Kohana::find_file('assets', $file, FALSE); if ($path === FALSE) { throw HTTP_Exception::factory('404', 'File not found!'); } $dir = DOCROOT . 'assets' . DIRECTORY_SEPARATOR; // Set the proper headers for browser caching $this->response->headers('content-type', File::mime_by_ext($ext)); $this->response->headers('last-modified', date('r', filemtime($path))); $content = file_get_contents($path); $this->response->body($content); // Don't cache the assets unless we are in STAGING OR PRODUCTION. if (Kohana::$environment >= Kohana::STAGING) { return; } // Only cache for specific extensions. if (!in_array($ext, $this->_cache_extensions)) { return; } // Check if assets sub dir exist. $parts = explode('/', $file); $file = array_pop($parts); foreach ($parts as $part) { $dir .= $part . DIRECTORY_SEPARATOR; if (!is_dir($dir)) { mkdir($dir); } } file_put_contents($dir . $file, $content); }
public function __construct(array $options = array()) { $this->_basedir = isset($options['base']) ? $options['base'] : 'aceui'; $this->type = isset($options['type']) ? $options['type'] : 'page'; //page or layout? $this->name = $options["name"]; //page or layout name $this->data_dir = $options['path']['data']; $data = $this->_load_file($options['base'], "{$this->data_dir}/{$this->type}s/{$this->name}", 'json'); //file_get_contents($filename); $this->vars = json_decode($data, TRUE); if (isset($this->vars['alias'])) { $this->name = $this->vars['alias']; $data = $this->_load_file($options['base'], "{$this->data_dir}/{$this->type}s/{$this->name}", 'json'); $this->vars = array_merge(json_decode($data, TRUE), $this->vars); } if ($this->type != "layout" && !isset($this->vars["layout"])) { //if no default layout for this page, then consider it to be "default" $this->vars["layout"] = "default"; } $this->views_dir = $options['path']['views']; if ($this->type == 'page') { if (is_file(Kohana::find_file($this->_basedir, "{$this->views_dir}/assets/scripts/{$this->name}", 'js'))) { $this->vars['inline_scripts'] = $this->_load_file($options['base'], "{$this->views_dir}/assets/scripts/{$this->name}", 'js'); } if (is_file(Kohana::find_file($this->_basedir, "{$this->views_dir}/assets/styles/{$this->name}", 'css'))) { $this->vars['inline_styles'] = $this->_load_file($options['base'], "{$this->views_dir}/assets/styles/{$this->name}", 'css'); } } $this->map_script_names(); //now load all data relating to this page $this->load_data($this->data_dir); }
public function action_index() { if (Kohana::$environment !== Kohana::PRODUCTION) { require Kohana::find_file('vendor/webgrind', 'index'); } die; }
public function test_render() { $view = new View_Test(); $expected = file_get_contents(Kohana::find_file('tests', 'output/test', 'txt')); $this->assertSame($expected, $view->render()); }
/** * @return string */ public function bootstrap() { $file = Kohana::find_file('assets', 'css/bootstrap.min', 'css'); if ($file !== NULL) { return file_get_contents($file); } }
public function before() { if (is_null($this->_template)) { $this->_template = $this->request->controller . '/' . $this->request->action; } if ($this->_auto_render) { $this->_master = View::factory($this->_master); if (($path = Kohana::find_file('views', $this->_template)) !== FALSE) { $this->_template = View::factory($this->_template); } else { $this->_template = $this->request->controller . '/' . $this->request->_action_requested; if (($path = Kohana::find_file('views', $this->_template)) !== FALSE) { $this->_template = View::factory($this->_template); } else { $this->_template = $this->request->controller; if (($path = Kohana::find_file('views', $this->_template)) !== FALSE) { $this->_template = View::factory($this->_template); } else { $this->_template = ""; $this->_auto_render = FALSE; } } } $this->_master->styles = array(); $this->_master->scripts = array(); $this->_master->metas = array(); $this->_master->httpequivs = array(); $this->_master->links = array(); $this->_master->body = ""; $this->_master->js_text = ""; } }
/** * Send The SMS Message Using Default Provider * @param to mixed The destination address. * @param from mixed The source/sender address * @param text mixed The text content of the message * * @return mixed/bool (returns TRUE if sent FALSE or other text for fail) */ public static function send($to = NULL, $from = NULL, $message = NULL) { if (!$to or !$message) { return "Missing Recipients and/or Message"; } // 1. Do we have an SMS Provider? $provider = Kohana::config("settings.sms_provider"); if ($provider) { // 2. Does the plugin exist, and if so, is it active? $plugin = ORM::factory("plugin")->where("plugin_name", $provider)->where("plugin_active", 1)->find(); if ($plugin->loaded) { // Plugin exists and is active // 3. Does this plugin have the SMS Library in place? $class = ucfirst($provider) . '_SMS'; if (Kohana::find_file('libraries', $provider . '_SMS')) { // File Exists $sender = new $class(); // 4. Does the send method exist in this class? if (method_exists($sender, 'send')) { $response = $sender->send($to, $from, $message); return $response; } } } } return "No SMS Sending Provider In System"; }
/** * [action_form] generates the form to pay at paypal */ public function action_pay() { $this->auto_render = FALSE; $id_order = $this->request->param('id'); //retrieve info for the item in DB $order = new Model_Order(); $order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find(); if ($order->loaded()) { // include class vendor require Kohana::find_file('vendor/authorize/', 'autoload'); define('AUTHORIZENET_API_LOGIN_ID', Core::config('payment.authorize_login')); define('AUTHORIZENET_TRANSACTION_KEY', Core::config('payment.authorize_key')); define('AUTHORIZENET_SANDBOX', Core::config('payment.authorize_sandbox')); $sale = new AuthorizeNetAIM(); $sale->amount = $order->amount; $sale->card_num = Core::post('card-number'); $sale->exp_date = Core::post('expiry-month') . '/' . Core::post('expiry-year'); $response = $sale->authorizeAndCapture(); if ($response->approved) { $order->confirm_payment('authorize', $response->transaction_id); //redirect him to his ads Alert::set(Alert::SUCCESS, __('Thanks for your payment!') . ' ' . $response->transaction_id); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } else { Alert::set(Alert::INFO, $response->error_message); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } } else { Alert::set(Alert::INFO, __('Order could not be loaded')); $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } }
/** * Returns the translation table for a given language. * * @param string language to load * @return array */ public static function load($lang) { if (isset(I18n::$_cache[$lang])) { return I18n::$_cache[$lang]; } // New translation table $table = array(); // Split the language: language, region, locale, etc $parts = explode('-', $lang); do { // Create a path for this set of parts $path = implode(DIRECTORY_SEPARATOR, $parts); if ($files = Kohana::find_file('i18n', $path)) { $t = array(); foreach ($files as $file) { // Merge the language strings into the sub table $t = array_merge($t, Kohana::load($file)); } // Append the sub table, preventing less specific language // files from overloading more specific files $table += $t; } // Remove the last part array_pop($parts); } while ($parts); // Cache the translation table locally return I18n::$_cache[$lang] = $table; }
public function action_rid() { if (!user::logged()) { ajax::error('You must be logged in to see this.', array('problem' => 'auth')); } $user = user::get(); $langs = array(1 => 'english', 17 => 'french', 19 => 'german', 22 => 'hungarian', 34 => 'portugese'); $userlang = $user->option('language'); if (!key_exists($userlang, $langs)) { ajax::error('We currently only have RID data available for English, French, German, Hungarian and Portugese.', array('problem' => 'data')); } $page = ORM::factory('Page', arr::get($_POST, 'id', '')); if (!$page->loaded() || !$page->user_id == $user->id) { ajax::error('That page wasn\'t found!'); } if ($page->rid == '') { require Kohana::find_file('vendor/rid', 'rid'); $rid = new RID(); $rid->load_dictionary(Kohana::find_file('vendor/rid', $langs[$userlang], 'cat')); $data = $rid->analyze($page->content()); $vals = array(); $colors = array('#B0BF1A', '#7CB9E8', '#C9FFE5', '#B284BE', '#5D8AA8', '#00308F', '#00308F', '#AF002A', '#F0F8FF', '#E32636', '#C46210', '#EFDECD', '#E52B50', '#AB274F', '#F19CBB', '#3B7A57', '#FFBF00', '#FF7E00', '#FF033E', '#9966CC', '#A4C639', '#CD9575', '#665D1E', '#915C83', '#841B2D', '#FAEBD7', '#008000', '#8DB600', '#FBCEB1', '#00FFFF', '#7FFFD4', '#4B5320', '#3B444B', '#8F9779', '#E9D66B', '#B2BEB5', '#87A96B', '#FF9966', '#A52A2A', '#FDEE00', '#6E7F80', '#568203', '#007FFF'); $i = 0; foreach ($data->category_percentage as $key => $val) { $vals[] = array('value' => $val, 'label' => $key, 'color' => $colors[$i]); $i++; } $page->rid = serialize($vals); $page->save(); } ajax::success('ok', array('data' => unserialize($page->rid))); }
/** * Includes needed libraries (CSSMin & JSMin). */ protected function __construct(array $config) { parent::__construct($config); require_once Kohana::find_file('vendor/cssmin', 'cssmin'); require_once Kohana::find_file('vendor/jsmin', 'jsmin'); }
/** * Find a template file in the cascading filesystem * * @param string $name Base name of template file * @return string Path to template file */ public function find_template($name) { if (($path = Kohana::find_file($this->_config['path'], $name, $this->_config['extension'])) === FALSE) { throw new Twig_Exception('The requested twig :name could not be found', array(':name' => $name)); } return $path; }
public static function parse_config($file) { $config = new stdClass(); $config->name = $file; $config->description = ''; $config->options = array(); if ($filename = Kohana::find_file('config', $file)) { $config->source = file_get_contents($filename[0]); $start_offset = 0; // Find the config file comment first if (preg_match('~(/\\*.*?\\*/)~s', $config->source, $config_comment)) { $comment = Kodoc::parse($config_comment[0]); $config->description = $comment[0]; $config->tags = $comment[1]; $start_offset = strlen($config_comment[0]); } preg_match_all('~(/\\*.*?\\*/)?\\s*(\\$config\\[([^\\]]+)]\\s*=\\s*([^;]*?);)~s', $config->source, $matches, PREG_SET_ORDER, $start_offset); foreach ($matches as $item) { $comment = Kodoc::parse($item[1]); $default = isset($comment[1]['default'][0]) ? $comment[1]['default'][0] : NULL; // Remove the @default tag unset($comment[1]['default']); $config->options[] = (object) array('description' => $comment[0], 'source' => $item[2], 'name' => trim($item[3], '\'"'), 'value' => $item[4], 'default' => $default, 'tags' => (object) $comment[1]); } } return $config; }
/** * Returns the singleton instance of HTML Purifier. If no instance has * been created, a new instance will be created. Configuration options * for HTML Purifier can be set in `APPPATH/config/purifier.php` in the * "settings" key. * * $purifier = Security::htmlpurifier(); * * @return HTMLPurifier */ public static function htmlpurifier() { if (!Security::$htmlpurifier) { if (!class_exists('HTMLPurifier_Config', FALSE)) { if (kohana::$config->load('purifier')->get('preload')) { // Load the all of HTML Purifier right now. // This increases performance with a slight hit to memory usage. require Kohana::find_file('vendor', 'htmlpurifier/library/HTMLPurifier.includes'); } // Load the HTML Purifier auto loader require Kohana::find_file('vendor', 'htmlpurifier/library/HTMLPurifier.auto'); } // Create a new configuration object $config = HTMLPurifier_Config::createDefault(); if (!kohana::$config->load('purifier')->get('finalize')) { // Allow configuration to be modified $config->autoFinalize = FALSE; } // Use the same character set as Kohana $config->set('Core.Encoding', Kohana::$charset); if (is_array($settings = kohana::$config->load('purifier')->get('settings'))) { // Load the settings $config->loadArray($settings); } // Configure additional options $config = Security::configure($config); // Create the purifier instance Security::$htmlpurifier = new HTMLPurifier($config); } return Security::$htmlpurifier; }
public function set_filename($file) { Kohana::$profiling === TRUE && ($bm = Profiler::start('View', __FUNCTION__)); $this->_import_options($file); if ($this->_viewfile) { if (($path = Kohana::find_file('views', $this->_viewfile, $this->_format . '.haml')) === FALSE) { if (($path = Kohana::find_file('views', $this->_viewfile, $this->_format . '.php')) !== FALSE) { $this->_file = $path; } else { if (is_string($file) && ($path = Kohana::find_file('views', $file)) !== FALSE) { $this->_file = $path; } } isset($bm) && Profiler::stop($bm); return $this; } $this->_file = $this->_get_compiled_haml($path); isset($bm) && Profiler::stop($bm); return $this; } if ($this->_is_inline) { $this->_file = $this->_get_compiled_inline_haml($this->_inline_haml); } isset($bm) && Profiler::stop($bm); return $this; }
public static function include_vendor() { require_once Kohana::find_file('vendor', 'hybridauth/hybridauth/Hybrid/Auth', 'php'); require_once Kohana::find_file('vendor', 'hybridauth/hybridauth/Hybrid/Endpoint', 'php'); require_once Kohana::find_file('vendor', 'hybridauth/hybridauth/Hybrid/Logger', 'php'); require_once Kohana::find_file('vendor', 'hybridauth/hybridauth/Hybrid/Exception', 'php'); }
/** * Creates the spreadsheet with given or default settings * * @param array $options with optional parameters: title, subject, description, author * @return void */ public function __construct($options = array()) { /* PHP Excel integration */ require_once Kohana::find_file('vendor', 'phpexcel/Classes/PHPExcel'); $this->_spreadsheet = new PHPExcel(); $this->set_options($options); }