当前位置: 首页>>代码示例>>PHP>>正文


PHP Source::getPageText方法代码示例

本文整理汇总了PHP中Source::getPageText方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::getPageText方法的具体用法?PHP Source::getPageText怎么用?PHP Source::getPageText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Source的用法示例。


在下文中一共展示了Source::getPageText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfAddPage

/**
 * Create family tree page
 *
 * This is also called by search.js
 *
 * @param unknown_type $args
 * @return GE_SUCCESS, GE_INVALID_ARG, GE_NOT_LOGGED_IN, GE_NOT_AUTHORIZED, GE_NOT_FOUND, GE_DUP_KEY, GE_DB_ERROR
 */
function wfAddPage($args)
{
    global $wgUser, $wgAjaxCachePolicy, $wgArticle, $wgTitle, $wgLang;
    // set cache policy
    $wgAjaxCachePolicy->setPolicy(0);
    $status = GE_SUCCESS;
    $title = null;
    $titleString = null;
    $error = '';
    $args = AjaxUtil::getArgs($args);
    $ns = $wgLang->getNsIndex($args['ns']);
    $titleString = @$args['title'];
    $update = $args['update'] == 'true';
    if (!$wgUser->isLoggedIn()) {
        $status = GE_NOT_LOGGED_IN;
    } else {
        if ($wgUser->isBlocked() || wfReadOnly()) {
            $status = GE_NOT_AUTHORIZED;
        }
    }
    if ($status == GE_SUCCESS) {
        $dbw =& wfGetDB(DB_MASTER);
        $dbw->ignoreErrors(true);
        $dbw->begin();
        $text = '';
        if ($titleString) {
            // user passed in existing title; just add to watchlist and trees
            $title = Title::newFromText($titleString, $ns);
        } else {
            if ($ns == NS_PERSON) {
                if (ESINHandler::isLivingDates($args['bd'], null, $args['dd'], $args['dp'])) {
                    $error = 'Living people cannot be added to WeRelate. People born in the last 110 years must have a death date';
                } else {
                    if (ESINHandler::isAmbiguousDate($args['bd']) || ESINHandler::isAmbiguousDate($args['dd'])) {
                        $error = "Please write dates in D MMM YYYY format so they are unambiguous (ie 5 Jan 1900)";
                    } else {
                        if (!$title) {
                            $title = StructuredData::constructPersonTitle($args['g'], $args['s']);
                        }
                        if ($title) {
                            if ($args['bt'] == 'chr') {
                                $bird = '';
                                $birp = '';
                                $chrd = $args['bd'];
                                $chrp = $args['bp'];
                            } else {
                                $bird = $args['bd'];
                                $birp = $args['bp'];
                                $chrd = '';
                                $chrp = '';
                            }
                            if ($args['dt'] == 'bur') {
                                $dead = '';
                                $deap = '';
                                $burd = $args['dd'];
                                $burp = $args['dp'];
                            } else {
                                $dead = $args['dd'];
                                $deap = $args['dp'];
                                $burd = '';
                                $burp = '';
                            }
                            $text = Person::getPageText($args['g'], $args['s'], $args['gnd'], $bird, $birp, $dead, $deap, $title->getText(), null, @$args['pf'], @$args['sf'], $chrd, $chrp, $burd, $burp);
                        }
                    }
                }
            } else {
                if ($ns == NS_FAMILY) {
                    if (ESINHandler::isAmbiguousDate($args['md'])) {
                        $error = "Please write dates in D MMM YYYY format so they are unambiguous (ie 5 Jan 1900)";
                    } else {
                        $title = StructuredData::constructFamilyTitle($args['hg'], $args['hs'], $args['wg'], $args['ws']);
                        if ($title) {
                            $text = Family::getPageText($args['md'], $args['mp'], $title->getText(), null, @$args['ht'], @$args['wt'], @$args['ct']);
                        }
                    }
                } else {
                    if ($ns == NS_SOURCE) {
                        $title = StructuredData::constructSourceTitle($args['sty'], $args['st'], $args['a'], $args['p'], $args['pi'], $args['pu']);
                        if ($title) {
                            $text = Source::getPageText($args['sty'], $args['st'], $args['a'], $args['p'], $args['pi'], $args['pu']);
                        } else {
                            $error = 'Required source fields are missing; please press the Back button on your browser to enter the required fields.';
                        }
                    } else {
                        if ($ns == NS_MYSOURCE) {
                            $t = $args['t'];
                            if (mb_strpos($t, $wgUser->getName() . '/') != 0) {
                                $t = $wgUser->getName() . '/' . $t;
                            }
                            $title = Title::newFromText($t, NS_MYSOURCE);
                            if ($title) {
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:GedcomAjaxFunctions.php

示例2: toEditFields

 /**
  * Create edit fields from xml property
  */
 protected function toEditFields(&$textbox1)
 {
     global $wgOut, $wgScriptPath, $wgRequest;
     $result = '';
     $target = $wgRequest->getVal('target');
     // add javascript functions
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>");
     //      if ($target && $target != 'AddPage') {
     //         $result .= "<p><font color=red>Add any additional information you have about the source".
     //                     ($target == 'gedcom' ? ' and save the page' : ', save the page, then close this window').
     //                    ".</font></p>";
     //      }
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/jquery.multiSelect.yui.1.js\"></script>");
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/source.18.js\"></script>");
     $tm = new TipManager();
     $sourceType = '';
     $authors = '';
     $sourceTitle = '';
     $subtitle = '';
     $publisher = '';
     $dateIssued = '';
     $placeIssued = '';
     $seriesName = '';
     $pages = '';
     $references = '';
     $surnames = '';
     $places = '';
     $subjects = array();
     $ethnicity = '';
     $religion = '';
     $occupation = '';
     $fromYear = '';
     $toYear = '';
     $invalidStyle = ' style="background-color:#fdd;"';
     $fromYearStyle = '';
     $toYearStyle = '';
     $exists = isset($this->xml);
     if (!$exists) {
         // construct <source> text from request
         $text = Source::getPageText($wgRequest->getVal('sty'), $wgRequest->getVal('st'), $wgRequest->getVal('a'), $wgRequest->getVal('p'), $wgRequest->getVal('pi'), $wgRequest->getVal('pu'));
         $this->xml = StructuredData::getXml('source', $text);
     }
     if (isset($this->xml)) {
         $sourceType = htmlspecialchars((string) $this->xml->source_type);
         foreach ($this->xml->author as $author) {
             $authors .= htmlspecialchars((string) $author) . "\n";
         }
         $sourceTitle = htmlspecialchars((string) $this->xml->source_title);
         if (!$sourceTitle) {
             $sourceTitle = htmlspecialchars($this->titleString);
         }
         $subtitle = htmlspecialchars((string) $this->xml->subtitle);
         $publisher = htmlspecialchars((string) $this->xml->publisher);
         if (!$publisher) {
             $publisher = htmlspecialchars((string) $this->xml->publication_info);
         }
         $dateIssued = htmlspecialchars((string) $this->xml->date_issued);
         $placeIssued = htmlspecialchars((string) $this->xml->place_issued);
         $seriesName = htmlspecialchars((string) $this->xml->series_name);
         $volumes = htmlspecialchars((string) $this->xml->volumes);
         $pages = htmlspecialchars((string) $this->xml->pages);
         $references = htmlspecialchars((string) $this->xml->references);
         foreach ($this->xml->surname as $surname) {
             $surnames .= htmlspecialchars((string) $surname) . "\n";
         }
         foreach ($this->xml->place as $place) {
             $places .= htmlspecialchars((string) $place) . "\n";
         }
         foreach ($this->xml->subject as $subject) {
             $subjects[] = htmlspecialchars((string) $subject);
         }
         if (count($subjects) == 0 && (string) $this->xml->source_category) {
             $subjects[] = htmlspecialchars((string) $this->xml->source_category);
         }
         $ethnicity = htmlspecialchars((string) $this->xml->ethnicity);
         $religion = htmlspecialchars((string) $this->xml->religion);
         $occupation = htmlspecialchars((string) $this->xml->occupation);
         $fromYear = htmlspecialchars((string) $this->xml->from_year);
         $toYear = htmlspecialchars((string) $this->xml->to_year);
         $url = htmlspecialchars((string) $this->xml->url);
         // old
         $callNumber = htmlspecialchars((string) $this->xml->call_number);
         // old
         $repoName = htmlspecialchars((string) $this->xml->repository_name);
         // old
         $repoAddr = htmlspecialchars((string) $this->xml->repository_addr);
         // old
     }
     $missingAvailability = false;
     if (isset($this->xml)) {
         foreach ($this->xml->repository as $repository) {
             // the source_location condition is temporary
             if (!(string) $repository['availability'] && stripos((string) $repository['source_location'], 'www.familysearch.org/Eng/Library/fhlcatalog') === false) {
                 $missingAvailability = true;
             }
         }
         if ($url && stripos($url, 'www.familysearch.org/Eng/Library/fhlcatalog') === false) {
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:Source.php


注:本文中的Source::getPageText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。