本文整理汇总了PHP中F::app方法的典型用法代码示例。如果您正苦于以下问题:PHP F::app方法的具体用法?PHP F::app怎么用?PHP F::app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->test = $this->hasOption('test');
$this->verbose = $this->hasOption('verbose');
$action = $this->getOption('action');
$key = $this->getOption('key');
$class = $this->hasOption("class");
$servers = $this->hasOption("servers");
if ($class) {
global $gMemCachedClass;
echo get_class(F::app()->wg->Memc->getClient()) . "\n";
}
if ($servers) {
//print_r( F::app()->wg->Memc->getClient() );
//echo "\n\n";
foreach (F::app()->wg->Memc->getClient()->_servers as $stuff) {
print_r($stuff);
echo "\n";
}
}
$memc = F::app()->wg->Memc;
if ($action == 'get') {
print_r($memc->get($key));
}
if ($action == 'delete') {
print_r($memc->delete($key));
}
}
示例2: execute
public function execute($subpage)
{
global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
// Boilerplate special page permissions
if ($wgUser->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
if (wfReadOnly() && !wfAutomaticReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if (!$wgUser->isAllowed('createpage') || !$wgUser->isAllowed('edit')) {
$this->displayRestrictionError();
return;
}
$wgOut->addModules("wikia.jquery.ui");
$wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaPoll/js/CreateWikiaPoll.js"></script>');
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaPoll/css/CreateWikiaPoll.scss'));
if ($subpage != '') {
// We came here from the edit link, go into edit mode
$wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPageEdit', array('title' => $subpage)));
} else {
$wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPage'));
}
}
示例3: efReCaptcha
/**
* Make sure the keys are defined.
*
* @throws Exception
*/
function efReCaptcha()
{
$wg = F::app()->wg;
if ($wg->ReCaptchaPublicKey == '' || $wg->ReCaptchaPrivateKey == '') {
throw new Exception(wfMessage('recaptcha-misconfigured')->escaped());
}
}
示例4: buildMimeTypesBlacklist
private function buildMimeTypesBlacklist()
{
if (self::$mimeTypesBlacklist === null) {
wfProfileIn(__METHOD__);
$app = F::app();
// blacklist types that thumbnailer cannot generate thumbs for (BAC-770)
$mimeTypesBlacklist = ['svg+xml', 'svg'];
if ($app->wg->UseMimeMagicLite) {
// MimeMagicLite defines all the mMediaTypes in PHP that MimeMagic
// defines in text files
$mimeTypes = new MimeMagicLite();
} else {
$mimeTypes = new MimeMagic();
}
foreach (['AUDIO', 'VIDEO'] as $type) {
foreach ($mimeTypes->mMediaTypes[$type] as $mime) {
// parse mime type - "image/svg" -> "svg"
list(, $mimeMinor) = explode('/', $mime);
$mimeTypesBlacklist[] = $mimeMinor;
}
}
self::$mimeTypesBlacklist = array_unique($mimeTypesBlacklist);
wfDebug(sprintf("%s: minor MIME types blacklist - %s\n", __CLASS__, join(', ', self::$mimeTypesBlacklist)));
wfProfileOut(__METHOD__);
}
}
示例5: execute
public function execute($subpage)
{
global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
// Boilerplate special page permissions
if ($wgUser->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
if (!$wgUser->isAllowed('wikiaquiz')) {
$this->displayRestrictionError();
return;
}
if (wfReadOnly() && !wfAutomaticReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$wgOut->addScript('<script src="' . $wgResourceBasePath . '/resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js"></script>');
$wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaQuiz/js/CreateWikiaQuizArticle.js"></script>');
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
if ($subpage != '') {
// We came here from the edit link, go into edit mode
$wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'EditQuizArticle', array('title' => $subpage)));
} else {
$wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'CreateQuizArticle'));
}
}
示例6: onArticleFromTitle
/**
* set appropriate status code for deleted pages
*
* @author ADi
* @param Title $title
* @param Article $article
* @return bool
*/
public function onArticleFromTitle(&$title, &$article)
{
if (!$title->exists() && $title->isDeleted()) {
F::app()->wg->Out->setStatusCode(SEOTweaksHooksHelper::DELETED_PAGES_STATUS_CODE);
}
return true;
}
示例7: index
public function index()
{
$this->wg->Out->setPageTitle(wfMsg('wikifeatures-title'));
if (!$this->wg->User->isAllowed('wikifeaturesview')) {
// show this feature to logged in users only regardless of their rights
$this->displayRestrictionError();
return false;
// skip rendering
}
$this->isOasis = F::app()->checkSkin('oasis');
if (!$this->isOasis) {
$this->forward('WikiFeaturesSpecial', 'notOasis');
return;
}
$this->response->addAsset('extensions/wikia/WikiFeatures/css/WikiFeatures.scss');
$this->response->addAsset('extensions/wikia/WikiFeatures/js/modernizr.transform.js');
$this->response->addAsset('extensions/wikia/WikiFeatures/js/WikiFeatures.js');
if ($this->getVal('simulateNewLabs', false)) {
// debug code
WikiFeaturesHelper::$release_date = array('wgEnableChat' => '2032-09-01');
}
$this->features = WikiFeaturesHelper::getInstance()->getFeatureNormal();
$this->labsFeatures = WikiFeaturesHelper::getInstance()->getFeatureLabs();
$this->editable = $this->wg->User->isAllowed('wikifeatures') ? true : false;
// only those with rights can make edits
if ($this->getVal('simulateEmptyLabs', false)) {
// debug code
$this->labsFeatures = array();
}
}
示例8: testCache
/**
* @group UsingDB
*/
public function testCache()
{
$user = $this->getTestUser();
//create object here, so we use the same one all the time, that way we can test local cache
$object = new UserService();
$cachedLocalUser = $this->invokePrivateMethod('UserService', 'getUserFromLocalCacheById', $user->getId(), $object);
$cachedLocalUserByName = $this->invokePrivateMethod('UserService', 'getUserFromLocalCacheByName', $user->getName(), $object);
//values are not cached localy yet
$this->assertEquals(false, $cachedLocalUser);
$this->assertEquals(false, $cachedLocalUserByName);
//cache user, both locally and mem cached
$this->invokePrivateMethod('UserService', 'cacheUser', $user, $object);
//do the assertion again, local cache should have hit one
$cachedLocalUser = $this->invokePrivateMethod('UserService', 'getUserFromLocalCacheById', $user->getId(), $object);
$cachedLocalUserByName = $this->invokePrivateMethod('UserService', 'getUserFromLocalCacheByName', $user->getName(), $object);
$this->assertEquals($user, $cachedLocalUser);
$this->assertEquals($user, $cachedLocalUserByName);
//check if user was cached in memcache, use new object for that
$cachedMemCacheById = $this->invokePrivateMethod('UserService', 'getUserFromMemCacheById', $user->getId());
$cachedMemCacheByName = $this->invokePrivateMethod('UserService', 'getUserFromMemCacheByName', $user->getName());
$this->assertEquals($user, $cachedMemCacheById);
$this->assertEquals($user, $cachedMemCacheByName);
//need for deleting form cache test values
$sharedIdKey = wfSharedMemcKey("UserCache:" . $user->getId());
$sharedNameKey = wfSharedMemcKey("UserCache:" . $user->getName());
//remove user from memcache
F::app()->wg->memc->delete($sharedIdKey);
F::app()->wg->memc->delete($sharedNameKey);
//do assert against memcache again
$cachedMemCacheById = $this->invokePrivateMethod('UserService', 'getUserFromMemCacheById', $user->getId());
$cachedMemCacheByName = $this->invokePrivateMethod('UserService', 'getUserFromMemCacheByName', $user->getName());
$this->assertEquals(false, $cachedMemCacheById);
$this->assertEquals(false, $cachedMemCacheByName);
}
示例9: onOverwriteTOC
public static function onOverwriteTOC(&$title, &$toc)
{
if (F::app()->checkSkin('venus')) {
$toc = '';
}
return true;
}
示例10: onAlternateEdit
/**
* Blocks view source page & make it so that users cannot create/edit
* pages that are on the takedown list.
*
* @param EditPage $editPage edit page instance
* @return bool show edit page form?
*/
public static function onAlternateEdit(EditPage $editPage)
{
$wg = F::app()->wg;
$wf = F::app()->wf;
$title = $editPage->getTitle();
// Block view-source on the certain pages.
if ($title->exists()) {
// Look at the page-props to see if this page is blocked.
if (!$wg->user->isAllowed('editlyricfind')) {
// some users (staff/admin) will be allowed to edit these to prevent vandalism/spam issues.
$removedProp = $wf->GetWikiaPageProp(WPP_LYRICFIND_MARKED_FOR_REMOVAL, $title->getArticleID());
if (!empty($removedProp)) {
$wg->Out->addHTML(Wikia::errorbox(wfMessage('lyricfind-editpage-blocked')));
$blockEdit = true;
}
}
} else {
// Page is being created. Prevent this if page is prohibited by LyricFind.
$blockEdit = LyricFindTrackingService::isPageBlockedViaApi($amgId = "", $gracenoteId = "", $title->getText());
if ($blockEdit) {
$wg->Out->addHTML(Wikia::errorbox(wfMessage('lyricfind-creation-blocked')));
}
}
return !$blockEdit;
}
示例11: __construct
public function __construct()
{
$this->allowedRequests['store'] = array('json');
$this->allowedRequests['index'] = array('json');
$this->app = F::app();
$this->UAD = new UAD();
}
示例12: getEmbed
public function getEmbed($width, array $options = [])
{
$autoplay = !empty($options['autoplay']);
$height = $this->getHeight($width);
$autoplayParam = self::$autoplayParam;
$autoplayValue = $autoplay ? self::$autoplayValue : 'false';
$url = $this->getEmbedUrl();
$sizeString = $this->getSizeString($width, $height);
if (F::app()->checkSkin('wikiamobile')) {
$style = '';
} else {
$style = "style='background: #000000; display:block; overflow: hidden;'";
}
$html = <<<EOT
<object {$sizeString} type="application/x-shockwave-flash" data="{$url}/" {$style}>
\t<param name="movie" value="{$url}" />
\t<param name="allowfullscreen" value="true" />
\t<param name="bgcolor" value="#000000" />
\t<param name="wmode" value="transparent" />
\t<param name="allowscriptaccess" value="always" />
\t<param name="FlashVars" value="{$autoplayParam}={$autoplayValue}" />
\t<embed src="{$url}" type="application/x-shockwave-flash" allowfullscreen="true" movie="{$url}" wmode="transparent" allowscriptaccess="always" ></embed>
</object>
EOT;
return array('html' => $html, 'width' => $width, 'height' => $height);
}
示例13: execute
/**
* See functions below for expected URL params
*/
public function execute()
{
$app = F::app();
wfProfileIn(__METHOD__);
$format = 'html';
extract($this->extractRequestParams());
if (!empty($controller)) {
if (empty($method)) {
$method = 'index';
}
if (!empty($parameters)) {
$par = array();
$params = explode('|', $parameters);
foreach ($params as $param) {
$p = explode(':', $param);
$par[$p[0]] = $p[1];
}
} else {
$params = null;
}
$resp = $app->sendRequest($controller, $method, $params);
if ($format == 'html' || $format == 'json') {
$resp = $resp->toString();
}
$this->getResult()->addValue($this->getModuleName(), $controller, $resp);
} else {
$this->getResult()->addValue($this->getModuleName(), 'Error', 'No Controller Specified');
}
wfProfileOut(__METHOD__);
}
示例14: setupSource
public function setupSource($startDate, $endDate)
{
$this->serieName = wfMessage('special-pageviews-report-series')->escaped();
$this->setDatabase(wfGetDB(DB_SLAVE, array(), F::app()->wg->DWStatsDB));
$this->setStartDate($startDate->format('Y-m-d'));
$this->setEndDate($endDate->format('Y-m-d'));
}
示例15: onGetRecentChangeQuery
public static function onGetRecentChangeQuery(&$conds, &$tables, &$join_conds, $opts)
{
$app = F::app();
if ($app->wg->User->isAnon()) {
return true;
}
if ($app->wg->Title->isSpecial('RecentChanges')) {
return true;
}
if ($opts['invert'] !== false) {
return true;
}
if (!isset($opts['namespace']) || empty($opts['namespace'])) {
$rcfs = new RecentChangesFiltersStorage($app->wg->User);
$selected = $rcfs->get();
if (empty($selected)) {
return true;
}
$db = wfGetDB(DB_SLAVE);
$cond = 'rc_namespace IN (' . $db->makeList($selected) . ')';
$flag = true;
foreach ($conds as $key => &$value) {
if (strpos($value, 'rc_namespace') !== false) {
$value = $cond;
$flag = false;
break;
}
}
if ($flag) {
$conds[] = $cond;
}
}
return true;
}