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


PHP WT_Filter::get方法代码示例

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


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

示例1: getOptions

 function getOptions()
 {
     parent::getOptions();
     $this->search = WT_Filter::get('search');
     $this->replace = WT_Filter::get('replace');
     $this->method = WT_Filter::get('method', 'exact|words|wildcards|regex', 'exact');
     $this->case = WT_Filter::get('case', 'i');
     $this->error = '';
     switch ($this->method) {
         case 'exact':
             $this->regex = preg_quote($this->search, '/');
             break;
         case 'words':
             $this->regex = '\\b' . preg_quote($this->search, '/') . '\\b';
             break;
         case 'wildcards':
             $this->regex = '\\b' . str_replace(array('\\*', '\\?'), array('.*', '.'), preg_quote($this->search, '/')) . '\\b';
             break;
         case 'regex':
             $this->regex = $this->search;
             // Check for invalid regexes
             // If the regex is bad, $ct will be left at -1
             $ct = -1;
             $ct = @preg_match('/' . $this->search . '/', '');
             if ($ct == -1) {
                 $this->error = '<br><span class="error">' . WT_I18N::translate('The regex appears to contain an error.  It can’t be used.') . '</span>';
             }
             break;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:30,代码来源:search_replace.php

示例2: ajaxRequest

 public function ajaxRequest()
 {
     global $SEARCH_SPIDER;
     // Search engines should not make AJAX requests
     if ($SEARCH_SPIDER) {
         header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
         exit;
     }
     // Initialise tabs
     $tab = WT_Filter::get('module');
     // A request for a non-existant tab?
     if (array_key_exists($tab, $this->tabs)) {
         $mod = $this->tabs[$tab];
     } else {
         header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
         exit;
     }
     header("Content-Type: text/html; charset=UTF-8");
     // AJAX calls do not have the meta tag headers and need this set
     header("X-Robots-Tag: noindex,follow");
     // AJAX pages should not show up in search results, any links can be followed though
     Zend_Session::writeClose();
     echo $mod->getTabContent();
     if (WT_DEBUG_SQL) {
         echo WT_DB::getQueryLog();
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:27,代码来源:Individual.php

示例3: getBlock

 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     switch (WT_Filter::get('action')) {
         case 'deletenews':
             $news_id = WT_Filter::getInteger('news_id');
             if ($news_id) {
                 deleteNews($news_id);
             }
             break;
     }
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $usernews = getUserNews(WT_USER_ID);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = '';
     $title .= $this->getTitle();
     $content = '';
     if (count($usernews) == 0) {
         $content .= WT_I18N::translate('You have not created any journal items.');
     }
     foreach ($usernews as $key => $news) {
         $day = date('j', $news['date']);
         $mon = date('M', $news['date']);
         $year = date('Y', $news['date']);
         $content .= "<div class=\"journal_box\">";
         $content .= "<div class=\"news_title\">" . $news['title'] . '</div>';
         $content .= "<div class=\"news_date\">" . format_timestamp($news['date']) . '</div>';
         if ($news["text"] == strip_tags($news["text"])) {
             // No HTML?
             $news["text"] = nl2br($news["text"], false);
         }
         $content .= $news["text"] . "<br><br>";
         $content .= "<a href=\"#\" onclick=\"window.open('editnews.php?news_id='+" . $key . ", '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Edit') . "</a> | ";
         $content .= "<a href=\"index.php?action=deletenews&amp;news_id={$key}&amp;ctype={$ctype}\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . "</a><br>";
         $content .= "</div><br>";
     }
     if (WT_USER_ID) {
         $content .= "<br><a href=\"#\" onclick=\"window.open('editnews.php?user_id='+WT_USER_ID, '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Add a new journal entry') . "</a>";
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:57,代码来源:module.php

示例4: __construct

 public function __construct()
 {
     global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight;
     $bwidth = $Dbwidth;
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $xref = WT_Filter::get('famid', WT_REGEX_XREF);
     $this->record = WT_Family::getInstance($xref);
     parent::__construct();
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:10,代码来源:Family.php

示例5: modAction

 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin':
             $this->admin();
             break;
         case 'generate':
             Zend_Session::writeClose();
             $this->generate(WT_Filter::get('file'));
             break;
         default:
             header('HTTP/1.0 404 Not Found');
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:14,代码来源:module.php

示例6: __construct

 function __construct($rootid = '', $show_full = 1)
 {
     global $bheight, $bwidth, $cbwidth, $cbheight, $bhalfheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS;
     global $TEXT_DIRECTION, $show_full;
     parent::__construct();
     // Extract parameters from from
     $this->pid = WT_Filter::get('rootid', WT_REGEX_XREF);
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1, 0);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     if (!empty($rootid)) {
         $this->pid = $rootid;
     }
     //-- flip the arrows for RTL languages
     if ($TEXT_DIRECTION == 'ltr') {
         $this->left_arrow = 'icon-larrow';
         $this->right_arrow = 'icon-rarrow';
     } else {
         $this->left_arrow = 'icon-larrow';
         $this->right_arrow = 'icon-larrow';
     }
     // -- size of the detailed boxes based upon optional width parameter
     $Dbwidth = $this->box_width * $bwidth / 100;
     $Dbheight = $this->box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $this->box_width * $cbwidth / 100;
         $bheight = $cbheight;
     }
     $bhalfheight = (int) ($bheight / 2);
     // Validate parameters
     $this->hourPerson = WT_Individual::getInstance($this->pid);
     if (!$this->hourPerson) {
         $this->hourPerson = $this->getSignificantIndividual();
         $this->pid = $this->hourPerson->getXref();
     }
     $this->name = $this->hourPerson->getFullName();
     //Checks how many generations of descendency is for the person for formatting purposes
     $this->dgenerations = $this->max_descendency_generations($this->pid, 0);
     if ($this->dgenerations < 1) {
         $this->dgenerations = 1;
     }
     $this->setPageTitle(WT_I18N::translate('Hourglass chart of %s', $this->name));
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:49,代码来源:Hourglass.php

示例7: getSidebarAjaxContent

 public function getSidebarAjaxContent()
 {
     $alpha = WT_Filter::get('alpha');
     // All surnames beginning with this letter where "@"=unknown and ","=none
     $surname = WT_Filter::get('surname');
     // All indis with this surname.
     $search = WT_Filter::get('search');
     if ($search) {
         return $this->search($search);
     } elseif ($alpha == '@' || $alpha == ',' || $surname) {
         return $this->getSurnameIndis($alpha, $surname);
     } elseif ($alpha) {
         return $this->getAlphaSurnames($alpha, $surname);
     } else {
         return '';
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:17,代码来源:module.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->surname = WT_Filter::get('surname');
     $this->soundex_std = WT_Filter::getBool('soundex_std');
     $this->soundex_dm = WT_Filter::getBool('soundex_dm');
     if ($this->surname) {
         $this->setPageTitle(WT_I18N::translate('Branches of the %s family', WT_Filter::escapeHtml($this->surname)));
         $this->loadIndividuals();
         $self = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
         if ($self) {
             $this->loadAncestors(WT_Individual::getInstance(WT_USER_GEDCOM_ID), 1);
         }
     } else {
         $this->setPageTitle(WT_I18N::translate('Branches'));
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:17,代码来源:Branches.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     $this->rootid = WT_Filter::get('rootid', WT_REGEX_XREF);
     if ($this->rootid) {
         $this->root = WT_Individual::getInstance($this->rootid);
     } else {
         // Missing rootid parameter?  Do something.
         $this->root = $this->getSignificantIndividual();
         $this->rootid = $this->root->getXref();
     }
     if (!$this->root || !$this->root->canShowName()) {
         header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
         $this->error_message = WT_I18N::translate('This individual does not exist or you do not have permission to view it.');
         $this->rootid = null;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:17,代码来源:Chart.php

示例10: rawurlencode

    $show_all = 'no';
    $legend = $UNKNOWN_NN;
    $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&amp;ged=' . WT_GEDURL;
    $show = 'indi';
    // SURN list makes no sense here
} elseif ($alpha == ',') {
    $show_all = 'no';
    $legend = WT_I18N::translate('None');
    $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&amp;ged=' . WT_GEDURL;
    $show = 'indi';
    // SURN list makes no sense here
} elseif ($alpha) {
    $show_all = 'no';
    $legend = WT_Filter::escapeHtml($alpha) . '…';
    $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&amp;ged=' . WT_GEDURL;
    $show = WT_Filter::get('show', 'surn|indi', 'surn');
} else {
    $show_all = 'no';
    $legend = '…';
    $url = WT_SCRIPT_NAME . '?ged=' . WT_GEDURL;
    $show = 'none';
    // Don't show lists until something is chosen
}
$legend = '<span dir="auto">' . $legend . '</span>';
$controller->setPageTitle(WT_I18N::translate('Families') . ' : ' . $legend)->pageHeader();
echo '<h2 class="center">', WT_I18N::translate('Families'), '</h2>';
// Print a selection list of initial letters
$list = array();
foreach (WT_Query_Name::surnameAlpha($show_marnm, true, WT_GED_ID) as $letter => $count) {
    switch ($letter) {
        case '@':
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:famlist.php

示例11: define

//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
define('WT_SCRIPT_NAME', 'reportengine.php');
require './includes/session.php';
require WT_ROOT . 'includes/functions/functions_rtl.php';
$controller = new WT_Controller_Page();
$famid = WT_Filter::get('famid', WT_REGEX_XREF);
$pid = WT_Filter::get('pid', WT_REGEX_XREF);
$action = WT_Filter::get('action', 'choose|setup|run', 'choose');
$report = WT_Filter::get('report');
$output = WT_Filter::get('output', 'HTML|PDF', 'PDF');
$vars = WT_Filter::get('vars');
$varnames = WT_Filter::get('varnames');
$type = WT_Filter::get('type');
if (!is_array($vars)) {
    $vars = array();
}
if (!is_array($varnames)) {
    $varnames = array();
}
if (!is_array($type)) {
    $type = array();
}
/**
 * function to get the values for the given tag
 */
function get_tag_values($tag)
{
    global $tags, $values;
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:reportengine.php

示例12: __construct

 function __construct()
 {
     parent::__construct();
     $this->setPageTitle(WT_I18N::translate('Timeline'));
     $this->baseyear = date("Y");
     // new pid
     $newpid = WT_Filter::get('newpid', WT_REGEX_XREF);
     // pids array
     $this->pids = WT_Filter::getArray('pids', WT_REGEX_XREF);
     // make sure that arrays are indexed by numbers
     $this->pids = array_values($this->pids);
     if (!empty($newpid) && !in_array($newpid, $this->pids)) {
         $this->pids[] = $newpid;
     }
     if (count($this->pids) == 0) {
         $this->pids[] = $this->getSignificantIndividual()->getXref();
     }
     $remove = WT_Filter::get('remove', WT_REGEX_XREF);
     // cleanup user input
     $newpids = array();
     foreach ($this->pids as $value) {
         if ($value != $remove) {
             $newpids[] = $value;
             $person = WT_Individual::getInstance($value);
             if ($person) {
                 $this->people[] = $person;
             }
         }
     }
     $this->pids = $newpids;
     $this->pidlinks = "";
     /* @var $indi Person */
     foreach ($this->people as $p => $indi) {
         if (!is_null($indi) && $indi->canShow()) {
             // setup string of valid pids for links
             $this->pidlinks .= "pids%5B%5D=" . $indi->getXref() . "&amp;";
             $bdate = $indi->getBirthDate();
             if ($bdate->isOK()) {
                 $date = $bdate->MinDate();
                 $date = $date->convert_to_cal('gregorian');
                 if ($date->y) {
                     $this->birthyears[$indi->getXref()] = $date->y;
                     $this->birthmonths[$indi->getXref()] = max(1, $date->m);
                     $this->birthdays[$indi->getXref()] = max(1, $date->d);
                 }
             }
             // find all the fact information
             $facts = $indi->getFacts();
             foreach ($indi->getSpouseFamilies() as $family) {
                 foreach ($family->getFacts() as $fact) {
                     $fact->spouse = $family->getSpouse($indi);
                     $facts[] = $fact;
                 }
             }
             foreach ($facts as $event) {
                 // get the fact type
                 $fact = $event->getTag();
                 if (!in_array($fact, $this->nonfacts)) {
                     // check for a date
                     $date = $event->getDate();
                     $date = $date->MinDate();
                     $date = $date->convert_to_cal('gregorian');
                     if ($date->y) {
                         $this->baseyear = min($this->baseyear, $date->y);
                         $this->topyear = max($this->topyear, $date->y);
                         if (!$indi->isDead()) {
                             $this->topyear = max($this->topyear, date('Y'));
                         }
                         $event->temp = $p;
                         // do not add the same fact twice (prevents marriages from being added multiple times)
                         // TODO - this code does not work.  If both spouses are shown, their marriage is duplicated...
                         if (!in_array($event, $this->indifacts, true)) {
                             $this->indifacts[] = $event;
                         }
                     }
                 }
             }
         }
     }
     $scale = WT_Filter::getInteger('scale', 0, 200);
     if ($scale == 0) {
         $this->scale = round(($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4);
         if ($this->scale < 6) {
             $this->scale = 6;
         }
     } else {
         $this->scale = $scale;
     }
     if ($this->scale < 2) {
         $this->scale = 2;
     }
     $this->baseyear -= 5;
     $this->topyear += 5;
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:94,代码来源:Timeline.php

示例13: __construct

 public function __construct()
 {
     $xref = WT_Filter::get('rid', WT_REGEX_XREF);
     $this->record = WT_Repository::getInstance($xref);
     parent::__construct();
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:6,代码来源:Repository.php

示例14: define

// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_trees_renumber.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Renumber family tree'))->pageHeader();
// Every XREF used by this tree and also used by some other tree
$xrefs = WT_DB::prepare("SELECT xref, type FROM (" . " SELECT i_id AS xref, 'INDI' AS type FROM `##individuals` WHERE i_file = ?" . "  UNION " . " SELECT f_id AS xref, 'FAM' AS type FROM `##families` WHERE f_file = ?" . "  UNION " . " SELECT s_id AS xref, 'SOUR' AS type FROM `##sources` WHERE s_file = ?" . "  UNION " . " SELECT m_id AS xref, 'OBJE' AS type FROM `##media` WHERE m_file = ?" . "  UNION " . " SELECT o_id AS xref, o_type AS type FROM `##other` WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS this_tree JOIN (" . " SELECT xref FROM `##change` WHERE gedcom_id <> ?" . "  UNION " . " SELECT i_id AS xref FROM `##individuals` WHERE i_file <> ?" . "  UNION " . " SELECT f_id AS xref FROM `##families` WHERE f_file <> ?" . "  UNION " . " SELECT s_id AS xref FROM `##sources` WHERE s_file <> ?" . "  UNION " . " SELECT m_id AS xref FROM `##media` WHERE m_file <> ?" . "  UNION " . " SELECT o_id AS xref FROM `##other` WHERE o_file <> ? AND o_type NOT IN ('HEAD', 'TRLR')" . ") AS other_trees USING (xref)")->execute(array(WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID, WT_GED_ID))->fetchAssoc();
echo '<h2>', $controller->getPageTitle(), ' — ', $WT_TREE->tree_title_html, '</h2>';
if (WT_Filter::get('go')) {
    foreach ($xrefs as $old_xref => $type) {
        WT_DB::exec("START TRANSACTION");
        WT_DB::exec("LOCK TABLE `##individuals` WRITE," . " `##families` WRITE," . " `##sources` WRITE," . " `##media` WRITE," . " `##other` WRITE," . " `##name` WRITE," . " `##placelinks` WRITE," . " `##change` WRITE," . " `##next_id` WRITE," . " `##dates` WRITE," . " `##default_resn` WRITE," . " `##hit_counter` WRITE," . " `##link` WRITE," . " `##user_gedcom_setting` WRITE");
        $new_xref = get_new_xref($type);
        switch ($type) {
            case 'INDI':
                WT_DB::prepare("UPDATE `##individuals` SET i_id = ?, i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_id = ? AND i_file = ?")->execute(array($new_xref, "0 @{$old_xref}@ INDI\n", "0 @{$new_xref}@ INDI\n", $old_xref, WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'HUSB') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " HUSB @{$old_xref}@", " HUSB @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'WIFE') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " WIFE @{$old_xref}@", " WIFE @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'CHIL') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " CHIL @{$old_xref}@", " CHIL @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = 'ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##families` JOIN `##link` ON (l_file = f_file AND l_to = ? AND l_type = '_ASSO') SET f_gedcom = REPLACE(f_gedcom, ?, ?) WHERE f_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = 'ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " ASSO @{$old_xref}@", " ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##individuals` JOIN `##link` ON (l_file = i_file AND l_to = ? AND l_type = '_ASSO') SET i_gedcom = REPLACE(i_gedcom, ?, ?) WHERE i_file = ?")->execute(array($old_xref, " _ASSO @{$old_xref}@", " _ASSO @{$new_xref}@", WT_GED_ID));
                WT_DB::prepare("UPDATE `##placelinks` SET pl_gid = ? WHERE pl_gid = ? AND pl_file = ?")->execute(array($new_xref, $old_xref, WT_GED_ID));
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_trees_renumber.php

示例15: __construct

 function __construct()
 {
     global $WT_SESSION;
     parent::__construct();
     $this->setPageTitle(WT_I18N::translate('Lifespans'));
     $this->colorindex = 0;
     $this->Fcolorindex = 0;
     $this->Mcolorindex = 0;
     $this->zoomfactor = 10;
     $this->color = "#0000FF";
     $this->currentYear = date("Y");
     $this->deathMod = 0;
     $this->endDate = $this->currentYear;
     // Request parameters
     $newpid = WT_Filter::get('newpid', WT_REGEX_XREF);
     $remove = WT_Filter::get('remove', WT_REGEX_XREF);
     $pids = WT_Filter::getArray('pids', WT_REGEX_XREF);
     $clear = WT_Filter::getBool('clear');
     $addfam = WT_Filter::getBool('addFamily');
     $place = WT_Filter::get('place');
     $beginYear = WT_Filter::getInteger('beginYear', 0, date('Y') + 100, 0);
     $endYear = WT_Filter::getInteger('endYear', 0, date('Y') + 100, 0);
     if ($clear) {
         // Empty list
         $this->pids = array();
     } elseif ($pids) {
         // List of specified records
         $this->pids = $pids;
     } elseif ($place) {
         // All records found in a place
         $wt_place = new WT_Place($place, WT_GED_ID);
         $this->pids = WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($wt_place->getPlaceId(), WT_GED_ID))->fetchOneColumn();
         $this->place = $place;
     } else {
         // Modify an existing list of records
         if (is_array($WT_SESSION->timeline_pids)) {
             $this->pids = $WT_SESSION->timeline_pids;
         } else {
             $this->pids = array();
         }
         if ($remove) {
             foreach ($this->pids as $key => $value) {
                 if ($value == $remove) {
                     unset($this->pids[$key]);
                 }
             }
         } elseif ($newpid) {
             $person = WT_Individual::getInstance($newpid);
             $this->addFamily($person, $addfam);
         } elseif (!$this->pids) {
             $this->addFamily($this->getSignificantIndividual(), false);
         }
     }
     $WT_SESSION->timeline_pids = $this->pids;
     $this->beginYear = $beginYear;
     $this->endYear = $endYear;
     if ($beginYear == 0 || $endYear == 0) {
         //-- cleanup user input
         $this->pids = array_unique($this->pids);
         //removes duplicates
         foreach ($this->pids as $key => $value) {
             if ($value != $remove) {
                 $this->pids[$key] = $value;
                 $person = WT_Individual::getInstance($value);
                 // list of linked records includes families as well as individuals.
                 if ($person) {
                     $bdate = $person->getEstimatedBirthDate();
                     if ($bdate->isOK() && $person->canShow()) {
                         $this->people[] = $person;
                     }
                 }
             }
         }
     } else {
         //--Finds if the begin year and end year textboxes are not empty
         //-- reset the people array when doing a year range search
         $this->people = array();
         //Takes the begining year and end year passed by the postback and modifies them and uses them to populate
         //the time line
         //Variables to restrict the person boxes to the year searched.
         //--Searches for individuals who had an even between the year begin and end years
         $indis = self::search_indis_year_range($beginYear, $endYear);
         //--Populates an array of people that had an event within those years
         foreach ($indis as $person) {
             if (empty($searchplace) || in_array($person->getXref(), $this->pids)) {
                 $bdate = $person->getEstimatedBirthDate();
                 if ($bdate->isOK() && $person->canShow()) {
                     $this->people[] = $person;
                 }
             }
         }
         $WT_SESSION->timeline_pids = null;
     }
     // Sort the array in order of birth year
     uasort($this->people, function (WT_Individual $a, WT_Individual $b) {
         return WT_Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate());
     });
     //If there is people in the array posted back this if occurs
     if (isset($this->people[0])) {
         //Find the maximum Death year and mimimum Birth year for each individual returned in the array.
//.........这里部分代码省略.........
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:Lifespan.php


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