本文整理汇总了PHP中using函数的典型用法代码示例。如果您正苦于以下问题:PHP using函数的具体用法?PHP using怎么用?PHP using使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了using函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: convert
public function convert($fv, $fc, $tc)
{
using('lepton.web.forex');
$cc = new CurrencyExchange();
$tv = $cc->convert($fv, $fc, $tc);
console::writeLn("%0.2f %s = %0.2f %s", $fv, $fc, $tv, $tc);
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:forex.php
示例2: test_using_two_disponsables_with_exceptions_calling_both_disposes
function test_using_two_disponsables_with_exceptions_calling_both_disposes()
{
$disposeCalled = ['foo' => false, 'bar' => false];
$foo = $this->getMockBuilder('Foo')->getMock();
$foo->expects($this->any())->method('dispose')->will($this->returnCallback(function () use(&$disposeCalled) {
$disposeCalled['foo'] = true;
}));
$foo->expects($this->any())->method('hello')->will($this->returnCallback(function () {
throw new \Exception('hello function exception');
}));
$bar = $this->getMockBuilder('Bar')->getMock();
$bar->expects($this->any())->method('dispose')->will($this->returnCallback(function () use(&$disposeCalled) {
$disposeCalled['bar'] = true;
}));
$this->assertFalse($disposeCalled['foo'], 'Foo dispose has been called');
$this->assertFalse($disposeCalled['bar'], 'Bar dispose has been called');
try {
using([$foo, $bar], function (Foo $foo, Bar $bar) {
$foo->hello("Gonzalo");
$bar->hello("Gonzalo");
});
} catch (\Exception $e) {
}
$this->assertTrue($disposeCalled['foo'], 'Foo dispose has been called');
$this->assertTrue($disposeCalled['bar'], 'Bar dispose has been called');
}
开发者ID:gonzalo123,项目名称:using,代码行数:26,代码来源:UsingTest.php
示例3: __construct
function __construct()
{
using('lepton.web.captcha');
using('lepton.mvc.request');
using('lepton.mvc.response');
using('lepton.mvc.session');
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:captcha.php
示例4: discover
/**
* @description Service Discovery
*/
function discover()
{
using('lepton.net.httprequest');
using('lepton.web.discovery');
$d = Discovery::discover('http://127.0.0.1');
$this->assertNotNull($d);
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:10,代码来源:web.php
示例5: detail
function detail()
{
global $G;
using("area", "industry");
$area = new Areas();
$industry = new Industries();
$tpl_file = "company/detail";
$this->viewhelper->setTitle(L("yellow_page", "tpl"));
$this->viewhelper->setPosition(L("yellow_page", "tpl"), "index.php?do=company");
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
$result = $area->dbstuff->GetRow("SELECT * FROM {$area->table_prefix}companies WHERE id='" . $id . "'");
if (!empty($result)) {
$login_check = 1;
//default open
if (isset($G['setting']['company_logincheck'])) {
$login_check = $G['setting']['company_logincheck'];
}
$this->viewhelper->setTitle($result['name']);
$this->viewhelper->setPosition($result['name']);
$result['tel'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['tel']));
$result['fax'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['fax']));
$result['mobile'] = pb_hidestr($result['mobile']);
$result['industry_names'] = $industry->disSubNames($result['industry_id'], null, true, "company");
$result['area_names'] = $area->disSubNames($result['area_id'], null, true, "company");
setvar("item", $result);
setvar("LoginCheck", $login_check);
}
}
render($tpl_file, 1);
}
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:company_controller.php
示例6: start
/**
* Magic Start method. When this method is invoked the job is to pick up
* where it left off and resume or start the processing of the job.
*/
function start()
{
$this->setState(LdwpJob::STATE_RUNNING, 0, 1, "Downloading " . $this->url);
using('lepton.net.httprequest');
$dl = new HttpRequest($this->url, array('saveto' => $this->destination, 'onprogress' => new Callback($this, 'onDownloadProgress')));
$this->setState(LdwpJob::STATE_COMPLETED, 1, 1, "Saved " . $this->url);
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:11,代码来源:download.php
示例7: broke
function broke()
{
foreach (using(function () {
(yield 1);
(yield 2);
(yield 3);
}) as $x) {
var_dump($x);
}
}
开发者ID:n3b,项目名称:hiphop-php,代码行数:10,代码来源:inline_closure_gen.php
示例8: findClass
protected function findClass($classpath)
{
if (strpos($classpath, '.') !== false) {
using($classpath);
$class = explode('.', $classpath);
return $class[count($class) - 1];
} else {
return $classpath;
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:10,代码来源:TService.php
示例9: lists
function lists()
{
global $viewhelper, $pos;
using("industry", "area");
$area = new Areas();
$industry = new Industries();
$conditions[] = "Job.status=1";
$viewhelper->setTitle(L("hr_information", "tpl"));
$viewhelper->setPosition(L("hr_information", "tpl"), "index.php?do=job&action=" . __FUNCTION__);
if (!empty($_GET['q'])) {
$title = trim($_GET['q']);
$conditions[] = "Job.name like '%" . $title . "%'";
}
if (!empty($_GET['data']['salary_id'])) {
$conditions[] = "Job.salary_id=" . intval($_GET['data']['salary_id']);
}
if (!empty($_GET['data']['area_id'])) {
$conditions[] = "Job.area_id=" . intval($_GET['data']['area_id']);
}
if (isset($_GET['industryid'])) {
$industry_id = intval($_GET['industryid']);
$tmp_info = $industry->setInfo($industry_id);
if (!empty($tmp_info)) {
$conditions[] = "Job.industry_id=" . $tmp_info['id'];
$viewhelper->setTitle($tmp_info['name']);
$viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&industryid=" . $tmp_info['id']);
}
}
if (isset($_GET['areaid'])) {
$area_id = intval($_GET['areaid']);
$tmp_info = $area->setInfo($area_id);
if (!empty($tmp_info)) {
$conditions[] = "Job.area_id=" . $tmp_info['id'];
$viewhelper->setTitle($tmp_info['name']);
$viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&areaid=" . $tmp_info['id']);
}
}
$amount = $this->job->findCount(null, $conditions, "Job.id");
$result = $this->job->findAll("Job.*,Job.cache_spacename AS userid,Job.created AS pubdate,(select Company.name from " . $this->job->table_prefix . "companies Company where Company.id=Job.id) AS companyname", null, $conditions, "Job.id DESC", $pos, $this->displaypg);
$viewhelper->setTitle(L("search", "tpl"));
$viewhelper->setPosition(L("search", "tpl"));
setvar("items", $result);
setvar("paging", array('total' => $amount));
render("job/list", 1);
}
开发者ID:reboxhost,项目名称:phpb2b,代码行数:45,代码来源:job_controller.php
示例10: add
function add()
{
global $smarty;
using("message");
$pms = new Messages();
if (isset($_POST['do']) && !empty($_POST['friendlink'])) {
pb_submit_check('friendlink');
$data = $_POST['friendlink'];
$result = false;
$data['status'] = 0;
$data['created'] = $data['modified'] = $this->friendlink->timestamp;
$result = $this->friendlink->save($data);
if ($result) {
$pms->SendToAdmin('', array("title" => $data['title'] . L("apply_friendlink"), "content" => $data['title'] . L("apply_friendlink") . "\n" . $_POST['data']['email'] . "\n" . $data['description']));
flash('wait_apply');
}
} else {
flash();
}
}
开发者ID:reboxhost,项目名称:phpb2b,代码行数:20,代码来源:friendlink_controller.php
示例11: request
static function request($event, $data)
{
$qurl = $data['uri'];
if (url($qurl)->like('/^\\/sts-rpc[\\/]?/')) {
using('s2s.request');
$cmd = request::get('cmd');
$req = new S2SRequest(S2SRequest::RT_HTTP, $cmd, request::getAll());
$res = new S2SResponse(S2SRequest::RT_HTTP, $cmd);
$cmdp = explode('.', $cmd);
$mod = $cmdp[0];
$modc = $mod . 'S2SEndpoint';
if (class_exists($modc)) {
$ci = new $modc();
$rd = $ci->invoke($req, $res);
var_dump($rd);
} else {
printf("Bad endpoint");
}
return true;
}
return false;
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:22,代码来源:requesthandler.php
示例12: using
<?php
config::def('lepton.gallery.mediadir', base::appPath() . '/media/');
config::def('lepton.gallery.cachedir', base::appPath() . '/cache/');
// config::def('lepton.gallery.renderer', array('WatermarkImageFilter','mylogo.png'));
using('lepton.graphics.canvas');
using('lepton.utils.pagination');
class GalleryItemsTable extends SqlTableSchema
{
function define()
{
// Only to be used during testing!
$this->dropOnCreate();
// Table name
$this->setName('galleryitems');
// Table columns
$this->addColumn('id', 'int', self::COL_AUTO | self::KEY_PRIMARY);
$this->addColumn('name', 'varchar:160');
$this->addColumn('uuid', 'char:37', self::COL_FIXED);
$this->addColumn('src', 'varchar:200');
// Indexes
$this->addIndex('uuidkey', array('uuid'), self::KEY_UNIQUE);
$this->addIndex('srckey', array('src'), self::KEY_UNIQUE);
}
}
SqlTableSchema::apply(new GalleryItemsTable());
/**
* @class Gallery
* @package lepton.media
* @brief Gallery Management
*
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:gallery.php
示例13: using
<?php
using('lepton.system.threading');
interface ILdwpTransport
{
function connect($uri);
function getQueue();
function getJob($jobid);
}
abstract class LdwpTransport implements ILdwpTransport
{
static function factory($uri)
{
//
}
function connect($uri)
{
}
function getQueue()
{
}
function getJob($jobid)
{
}
}
class LdwpLocalTransport extends LdwpTransport
{
}
class LdwpHttpTransport extends LdwpTransport
{
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:node.php
示例14: __construct
function __construct($label,$key,array $options = null) {
using('lepton.web.captcha');
$this->setKey($key);
$this->label = $label;
parent::__construct($options);
$this->captchaid = Captcha::generate();
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:basic.php
示例15: __construct
function __construct()
{
using('lepton.utils.streams');
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:4,代码来源:streams.php
示例16: using
<?php
using('xsnp.utils');
using('lepton.utils.prefs');
using('lepton.web.xmlrpc');
using('lepton.crypto.uuid');
class XsnpServer
{
private $extensions;
function __construct()
{
$this->loadExtensions();
}
private function loadExtensions()
{
$desc = getDescendants('XsnpServerExtension');
foreach ($desc as $dc) {
$this->extensions[] = new $dc($this);
}
}
public function handleRequest($requestdata)
{
// Go through the extensions and decide which one is to handle it
}
function xmlrpcRequest()
{
$xr = new XmlrpcServer();
if ($this->conf->interactenable != true) {
$xr->sendError(0, 'Function Disabled');
return;
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:server.php
示例17: module
<?php
module("RGB Color Space Routines");
using('lepton.graphics.colorspace');
using('lepton.graphics.graphics');
class RgbColor extends Color
{
private $red;
private $green;
private $blue;
private $alpha;
/**
* Constructor. This method will accept parameters in a number of
* different formats:
* (R,G,B) red, green, and blue (0-255)
* (R,G,B,A) red, green, blue and alpha(0-255)
* #RGB rgb, as a hexadecimal string (0-F)
* #RRGGBB rgb, as a hexadecimal string (00-FF)
* #RRGGBBAA rgba, as a hexidecimal string (00-FF)
*/
function __construct()
{
$args = func_get_args();
switch (func_num_args()) {
case 0:
$red = 0;
$green = 0;
$blue = 0;
$alpha = 255;
break;
case 1:
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:rgb.php
示例18: using
<?php
using('lunit.*');
using('lepton.content.*');
class DummyContentExtension extends ContentExtension
{
private $object;
function getHandle()
{
return 'dummy';
}
function __construct($object = null)
{
$this->object = $object;
}
function reverse()
{
$data = $this->object->getHtml();
$datao = '';
for ($n = strlen($data) - 1; $n >= 0; $n--) {
$datao = $datao . $data[$n];
}
return $datao;
}
}
class DummyContentObject extends ContentObject
{
private $id;
function __construct($id)
{
$this->id = $id;
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:content.php
示例19: module
<?php
module("Console application base files");
// Console applications or services shouldn't time out
set_time_limit(0);
using('lepton.cli.debug');
using('lepton.cli.exception');
using('lepton.system.process');
using('lepton.cli.ansi');
logger::registerFactory(new ConsoleLoggerFactory());
abstract class AppBaseList implements IteratorAggregate, ArrayAccess
{
protected $data;
public function __construct()
{
$this->data = array();
}
public function getData()
{
return $this->data;
}
public function getIterator()
{
return new ArrayIterator($this->data);
}
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->data[] = $value;
} else {
$this->data[$offset] = $value;
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:application.php
示例20: using
<?php
using('lepton.geo.geo');
/**
*
*
* @todo Make this class extendable with various APIs including maxmind's
* geoIp.
*
* 'geoplugin_city' => 'Hammarö',
* 'geoplugin_region' => 'Värmlands Län',
* 'geoplugin_areaCode' => '0',
* 'geoplugin_dmaCode' => '0',
* 'geoplugin_countryCode' => 'SE',
* 'geoplugin_countryName' => 'Sweden',
* 'geoplugin_continentCode' => 'EU',
* 'geoplugin_latitude' => '59.333301544189',
* 'geoplugin_longitude' => '13.516699790955',
* 'geoplugin_regionCode' => '22',
* 'geoplugin_regionName' => 'Värmlands Län',
* 'geoplugin_currencyCode' => 'SEK',
* 'geoplugin_currencySymbol' => 'kr',
* 'geoplugin_currencyConverter' => 6.2286000252,
*/
class GeopluginResolver
{
const API_QUERY_URL = 'http://www.geoplugin.net/php.gp?ip=%s';
static function getInformationFromIp($ip)
{
$data = unserialize(file_get_contents(sprintf(self::API_QUERY_URL, $ip)));
foreach ($data as $k => $v) {
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:geoplugin.php
注:本文中的using函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论