/** * Uses the stored database, and creates a new ShopDao, using the autoload * function to include the Dao itself. * * @param string $resourceName * @return Dao */ protected function create($resourceName) { $className = $resourceName . 'Dao'; require_class($className, $this->daosPath . $className . '.php'); $dao = new $className($this->dataSource, $this->container->shopDaoFactory); if ($this->daoCache) { $dao->setCache($this->daoCache); } return $dao; }
public function setup() { /** * Setup system config */ require_class('IniFileConfig', 'Config'); $config = new IniFileConfig(ROOT_PATH . '/includes/local.conf', ROOT_PATH . '/includes/default.conf', true); $this->setupContainer($config); /** * Include the main ini file. */ require $this->globalConfigFileUri; /** * Starting the session * Has to be after ini.boot since it defines where to store the session. * * I removed it from the ini.php since you don't want a session to be started for static files. */ session_start(); return $this; // if ($this->appConfigFileUri) require $this->appConfigFileUri; }
<?php define('ROOT_PATH', ''); require_once ROOT_PATH . 'functions.php'; restrictAccess('a'); //xuca if (posted("directory")) { $directory = $_POST["directory"]; if (is_dir($directory)) { require_class("fileToStr", "qParser"); $f = new fileToStr(); $qp = new qParser(); echo "Processing directory {$directory}:<br>"; foreach (glob($directory . '/*.*') as $file) { echo " " . $file . " parsed:<br><textarea>" . $qp->parse($f->convert($file, $file)) . "</textarea><br><br>"; ob_flush(); flush(); } } else { echo "{$directory} is not a valid directory."; } } ?> <form action="bulk_file_process.php" method="POST"> <b>Add All Files From Directory:</b> <input type="text" name="directory"/> </form>
/** * Uses the printer delegate to print the results of the Profiler. */ public function printResult() { if (!$this->didEnd()) { $this->end(); } if (!$this->printerDelegate) { require_class('DefaultHtmlProfilerPrinterDelegate', 'Profiler'); $this->printerDelegate = new DefaultHtmlProfilerPrinterDelegate(); } $this->printerDelegate->printProfiler($this); }
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('UsernameSanitizer', 'Sanitizer'); /** * Test class for UrlSanitizer. */ class UsernameSanitizerTest extends PHPUnit_Framework_TestCase { /** * @var UsernameSanitizer */ protected $usernameSanitizer; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->usernameSanitizer = new UsernameSanitizer(); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** */ public function testSanitizing()
<?php /** * This file contains the DaoToManyReference definition that's used to describe * references to many other records in a datasource. * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, Matthias Loitsch * @package Dao */ /** * Including the basic dao reference. */ require_class('BasicDaoToManyReference', dirname(__FILE__) . '/BasicDaoToManyReference.php'); /** * A DaoToManyReference describes references to many resources. * * The DaoToManyReference works exactly as the DaoReference, but works with * arrays that either contain ids, or data hashes. * * In a DaoToManyReference the localKey, if specified, has to be of type Dao::SEQUENCE. * * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, Matthias Loitsch * @package Dao * @see DaoReference * @see DaoToOneReference */ class DaoToManyReference extends BasicDaoToManyReference {
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('Record'); /** * Test class for Record. */ class RecordCoerceTest extends PHPUnit_Framework_TestCase { /** * * @fixme Migrate to DAO */ public function testCoerceWithInts() { return; $this->assertEquals(null, Record::coerce(null, 'someName', null, Dao::STRING, $allowNull = true)); $this->assertEquals('', Record::coerce(null, 'someName', null, Dao::STRING, $allowNull = false, $quiet = true)); $this->assertEquals('some string', Record::coerce(null, 'someName', 'some string', Dao::STRING, $allowNull = true)); $this->assertEquals(null, Record::coerce(null, 'someName', array(), Dao::STRING, $allowNull = true)); $this->assertEquals('234', Record::coerce(null, 'someName', 234, Dao::STRING, $allowNull = false)); $this->assertEquals('234.123', Record::coerce(null, 'someName', 234.123, Dao::STRING, $allowNull = false)); $this->assertEquals('234', Record::coerce(null, 'someName', 234, Dao::STRING, $allowNull = true), '234'); $this->assertEquals('234.123', Record::coerce(null, 'someName', 234.123, Dao::STRING, $allowNull = true)); $this->assertEquals('', Record::coerce(null, 'someName', array(), Dao::STRING, $allowNull = false)); } }
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('UrlSanitizer', 'Sanitizer'); /** * Test class for UrlSanitizer. */ class UrlSanitizerTest extends PHPUnit_Framework_TestCase { /** * @var UrlSanitizer */ protected $urlSanitizer; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->urlSanitizer = new UrlSanitizer(); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** */ public function testSanitizing()
<?php /** * This file contains the HttpServer class definition */ /** * Including the HttpServerResponse */ require_class('HttpServerResponse', 'Server'); /** * The server class is used to configure a server and make requests to it. */ class HttpServer { /** * @var bool */ protected $useHttps; /** * @var string Can be IP of course */ protected $domain; /** * * @var string Will be appended to domain. */ protected $path; /** * @var int */ protected $port;
<?php require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '/../../setup.php'; require_class('ProfilerTimer', 'Profiler'); /** * Test class for ProfilerTimer with fixed times. * Generated by PHPUnit on 2011-04-19 at 14:02:29. */ class ProfilerTimerFixedTest extends PHPUnit_Framework_TestCase { /** * @var ProfilerTimer */ protected $profilerTimer; protected $startTime = 1000.0; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->profilerTimer = new ProfilerTimer('Text context', 'Section name', $this->startTime); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { }
} catch (Exception $e) { $err = "Error: " . $e->getMessage(); } if ($err == '') { echo "Questions entered successfully, with Question-IDs <b>" . arrayToRanges($q->getQIDs()) . "</b><br><br><br>"; } else { echo $err; } } else { require_class("qIO", "qParser"); $qp = new qParser(); $error = false; if (posted("copypaste")) { $unparsed = $qp->parse($_POST["copypaste"]); } elseif (filed("fileupload")) { require_class("fileToStr"); $fs = new fileToStr(); if (is_array($_FILES["fileupload"]["tmp_name"])) { //for multiple-supporting browsers foreach ($_FILES["fileupload"]["tmp_name"] as $ind => $tmp_name) { $name = $_FILES["fileupload"]["name"][$ind]; echo "File <b>{$name}</b>: "; if ($name == '' || $tmp_name == '') { echo "No file."; } else { $unparsed .= $qp->parse($fs->convert($name, $tmp_name)); } echo "<br>"; } } else { $unparsed = $qp->parse($fs->convert($_FILES["fileupload"]["name"], $_FILES["fileupload"]["tmp_name"]));
public function save_rooms_and_guest_info() { if (defined('DOING_AJAX') && DOING_AJAX && $_POST) { $data = $_POST; if (is_rooms_exists_on_booking($data['room_ID'], $data['booking_ID'], $data['booking_room_ID'])) { wp_send_json_error(array('message' => 'Room already exists')); } else { require_class('gump.class.php'); $gump = new GUMP(); $data['room_type_ID'] = get_room_type($data['room_ID'])->ID; $data = $gump->sanitize($data); $gump->validation_rules(array('guest' => 'required|min_len,1|max_len,100', 'room_ID' => 'required|numeric', 'room_type_ID' => 'required|numeric', 'no_of_adult' => 'required|numeric', 'no_of_child' => 'numeric', 'date_in' => 'required|date', 'date_out' => 'required|date')); if ($gump->run($data) !== false) { if (in_array(get_booking_status($data['booking_ID']), array('NEW'))) { wp_send_json_error(array('message' => 'You can\'t add room while booking is not confirmed.')); } else { if (is_room_available($data['room_ID'], $data['date_in'], $data['booking_room_ID']) == 0) { $error['date_in'] = 'Selected room is not available on that date. Please check calendar to see availability.'; javacript_notices($error, '#roomsAndGuestInfoForm'); wp_send_json_error(array('js' => print_javascript_notices(false))); } else { if (do_save_rooms_and_guest_info($data) !== false) { wp_send_json_success(array('message' => 'Successfully saved.')); } else { wp_send_json_error(array('message' => 'Error while saving.')); } } } } else { javacript_notices($gump->get_key_and_value_errors(true), '#roomsAndGuestInfoForm'); wp_send_json_error(array('js' => print_javascript_notices(false))); } } exit; } }
/** * Loading the DaoKeyListIterator Class */ include dirname(__FILE__) . '/DaoKeyListIterator.php'; /** * Loading the DaoHashListIterator Class */ include dirname(__FILE__) . '/DaoHashListIterator.php'; /** * Loading the Record Class */ require_class('Record'); /** * Loading the Date Class */ require_class('Date'); /** * This abstract base class for all Daos. * IMPORTANT NOTE: The Dao (and Record for that matter) depend on the resource * having a primary `id` attribute! * If your resource layout does not provide this attribute, the framework will not work. * * The typical usage of the Dao is as follows: * <code> * <?php * $userDao = new UserDao($datasource); // UserDao extends MysqlDao for example * $userDao->get()->set('username', 'user2000')->save(); // Insert new user * $userDao->getById(4)->set('name', 'New Name')->save(); // Update existing user * $userDao->getByUsername('user2000')->delete(); // Deletes the user. * // getByUsername() has to be implemented by the UserDao * ?>
/** * Adds a renderer to the pool * * @param string $className * @param string $fileUri * @param string $serviceName */ public function registerRenderer($className, $fileUri, $serviceName = null) { $this->renderersList[] = array($className, $serviceName ? $serviceName : lcfirst($className)); require_class($className, $fileUri); }
/** * Including all exceptions */ include dirname(__FILE__) . '/ControllerExceptions.php'; /** * Including exceptions */ require_class('DispatcherException', dirname(__FILE__) . '/DispatcherExceptions.php'); /** * Including ContainerAware interface */ require_interface('ContainerAware'); /** * Including model */ require_class('Model', 'Renderer'); /** * The Controller is the base class for every Controller type. * * When a Controller gets initialized, the constructor calls * - authorize() * - prepare() * in that order. * * You then get the html output from the Controller, by calling getHtml() * * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2009, Matthias Loitsch * @package Controller */
<?php define('ROOT_PATH', ''); require_once ROOT_PATH . 'functions.php'; require_class('qIO'); restrictAccess('u'); //xuca $q = new qIO(); $q->addRand(null, null, [0], 1); ?> <style> body{ font-size:30pt; background-color:black; color:white; font-family:Segoe UI, Segoe, Frutiger, WeblySleekUI, CartoGothic STD, Open Sans, Arial, sans-serif; } .anschoices button{ font-family:"Robot!Head", transition:background-color 0.5s; font-size:inherit; background-color:white; color:black; display:block; width:100%; text-align:center; border-radius:20px; border:none; margin-top:10px; cursor:pointer;
<?php /** * This file contains the FileLogger definition. * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, Matthias Loitsch * @package Logger * */ /** * Include the Logger */ require_class('Logger'); /** * The DevNull Logger just trashes output. * If you want a catchall logger, but you want a specific context excluded, just * register a DevNullLogger for that context. * * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, Matthias Loitsch * @package Logger * */ class DevNullLogger extends Logger { /** * Does nothing. * * @param string $message * @param int $level * @param string $context Can contain a context to log for.
<?php /** * This file contains the Router definition. * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, I-Netcompany * @package Router */ /** * Including the Router */ require_class('DefaultRouter', 'Router'); /** * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2009, Matthias Loitsch * @package Utils * @package Router */ class SecurityRouter extends DefaultRouter { /** * @var Encryption */ protected $urlEncryption; /** * @param Encryption $urlEncryption * @param bool $useRestfulUrls */ public function __construct(Encryption $urlEncryption, $useRestfulUrls = true) {
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('Encryption', 'Security'); /** * Test class for DefaultSecurity. */ class SecurityTest extends PHPUnit_Framework_TestCase { /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } public function testBase64Encode() { $string = '!!?*!~Za_-c@#$2üäas!'; self::assertSame('ISE/KiF+WmFfLWNAIyQyw7zDpGFzIQ==', base64_encode($string)); self::assertSame('ISE_KiF-WmFfLWNAIyQyw7zDpGFzIQ', Encryption::base64Encode($string)); } public function testBase64Decode() {
<?php /** * The file for the TwigRenderer class * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, I-Netcompany * @package Renderer */ /** * Including the Renderer */ require_class('BaseRenderer', 'Renderer'); /** * The TwigRenderer is the Twig implementation of a Renderer. * * @author Matthias Loitsch <*****@*****.**> * @copyright Copyright (c) 2010, I-Netcompany * @package Renderer */ class TwigRenderer extends BaseRenderer { /** * The file extension the renderer will handle * @var string */ public static $templateFileExtension = 'html.twig'; /** * A list of content types this Renderer accepts. * If it's the string * then any content type is accepted. *
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('Ssl', 'Security'); /** * Test class for Ssl. */ class SslTest extends PHPUnit_Framework_TestCase { /** * @var Ssl */ protected $ssl; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->ssl = new Ssl('AES-128-CFB8', '*%=XC=Hj!bUXKQP;;8y', '`/:p@:f8;'); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } public function testEncryptedIsCorrectlyFormatted() { $encrypted = $this->ssl->encrypt('TEST');
function require_class($className, $fileUriOrService = null) { if (!class_exists($className, false)) { include RW_determineFileUri($className, $fileUriOrService); } } /** * Includes a file only if interface does not exist. * * @param string $interfaceName * @param string $fileUriOrService * @see require_class */ function require_interface($interfaceName, $fileUriOrService = null) { if (!interface_exists($interfaceName, false)) { include RW_determineFileUri($interfaceName, $fileUriOrService); } } /** * Now include the necessary static classes. */ /** * Loading the Log class. */ require_class('Log', 'Logger'); /** * Loading the Profile class. */ require_class('Profile', 'Profiler');
<?php require_once dirname(__FILE__) . '/../../setup.php'; require_class('Hasher', 'Security'); /** * Test class for DefaultSecurity. */ class HasherTest extends PHPUnit_Framework_TestCase { /** * @var Hasher */ protected $hasher; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->hasher = new Hasher('1234'); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** */ public function testHash()