/** * @func void * @return void */ public function __construct() { echo 'tss1 controller works<br/>'; /* load::service('validator'); $rules = array ( 'name' => 'alpha|required', 'year' => 'num|required', ); $Validation = new Validator(); $Validation->validate($_POST, $rules); if (!$Validation->passed()) { $Validation->goBackWithErrors(); } if (!empty($Validation->getErrors())) { print_r($Validation->getErrors()); } */ load::library(SF::STRINGS); load::library(SF::NETWORK); #$test_string = Strings::generate_password(4); $test_string = Strings::generatePassword(4); var_dump($test_string); $numeric_test = (int) '-abc12.3edf'; // this SHOULD FALL AND THROW AN ERROR #var_dump(Strings::strip_to_numeric($numeric_test)); var_dump(Strings::StripToNumeric($numeric_test)); #var_dump(Network::get_client_lang()); var_dump(Network::getClientLang()); exit; // database testing $data = Entries::getData(); var_dump($data); /* load::library(SF::DEBUG); //load::library(SF::DEBUG)->func('pr'); // will only load clean_str() ExecuteTime::start(); $parameters = array ( 'key' => '1e46165dsa5ds4a', 'action' => 'push', 'userid' => 1234998, 'keywords' => 'test' ); ExecuteTime::end(); echo ExecuteTime::display(); */ }
public static function run() { define('DINGO_VERSION', '0.7.1'); // Start buffer ob_start(); // Autoloading files require_once SYSTEM . '/core/core.php'; require_once SYSTEM . '/core/error.php'; spl_autoload_register(array('bootstrap', 'autoload')); bootstrap::addPackage(SYSTEM . '/core'); bootstrap::addPackage(SYSTEM . '/library'); bootstrap::addPackage(APPLICATION . '/'); load::library('db'); require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/config.php'; set_error_handler('dingo_error'); set_exception_handler('dingo_exception'); // Load route configuration require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/route.php'; set_error_handler('dingo_error'); set_exception_handler('dingo_exception'); config::set('system', SYSTEM); config::set('application', APPLICATION); config::set('config', CONFIG); // Load route configuration require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/route.php'; // Get route $uri = route::get(bootstrap::get_request_url()); // Set current page define('CURRENT_PAGE', $uri['string']); // Validate if (!route::valid($uri)) { load::error('general', 'Invalid URL', 'The requested URL contains invalid characters.'); } // Load Controller //---------------------------------------------------------------------------------------------- // Initialize controller $tmp = "{$uri['controller_class']}_controller"; if (!class_exists($tmp)) { load::error('404'); } $controller = new $tmp(); unset($tmp); // Check if using valid REST API if (api::get()) { if (!empty($controller->controller_api) and is_array($controller->controller_api) and !empty($controller->controller_api[$uri['function']]) and is_array($controller->controller_api[$uri['function']])) { foreach ($controller->controller_api[$uri['function']] as $e) { api::permit($e); } if (!api::allowed(api::get())) { load::error('404'); } } else { load::error('404'); } } // Autoload Components bootstrap::autoload1($controller); // Check to see if function exists if (!is_callable(array($controller, $uri['function']))) { // Try replacing underscores with dashes $minus_function_name = str_replace('-', '_', $uri['function']); if (!is_callable(array($controller, $minus_function_name))) { load::error('404'); } else { $uri['function'] = $minus_function_name; } } // Run Function call_user_func_array(array($controller, $uri['function']), $uri['arguments']); // Display echoed content ob_end_flush(); }
{ if (empty($names)) { return false; } if (!is_array($names)) { $tmp[0] = $names; $names = $tmp; } foreach ($names as $name) { include 'helpers/' . $name . '.php'; } } public static function model($names) { if (empty($names)) { return false; } if (!is_array($names)) { $tmp[0] = $names; $names = $tmp; } foreach ($names as $name) { include 'model/' . $name . '.php'; } } } //Auto Load from config config::load(); load::library(config::item('autoload_lib')); load::helper(config::item('autoload_helper')); load::model(config::item('autoload_model'));
public function paginate($page = 1, $limit = 10, &$p = FALSE) { // Get row count $q = new DingoQuery('count'); $q->table = $this->table; $q->where_list = $this->where_list; $q->order_list = $this->order_list; $q->_join = $this->_join; $count = $q->execute(); // Paginate load::library('pagination'); $p = new pagination($count, $page, $limit); $this->offset($p->min); $this->limit($limit); return $this; }
public static function api($id = '76561197988315974') { load::library('steam_api'); steam_api::getinfo($id); echo '<img src="' . steam_api::$avatar . '"/>'; }