示例#1
1
<?php

$title = "Demo 1";
$path = realpath($_SERVER["DOCUMENT_ROOT"]) . "/";
include_once $path . "php/head.php";
?>
	<link rel="stylesheet" href="style.css" type="text/css">
<?php 
$color1 = 280;
include_once $path . "php/header.php";
include_once $path . "php/demo.php";
$demo = new Demo();
?>
		
		<div class="project">
		
		<article class="align_nav">
			<?php 
$demo->draw("../../project/carted3", $color1, "Version 1");
?>
		</article>

		<script type="x-shader/x-vertex" id="vertexShader">

			varying vec2 vUv;

			void main() {

				vUv  = uv;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
示例#2
1
文件: routes.php 项目: avin/demo
<?php

Route::get('demo', 'Avin\\Demo\\Http\\DemoController@index');
Route::get('demo/test', function () {
    return 'Test';
});
Route::get('demo/hello', function () {
    return Demo::hello();
});
Route::get('demo/view', function () {
    return view('avin-demo::index');
});
Route::get('demo/config', function () {
    return config('avin-demo.main.hello') . config('avin-demo.main.world');
});
Route::get('demo/model', function () {
    dd(\Avin\Demo\Models\Item::get());
});
示例#3
0
文件: demo.php 项目: xuyintao/thindev
 public function add()
 {
     //ProjectId,Memo,CreateTime,UserId,Hours1,Ratio,Hours2
     $res = array();
     $obj = new Demo();
     $obj->ProjectId = $this->ProjectId;
     $obj->Memo = $this->Memo;
     $obj->Hours1 = $this->Hours1;
     $obj->CreateTime = date('Y-m-d H:i:s');
     $obj->WorkDate = $this->WorkDate;
     $obj->UserId = $this->UserId;
     $obj->Ratio = 0;
     $obj->Hours2 = 0;
     $result = $obj->add();
     if ($result > 0) {
         $res['Success'] = true;
         $res['Message'] = "工时登记成功";
         $res['NewId'] = $result;
     } else {
         $res['Success'] = false;
         $res['Message'] = "工时登记失败,请联系技术部";
     }
     echo json_encode($res);
     exit;
 }
示例#4
0
 public function actionIOSsend()
 {
     /* if(isset($_POST['keyword']))
     		{
     			
     			$keyword=$_POST['keyword'];
     			
     		} */
     $demo = new Demo("", "");
     $demo->sendIOSGroupcast();
 }
示例#5
0
 function __construct()
 {
     $this->pub = 'I am a public member variable';
     $this->pri = 'I am a private member variable';
     $this->pro = 'I am a protected member variable';
     self::$pubs = 'I am a public static member variable';
 }
示例#6
0
文件: Demo.php 项目: paoim/PHPDemo
 public static function instance()
 {
     if (!self::$_instance) {
         self::$_instance = new Demo();
     }
     return self::$_instance;
 }
示例#7
0
 private static function parseurl()
 {
     if (isset($_REQUEST['act']) && !empty($_REQUEST['act'])) {
         $act = ucfirst(trim($_REQUEST['act']) . 'Action');
     } else {
         $act = 'IndexAction';
     }
     if (isset($_REQUEST['mod']) && !empty($_REQUEST['mod'])) {
         $method = trim($_REQUEST['mod']);
     } else {
         $method = 'Index';
     }
     if (CREATE_DEMO) {
         //if need create demo
         $demo = new Demo();
         $demo->run();
     }
     if (!class_exists($act)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ' not find. ');
         } else {
             //record log
             SL('controller not find', '访问的controller: ' . $act . ' class not find', '访问日志', 1);
             location();
         }
     }
     self::$controller_obj =& $controller;
     self::$act = str_ireplace('Action', '', $act);
     self::$mod = $method;
     $controller = new $act();
     if (!method_exists($controller, $method)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ', method: ' . $method . ' not find. ');
         } else {
             //record log
             SL('method not find', '访问的controller: ' . $act . ' class method: ' . $method . ' not find', '访问日志', 1);
             location();
         }
     }
     $controller->method = $method;
     $controller->open_token = OPEN_TOKEN;
     $controller->act = self::$act;
     $controller->{$method}();
 }
示例#8
0
 public function __construct()
 {
     if (!self::$info) {
         self::$info = $this;
         echo 'Khai bao moi<br />';
         return self::$info;
     } else {
         echo 'Khai bao cu<br />';
         return self::$info;
     }
 }
 private static function parseurl()
 {
     if (isset($_REQUEST['act']) && isset($_REQUEST['mod'])) {
         $act = ucfirst(trim($_REQUEST['act']) . 'Action');
         $method = trim($_REQUEST['mod']);
     } else {
         $act = 'IndexAction';
         $method = 'index';
     }
     if (isset($_REQUEST['app']) && !defined('APP_NAME')) {
         define('APP_NAME', trim($_REQUEST['app']));
     }
     if (CREATE_DEMO) {
         //if need create demo
         $demo = new Demo();
         $demo->run();
     }
     if (!class_exists($act)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ' not find. ');
         } else {
             location();
         }
     }
     $controller = new $act();
     if (!method_exists($controller, $method)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ', method: ' . $method . ' not find. ');
         } else {
             location();
         }
     }
     self::$controller_obj = $controller;
     $controller->method = $method;
     $controller->open_token = OPEN_TOKEN;
     $controller->act = str_ireplace('Action', '', $act);
     self::$act = $controller->act;
     self::$mod = $method;
     $controller->{$method}();
 }
示例#10
0
 public static function fromReflectionMethod(\ReflectionMethod $method)
 {
     $methodName = $method->getName();
     $docComment = $method->getDocComment();
     $reactivexId = extract_doc_annotation($docComment, '@reactivex');
     $demoFiles = extract_doc_annotations($docComment, '@demo');
     $description = extract_doc_description($docComment);
     $isObservable = Str::contains($docComment, '@observable');
     $demos = array_map(function ($path) {
         return Demo::fromPath($path);
     }, $demoFiles);
     return new DocumentedMethod($methodName, $reactivexId, $description, $demos, $isObservable);
 }
示例#11
0
 /**
  * Kernel类的核心启动框架的方法
  */
 public static function start()
 {
     //加载配置信息,用户自定义的配置会覆盖系统的配置
     self::loadConf();
     //加载语言包
     self::loadLang();
     //自动加载类库
     spl_autoload_register('Kernel::autoload');
     //自动加载用户自定义的函数库
     self::loadfunc();
     //初始化session
     self::session();
     //自动的解析URL分发
     self::parseurl();
     //脚本退出注册函数
     register_shutdown_function('shutdown');
     //目录检测和自动生成,为了效率此函数仅仅执行一次
     self::mkdirs();
     //是否创建demo例子程序
     $lockfile = TEMP_PATH . 'build_demo.lock';
     if (C_DEMO && !is_file($lockfile)) {
         Demo::cdemo();
         touch($lockfile);
     }
     $con_name = self::$_controller . self::$_conf['C_NAME'];
     $act_name = self::$_controller . '_' . self::$_action . self::$_conf['A_NAME'];
     if (!class_exists($con_name)) {
         if (DEBUG) {
             die(self::$_lang['_SYS_LANG_CLASS_NOT_FIND'] . ' : ' . $con_name);
         } else {
             die(self::$_lang['_SYS_LANG_CLASS_NOT_FIND']);
         }
     }
     if (!class_exists($act_name)) {
         if (DEBUG) {
             die(self::$_lang['_SYS_LANG_CLASS_NOT_FIND'] . ' : ' . $act_name);
         } else {
             die(self::$_lang['_SYS_LANG_CLASS_NOT_FIND']);
         }
     }
     $con_obj = new $con_name();
     $act_obj = new $act_name();
     $con_obj->init();
     $act_obj->init();
     $act_obj->run();
 }
示例#12
0
<?php

/**
 * @package Demos
 */
require_once dirname(__FILE__) . '/helpers/common.php';
require_once dirname(__FILE__) . '/../lib/WideImage.php';
$request = Request::getInstance();
$demo = Demo::create($request->get('demo'));
$image = WideImage::load('images/' . $request->get('image'));
$result = $demo->execute($image, $request);
$output = new FormatSelectField('output');
$output->init(Request::getInstance());
if ($output->value == 'preset for demo') {
    $format = $demo->getFormat();
} else {
    $format = $output->value;
}
if ($format === 'as input') {
    $format = substr($request->get('image'), -3);
}
$output = 24;
if ($format == 'png8') {
    $output = 8;
    $format = 'png';
} elseif ($format == 'png24') {
    $format = 'png';
} elseif ($format == 'gif') {
    $output = 8;
}
if ($output == 8) {
示例#13
0
<?php

require_once 'Demo.php';
$objDemo = new Demo();
$objDemo->setName('r2d2');
$objDemo->diHola();
$objDemo->setName(False);
$objDemo->diHola();
$objDemo->setName(123);
$objDemo->diHola();
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
		
    You should have received a copy of the GNU Lesser General Public License
    along with WideImage; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    
	* @package Demos
  **/
include 'helpers/common.php';
$demos = array();
$di = new DirectoryIterator(dirname(__FILE__) . '/demos/');
foreach ($di as $file) {
    if (substr($file->getFilename(), -4) == '.php') {
        $demos[] = Demo::create(substr($file->getFilename(), 0, -4));
    }
}
usort($demos, 'cmp_demos');
function cmp_demos($d1, $d2)
{
    if ($d1->order === $d2->order) {
        return 0;
    }
    return $d1->order < $d2->order ? -1 : 1;
}
if (isset($_GET['demo'])) {
    $activeDemoName = $_GET['demo'];
} else {
    $activeDemoName = null;
}
 function getDemoList($startRange, $banCount, $sortBy, $sortDirection, $searchText)
 {
     $searchText = trim($searchText);
     // Remove whitespace from search text
     $searchJoin = "";
     // Prevent SQL injection
     $sortBy = addslashes($sortBy);
     $sortDirection = addslashes($sortDirection);
     $searchText = addslashes($searchText);
     // Prevent SQL Injection
     if ($searchText != null && $searchText != "") {
         $searchJoin = " (d.steam_id LIKE '%" . $searchText . "%' OR d.demo_name LIKE '%" . $searchText . "%') ";
     }
     // Use LEFT JOIN so that bad reasons or serverids still display on the ban list, but as empty values
     // Get list of all demos that fit the criteria
     $demoList = "SELECT d.demo_id, d.steam_id, COALESCE(s.name, 'Bad Server ID') AS servername, d.server_id, d.add_date, r.reason,\n    d.reason_id, d.demo_name, d.offender_name, d.uploader_name, d.uploader_steam_id,\n    (SELECT count(1) FROM gban_ban b WHERE b.steam_id = d.steam_id and b.active = 1) as banned\n    FROM gban_demo d\n    LEFT JOIN gban_reason r ON d.reason_id = r.reason_id\n    LEFT JOIN gban_servers s ON d.server_id = s.server_id ";
     if (!empty($searchJoin)) {
         $demoList .= " WHERE " . $searchJoin;
     }
     $demoList .= "ORDER BY {$sortBy} {$sortDirection}";
     if ($this->bansPerPage > 0) {
         $this->endRange = $this->bansPerPage;
         $demoList .= " LIMIT " . $startRange . ", " . $this->endRange;
     }
     $this->db->sql_query($demoList);
     $demosArray = $this->db->get_array();
     $demos = array();
     for ($i = 0; $i < count($demosArray); $i++) {
         $demo = new Demo();
         $demo->setDemoId($demosArray[$i]['demo_id']);
         $demo->setSteamId($demosArray[$i]['steam_id']);
         $demo->setDemoName($demosArray[$i]['demo_name']);
         $demo->setServer($demosArray[$i]['servername']);
         $demo->setServerId($demosArray[$i]['server_id']);
         $demo->setAddDate($demosArray[$i]['add_date']);
         $demo->setReason($demosArray[$i]['reason']);
         $demo->setReasonId($demosArray[$i]['reason_id']);
         $demo->setOffenderName($demosArray[$i]['offender_name']);
         $demo->setUploaderName($demosArray[$i]['uploader_name']);
         $demo->setUploaderSteamId($demosArray[$i]['uploader_steam_id']);
         $demo->setBanned($demosArray[$i]['banned']);
         // Can only be 0 or 1
         array_push($demos, $demo);
         // Add the demo object to the array
     }
     return $demos;
 }
<?php

include_once __DIR__ . '/../autoload.php';
if (!interface_exists('Psr\\Log\\LoggerInterface')) {
    \Demo::error('Please install "psr/log" for run this demo (Notification with logger system).');
}
include_once __DIR__ . '/CustomLogger.php';
use Apple\ApnPush\Certificate\Certificate;
use Apple\ApnPush\Notification\Notification;
use Apple\ApnPush\Notification\Connection;
use Apple\ApnPush\Notification\SendException;
// Create connection
$certificate = new Certificate(CERTIFICATE_FILE, PASS_PHRASE);
$connection = new Connection($certificate, SANDBOX_MODE);
// Create custom logger
$logger = new CustomLogger();
// Create notification
$notification = new Notification();
$notification->setLogger($logger)->setConnection($connection);
// Send to correct device token
$notification->sendMessage(DEVICE_TOKEN, '[Correct] Hello');
try {
    // Send to incorrect device token
    $notification->sendMessage(str_repeat('a', 64), '[Incorrect] Hello');
} catch (SendException $e) {
}
$notification->sendMessage(DEVICE_TOKEN, '[Correct] Hello 2 ;)');
示例#17
0
<?php

$title = "Demo 4";
$path = realpath($_SERVER["DOCUMENT_ROOT"]) . "/";
include_once $path . "php/head.php";
?>
	<link rel="stylesheet" type="text/css" href="style.css" >
<?php 
$color1 = 280;
include_once $path . "php/header.php";
include_once $path . "php/demo.php";
$demo = new Demo();
?>
	
	<div class="project">
		<article class="align_nav">
			<?php 
$demo->draw("../../project/carted3", $color1, $title);
?>
		</article>
	</div>

	<div id="main" class="clearfix">

		<p id="noWebgl">Votre carte graphique ou votre navigateur ne supporte pas webgl. <br/>Vous pouvez essayer d'utiliser firefox ou rester sur la version 2d de la carte.</p>

		<div id="control_mode">
			<button class="btn_mode" id="btn_2d" type="button">2d</button>
			<button class="btn_mode" id="btn_3d" type="button">3d</button>
			<button class="btn_mode" id="btn_in" type="button">zoom +</button>
			<button class="btn_mode" id="btn_out" type="button">zoom -</button>
示例#18
0
RegEx to find all the keywords:

\\b(
(a(bstract|nd|rray|s))|
(c(a(llable|se|tch)|l(ass|one)|on(st|tinue)))|
(d(e(clare|fault)|ie|o))|
(e(cho|lse(if)?|mpty|nd(declare|for(each)?|if|switch|while)|val|x(it|tends)))|
(f(inal|or(each)?|unction))|
(g(lobal|oto))|
(i(f|mplements|n(clude(_once)?|st(anceof|eadof)|terface)|sset))|
(n(amespace|ew))|
(p(r(i(nt|vate)|otected)|ublic))|
(re(quire(_once)?|turn))|
(s(tatic|witch))|
(t(hrow|r(ait|y)))|
(u(nset|se))|
(__halt_compiler|break|list|(x)?or|var|while)
)\\b
EOT;
    }
    public function constants()
    {
        echo PHP_VERSION, PHP_OS, PHP_SAPI, PHP_INT_MAX, PHP_INT_SIZE, DEFAULT_INCLUDE_PATH, PEAR_INSTALL_DIR, PEAR_EXTENSION_DIR;
    }
    public function make()
    {
        //        静态声明是在编译时解析的。
    }
}
$demo = new Demo();
$demo->constants();
示例#19
0
    /**
     * 扫描带参数二维码 用户未关注时,进行关注后的事件推送
     */
    public function event_qrcode_unsubscribe(Event $event)
    {
        var_dump($event->getOptions());
    }
    /**
     * 上报地理位置事件
     */
    public function event_location(Event $event)
    {
        var_dump($event->getOptions());
    }
    /**
     * 自定义菜单事件
     */
    public function event_click(Event $event)
    {
        var_dump($event->getOptions());
    }
    /**
     * 点击菜单跳转链接时的事件推送
     */
    public function event_view(Event $event)
    {
        var_dump($event->getOptions());
    }
}
$demo = new Demo();
$demo->run();
示例#20
0
<?php

include_once __DIR__ . '/../autoload.php';
if (!class_exists('Redis')) {
    \Demo::error('Please install PHP Redis Extension for run this demo (Redis Queue).');
}
use Apple\ApnPush\Notification\Notification;
use Apple\ApnPush\Notification\Connection;
use Apple\ApnPush\Queue\Redis;
// Create connection
$connection = new Connection(CERTIFICATE_FILE, PASS_PHRASE, SANDBOX_MODE);
// Create notification
$notification = new Notification($connection);
// Create amqp queue
$amqp = Redis::create($notification);
$amqp->runReceiver();
示例#21
0
 public function testSum()
 {
     $demo = new Demo();
     $this->assertEquals(4, $demo->sum(2, 2));
     $this->assertNotEquals(3, $demo->sum(1, 1));
 }
示例#22
0
文件: index.php 项目: localgod/karla
  pre .com, code .com { color: #600; font-style: italic; }
  pre .typ, code .typ { color: #404; font-weight: bold; }
  pre .lit, code .lit { color: #044; }
  pre .pun, code .pun { color: #440; }
  pre .pln, code .pln { color: #000; }
  pre .tag, code .tag { color: #006; font-weight: bold; }
  pre .atn, code .atn { color: #404; }
  pre .atv, code .atv { color: #060; }
}
	
	</style>
</head>
<body onload="prettyPrint()">
    <?php 
require_once 'Demo.php';
$demo = new Demo();
$examples = $demo->examples();
?>
    
    <?php 
foreach ($examples as $example) {
    ?>
     <h2><?php 
    echo $example['name'];
    ?>
</h2>
    <img alt="demo" src="<?php 
    echo $example['original'];
    ?>
"/>
    <img alt="demo" src="<?php 
<?php

class Demo extends PerformanceTest
{
    protected function testOne()
    {
        $time = 0.5;
        $this->enterResult($time);
    }
    protected function testTwo()
    {
        $time = 1.5;
        $this->enterResult($time);
    }
    public function run()
    {
        $this->name = "demo";
        $this->testOne();
        $this->testTwo();
    }
}
$test = new Demo($suite);
$test->run();
echo $test->getResult();
echo $test->getName();
示例#24
0
文件: demo.php 项目: xuyintao/thindev
 public function verify()
 {
     $res = array();
     $res['Success'] = false;
     if ($this->Action > 1) {
         //不通过,删除操作
         $obj = new Demo();
         $obj->Id = $this->Id;
         $result = $obj->delete();
         if ($result > 0) {
             $res['Success'] = true;
             $res['Message'] = "删除成功";
         } else {
             $res['Message'] = "删除失败";
         }
     } else {
         //通过,计入项目总工时
         $obj = new Demo();
         $obj->Id = $this->Id;
         $obj->Ratio = $this->Ratio;
         $obj->Hours2 = $this->Hours2;
         $result = $obj->update();
         if ($result > 0) {
             $res['Success'] = true;
             $res['Message'] = "审核通过";
             $res['NewId'] = $this->Id;
         } else {
             $res['Success'] = false;
             $res['Message'] = "审核失败";
         }
     }
     echo json_encode($res);
     exit;
 }
示例#25
0
文件: test.php 项目: godruoyi/portal
 public function testgetB()
 {
     $dome = new Demo();
     echo $dome->gettwo();
 }
示例#26
0
<?php

use General\Odps\Account\Account;
/**
 * @author fengzbao@qq.com
 * @copyright Copyright (c) fzb.me
 * @version $Id:1.0.0, Demo.php, 2015-12-24 19:14 created (updated)$
 */
class Demo
{
    private $accessId = 'Lxw7YZ1Cxqsa4DPg';
    private $accessKey = 'UqgrTSJTTJSfjeL3GlrpNi9qcMKnYa';
    public function execute()
    {
        $account = new Account($this->accessId, $this->accessKey);
        $odps = new General\Odps\Odps\Odps($account);
        var_dump($odps);
    }
}
$d = new Demo();
$d->execute();
示例#27
0
<?php

include_once __DIR__ . '/../autoload.php';
if (!class_exists('AMQPConnection')) {
    \Demo::error('Please install PHP Amqp Extension for run this demo (AMQP Queue).');
}
use Apple\ApnPush\Notification\Notification;
use Apple\ApnPush\Notification\Message;
use Apple\ApnPush\Notification\Connection;
use Apple\ApnPush\Queue\Amqp;
// Create connection
$connection = new Connection(CERTIFICATE_FILE, PASS_PHRASE, SANDBOX_MODE);
// Create notification
$notification = new Notification($connection);
// Create message
$message = new Message();
$message->setBody('[Amqp queue] Hello world')->setDeviceToken(DEVICE_TOKEN);
// Create amqp queue and send message
$amqp = Amqp::create($notification);
$amqp->addMessage($message);
示例#28
0
<?php

require_once "vendor/autoload.php";
class Demo
{
    public function go()
    {
        $conn = new DataProcessors\AMQP\AMQPConnection();
        (yield $conn->connect('127.0.0.1', 5672, 'guest', 'guest'));
        $channel = (yield $conn->channel());
        (yield $channel->basic_consume('test', '', false, false, false, false, function ($msg) {
            echo "Got a message\n";
        }));
    }
}
$demo = new Demo();
$coroutine = new Icicle\Coroutine\Coroutine($demo->go());
Icicle\Loop\run();
示例#29
0
 public function test_Find()
 {
     $demo = new Demo();
     $demo->key = "Test";
     $demo->value = "Testing here!";
     $this->assertTrue($demo->create());
     $demo->key = "Test2";
     $this->assertTrue($demo->create());
     $objs = Demo::find(array("key" => "Test2"));
     $this->assertTrue(isset($objs[0]));
     $this->assertFalse(isset($objs[1]));
     $this->assertEquals($objs[0]->key, "Test2");
     $this->assertEquals($objs[0]->value, "Testing here!");
 }
<?php

include_once __DIR__ . '/../autoload.php';
if (!class_exists('Symfony\\Component\\EventDispatcher\\EventDispatcher')) {
    \Demo::error('Please install "symfony/event-dispatcher" for run this demo (Notification with EventDispatcher).');
}
use Symfony\Component\EventDispatcher\EventDispatcher;
use Apple\ApnPush\Notification\Notification;
use Apple\ApnPush\Notification\NotificationEvents;
use Apple\ApnPush\Notification\SendException;
use Apple\ApnPush\Notification\Connection;
// Create event dispatcher
$eventDispatcher = new EventDispatcher();
// Add complete listener
$eventDispatcher->addListener(NotificationEvents::SEND_MESSAGE_ERROR, function () {
    print "[*] Error with send message.\n";
});
// Add error listener
$eventDispatcher->addListener(NotificationEvents::SEND_MESSAGE_COMPLETE, function () {
    print "[-] Complete send message.\n";
});
// Create connection
$connection = new Connection(CERTIFICATE_FILE, PASS_PHRASE, SANDBOX_MODE);
// Create notification
$notification = new Notification($connection);
// Set event dispatcher
$notification->setEventDispatcher($eventDispatcher);
// Send correct message
$notification->sendMessage(DEVICE_TOKEN, '[Correct] Hello');
try {
    // Send incorrect message