Ejemplo n.º 1
0
 public function testAdditionalPathAfterInitialRegister()
 {
     Loader::register();
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'controller' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS . 'exceptions' . DS));
     Loader::addPath(THINKUP_ROOT_PATH . 'tests' . DS . 'classes');
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'controller' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS . 'exceptions' . DS, THINKUP_ROOT_PATH . 'tests' . DS . 'classes'));
 }
Ejemplo n.º 2
0
 public function testRegisterAutoloader()
 {
     $this->markTestSkipped();
     set_include_path(implode(PATH_SEPARATOR, array(__DIR__ . '/classes', get_include_path())));
     Loader::register();
     $this->assertTrue(class_exists("ns\\Clazz", true));
     $this->assertTrue(class_exists("pr_Clazz", true));
 }
 /**
  * Set up
  * Initializes Config and Webapp objects, clears $_SESSION, $_POST, $_REQUEST
  */
 public function setUp()
 {
     parent::setUp();
     Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/'));
     $config = Config::getInstance();
     //disable caching for tests
     $config->setValue('cache_pages', false);
     //tests assume profiling is off
     $config->setValue('enable_profiler', false);
     if ($config->getValue('timezone')) {
         date_default_timezone_set($config->getValue('timezone'));
     }
     $webapp = Webapp::getInstance();
     $crawler = Crawler::getInstance();
 }
 /**
  * Initialize Config and Webapp objects, clear $_SESSION, $_POST, $_GET, $_REQUEST
  */
 public function setUp()
 {
     parent::setUp();
     Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/'));
     $config = Config::getInstance();
     //disable caching for tests
     $config->setValue('cache_pages', false);
     //tests assume profiling is off
     $config->setValue('enable_profiler', false);
     if ($config->getValue('timezone')) {
         date_default_timezone_set($config->getValue('timezone'));
     }
     $webapp = Webapp::getInstance();
     $crawler = Crawler::getInstance();
     $this->DEBUG = getenv('TEST_DEBUG') !== false ? true : false;
     self::isTestEnvironmentReady();
 }
 /**
  * Initialize Config and Webapp objects, clear $_SESSION, $_POST, $_GET, $_REQUEST
  */
 public function setUp()
 {
     parent::setUp();
     Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/'));
     $config = Config::getInstance();
     //disable caching for tests
     $config->setValue('cache_pages', false);
     //tests assume profiling is off
     $config->setValue('enable_profiler', false);
     if ($config->getValue('timezone')) {
         date_default_timezone_set($config->getValue('timezone'));
     }
     //tests assume no redirect to ThinkUp LLC
     if ($config->getValue('thinkupllc_endpoint') != null) {
         $config->setValue('thinkupllc_endpoint', null);
     }
     $webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
     $crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
     $this->DEBUG = getenv('TEST_DEBUG') !== false ? true : false;
     self::isTestEnvironmentReady();
 }
Ejemplo n.º 6
0
 *
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2011-2013 Gina Trapani
 *
 * Usage:
 * makemode.php <table_name> <object_name> [<parent_object_name>]
 */
chdir('..');
chdir('..');
chdir('..');
chdir('webapp');
require_once 'init.php';
Loader::register(array(THINKUP_ROOT_PATH . 'extras/dev/makemodel/classes/'));
if (isset($argv) && sizeof($argv) > 2) {
    $object = new ModelMaker($argv[1], $argv[2]);
    echo $object->makeModel();
} else {
    echo "Usage:\n    makemodel.php <table_name> <object_name> [<parent_object_name>]\n";
}
Ejemplo n.º 7
0
<?php

/*
 * Copyright 2014 Empodex PHP Framework.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @copyright 2014-2015 Empoddy Labs.
 * @author Prabhat Shankar <prabhat.singh88[at]gmail.com>
 */
chdir('..');
require_once 'init.php';
Loader::register(array(EFC_ROOT_PATH . 'makemodel/classes/'));
echo EFC_ROOT_PATH;
if ($_GET['table_name'] && $_GET['object_name']) {
    $object = new ModelMaker($_GET['table_name'], $_GET['object_name']);
    echo $object->makeModel();
} else {
    echo "Usage:\n    makemodel.php <table_name> <object_name> [<parent_object_name>]\n";
}
Ejemplo n.º 8
0
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2013 Gina Trapani
 */
putenv("MODE=TESTS");
require_once 'config.tests.inc.php';
//set up 3 required constants
if (!defined('THINKUP_ROOT_PATH')) {
    define('THINKUP_ROOT_PATH', str_replace("\\", '/', dirname(dirname(__FILE__))) . '/');
}
if (!defined('THINKUP_WEBAPP_PATH')) {
    define('THINKUP_WEBAPP_PATH', THINKUP_ROOT_PATH . 'webapp/');
}
if (!defined('TESTS_RUNNING')) {
    define('TESTS_RUNNING', true);
}
//Register our lazy class loader
require_once THINKUP_WEBAPP_PATH . '_lib/class.Loader.php';
Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/', THINKUP_WEBAPP_PATH . 'plugins/expandurls/tests/', THINKUP_WEBAPP_PATH . 'plugins/embedthread/tests/', THINKUP_WEBAPP_PATH . 'plugins/facebook/tests/', THINKUP_WEBAPP_PATH . 'plugins/twitter/tests/', THINKUP_WEBAPP_PATH . 'plugins/twitterrealtime/tests/', THINKUP_WEBAPP_PATH . 'plugins/geoencoder/tests/', THINKUP_WEBAPP_PATH . 'plugins/hellothinkup/tests/', THINKUP_WEBAPP_PATH . 'plugins/googleplus/tests/', THINKUP_WEBAPP_PATH . 'plugins/foursquare/tests/', THINKUP_WEBAPP_PATH . 'plugins/insightsgenerator/tests/'));
Ejemplo n.º 9
0
/**
 * **************
 *     Core
 * **************
 */
// we are using UTF-8 strings until the end of the script
mb_internal_encoding('UTF-8');
// we'll be outputting UTF-8 to the browser
mb_http_output('UTF-8');
// include the autoloader
include_once __DIR__ . '/classes/Loader.php';
// instantiate the loader
$loader = new Loader();
// register the autoloader
$loader->register();
// add core classes to autoload
$loader->addNamespace('', dirname(__FILE__) . '/../core/classes');
// vendor autoload
if (file_exists(base_path('/vendor/autoload.php'))) {
    include_once base_path('/vendor/autoload.php');
}
// set error/exception handlers
error_reporting(E_ALL);
set_error_handler([new Exceptions\Exception('error_handling'), 'errorHandler']);
set_exception_handler([new Exceptions\Exception('exception_handling'), 'exceptionHandler']);
/**
 * **************
 *      App
 * **************
 */
Ejemplo n.º 10
0
<?php

$dirname = dirname(__FILE__);
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
require_once $dirname . '/helpers.php';
require_once $dirname . '/app/core/Loader.php';
require_once $dirname . '/app/libs/Smarty.class.php';
$basename = basename($dirname);
$autoloader = new Loader();
$autoloader->register();
$class = getclass();
Bootstrap::app($class);
function getclass()
{
    $dirname = dirname(__FILE__);
    $basename = basename($dirname);
    return ucfirst($basename);
}
Ejemplo n.º 11
0
 /**
  * 注册自动加载器
  */
 public function registerAutoloader($path = null)
 {
     if (is_null(static::$loader)) {
         require __DIR__ . DIRECTORY_SEPARATOR . 'Loader.php';
         $loader = new Loader();
         $loader->register();
         $loader->addClassMap(require __DIR__ . DIRECTORY_SEPARATOR . 'classmap.php');
         // 注册文件夹
         if (is_dir($path)) {
             $loader->add(null, $path);
         }
         static::$loader = $loader;
     }
     return static::$loader;
 }
Ejemplo n.º 12
0
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2011 Gina Trapani
 */
require_once 'init.tests.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/autorun.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/web_tester.php';
require_once THINKUP_ROOT_PATH . 'webapp/_lib/extlib/simpletest/mock_objects.php';
$RUNNING_ALL_TESTS = true;
Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/'));
/* PLUGIN TESTS */
require_once THINKUP_ROOT_PATH . 'webapp/plugins/expandurls/tests/TestOfFlickrAPIAccessor.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/expandurls/tests/TestOfExpandURLsPluginConfigurationController.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/expandurls/tests/TestOfExpandURLsPlugin.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/embedthread/tests/TestOfThinkUpEmbedController.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/embedthread/tests/TestOfThreadJSController.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/facebook/tests/TestOfFacebookCrawler.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/facebook/tests/TestOfFacebookPlugin.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/facebook/tests/TestOfFacebookPluginConfigurationController.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfRetweetDetector.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfTwitterAPIAccessorOAuth.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfTwitterAuthController.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfTwitterCrawler.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfTwitterOAuth.php';
require_once THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/TestOfTwitterPlugin.php';
Ejemplo n.º 13
0
 public function testAdditionalPathAfterInitialRegister()
 {
     Loader::register();
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib/model/', THINKUP_WEBAPP_PATH . '_lib/controller/', THINKUP_WEBAPP_PATH . '_lib/model/exceptions/'));
     Loader::addPath(THINKUP_ROOT_PATH . 'tests/classes');
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib/model/', THINKUP_WEBAPP_PATH . '_lib/controller/', THINKUP_WEBAPP_PATH . '_lib/model/exceptions/', THINKUP_ROOT_PATH . 'tests/classes'));
 }
Ejemplo n.º 14
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require 'loader.php';
Loader::register('Vendor/Joridos', 'Joridos');
use Joridos\Zipme;
$zip = new Zipme('heuehuehu.zip', './src', './src/testezip.txt', true);
Ejemplo n.º 15
0
        if (!static::$initialized) {
            static::initialize();
        }
        static::$paths[$namespace] = trim($path, DIRECTORY_SEPARATOR);
    }
    public static function load($class)
    {
        if (class_exists($class, false)) {
            return;
        }
        if (!static::$initialized) {
            static::initialize();
        }
        foreach (static::$paths as $namespace => $path) {
            if (!$namespace || $namespace . static::$nsChar === substr($class, 0, strlen($namespace . static::$nsChar))) {
                $fileName = substr($class, strlen($namespace . static::$nsChar) - 1);
                $fileName = str_replace(static::$nsChar, DIRECTORY_SEPARATOR, ltrim($fileName, static::$nsChar));
                $fileName = static::$parentPath . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $fileName . '.php';
                if (file_exists($fileName)) {
                    include $fileName;
                    return true;
                }
            }
        }
        return false;
    }
}
spl_autoload_register(array('Loader', 'load'));
// register goglobalapi namespaces
Loader::register('src', 'ustmaestro\\goglobalapi');
Ejemplo n.º 16
0
<!doctype html>
<html>
<head>
    <title>Demo</title>
</head>
<body>
    <ol>
        <?php 
require_once 'loader.php';
Loader::register('../lib', 'RobThree\\Auth');
use RobThree\Auth\TwoFactorAuth;
$tfa = new TwoFactorAuth('MyApp');
echo '<li>First create a secret and associate it with a user';
$secret = $tfa->createSecret();
echo '<li>Next create a QR code and let the user scan it:<br><img src="' . $tfa->getQRCodeImageAsDataUri('My label', $secret) . '"><br>...or display the secret to the user for manual entry: ' . chunk_split($secret, 4, ' ');
$code = $tfa->getCode($secret);
echo '<li>Next, have the user verify the code; at this time the code displayed by a 2FA-app would be: <span style="color:#00c">' . $code . '</span> (but that changes periodically)';
echo '<li>When the code checks out, 2FA can be / is enabled; store (encrypted?) secret with user and have the user verify a code each time a new session is started.';
echo '<li>When aforementioned code (' . $code . ') was entered, the result would be: ' . ($tfa->verifyCode($secret, $code) === true ? '<span style="color:#0c0">OK</span>' : '<span style="color:#c00">FAIL</span>');
?>
    </ol>
    <p>Note: Make sure your server-time is <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol">NTP-synced</a>! Depending on the $discrepancy allowed your time cannot drift too much from the users' time!</p>
</body>
</html>
Ejemplo n.º 17
0
<?php

Loader::register('mindaphp', 'MindaPHP');
Ejemplo n.º 18
0
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2011 Gina Trapani
 */
putenv("MODE=TESTS");
require_once 'config.tests.inc.php';
//set up 3 required constants
if (!defined('THINKUP_ROOT_PATH')) {
    define('THINKUP_ROOT_PATH', str_replace("\\", '/', dirname(dirname(__FILE__))) . '/');
}
if (!defined('THINKUP_WEBAPP_PATH')) {
    define('THINKUP_WEBAPP_PATH', THINKUP_ROOT_PATH . 'webapp/');
}
if (!defined('TESTS_RUNNING')) {
    define('TESTS_RUNNING', true);
}
//Register our lazy class loader
require_once THINKUP_ROOT_PATH . 'webapp/_lib/model/class.Loader.php';
Loader::register(array(THINKUP_ROOT_PATH . 'tests/', THINKUP_ROOT_PATH . 'tests/classes/', THINKUP_ROOT_PATH . 'tests/fixtures/', THINKUP_ROOT_PATH . 'webapp/plugins/expandurls/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/embedthread/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/facebook/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/twitter/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/twitterrealtime/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/geoencoder/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/hellothinkup/tests/', THINKUP_ROOT_PATH . 'webapp/plugins/googleplus/tests/'));
Ejemplo n.º 19
0
 /**
  * Get Installer instance
  *
  * @return Installer
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new Installer();
         // use lazy loading
         if (!class_exists('Loader', FALSE)) {
             require_once THINKUP_WEBAPP_PATH . '_lib/class.Loader.php';
         }
         Loader::register();
         // get required version of php and mysql
         // and set current version
         require THINKUP_WEBAPP_PATH . 'install/version.php';
         self::$required_version = array('php' => $THINKUP_VERSION_REQUIRED['php'], 'mysql' => $THINKUP_VERSION_REQUIRED['mysql']);
         self::$current_version = $THINKUP_VERSION;
     }
     return self::$instance;
 }
Ejemplo n.º 20
0
<?php

require_once 'config.tests.inc.php';
//set up 3 required constants
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
if (!defined('THINKUP_ROOT_PATH')) {
    define('THINKUP_ROOT_PATH', dirname(dirname(__FILE__)) . DS);
}
if (!defined('THINKUP_WEBAPP_PATH')) {
    define('THINKUP_WEBAPP_PATH', THINKUP_ROOT_PATH . 'webapp' . DS);
}
if (!defined('TESTS_RUNNING')) {
    define('TESTS_RUNNING', true);
}
//Register our lazy class loader
require_once THINKUP_ROOT_PATH . 'webapp/_lib/model/class.Loader.php';
Loader::register(array(THINKUP_ROOT_PATH . 'tests' . DS, THINKUP_ROOT_PATH . 'tests' . DS . 'classes' . DS, THINKUP_ROOT_PATH . 'tests' . DS . 'fixtures' . DS));
Ejemplo n.º 21
0
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <*****@*****.**>
// +----------------------------------------------------------------------
namespace think;

// ThinkPHP 引导文件
// 加载基础文件
require __DIR__ . '/base.php';
require CORE_PATH . 'loader.php';
// 注册自动加载
Loader::register();
// 注册错误和异常处理机制
register_shutdown_function(['think\\Error', 'appShutdown']);
set_error_handler(['think\\Error', 'appError']);
set_exception_handler(['think\\Error', 'appException']);
// 加载模式定义文件
$mode = (require MODE_PATH . APP_MODE . EXT);
// 加载模式别名定义
if (isset($mode['alias'])) {
    Loader::addMap(is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']));
}
// 加载模式配置文件
if (isset($mode['config'])) {
    is_array($mode['config']) ? Config::set($mode['config']) : Config::load($mode['config']);
}
// 加载模式行为定义
Ejemplo n.º 22
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
//$mageFile = __DIR__ . '/../app/Mage.php';
//echo "$mageFile\n";
if (!file_exists('../app/Mage.php')) {
    die("mage file not found");
}
require '../app/Mage.php';
require 'loader.php';
Loader::register('Vendor/Magento', 'Magento');
use Magento\magePatchUpdate;
$mage = new Mage();
$updater = new magePatchUpdate($mage);
$updater->teste();