當前位置: 首頁>>代碼示例>>PHP>>正文


PHP App類代碼示例

本文整理匯總了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;
}
開發者ID:nphyx,項目名稱:friendica,代碼行數:30,代碼來源:expire.php

示例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;
}
開發者ID:nextgensh,項目名稱:friendica,代碼行數:33,代碼來源:expire.php

示例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;
}
開發者ID:robhell,項目名稱:friendica,代碼行數:35,代碼來源:gprobe.php

示例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);
     }
 }
開發者ID:DOM-Digital-Online-Media,項目名稱:apps,代碼行數:7,代碼來源:hooks.php

示例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();
         }
     }
 }
開發者ID:bazizi426,項目名稱:SimpleBlog,代碼行數:31,代碼來源:Router.php

示例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;
}
開發者ID:rahmiyildiz,項目名稱:friendica,代碼行數:32,代碼來源:directory.php

示例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;
}
開發者ID:DrJCFitz,項目名稱:craft-demo,代碼行數:32,代碼來源:getAppDetails.php

示例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;
}
開發者ID:nextgensh,項目名稱:friendica,代碼行數:26,代碼來源:directory.php

示例9: __construct

 /**
  * @param App $app
  */
 public function __construct($app)
 {
     $this->commandConfig = $app->getCommandConfig();
     if ($this->commandConfig->isMultipleCommandMode()) {
         $this->subcommandName = $app->getSubcommandName();
     }
 }
開發者ID:hyperframework,項目名稱:hyperframework,代碼行數:10,代碼來源:Help.php

示例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'];
     }
 }
開發者ID:tuantran1,項目名稱:rusty,代碼行數:27,代碼來源:helper.php

示例11: __construct

 public function __construct()
 {
     $this->app = App::getInstance();
     $this->view = View::getInstance();
     $this->config = $this->app->getConfig();
     $this->input = InputData::getInstance();
 }
開發者ID:KonstantinKirchev,項目名稱:WebDevelopment,代碼行數:7,代碼來源:DefaultController.php

示例12: change_theme

function change_theme($job)
{
    $json = $job->workload();
    $data = json_decode($json, true);
    $app = new App($data['token']);
    $app->themeWorker($data);
}
開發者ID:kehers,項目名稱:tinypress,代碼行數:7,代碼來源:change_theme.php

示例13: main

function main()
{
    $app = new App();
    $app->bootstrap();
    $app->setupErrorHandling();
    $app->dispatch();
}
開發者ID:rajatkhanduja,項目名稱:opc,代碼行數:7,代碼來源:bootstrap.php

示例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));
 }
開發者ID:yannisrichard,項目名稱:uframework,代碼行數:8,代碼來源:AppTest.php

示例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;
 }
開發者ID:nekonekonik,項目名稱:nuswhispers,代碼行數:8,代碼來源:BaseRepository.php


注:本文中的App類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。