本文整理汇总了PHP中App类的典型用法代码示例。如果您正苦于以下问题:PHP App类的具体用法?PHP App怎么用?PHP App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了App类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: expire_run
function expire_run($argv, $argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
require_once 'include/session.php';
require_once 'include/datetime.php';
require_once 'library/simplepie/simplepie.inc';
require_once 'include/items.php';
require_once 'include/Contact.php';
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system', 'url'));
logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
if (count($r)) {
foreach ($r as $rr) {
logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
item_expire($rr['uid'], $rr['expire']);
}
}
return;
}
示例2: expire_run
function expire_run($argv, $argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
require_once 'include/session.php';
require_once 'include/datetime.php';
require_once 'library/simplepie/simplepie.inc';
require_once 'include/items.php';
require_once 'include/Contact.php';
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system', 'url'));
// physically remove anything that has been deleted for more than two months
$r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY");
q("optimize table item");
logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
if (count($r)) {
foreach ($r as $rr) {
logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
item_expire($rr['uid'], $rr['expire']);
}
}
return;
}
示例3: gprobe_run
function gprobe_run($argv, $argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
require_once 'include/session.php';
require_once 'include/datetime.php';
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system', 'url'));
load_hooks();
if ($argc != 2) {
return;
}
$url = hex2bin($argv[1]);
$r = q("select * from gcontact where nurl = '%s' limit 1", dbesc(normalise_link($url)));
if (!count($r)) {
$arr = probe_url($url);
if (count($arr) && x($arr, 'network') && $arr['network'] === NETWORK_DFRN) {
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`)\n\t\t\t\tvalues ( '%s', '%s', '%s', '%s') ", dbesc($arr['name']), dbesc($arr['url']), dbesc(normalise_link($arr['url'])), dbesc($arr['photo']));
}
$r = q("select * from gcontact where nurl = '%s' limit 1", dbesc(normalise_link($url)));
}
if (count($r)) {
poco_load(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));
}
return;
}
示例4: smstorage_parseMessages
public static function smstorage_parseMessages($data)
{
$emoji = new App();
foreach ($data['messages'] as $message) {
$message->body = $emoji->any_to_html($message->body);
}
}
示例5: route
/**
* The route method calls a specefic controller
* then apply the action and passing the arguments passed in URL
* @param App $app
* @return mixte
*/
public function route(App $app)
{
$urls = $this->cleanUrl();
$controller = !empty($urls) ? array_shift($urls) : 'index';
$action = !empty($urls) ? array_shift($urls) : '';
$params = !empty($urls) ? $urls : '';
if ($controller === 'index') {
return $app->controller->index();
} else {
if ($app->exists($app->{$controller})) {
if ($action !== '') {
if (method_exists($app->{$controller}, $action)) {
call_user_func_array([$app->{$controller}, $action], [$params]);
return;
} else {
return $app->controller->e404();
}
} else {
return $app->{$controller}->index();
}
} else {
return $app->controller->e404();
}
}
}
示例6: directory_run
function directory_run(&$argv, &$argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "include/dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
load_config('config');
load_config('system');
if ($argc != 2) {
return;
}
load_config('system');
load_hooks();
$a->set_baseurl(get_config('system', 'url'));
$dir = get_config('system', 'directory_submit_url');
if (!strlen($dir)) {
return;
}
$arr = array('url' => $argv[1]);
call_hooks('globaldir_update', $arr);
logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
if (strlen($arr['url'])) {
fetch_url($dir . '?url=' . bin2hex($arr['url']));
}
return;
}
示例7: getAppDetails
function getAppDetails($appID, $connection)
{
$appQuerySQL = "SELECT id, appID, averageUserRating, currency";
$appQuerySQL .= ", price, releaseDate, sellerName, sellerURL";
$appQuerySQL .= ", userRatingCount, version";
$appQuerySQL .= " FROM craft_demo.`app`";
$appQuerySQL .= " WHERE appID = '" . $appID . "';";
$appResult = $connection->query($appQuerySQL);
$app = null;
$rating_floor = 4;
if ($row = $appResult->fetch_assoc()) {
$app = new App($appID, $row['averageUserRating'], $row['userRatingCount'], $row['currency'], $row['price'], $row['sellerName'], $row['releaseDate']);
if ($row['version']) {
$app->setVersion($row['version']);
}
if ($row['sellerURL']) {
$app->setSellerUrl($row['sellerURL']);
}
$reviews = array();
$reviewQuerySQL = "SELECT author, title, content, rating";
$reviewQuerySQL .= " FROM craft_demo.`reviews`";
$reviewQuerySQL .= " WHERE app_id = " . $row['id'];
$reviewQuerySQL .= " AND rating > " . $rating_floor . ";";
$reviewResult = $connection->query($reviewQuerySQL);
while ($reviewRow = $reviewResult->fetch_assoc()) {
$review = new Review($reviewRow['author'], $reviewRow['title'], $reviewRow['content'], $reviewRow['rating']);
$reviews[] = $review;
}
$app->setReviews($reviews);
}
return $app;
}
示例8: directory_run
function directory_run($argv, $argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
load_config('config');
load_config('system');
if ($argc != 2) {
return;
}
load_config('system');
$a->set_baseurl(get_config('system', 'url'));
$dir = get_config('system', 'directory_submit_url');
if (!strlen($dir)) {
return;
}
fetch_url($dir . '?url=' . bin2hex($argv[1]));
return;
}
示例9: __construct
/**
* @param App $app
*/
public function __construct($app)
{
$this->commandConfig = $app->getCommandConfig();
if ($this->commandConfig->isMultipleCommandMode()) {
$this->subcommandName = $app->getSubcommandName();
}
}
示例10: getAdv_list
function getAdv_list($params)
{
$getOption = strip_tags(JRequest::getVar('option'));
$app = new App();
$getAdvs = $app->getAdv();
$getUrl = JURI::base();
if (strpos($getUrl, 'local') !== false) {
$prefix = 'local_';
} elseif (strpos($getUrl, 'staging2') !== false) {
$prefix = 'staging_';
} elseif (strpos($getUrl, 'live') !== false) {
$prefix = '';
} else {
$prefix = '';
}
if ($params->get("layout") == "_:default") {
if ($getOption == "com_video" || $getOption == "com_gallery") {
return $getAdvs[$prefix . 'gpt_adv_id_gallery_video'];
}
return $getAdvs[$prefix . 'gpt_adv_id_topbanner'];
} elseif ($params->get("layout") == "_:right") {
if ($getOption == "com_video" || $getOption == "com_gallery") {
return $getAdvs[$prefix . 'gpt_adv_id_gallery'];
}
return $getAdvs[$prefix . 'gpt_adv_id_right'];
}
}
示例11: __construct
public function __construct()
{
$this->app = App::getInstance();
$this->view = View::getInstance();
$this->config = $this->app->getConfig();
$this->input = InputData::getInstance();
}
示例12: change_theme
function change_theme($job)
{
$json = $job->workload();
$data = json_decode($json, true);
$app = new App($data['token']);
$app->themeWorker($data);
}
示例13: main
function main()
{
$app = new App();
$app->bootstrap();
$app->setupErrorHandling();
$app->dispatch();
}
示例14: testRenderWithStatusCode
public function testRenderWithStatusCode()
{
$mock = $this->getMock('View\\TemplateEngineInterface');
$mock->expects($this->once())->method('render')->will($this->returnValue('Heya'));
$app = new \App($mock);
$this->assertEquals('Heya', $app->render('a/template.php', array(), 201));
$this->assertEquals(201, $this->readStatusCode($app));
}
示例15: makeModel
public function makeModel()
{
$model = $this->_app->getFacadeApplication()->make($this->model());
if (!$model instanceof Model) {
throw new \Exception("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
}
return $this->model = $model;
}