本文整理汇总了PHP中F类的典型用法代码示例。如果您正苦于以下问题:PHP F类的具体用法?PHP F怎么用?PHP F使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了F类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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';
}
示例2: init
/**
* Check if:
* controller - is first parameter
* method - is second parameter
* rest of parameters - are sorted
*
* @author Jakub Olek <jolek@wikia-inc.com>
*
* @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');
}
}
}
示例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,
// ));
}
示例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;
}
}
}
示例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;
}
示例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'));
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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]);
}
示例11: __construct
function __construct(User $user)
{
$app = F::App();
$this->user = $user;
$this->memc = $app->wg->Memc;
$this->namespaces = wfGetNamespaces();
}
示例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)));
}
示例13: __construct
public function __construct(WikiaApp $app = null)
{
if (is_null($app)) {
$app = F::app();
}
$this->app = $app;
}
示例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;
}
示例15: __construct
public function __construct()
{
parent::__construct();
//TODO: use Factory here
//$this->setProvider(F::build('MysqlWikiaHubsV2SliderModuleDataProvider'));
$this->setProvider(F::build('StaticWikiaHubsV2SliderModuleDataProvider'));
}