本文整理汇总了PHP中F类的典型用法代码示例。如果您正苦于以下问题:PHP F类的具体用法?PHP F怎么用?PHP F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了F类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildData
protected function buildData()
{
$this->available = F::app()->wg->user->isAllowed('performancestats');
$this->enabled = F::app()->wg->user->isAllowed('performancestats');
$this->caption = wfMsg('oasis-toolbar-devinfo');
$this->linkClass = 'tools-devinfo';
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:DevInfoUserCommand.php
示例2: init
/**
* Check if:
* controller - is first parameter
* method - is second parameter
* rest of parameters - are sorted
*
* @author Jakub Olek <[email protected]>
*
* @throws WikiaException
*/
public final function init()
{
$webRequest = F::app()->wg->Request;
$accessService = new ApiAccessService($this->getRequest());
$controller = $webRequest->getVal('controller');
$method = $webRequest->getVal('method');
$accessService->checkUse($controller . 'Controller', $method);
//this is used for monitoring purposes, do not change unless you know what you are doing
//should set api/v1 as the transaction name
if (!$this->request->isInternal()) {
Transaction::setEntryPoint(Transaction::ENTRY_POINT_API_V1);
}
if (!$this->request->isInternal()) {
if ($this->hideNonCommercialContent()) {
$this->blockIfNonCommercialOnly();
}
$paramKeys = array_keys($webRequest->getQueryValues());
$count = count($paramKeys);
if ($count >= 2 && $paramKeys[0] === 'controller' && $paramKeys[1] === 'method') {
if ($count > 2) {
$origParam = $paramKeys = array_flip(array_slice($paramKeys, 2));
ksort($paramKeys);
ksort($origParam);
if ($paramKeys !== $origParam) {
throw new BadRequestApiException('The parameters\' order is incorrect');
}
}
} else {
throw new BadRequestApiException('Controller and/or method missing');
}
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:42,代码来源:WikiaApiController.class.php
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Order();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Order'])) {
$model->attributes = $_POST['Order'];
$model->id = F::get_order_id();
$model->user_id = Yii::app()->user->id ? Yii::app()->user->id : '0';
if ($model->save()) {
$cart = Yii::app()->cart;
$mycart = $cart->contents();
foreach ($mycart as $mc) {
$OrderItem = new OrderItem();
$OrderItem->order_id = $model->order_id;
$OrderItem->item_id = $mc['id'];
$OrderItem->title = $mc['title'];
$OrderItem->pic_url = serialize($mc['pic_url']);
$OrderItem->sn = $mc['sn'];
$OrderItem->num = $mc['qty'];
$OrderItem->save();
}
$cart->destroy();
$this->redirect(array('success'));
}
}
// $this->render('create', array(
// 'model' => $model,
// ));
}
开发者ID:rainsongsky,项目名称:yincart,代码行数:34,代码来源:OrderController.php
示例4: uploadIcon
public function uploadIcon($file)
{
$filename = $file->getName();
//获取文件名
$filename = F::random_filename() . '.' . pathinfo($filename, PATHINFO_EXTENSION);
$filesize = $file->getSize();
//获取文件大小
$filetype = $file->getType();
//获取文件类型
$filePath = Yii::app()->params->uploadPath . "tmp/";
if (!file_exists($filePath)) {
mkdir($filePath, 0777);
}
if ($file->saveAs($filePath . $filename, true)) {
$ftpsavepath = 'common/frontmenu/';
$ftp = new Ftp();
$res = $ftp->uploadfile($filePath . $filename, $ftpsavepath . $filename);
$ftp->close();
if ($res['success']) {
@unlink($filePath . $filename);
return $filename;
} else {
var_dump($res);
die;
}
}
}
开发者ID:zwq,项目名称:unpei,代码行数:27,代码来源:FrontmenuController.php
示例5: getContent
public function getContent()
{
wfProfileIn(__METHOD__);
$processingTimeStart = null;
if ($this->mForceProfile) {
$processingTimeStart = microtime(true);
}
$hash = wfAssetManagerGetSASShash($this->mOid);
$paramsHash = md5(urldecode(http_build_query($this->mParams, '', ' ')));
$cacheId = "/Sass-{$paramsHash}-{$hash}-" . self::CACHE_VERSION;
$memc = F::App()->wg->Memc;
$cachedContent = $memc->get($cacheId);
if ($cachedContent) {
$this->mContent = $cachedContent;
} else {
$this->processContent();
// This is the final pass on contents which, among other things, performs minification
parent::getContent($processingTimeStart);
// Prevent cache poisoning if we are serving sass from preview server
if (getHostPrefix() == null && !$this->mForceProfile) {
$memc->set($cacheId, $this->mContent);
}
}
wfProfileOut(__METHOD__);
return $this->mContent;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:26,代码来源:AssetsManagerSassBuilder.class.php
示例6: 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'));
}
}
开发者ID:yusufchang,项目名称:app,代码行数:25,代码来源:SpecialCreateWikiaQuizArticle.class.php
示例7: actionGetlogisticslist
public function actionGetlogisticslist()
{
$organID = Commonmodel::getOrganID();
//获取机构ID
$criteria = new CDbCriteria();
$criteria->select = "*";
$criteria->order = "id DESC";
$criteria->addCondition("OrganID=" . $organID);
//查询条件:根据机构ID查询物流数据
$count = Logistics::model()->count($criteria);
$pages = new CPagination($count);
$pages->applyLimit($criteria);
$modeles = Logistics::model()->findAll($criteria);
foreach ($modeles as $key => $value) {
$data[$key]['ID'] = $value['ID'];
$data[$key]['OrganID'] = $value['OrganID'];
$data[$key]['Company'] = F::msubstr($value['LogisticsCompany']);
$data[$key]['Description'] = F::msubstr($value['LogisticsDescription']);
$data[$key]['LogisticsCompany'] = $value['LogisticsCompany'];
$data[$key]['LogisticsDescription'] = $value['LogisticsDescription'];
$data[$key]['CreateTime'] = date("Y-m-d H:i:s", $value['CreateTime']);
$data[$key]['UpdateTime'] = $value['UpdateTime'];
$data[$key]['Status'] = $value['Status'];
$address = $this->getAddress($value['ID']);
$data[$key]['Address'] = $address ? F::msubstr(substr($address, 0, -3)) : '';
$data[$key]['AddressDetail'] = $address ? substr($address, 0, -3) : '';
//$data[$key]['Address'] = Area::getCity($address['Province']) . Area::getCity($address['City']) . Area::getCity($address['Area']);
}
$rs = array('total' => $count, 'rows' => $data ? $data : array());
// var_dump($rs);exit;
echo json_encode($rs);
}
开发者ID:zwq,项目名称:unpei,代码行数:32,代码来源:LogisticsController.php
示例8: 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;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:15,代码来源:SEOTweaksHooksHelper.class.php
示例9: 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();
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:WikiFeaturesSpecialController.class.php
示例10: savePreferences
/**
* saves user preferences
*
* @return Illuminate\View\View
*/
public function savePreferences()
{
$section_ids = function ($input) {
$input_data = Input::get($input, '');
if (strlen($input_data) == 0) {
return "";
}
$arr = explode(',', $input_data);
return implode(',', array_unique(F::map($this->section->getByTitle($arr), function ($m) {
return $m->id;
})));
};
$show_nsfw = Input::get('show_nsfw', 0);
$show_nsfl = Input::get('show_nsfl', 0);
$frontpage_show_sections = $section_ids('frontpage_show_sections');
$frontpage_ignore_sections = $section_ids('frontpage_ignore_sections');
if ($frontpage_show_sections == "0") {
$frontpage_show_sections = "";
}
if ($frontpage_ignore_sections == "0") {
$frontpage_ignore_sections = "";
}
$this->user->savePreferences(Auth::id(), ['show_nsfw' => $show_nsfw, 'show_nsfl' => $show_nsfl, 'frontpage_show_sections' => $frontpage_show_sections, 'frontpage_ignore_sections' => $frontpage_ignore_sections]);
$sections = $this->section->get();
$section = $this->section->sectionFromEmptySection();
return View::make('page.user.prefs.savedpreferences', ['sections' => $sections, 'section' => $section]);
}
开发者ID:hrenos,项目名称:spreadit,代码行数:32,代码来源:PreferencesController.php
示例11: __construct
function __construct(User $user)
{
$app = F::App();
$this->user = $user;
$this->memc = $app->wg->Memc;
$this->namespaces = wfGetNamespaces();
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:RecentChangesFiltersStorage.class.php
示例12: require_params
/**
* 筛选数组,获取必备key对应value
*
* @access public
* @param array $require_params key array
* @param array $params 待筛选数组
* @return multitype:
*/
public static function require_params($require_params = array(), &$params = array())
{
if (!$params) {
$params = F::all_requests();
}
return array_values(array_diff($require_params, array_keys($params)));
}
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:15,代码来源:FValidator.php
示例13: __construct
public function __construct(WikiaApp $app = null)
{
if (is_null($app)) {
$app = F::app();
}
$this->app = $app;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:EmailsStorage.class.php
示例14: 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;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:RecentChangesHooks.class.php
示例15: __construct
public function __construct()
{
parent::__construct();
//TODO: use Factory here
//$this->setProvider(F::build('MysqlWikiaHubsV2SliderModuleDataProvider'));
$this->setProvider(F::build('StaticWikiaHubsV2SliderModuleDataProvider'));
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:WikiaHubsV2SliderModule.class.php
示例16: setTitle
public function setTitle($title)
{
$this->title = $title;
$globalTitleObj = (array) F::build('GlobalTitle', array($this->title), 'explodeURL');
$this->setArticleName($globalTitleObj['articleName']);
$this->setWikiId($globalTitleObj['wikiId']);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:ScavengerHuntGameArticle.class.php
示例17: __construct
public function __construct($url, $login = '', $passwd = '', $HTTPProxy = null)
{
$this->setCurl(F::build('Curl', array('url' => $url)));
$this->setLogin($login);
$this->setPasswd($passwd);
$this->setHTTPProxy($HTTPProxy);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:FogbugzService.class.php
示例18: pageNotFound
/**
* Page Not Found
*
* Get 20 most recent edited page
* get 5 images per page
*
* display random image on 404 page
* example:
*
* Open non existent page on any wiki
*
*/
function pageNotFound()
{
//setup all needed assets on 404 page
/**
* @var $out OutputPage
*/
$out = $this->request->getVal('out', $this->wg->Out);
$assetManager = F::build('AssetsManager', array(), 'getInstance');
//add styles that belongs only to 404 page
$styles = $assetManager->getURL(array('wikiamobile_404_scss'));
//this is going to be additional call but at least it won't be loaded on every page
foreach ($styles as $s) {
$out->addStyle($s);
}
//this is mainly for tracking
$scipts = $assetManager->getURL(array('wikiamobile_404_js'));
foreach ($scipts as $s) {
$out->addScript('<script src="' . $s . '"></script>');
}
//suppress rendering stuff that is not to be on 404 page
WikiaMobileFooterService::setSkipRendering(true);
WikiaMobilePageHeaderService::setSkipRendering(true);
/**
* @var $wikiaMobileStatsModel WikiaMobileStatsModel
*/
$wikiaMobileStatsModel = F::build('WikiaMobileStatsModel');
$ret = $wikiaMobileStatsModel->getRandomPopularPage();
$this->response->setVal('title', $this->wg->Out->getTitle());
$this->response->setVal('link', $ret[0]);
$this->response->setVal('img', $ret[1]);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:43,代码来源:WikiaMobileErrorService.class.php
示例19: getInterfaceObjectFromType
protected function getInterfaceObjectFromType($type)
{
wfProfileIn(__METHOD__);
$apiUrl = $this->getApiUrl();
if (empty($this->videoId)) {
throw new EmptyResponseException($apiUrl);
}
$memcKey = F::app()->wf->memcKey(static::$CACHE_KEY, $apiUrl, static::$CACHE_KEY_VERSION);
$processedResponse = F::app()->wg->memc->get($memcKey);
if (empty($processedResponse)) {
$req = MWHttpRequest::factory($apiUrl);
$req->setHeader('User-Agent', self::$REQUEST_USER_AGENT);
$status = $req->execute();
if ($status->isOK()) {
$response = $req->getContent();
$this->response = $response;
// Only for migration purposes
if (empty($response)) {
throw new EmptyResponseException($apiUrl);
} else {
if ($req->getStatus() == 301) {
throw new VideoNotFoundException($req->getStatus(), $this->videoId . ' Moved Permanently.', $apiUrl);
}
}
} else {
$this->checkForResponseErrors($req->status, $req->getContent(), $apiUrl);
}
$processedResponse = $this->processResponse($response, $type);
F::app()->wg->memc->set($memcKey, $processedResponse, static::$CACHE_EXPIRY);
}
wfProfileOut(__METHOD__);
return $processedResponse;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:GamestarApiWrapper.class.php
示例20: index
/**
* @brief Displays the main menu for the admin dashboard
*
*/
public function index()
{
$this->wg->Out->setPageTitle(wfMsg('admindashboard-title'));
if (!$this->wg->User->isAllowed('admindashboard')) {
$this->displayRestrictionError();
return false;
// skip rendering
}
$this->tab = $this->getVal('tab', 'general');
// links
$this->urlThemeDesigner = Title::newFromText('ThemeDesigner', NS_SPECIAL)->getFullURL();
$this->urlRecentChanges = Title::newFromText('RecentChanges', NS_SPECIAL)->getFullURL();
$this->urlTopNavigation = Title::newFromText('Wiki-navigation', NS_MEDIAWIKI)->getFullURL('action=edit');
$this->urlWikiFeatures = Title::newFromText('WikiFeatures', NS_SPECIAL)->getFullURL();
$this->urlPageLayoutBuilder = Title::newFromText('PageLayoutBuilder', NS_SPECIAL)->getFullURL('action=list');
$this->urlListUsers = Title::newFromText('ListUsers', NS_SPECIAL)->getFullURL();
$this->urlUserRights = Title::newFromText('UserRights', NS_SPECIAL)->getFullURL();
$this->urlCommunityCorner = Title::newFromText('Community-corner', NS_MEDIAWIKI)->getFullURL('action=edit');
$this->urlAllCategories = Title::newFromText('Categories', NS_SPECIAL)->getFullURL();
$this->urlAddPage = Title::newFromText('CreatePage', NS_SPECIAL)->getFullURL();
$this->urlAddPhoto = Title::newFromText('Upload', NS_SPECIAL)->getFullURL();
$this->urlCreateBlogPage = Title::newFromText('CreateBlogPage', NS_SPECIAL)->getFullURL();
$this->urlMultipleUpload = Title::newFromText('MultipleUpload', NS_SPECIAL)->getFullURL();
$this->urlGetPromoted = Title::newFromText('Promote', NS_SPECIAL)->getFullURL();
// special:specialpages
$this->advancedSection = (string) $this->app->sendRequest('AdminDashboardSpecialPage', 'getAdvancedSection', array());
// icon display logic
$this->displayPageLayoutBuilder = !empty($this->wg->EnablePageLayoutBuilder);
$this->displayWikiFeatures = !empty($this->wg->EnableWikiFeatures);
$this->displaySpecialPromote = !empty($this->wg->EnableSpecialPromoteExt);
// add messages package
F::build('JSMessages')->enqueuePackage('AdminDashboard', JSMessages::INLINE);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:37,代码来源:AdminDashboardSpecialPageController.class.php
注:本文中的F类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论