private static function runController($url) { bu::lib(sf('%s_application', $url->getBinType())); $class_name = sf('%sApplication', ucfirst($url->getBinType())); $app = new $class_name(); $app->runController($url); }
function resizeImage($origName, $destName, $maxWidth = false, $maxHeight = false, $quality = false) { //http://php.net/manual/en/function.imagecopyresampled.php if (!$maxWidth) { $maxWidth = bu::config('rc/maxWidth'); } if (!$maxHeight) { $maxHeight = bu::config('rc/maxHeight'); } if (!$quality) { $quality = bu::config('rc/quality'); } $width = $maxWidth; $height = $maxHeight; list($width_orig, $height_orig) = getimagesize($origName); $ratio_orig = $width_orig / $height_orig; if ($width_orig < $width and $height_orig < $height) { $width = $width_orig; $height = $height_orig; } elseif ($width / $height > $ratio_orig) { $width = $height * $ratio_orig; } else { $height = $width / $ratio_orig; } bu::lib('opt/smart_resize_image/smart_resize_image.function'); smart_resize_image($origName, $width, $height, false, $destName, false); }
function activerecord_autoload($class_name) { $inflector = new ActiveRecord\StandardInflector(); bu::lib('models/' . $inflector->uncamelize($class_name)); }
public static function layout() { bu::lib('bu/layout'); return buLayout::getInstance(); }
<?php bu::lib('helpers/shortcut'); bu::hook('session/init'); if (bu::isValidRequest()) { bu::hook('session/pages'); bu::hook('session/flash'); bu::hook('session/last_post'); } bu::hook('php_activerecord'); bu::lib('global'); bu::lib('yaml/sfYamlParser');
<?php bu::lib('session'); Session::start();
<?php bu::lib('php-activerecord/ActiveRecord'); ActiveRecord\Config::initialize(function ($cfg) { $dbs = bu::config('db'); $connections = array(); foreach ($dbs as $k => $v) { $connections[$k] = sprintf('%s://%s:%s@%s/%s', $v['driver'], $v['user'], $v['password'], $v['host'], $v['database']); } $cfg->set_connections($connections); $cfg->set_default_connection('default'); });
<?php require_once 'vendor/autoload.php'; require_once 'lib/prj/cache.php'; include 'base.php'; include 'boot/spyc.php'; #библиотека для парсинга конфигов include 'boot/bu_core.php'; include 'boot/bu_cache.php'; include 'boot/bu.php'; #магический класс который управляет всем-всем include 'boot/bu_route.php'; include 'boot/bu_loader.php'; include 'boot/bu_url.php'; include 'boot/bu_statistic.php'; include 'boot/bu_logger.php'; bu::timer('init', 'system'); bu::hook(['preload', 'blank']); bu::lib('category'); bu::lib('models/example');
<?php require_once 'lib/bu.defun/load.php'; bu::lib('category');
<?php bu::lib('helpers/shortcut'); bu::hook('session/init'); if (bu::isValidRequest()) { bu::hook('session/pages'); bu::hook('session/flash'); bu::hook('session/last_post'); } bu::hook('php_activerecord');
<?php bu::lib("opt/html_form_persister/lib/HTML/SemiParser"); bu::lib("opt/html_form_persister/lib/HTML/FormPersister"); class Form { public static function fillFromArray($htmlForm, $array = array()) { $savedPOST = $_POST; $_POST = $array; $data = HTML_FormPersister::ob_formPersisterHandler($htmlForm); $_POST = $savedPOST; return $data; } public static function fillFromLastPost($htmlForm) { return self::fillFromArray($htmlForm, bu::flash('last_post')); } public static function fillFromModel($htmlForm, $model) { return self::fillFromArray($htmlForm, $model->attributes()); } }
<? if($links){ echo cehr(); echo '<div id="links">'; if(count($links) == 1) echo $title.": <br>"; else echo $titles.": <br>"; bu::lib('helpers/intervals'); foreach ($links as $num=>$link){ if(is_array($link)){ foreach($link as $v) $t[$v][] = $num; }else{ $t[$link][] = $num; } } $return = array(); foreach ($t as $k=>$v){ $link = nice_link($k); $return[] = '<li>'.implode(', ', make_intervals($v)).' - '.$link."</li>\n"; } echo "<ul>".implode("\n",$return)."</ul>"; echo '</div>'; }