/** * @function boolean check if value doesn't exists in a database, ex.: <> (string), (int) */ public function _validation_table_hasnt($val, $table, $column) { $query = sprintf("SELECT COUNT(*) as counter FROM %s WHERE %s = '%s'", mysql_escape_string($table), mysql_escape_string($column), mysql_escape_string($val)); $result = Registry()->db->query($query); return $result->counter == 0; }
<?php /** * Silla.IO Boot loader and entry point. * * @package Silla.IO * @subpackage Core * @author Plamen Nikolov <*****@*****.**> * @copyright Copyright (c) 2015, Silla.io * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3.0 (GPLv3) */ namespace Core; if (version_compare(PHP_VERSION, '5.3.7', '<')) { exit("Sorry, Silla.IO framework will only run on PHP version 5.3.7 or greater!\n"); } if (!defined('SILLA_ENVIRONMENT')) { define('SILLA_ENVIRONMENT', 'development'); } chdir(dirname(__DIR__)); require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'configurations' . DIRECTORY_SEPARATOR . SILLA_ENVIRONMENT . DIRECTORY_SEPARATOR . 'environment.php'; require __DIR__ . DIRECTORY_SEPARATOR . 'core.php'; Registry()->set('locale', Config()->I18N['default']);
* @return array */ public static function getAll() { return self::$registry; } /** * Overwrite all entries in the with the provided array * of keys => objects * * @param $registry array */ public static function setAll($registry) { self::$registry = $registry; } } class Helper { public function help() { } } // init Registry::setAll(array()); /* clear */ Registry('helper', new Helper()); // time for ($j = 0; $j < $___opts['m']; $j++) { Registry('helper')->help(); }