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


PHP WT_Filter类代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     $PEDIGREE_FULL_DETAILS = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_FULL_DETAILS');
     $MAX_DESCENDANCY_GENERATIONS = get_gedcom_setting(WT_GED_ID, 'MAX_DESCENDANCY_GENERATIONS');
     // Extract the request parameters
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1);
     $this->descent = WT_Filter::getInteger('descent', 0, 9, 5);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // Box sizes are set globally in the theme.  Modify them here.
     global $bwidth, $bheight, $cbwidth, $cbheight, $Dbwidth, $bhalfheight, $Dbheight;
     $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 = $bheight / 2;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Family book of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Family book'));
     }
     //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;
     }
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:34,代码来源:Familybook.php

示例2: 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

示例3: __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

示例4: send

 public static function send(WT_Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message)
 {
     try {
         $mail = new Zend_Mail('UTF-8');
         $mail->setSubject($subject)->setBodyHtml($message)->setBodyText(WT_Filter::unescapeHtml($message))->setFrom(WT_Site::getPreference('SMTP_FROM_NAME'), $tree->preference('title'))->addTo($to_email, $to_name)->setReplyTo($replyto_email, $replyto_name)->send(WT_Mail::transport());
     } catch (Exception $ex) {
         Log::addErrorLog('Mail: ' . $ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:11,代码来源:Mail.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     // Extract the request parameters
     $this->show_thumbs = WT_Filter::getBool('show_thumbs');
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Compact tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Compact tree'));
     }
     $this->treeid = ancestry_array($this->rootid, 5);
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:12,代码来源:Compact.php

示例6: extractNames

 /**
  * Create a name for this note - apply (and remove) markup, then take
  * a maximum of 100 characters from the first line.
  */
 public function extractNames()
 {
     global $WT_TREE;
     $text = $this->getNote();
     switch ($WT_TREE->preference('FORMAT_TEXT')) {
         case 'markdown':
             $text = WT_Filter::markdown($text);
             $text = strip_tags($text);
             break;
     }
     list($text) = explode("\n", $text);
     $this->_addName('NOTE', strlen($text) > 100 ? mb_substr($text, 0, 100) . WT_I18N::translate('…') : $text, $this->getGedcom());
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:17,代码来源:Note.php

示例7: mediaList

 /**
  * Generate a filtered, sourced, privacy-checked list of media objects - for the media list.
  *
  * @param string $folder     folder to search
  * @param string $subfolders either "include" or "exclude"
  * @param string $sort       either "file" or "title"
  * @param string $filter     optional search string
  *
  * @return WT_Media[]
  * @throws Exception
  */
 public static function mediaList($folder, $subfolders, $sort, $filter)
 {
     // All files in the folder, plus external files
     $sql = "SELECT m_id AS xref, m_file AS gedcom_id, m_gedcom AS gedcom" . " FROM `##media`" . " WHERE m_file=?";
     $args = array(WT_GED_ID);
     // Only show external files when we are looking at the root folder
     if ($folder == '') {
         $sql_external = " OR m_filename LIKE 'http://%' OR m_filename LIKE 'https://%'";
     } else {
         $sql_external = "";
     }
     // Include / exclude subfolders (but always include external)
     switch ($subfolders) {
         case 'include':
             $sql .= " AND (m_filename LIKE CONCAT(?, '%') {$sql_external})";
             $args[] = WT_Filter::escapeLike($folder);
             break;
         case 'exclude':
             $sql .= " AND (m_filename LIKE CONCAT(?, '%')  AND m_filename NOT LIKE CONCAT(?, '%/%') {$sql_external})";
             $args[] = WT_Filter::escapeLike($folder);
             $args[] = WT_Filter::escapeLike($folder);
             break;
         default:
             throw new Exception('Bad argument (subfolders=' . $subfolders . ') in WT_Query_Media::mediaList()');
     }
     // Apply search terms
     if ($filter) {
         $sql .= " AND (SUBSTRING_INDEX(m_filename, '/', -1) LIKE CONCAT('%', ?, '%') OR m_titl LIKE CONCAT('%', ?, '%'))";
         $args[] = WT_Filter::escapeLike($filter);
         $args[] = WT_Filter::escapeLike($filter);
     }
     switch ($sort) {
         case 'file':
             $sql .= " ORDER BY m_filename";
             break;
         case 'title':
             $sql .= " ORDER BY m_titl";
             break;
         default:
             throw new Exception('Bad argument (sort=' . $sort . ') in WT_Query_Media::mediaList()');
     }
     $rows = WT_DB::prepare($sql)->execute($args)->fetchAll();
     $list = array();
     foreach ($rows as $row) {
         $media = WT_Media::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
         if ($media->canShow()) {
             $list[] = $media;
         }
     }
     return $list;
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:62,代码来源:Media.php

示例8: __construct

 private function __construct($tree_id, $tree_name, $tree_title, $imported)
 {
     if (strpos($tree_title, '%') === false) {
         // Allow users to translate tree titles.
         //$tree_title=WT_I18N::Translate($tree_title);
     }
     $this->tree_id = $tree_id;
     $this->tree_name = $tree_name;
     $this->tree_name_url = rawurlencode($tree_name);
     $this->tree_name_html = WT_Filter::escapeHtml($tree_name);
     $this->tree_title = $tree_title;
     $this->tree_title_html = '<span dir="auto">' . WT_Filter::escapeHtml($tree_title) . '</span>';
     $this->imported = $imported;
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:14,代码来源:Tree.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     $default_generations = get_gedcom_setting(WT_GED_ID, 'DEFAULT_PEDIGREE_GENERATIONS');
     // Extract the request parameters
     $this->fan_style = WT_Filter::getInteger('fan_style', 2, 4, 3);
     $this->fan_width = WT_Filter::getInteger('fan_width', 50, 300, 100);
     $this->generations = WT_Filter::getInteger('generations', 2, 9, $default_generations);
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Fan chart of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Fan chart'));
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:14,代码来源:Fanchart.php

示例10: modAction

 public function modAction($modAction)
 {
     global $controller;
     switch ($modAction) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
             if (WT_USER_ID && $record->canShowName()) {
                 self::addFavorite(array('user_id' => WT_USER_ID, 'gedcom_id' => $record->getGedcomId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 WT_FlashMessages::addMessage(WT_I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:14,代码来源:module.php

示例11: __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

示例12: __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

示例13: __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

示例14: 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

示例15: __construct

 function __construct()
 {
     global $bwidth, $bheight, $cbwidth, $cbheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full;
     parent::__construct();
     // Extract parameters from form
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3, 0);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     $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 (!isset($this->personcount)) {
         $this->personcount = 1;
     }
     // -- 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 = $cbwidth;
         $bheight = $cbheight;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     // Validate form variables
     if (strlen($this->name) < 30) {
         $this->cellwidth = 420;
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Descendants of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Descendants'));
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:38,代码来源:Descendancy.php


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