本文整理汇总了PHP中wfProfileOut函数的典型用法代码示例。如果您正苦于以下问题:PHP wfProfileOut函数的具体用法?PHP wfProfileOut怎么用?PHP wfProfileOut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfProfileOut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Finds search suggestions phrases for chosen query
*
* @requestParam string $query search term for suggestions
*
* @responseParam array $items The list of phrases matching the query
*
* @example &query=los
*/
public function getList()
{
wfProfileIn(__METHOD__);
if (!empty($this->wg->EnableLinkSuggestExt)) {
$query = trim($this->request->getVal(self::PARAMETER_QUERY, null));
if (empty($query)) {
throw new MissingParameterApiException(self::PARAMETER_QUERY);
}
$request = new WebRequest();
$request->setVal('format', 'array');
$linkSuggestions = LinkSuggest::getLinkSuggest($request);
if (!empty($linkSuggestions)) {
foreach ($linkSuggestions as $suggestion) {
$searchSuggestions[]['title'] = $suggestion;
}
$this->response->setVal('items', $searchSuggestions);
} else {
throw new NotFoundApiException();
}
$this->response->setCacheValidity(WikiaResponse::CACHE_STANDARD);
} else {
throw new NotFoundApiException('Link Suggest extension not available');
}
wfProfileOut(__METHOD__);
}
示例2: blurb
/**
* Returns information to summarize an article with a snippet of text and a picture if applicable.
*/
public function blurb()
{
wfProfileIn(__METHOD__);
$idStr = $this->request->getVal('ids');
$ids = explode(',', $idStr);
$summary = array();
# Iterate through each title per wiki ID
foreach ($ids as $id) {
$title = Title::newFromID($id);
if (empty($title)) {
$summary[$this->wg->CityId]['error'][] = "Unable to find title for ID {$id}";
break;
}
$service = new ArticleService($id);
$snippet = $service->getTextSnippet();
$imageServing = new ImageServing(array($id), 200, array('w' => 2, 'h' => 1));
$images = $imageServing->getImages(1);
// get just one image per article
$imageURL = '';
if (isset($images[$id])) {
$imageURL = $images[$id][0]['url'];
}
$summary[$id] = array('wiki' => $this->wg->Sitename, 'wikiUrl' => $this->wg->Server, 'titleDBkey' => $title->getPrefixedDBkey(), 'titleText' => $title->getFullText(), 'articleId' => $title->getArticleID(), 'imageUrl' => $imageURL, 'url' => $title->getFullURL(), 'snippet' => $snippet);
}
wfProfileOut(__METHOD__);
$this->summary = $summary;
}
示例3: getListTitles
/**
* Get list of Title objects representing existing boards
*
* @author Władysław Bodzek <wladek@wikia-inc.com>
*
* @return array List of board IDs
*/
public function getListTitles($db = DB_SLAVE, $namespace = NS_USER_WALL)
{
wfProfileIn(__METHOD__);
$titles = TitleBatch::newFromConds('page_wikia_props', array('page.page_namespace' => $namespace, 'page_wikia_props.page_id = page.page_id'), __METHOD__, array('ORDER BY' => 'page_title'), $db);
wfProfileOut(__METHOD__);
return $titles;
}
示例4: filterImages
protected function filterImages($imagesList = array())
{
wfProfileIn(__METHOD__);
# get image names from imagelinks table
$imagesName = array_keys($imagesList);
if (!empty($imagesName)) {
foreach ($imagesName as $img_name) {
$result = $this->db->select(array('imagelinks'), array('il_from'), array('il_to' => $img_name), __METHOD__, array('LIMIT' => $this->maxCount + 1));
#something goes wrong
if (empty($result)) {
continue;
}
# skip images which are too popular
if ($result->numRows() > $this->maxCount) {
continue;
}
# check image table
$oRowImg = $this->db->selectRow(array('image'), array('img_name', 'img_height', 'img_width', 'img_minor_mime'), array('img_name' => $img_name), __METHOD__);
if (empty($oRowImg)) {
continue;
}
if ($oRowImg->img_height > $this->minSize && $oRowImg->img_width > $this->minSize) {
if (!in_array($oRowImg->img_minor_mime, array("svg+xml", "svg"))) {
$this->addToFiltredList($oRowImg->img_name, $result->numRows(), $oRowImg->img_width, $oRowImg->img_height, $oRowImg->img_minor_mime);
}
}
}
}
wfProfileOut(__METHOD__);
}
示例5: view
/**
* Render Quiz namespace page
*/
public function view()
{
global $wgOut, $wgUser, $wgTitle, $wgRequest;
wfProfileIn(__METHOD__);
// let MW handle basic stuff
parent::view();
// don't override history pages
$action = $wgRequest->getVal('action');
if (in_array($action, array('history', 'historysubmit'))) {
wfProfileOut(__METHOD__);
return;
}
// quiz doesn't exist
if (!$wgTitle->exists() || empty($this->mQuiz)) {
wfProfileOut(__METHOD__);
return;
}
// set page title
$title = $this->mQuiz->getTitle();
$wgOut->setPageTitle($title);
// add CSS/JS
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
// render quiz page
$wgOut->clearHTML();
$wgOut->addHTML($this->mQuiz->render());
wfProfileOut(__METHOD__);
}
示例6: processHit
/**
* Records a hit and enforces rate limits unless that is explicitly disabled in the call (see 'enforceRateLimits' param).
*
* @param apiKey - string - the API key of the app that made the request we are now logging
* @param method - string - the method-name that was called in this request (should include class-name if appropriate - eg: 'MyClass::myMethod').
* @param timestamp - int - number of seconds since the unix epoch at the time that this hit was made.
* @param params - array - array of key-value pairs of the parameters that were passed into the method
* @param enforceRateLimits - boolean - optional (default:true) - if true, then this function will check rate-limits after logging, and ban the apiKey if
* it has surpassed any of its rate-limits.
*/
public function processHit($apiKey, $method, $timestamp, $params, $enforceRateLimits = true)
{
wfProfileIn(__METHOD__);
// TODO: IMPLEMENT
// TODO: IMPLEMENT
wfProfileOut(__METHOD__);
}
示例7: performAction
function performAction()
{
global $wgAjaxExportList, $wgOut;
if (empty($this->mode)) {
return;
}
wfProfileIn('AjaxDispatcher::performAction');
if (!in_array($this->func_name, $wgAjaxExportList)) {
header('Status: 400 Bad Request', true, 400);
print "unknown function " . htmlspecialchars((string) $this->func_name);
} else {
try {
$result = call_user_func_array($this->func_name, $this->args);
if ($result === false || $result === NULL) {
header('Status: 500 Internal Error', true, 500);
echo "{$this->func_name} returned no data";
} else {
if (is_string($result)) {
$result = new AjaxResponse($result);
}
$result->sendHeaders();
$result->printText();
}
} catch (Exception $e) {
if (!headers_sent()) {
header('Status: 500 Internal Error', true, 500);
print $e->getMessage();
} else {
print $e->getMessage();
}
}
}
wfProfileOut('AjaxDispatcher::performAction');
$wgOut = null;
}
示例8: onSubmit
public function onSubmit($data)
{
wfProfileIn(__METHOD__);
self::doWatch($this->getTitle(), $this->getUser());
wfProfileOut(__METHOD__);
return true;
}
示例9: run
/**
* Run a pageSchemasCreatePage job
* @return boolean success
*/
function run() {
wfProfileIn( __METHOD__ );
if ( is_null( $this->title ) ) {
$this->error = "pageSchemasCreatePage: Invalid title";
wfProfileOut( __METHOD__ );
return false;
}
$article = new Article( $this->title );
if ( !$article ) {
$this->error = 'pageSchemasCreatePage: Article not found "' . $this->title->getPrefixedDBkey() . '"';
wfProfileOut( __METHOD__ );
return false;
}
$page_text = $this->params['page_text'];
// change global $wgUser variable to the one
// specified by the job only for the extent of this
// replacement
global $wgUser;
$actual_user = $wgUser;
$wgUser = User::newFromId( $this->params['user_id'] );
$edit_summary = wfMsgForContent( 'ps-generatepages-editsummary' );
$article->doEdit( $page_text, $edit_summary );
$wgUser = $actual_user;
wfProfileOut( __METHOD__ );
return true;
}
示例10: execute
function execute($par)
{
wfProfileIn(__METHOD__);
global $wgOut, $wgExtensionsPath, $wgResourceBasePath, $wgJsMimeType, $wgUser;
// set basic headers
$this->setHeaders();
if (wfReadOnly()) {
$wgOut->readOnlyPage();
wfProfileOut(__METHOD__);
return;
}
if (!$this->userCanExecute($wgUser)) {
$this->displayRestrictionError();
wfProfileOut(__METHOD__);
return;
}
// include resources (css and js)
$wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/AchievementsII/css/platinum.css\n");
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/AchievementsII/css/oasis.scss'));
$wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/AchievementsII/js/platinum.js\"></script>\n");
$wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/aim/jquery.aim.js\"></script>\n");
// call service to get needed data
$badges = AchPlatinumService::getList();
// pass data to template
$template = new EasyTemplate(dirname(__FILE__) . '/templates');
$template->set_vars(array('badges' => $badges));
// render template
$wgOut->addHTML($template->render('SpecialPlatinum'));
wfProfileOut(__METHOD__);
}
示例11: getWikiaFooterLinks
/**
* @author Inez Korczynski <inez@wikia.com>
*/
private function getWikiaFooterLinks() {
wfProfileIn( __METHOD__ );
global $wgCityId;
$catId = WikiFactoryHub::getInstance()->getCategoryId( $wgCityId );
$message_key = 'shared-Oasis-footer-wikia-links';
$nodes = array();
if ( !isset( $catId ) || null == ( $lines = getMessageAsArray( $message_key . '-' . $catId ) ) ) {
if ( null == ( $lines = getMessageAsArray( $message_key ) ) ) {
wfProfileOut( __METHOD__ );
return $nodes;
}
}
foreach( $lines as $line ) {
$depth = strrpos( $line, '*' );
if( $depth === 0 ) {
$nodes[] = parseItem( $line );
}
}
wfProfileOut( __METHOD__ );
return $nodes;
}
示例12: execute
function execute($par)
{
global $wgOut, $wgRequest, $wgUser, $wgFBAppId, $wgFBAppSecret, $wgLanguageCode, $IP;
wfProfileIn(__METHOD__);
$wgOut->setRobotpolicy('noindex,nofollow');
if ($wgUser->getId() == 0) {
$wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
return;
}
require_once "{$IP}/extensions/wikihow/common/facebook-platform/facebook-php-sdk-771862b/src/facebook.php";
$this->facebook = new Facebook(array('appId' => $wgFBAppId, 'secret' => $wgFBAppSecret));
$accessToken = $wgRequest->getVal('token', null);
$this->facebook->setAccessToken($accessToken);
$action = $wgRequest->getVal('a', '');
switch ($action) {
case 'confirm':
$this->showConfirmation();
break;
case 'link':
$this->linkAccounts();
break;
}
wfProfileOut(__METHOD__);
return;
}
示例13: getList
/**
* Get RelatedPages for a given article ID
*
* @requestParam array $id Id of an article to fetch related pages for
* @requestParam integer $limit [OPTIONAL] Limit the number of related pages to return default: 3
*
* @responseParam object $items List of articles with related pages
* @responseParam array $basepath domain of a wiki to create a url for an article
*
* @example &ids=2087
* @example &ids=2087,3090
* @example &ids=2087&limit=5
*/
function getList()
{
wfProfileIn(__METHOD__);
if (!empty($this->wg->EnableRelatedPagesExt) && empty($this->wg->EnableAnswers)) {
$ids = $this->request->getArray(self::PARAMETER_ARTICLE_IDS, null);
$limit = $this->request->getInt(self::PARAMETER_LIMIT, 3);
$related = [];
if (is_array($ids)) {
$relatedPages = RelatedPages::getInstance();
foreach ($ids as $id) {
if (is_numeric($id)) {
$related[$id] = $relatedPages->get($id, $limit);
} else {
throw new InvalidParameterApiException(self::PARAMETER_ARTICLE_IDS);
}
$relatedPages->reset();
}
} else {
wfProfileOut(__METHOD__);
throw new MissingParameterApiException('ids');
}
$this->setResponseData(['items' => $related, 'basepath' => $this->wg->Server], ['imgFields' => 'imgUrl', 'urlFields' => ['imgUrl', 'url']], WikiaResponse::CACHE_SHORT);
wfProfileOut(__METHOD__);
} else {
wfProfileOut(__METHOD__);
throw new NotFoundApiException('Related Pages extension not available');
}
}
示例14: efConfigureSetup
/**
* Initalize the settings stored in a serialized file.
* This have to be done before the end of LocalSettings.php but is in a function
* because administrators might configure some settings between the moment where
* the file is loaded and the execution of these function.
* Settings are not filled only if they doesn't exists because of a security
* hole if the register_globals feature of PHP is enabled.
*
* @param $wiki String
*/
function efConfigureSetup($wiki = 'default')
{
global $wgConf, $wgConfigureFilesPath, $wgConfigureExtDir, $wgConfigureHandler, $wgConfigureAllowDeferSetup;
wfProfileIn(__FUNCTION__);
# Create the new configuration object...
$oldConf = $wgConf;
require_once dirname(__FILE__) . '/Configure.obj.php';
$wgConf = new WebConfiguration($wiki, $wgConfigureFilesPath);
# Copy the existing settings...
$wgConf->suffixes = $oldConf->suffixes;
$wgConf->wikis = $oldConf->wikis;
$wgConf->settings = $oldConf->settings;
$wgConf->localVHosts = $oldConf->localVHosts;
$wgConf->siteParamsCallback = $oldConf->siteParamsCallback;
$wgConf->snapshotDefaults();
if ($wgConfigureAllowDeferSetup && $wgConfigureHandler == 'db') {
// Defer to after caches and database are set up.
global $wgExtensionFunctions;
$wgExtensionFunctions[] = 'efConfigureInitialise';
} else {
efConfigureInitialise();
}
# Cleanup $wgConfigureExtDir as needed
if (substr($wgConfigureExtDir, -1) != '/' && substr($wgConfigureExtDir, -1) != '\\') {
$wgConfigureExtDir .= '/';
}
wfProfileOut(__FUNCTION__);
}
示例15: index
public function index()
{
wfProfileIn(__METHOD__);
$socialSharingService = SocialSharingService::getInstance();
$this->setVal('networks', $socialSharingService->getNetworks(array('facebook', 'twitter', 'plusone', 'email')));
wfProfileOut(__METHOD__);
}