本文整理汇总了PHP中Load类的典型用法代码示例。如果您正苦于以下问题:PHP Load类的具体用法?PHP Load怎么用?PHP Load使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Load类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Render
public function Render($form = "", $response_location = "", $url = "", $args = "")
{
$errorMsg = '';
$errors = FALSE;
$Load = new Load();
if (function_exists('is_empty') == FALSE) {
// Load validate helper
$Load->Helper('validate');
}
if (is_empty($form) == FALSE) {
$this->form = $form;
}
if (is_empty($response_location) == FALSE) {
$this->response_location = $response_location;
}
if (is_empty($url) == FALSE) {
$this->url = $url;
}
if (is_empty($args) == FALSE) {
$this->args = $args;
}
if (is_empty($this->form)) {
$errorMsg .= ' form requerido :$obj-> Form("id-form")<br /> ';
$errors = TRUE;
}
if (is_empty($this->response_location)) {
$errorMsg .= ' response_location requerido : $obj-> ResponseLocation("id-div-location")<br /> ';
$errors = TRUE;
}
if (is_empty($this->url)) {
$errorMsg .= ' url requerida : $obj-> Url("Controller/Action")<br /> ';
$errors = TRUE;
}
if ($errors == TRUE) {
echo 'Error:<br />' . $errorMsg;
return FALSE;
} else {
// Crear respuesta
$butonsCode = $this->RenderButtons();
$params = 'form:' . $this->form . ';url:' . $this->url . ';args:' . $this->args . ';';
$fx = new fk_ajax('submit', $this->response_location, $params);
$Result = ' <script type="text/javascript">
<!--
' . $butonsCode . '
$("#' . $this->form . '").validate({
submitHandler: function(form) {
' . $fx->render() . '
return false;
},invalidHandler: function(form, validator){
var errors = validator.numberOfInvalids();
if (errors) { alert("Por favor, llena los campos obligatorios");}
}
});
//-->
</script>';
return $Result;
}
}
示例2: register
public function register(Load $container)
{
$container->bindShared('db', function () {
return new \CODOF\Database\Connector();
});
$container->bindShared('i', function () {
return new \CODOF\User\CurrentUser\CurrentUser();
});
}
示例3: testLoadWithSystemData
/**
* @covers SysInfo\Linux\Load::__construct
* @covers SysInfo\Linux\Load::getAvg
*/
public function testLoadWithSystemData()
{
$load = new Load();
$result = $load->getAvg();
$this->assertInternalType('array', $result);
$this->assertInternalType('float', $result[0]);
$this->assertInternalType('float', $result[1]);
$this->assertInternalType('float', $result[2]);
}
示例4: testLoading
public function testLoading()
{
$sut = new Load(file_get_contents(__DIR__ . '/../.travis.yml'));
$scripts = $sut->getScripts();
$this->assertEquals('./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover', $scripts[0]);
$this->assertEquals('php ocular.phar code-coverage:upload --format=php-clover coverage.clover', $scripts[1]);
$this->assertEquals('./vendor/bin/phpcs --standard=PSR1 bin/ src/ test/', $scripts[2]);
$this->assertEquals('./vendor/bin/phpcs --standard=PSR2 bin/ src/ test/', $scripts[3]);
}
示例5: codes
function codes()
{
Load::model('user');
$User = new User();
$param['codes'] = $User->get_codes();
Load::view('codes', $param);
}
示例6: log_error
/**
* Handle log errors
*
* @author Rafael Nexus
* @param string $error_msg
* @return void
**/
function log_error($error_msg)
{
$error = Load::factory('Config')->error;
if ($error['log'] != 0) {
error_log($error_msg, $error['log'], $error['log_destination'], isset($error['log_extra_headers']) ? $error['log_extra_headers'] : '');
}
}
示例7: logout
/**
* logout
*
* @param void
* @return void
*/
public static function logout()
{
Load::lib('auth');
Load::lib('session');
Session::set(SESSION_KEY, false);
Auth::destroy_identity();
}
示例8: formatos
public function formatos()
{
$this->render(null, null);
Load::lib("formato");
echo "UTF8: " . Formato::utf8("México") . "<br />";
echo "Normal: " . "México" . "<br />";
echo "ISO8859-1: " . Formato::iso88591("México") . "<br />";
echo "<br />";
echo "Numero: " . Formato::numero(738374) . "<br />";
echo "Dinero: " . Formato::dinero(738374) . "<br />";
echo "Ceros: " . Formato::ceros(73, 5) . "<br />";
echo "<br />";
echo "Numero con Letra: " . Formato::numeroLetra(738374) . "<br />";
echo "<br />";
echo "Mayusculas: " . Formato::mayusculas("Lorem Ipsum is simply dummy text of the printing and typesetting industry") . "<br />";
echo "Minusculas: " . Formato::minusculas("Lorem Ipsum is simply dummy text of the printing and typesetting industry") . "<br />";
echo "Capital: " . Formato::capital("Lorem Ipsum is simply dummy text of the printing and typesetting industry") . "<br />";
echo "Texto: " . Formato::texto("clientes_distinguidos") . "<br />";
echo "Camello: " . Formato::camello("clientes_distinguidos") . "<br />";
echo "InversaCamello: " . Formato::inversaCamello("facturasEmitidasMes") . "<br />";
echo "<br />";
echo "Fecha: " . Formato::fecha(date("Y-m-d")) . "<br />";
echo "Fecha DB: " . Formato::fechaDB(date("d/m/Y")) . "<br />";
echo "Hora: " . Formato::hora(452) . "<br />";
}
示例9: logout
public function logout()
{
Load::lib('SdAuth');
SdAuth::logout();
View::template('login2');
Router::redirect('');
}
示例10: init
/**
* Starting point for every page request. Loads required core modules, gets data from url and calls
* necessary modules to make things happen.
*/
public static function init()
{
if (!self::$_inited) {
self::$_inited = true;
foreach (self::$_requiredCore as $module) {
require_once ROOT . 'core/' . $module . '/' . $module . EXT;
}
// Set the Load::auto method to handle all class loading from now on
spl_autoload_register('Load::auto');
Load::loadSetupFiles();
// If CLI mode, everything thats needed has been loaded
if (IS_CLI) {
return;
}
date_default_timezone_set(Config::get('system.timezone'));
Event::trigger('caffeine.started');
// If maintenance mode has been set in the config, stop everything and load mainteance view
if (Config::get('system.maintenance_mode')) {
View::error(ERROR_MAINTENANCE);
} else {
list($route, $data) = Router::getRouteData();
if ($data) {
if (self::_hasPermission($route, $data)) {
list($module, $controller, $method) = $data['callback'];
$params = Router::getParams();
// Make sure controller words are upper-case
$conBits = explode('_', $controller);
foreach ($conBits as &$bit) {
$bit = ucfirst($bit);
}
$controller = implode('_', $conBits);
$controller = sprintf('%s_%sController', ucfirst($module), ucwords($controller));
// Call the routes controller and method
if (method_exists($controller, $method)) {
$response = call_user_func_array(array($controller, $method), $params);
if (!self::_isErrorResponse($response)) {
Event::trigger('module.response', array($response));
View::load($module, $controller, $method);
} else {
View::error($response);
}
} else {
Log::error($module, sprintf('The method %s::%s() called by route %s doesn\'t exist.', $controller, $method, $route));
View::error(ERROR_500);
}
} else {
View::error(ERROR_ACCESSDENIED);
}
} else {
if ($route !== '[index]' || !View::directLoad('index')) {
View::error(ERROR_404);
}
}
}
View::output();
Event::trigger('caffeine.finished');
} else {
die('Why are you trying to re-initialize Caffeine?');
}
}
示例11: __construct
public function __construct()
{
// load the config object
$config = Load::library('Config');
// get the connection name based off the enviroment
$connection = $config->getEnvironment();
// load the connection details
$details = $config->get('connections.' . $connection);
try {
// instantiate the PDO object
$this->dbh = parent::__construct($details[0], $details[1], $details[2]);
} catch (PDOException $e) {
if ($config->isDev()) {
// throw the original exception
throw new Exception('PDO exception caught: ' . $e->getMessage());
} else {
// throw the generic DB exception
throw new Exception('Database connection error');
}
}
// set the PDO error mode to exception
parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// return the DB handle
return $this->dbh;
}
示例12: ModuleObject
function ModuleObject($config)
{
$this->MasterObject($config);
Load::logic('vote');
$this->VoteLogic = new VoteLogic($this);
$this->Execute();
}
示例13: ModuleObject
function ModuleObject( $config )
{
$this->MasterObject($config);
$this->iniz();
$runCode = Load::moduleCode($this);
$this->$runCode();
}
示例14: logout
public function logout()
{
Load::lib('SdAuth');
SdAuth::logout();
$this->render(null, 'login2');
$this->redirect('');
}
示例15: delete
function delete($id)
{
$article_title = $this->article->getArticleTitleById($id);
$result = $this->article->delete($id) ? 'Article <b>' . $article_title . '</b> deleted' : 'Error deleting the article';
$data = array('title' => 'All articles', 'notice' => array('type' => 'success', 'message' => $result));
Load::view('notice.php', $data);
}