Beispiel #1
0
<?php

// initialize seo
include "seo.php";
$seo = new SEO(array("title" => "A Smarter Performance Marketing Network", "photo" => CDN . "img/logo.png"));
Framework\Registry::set("seo", $seo);
Beispiel #2
0
    }
    // 3. load and initialize the Configuration class
    $configuration = new Framework\Configuration(array("type" => "ini"));
    Framework\Registry::set("configuration", $configuration->initialize());
    // 4. load and initialize the Database class – does not connect
    $database = new Framework\Database();
    Framework\Registry::set("database", $database->initialize());
    // 5. load and initialize the Cache class – does not connect
    $cache = new Framework\Cache();
    Framework\Registry::set("cache", $cache->initialize());
    // 6. load and initialize the Session class
    $session = new Framework\Session();
    Framework\Registry::set("session", $session->initialize());
    // 7. load the Router class and provide the url + extension
    $router = new Framework\Router(array("url" => isset($_GET["url"]) ? $_GET["url"] : "home/index", "extension" => !empty($_GET["extension"]) ? $_GET["extension"] : "html"));
    Framework\Registry::set("router", $router);
    // include custom routes
    include "public/routes.php";
    // 8. dispatch the current request
    $router->dispatch();
    // 9. unset global variables
    unset($configuration);
    unset($database);
    unset($cache);
    unset($session);
    unset($router);
} catch (Exception $e) {
    // list exceptions
    $exceptions = array("500" => array("Framework\\Cache\\Exception", "Framework\\Cache\\Exception\\Argument", "Framework\\Cache\\Exception\\Implementation", "Framework\\Cache\\Exception\\Service", "Framework\\Configuration\\Exception", "Framework\\Configuration\\Exception\\Argument", "Framework\\Configuration\\Exception\\Implementation", "Framework\\Configuration\\Exception\\Syntax", "Framework\\Controller\\Exception", "Framework\\Controller\\Exception\\Argument", "Framework\\Controller\\Exception\\Implementation", "Framework\\Core\\Exception", "Framework\\Core\\Exception\\Argument", "Framework\\Core\\Exception\\Implementation", "Framework\\Core\\Exception\\Property", "Framework\\Core\\Exception\\ReadOnly", "Framework\\Core\\Exception\\WriteOnly", "Framework\\Database\\Exception", "Framework\\Database\\Exception\\Argument", "Framework\\Database\\Exception\\Implementation", "Framework\\Database\\Exception\\Service", "Framework\\Database\\Exception\\Sql", "Framework\\Model\\Exception", "Framework\\Model\\Exception\\Argument", "Framework\\Model\\Exception\\Connector", "Framework\\Model\\Exception\\Implementation", "Framework\\Model\\Exception\\Primary", "Framework\\Model\\Exception\\Type", "Framework\\Model\\Exception\\Validation", "Framework\\Request\\Exception", "Framework\\Request\\Exception\\Argument", "Framework\\Request\\Exception\\Implementation", "Framework\\Request\\Exception\\Response", "Framework\\Router\\Exception", "Framework\\Router\\Exception\\Argument", "Framework\\Router\\Exception\\Implementation", "Framework\\Session\\Exception", "Framework\\Session\\Exception\\Argument", "Framework\\Session\\Exception\\Implementation", "Framework\\Template\\Exception", "Framework\\Template\\Exception\\Argument", "Framework\\Template\\Exception\\Implementation", "Framework\\Template\\Exception\\Parser", "Framework\\View\\Exception", "Framework\\View\\Exception\\Argument", "Framework\\View\\Exception\\Data", "Framework\\View\\Exception\\Implementation", "Framework\\View\\Exception\\Renderer", "Framework\\View\\Exception\\Syntax"), "404" => array("Framework\\Router\\Exception\\Action", "Framework\\Router\\Exception\\Controller"));
    $exception = get_class($e);
    // attempt to find the approapriate template, and render
Beispiel #3
0
<?php

$client_id = '<Client Id>';
$client_secret = '<Client Secret>';
$redirect_uri = 'http://trafficmonitor.ca/webmaster/authenticate';
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->setScopes('https://www.googleapis.com/auth/webmasters');
Framework\Registry::set("gClient", $client);
Beispiel #4
0
<?php

$apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential('<ClientID>', '<ClientSecret>'));
Framework\Registry::set("PayPalApiContext", $apiContext);
Beispiel #5
0
    $cache = new Framework\Cache();
    Framework\Registry::set("cache", $cache->initialize());
    // 6. load and initialize the Session class
    $session = new Framework\Session();
    Framework\Registry::set("session", $session->initialize());
    // 7. load the HttpRequest Class
    $httpRequest = new \Framework\HttpRequest();
    Framework\Registry::set('httpRequest', $httpRequest);
    // 8. load the Router class and provide the url + extension
    $router = new Framework\Router(array("url" => isset($_GET["url"]) ? $_GET["url"] : "books/getBooks", "extension" => isset($_GET["url"]) ? $_GET["url"] : "html"));
    Framework\Registry::set("router", $router);
    // include custom routes
    include __DIR__ . DIRECTORY_SEPARATOR . "routes.php";
    // 9. load the language file
    $language = new \Framework\Language();
    Framework\Registry::set('language', $language->load(DEFAULT_LANGUAGE));
    // 8. dispatch the current request after adding all the routes
    $router->dispatch();
    // 10. unset global variables
    unset($configuration);
    unset($database);
    unset($cache);
    unset($session);
    unset($router);
    unset($httpRequest);
} catch (Exception $e) {
    // list exceptions
    $exceptions = array("500" => array("Framework\\Cache\\Exception", "Framework\\Cache\\Exception\\Argument", "Framework\\Cache\\Exception\\Implementation", "Framework\\Cache\\Exception\\Service", "Framework\\Configuration\\Exception", "Framework\\Configuration\\Exception\\Argument", "Framework\\Configuration\\Exception\\Implementation", "Framework\\Configuration\\Exception\\Syntax", "Framework\\Controller\\Exception", "Framework\\Controller\\Exception\\Argument", "Framework\\Controller\\Exception\\Implementation", "Framework\\Core\\Exception", "Framework\\Core\\Exception\\Argument", "Framework\\Core\\Exception\\Implementation", "Framework\\Core\\Exception\\Property", "Framework\\Core\\Exception\\ReadOnly", "Framework\\Core\\Exception\\WriteOnly", "Framework\\Database\\Exception", "Framework\\Database\\Exception\\Argument", "Framework\\Database\\Exception\\Implementation", "Framework\\Database\\Exception\\Service", "Framework\\Database\\Exception\\Sql", "Framework\\Model\\Exception", "Framework\\Model\\Exception\\Argument", "Framework\\Model\\Exception\\Connector", "Framework\\Model\\Exception\\Implementation", "Framework\\Model\\Exception\\Primary", "Framework\\Model\\Exception\\Type", "Framework\\Model\\Exception\\Validation", "Framework\\Request\\Exception", "Framework\\Request\\Exception\\Argument", "Framework\\Request\\Exception\\Implementation", "Framework\\Request\\Exception\\Response", "Framework\\Router\\Exception", "Framework\\Router\\Exception\\Argument", "Framework\\Router\\Exception\\Implementation", "Framework\\Session\\Exception", "Framework\\Session\\Exception\\Argument", "Framework\\Session\\Exception\\Implementation", "Framework\\Template\\Exception", "Framework\\Template\\Exception\\Argument", "Framework\\Template\\Exception\\Implementation", "Framework\\Template\\Exception\\Parser", "Framework\\View\\Exception", "Framework\\View\\Exception\\Argument", "Framework\\View\\Exception\\Data", "Framework\\View\\Exception\\Implementation", "Framework\\View\\Exception\\Renderer", "Framework\\View\\Exception\\Syntax"), "404" => array("Framework\\Router\\Exception\\Action", "Framework\\Router\\Exception\\Controller"));
    $exception = get_class($e);
    // attempt to find the approapriate template, and render
    foreach ($exceptions as $template => $classes) {
Beispiel #6
0
// load config
$config = new Framework\Config(array('type' => 'ini'));
Framework\Registry::set('config', $config->initialize());
unset($config);
// load functions
$functions = new Framework\Functions();
Framework\Registry::set('functions', $functions->initialize());
unset($functions);
// load session
$session = new Framework\Session();
Framework\Registry::set('session', $session);
unset($session);
// load cookie
$cookie = new Framework\Cookie();
Framework\Registry::set('cookie', $cookie);
unset($cookie);
$input = new Framework\Input();
Framework\Registry::set('input', $input);
unset($input);
$validator = new Framework\Validator();
Framework\Registry::set('validator', $validator);
unset($validator);
// load database
$database = new Framework\Database();
Framework\Registry::set('database', $database->initialize());
unset($database);
// load router
$router = new Framework\Router();
Framework\Registry::set('router', $router);
unset($router);
Framework\Registry::get('router')->dispatch();
Beispiel #7
0
        $doc = new GoogleDOM($this->param("q"), $this->getUrl(), $this->getPage(), $this->param(self::PARAM_NBRESULTS));
        libxml_use_internal_errors(TRUE);
        $doc->loadHTML($r);
        libxml_use_internal_errors(FALSE);
        libxml_clear_errors();
        if ($doc->isCaptcha()) {
            throw new \GoogleUrl\Exception\CaptachaException();
        }
        return $doc;
    }
    /**
     * get the generated url
     * @return string the generated url
     */
    public function getUrl()
    {
        return $this->__toString();
    }
    /**
     * Same as gerUrl
     * @return string the generated url
     */
    public function __toString()
    {
        $url = "https://www.google." . $this->tld . "/search?" . http_build_query($this->googleParams);
        return $url;
    }
}
$googleUrl = new GoogleUrl();
Framework\Registry::set("googleScrape", $googleUrl);
unset($googleUrl);
Beispiel #8
0
        $headers = '';
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
            }
        }
        return $headers;
    }
}
// 2. load the Core class that includes an autoloader
require_once APP_PATH . "/framework/core.php";
Framework\Core::initialize();
// plugins
$path = APP_PATH . "/application/plugins";
$iterator = new DirectoryIterator($path);
// 3. load and initialize the Configuration class
$configuration = new Framework\Configuration(array("type" => "ini"));
Framework\Registry::set("configuration", $configuration->initialize());
// 4. load and initialize the Database class – does not connect
$database = new Framework\Database();
Framework\Registry::set("database", $database->initialize());
// 5. load and initialize the Cache class – does not connect
$cache = new Framework\Cache();
Framework\Registry::set("cache", $cache->initialize());
// 6. load and initialize the Session class
$session = new Framework\Session();
Framework\Registry::set("session", $session->initialize());
unset($configuration);
unset($database);
unset($cache);
unset($session);
Beispiel #9
0
<?php

// initialize Googl
include "googl.php";
$googl = new googl();
Framework\Registry::set("googl", $googl);
Beispiel #10
0
<?php

$database = new Framework\Database(array("type" => "mysql", "options" => array("host" => "localhost", "username" => "prophpmvc", "password" => "prophpmvc", "schema" => "prophpmvc")));
$database = $database->initialize();
$database = $database->connect();
Framework\Registry::set("database", $database);
class Example extends Framework\Model
{
    /**
     * @readwrite
     * @column
     * @type autonumber
     * @primary
     */
    protected $_id;
    /**
     * @readwrite
     * @column
     * @type text
     * @length 32
     */
    protected $_name;
    /**
     * @readwrite
     * @column
     * @type datetime
     */
    protected $_created;
}
Framework\Test::add(function () use($database) {
    $example = new Example();