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


PHP WT_Filter::escapeHtml方法代码示例

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


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

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

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

示例3: format_surname_list

function format_surname_list($surnames, $style, $totals, $script)
{
    global $GEDCOM;
    $html = array();
    foreach ($surnames as $surn => $surns) {
        // Each surname links back to the indilist
        if ($surn) {
            $url = $script . '?surname=' . urlencode($surn) . '&amp;ged=' . rawurlencode($GEDCOM);
        } else {
            $url = $script . '?alpha=,&amp;ged=' . rawurlencode($GEDCOM);
        }
        // If all the surnames are just case variants, then merge them into one
        // Comment out this block if you want SMITH listed separately from Smith
        $first_spfxsurn = null;
        foreach ($surns as $spfxsurn => $indis) {
            if ($first_spfxsurn) {
                if (WT_I18N::strtoupper($spfxsurn) == WT_I18N::strtoupper($first_spfxsurn)) {
                    $surns[$first_spfxsurn] = array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]);
                    unset($surns[$spfxsurn]);
                }
            } else {
                $first_spfxsurn = $spfxsurn;
            }
        }
        $subhtml = '<a href="' . $url . '" dir="auto">' . WT_Filter::escapeHtml(implode(WT_I18N::$list_separator, array_keys($surns))) . '</a>';
        if ($totals) {
            $subtotal = 0;
            foreach ($surns as $indis) {
                $subtotal += count($indis);
            }
            $subhtml .= '&nbsp;(' . WT_I18N::number($subtotal) . ')';
        }
        $html[] = $subhtml;
    }
    switch ($style) {
        case 1:
            return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
        case 2:
            return implode(WT_I18N::$list_separator, $html);
        case 3:
            $i = 0;
            $count = count($html);
            $col = 1;
            if ($count > 36) {
                $col = 4;
            } else {
                if ($count > 18) {
                    $col = 3;
                } else {
                    if ($count > 6) {
                        $col = 2;
                    }
                }
            }
            $newcol = ceil($count / $col);
            $html2 = '<table class="list_table"><tr>';
            $html2 .= '<td class="list_value" style="padding: 14px;">';
            foreach ($html as $surns) {
                $html2 .= $surns . '<br>';
                $i++;
                if ($i == $newcol && $i < $count) {
                    $html2 .= '</td><td class="list_value" style="padding: 14px;">';
                    $newcol = $i + ceil($count / $col);
                }
            }
            $html2 .= '</td></tr></table>';
            return $html2;
    }
}
开发者ID:brambravo,项目名称:webtrees,代码行数:69,代码来源:functions_print_lists.php

示例4: _addName


//.........这里部分代码省略.........
     // Fix bad slashes.  e.g. 'John/Smith' => 'John/Smith/'
     if (substr_count($full, '/') % 2 == 1) {
         $full = $full . '/';
     }
     // GEDCOM uses "//" to indicate an unknown surname
     $full = preg_replace('/\\/\\//', '/@N.N./', $full);
     // Extract the surname.
     // Note, there may be multiple surnames, e.g. Jean /Vasquez/ y /Cortes/
     if (preg_match('/\\/.*\\//', $full, $match)) {
         $surname = str_replace('/', '', $match[0]);
     } else {
         $surname = '';
     }
     // If we don’t have a SURN record, extract it from the NAME
     if (!$SURNS) {
         if (preg_match_all('/\\/([^\\/]*)\\//', $full, $matches)) {
             // There can be many surnames, each wrapped with '/'
             $SURNS = $matches[1];
             foreach ($SURNS as $n => $SURN) {
                 // Remove surname prefixes, such as "van de ", "d'" and "'t " (lower case only)
                 $SURNS[$n] = preg_replace('/^(?:[a-z]+ |[a-z]+\' ?|\'[a-z]+ )+/', '', $SURN);
             }
         } else {
             // It is valid not to have a surname at all
             $SURNS = array('');
         }
     }
     // If we don’t have a GIVN record, extract it from the NAME
     if (!$GIVN) {
         $GIVN = preg_replace(array('/ ?\\/.*\\/ ?/', '/ ?".+"/', '/ {2,}/', '/^ | $/'), array(' ', ' ', ' ', ''), $full);
     }
     // Add placeholder for unknown given name
     if (!$GIVN) {
         $GIVN = '@P.N.';
         $pos = strpos($full, '/');
         $full = substr($full, 0, $pos) . '@P.N. ' . substr($full, $pos);
     }
     // The NPFX field might be present, but not appear in the NAME
     if ($NPFX && strpos($full, "{$NPFX} ") !== 0) {
         $full = "{$NPFX} {$full}";
     }
     // The NSFX field might be present, but not appear in the NAME
     if ($NSFX && strrpos($full, " {$NSFX}") !== strlen($full) - strlen(" {$NSFX}")) {
         $full = "{$full} {$NSFX}";
     }
     // GEDCOM nicknames should be specificied in a NICK field, or in the
     // NAME filed, surrounded by ASCII quotes (or both).
     if ($NICK) {
         // NICK field found.  Add localised quotation marks.
         // GREG 28/Jan/12 - these localised quotation marks apparantly cause problems with LTR names on RTL
         // pages and vice-versa.  Just use straight ASCII quotes.  Keep the old code, so that we keep the
         // translations.
         if (false) {
             $QNICK = WT_I18N::translate('“%s”', $NICK);
         } else {
             $QNICK = '"' . $NICK . '"';
         }
         if (preg_match('/(^| |"|«|“|\'|‹|‘|„)' . preg_quote($NICK, '/') . '( |"|»|”|\'|›|’|”|$)/', $full)) {
             // NICK present in name.  Localise ASCII quotes (but leave others).
             // GREG 28/Jan/12 - redundant - see comment above.
             // $full=str_replace('"'.$NICK.'"', $QNICK, $full);
         } else {
             // NICK not present in NAME.
             $pos = strpos($full, '/');
             if ($pos === false) {
                 // No surname - append it
                 $full .= ' ' . $QNICK;
             } else {
                 // Insert before surname
                 $full = substr($full, 0, $pos) . $QNICK . ' ' . substr($full, $pos);
             }
         }
     }
     // Remove slashes - they don’t get displayed
     // $fullNN keeps the @N.N. placeholders, for the database
     // $full is for display on-screen
     $fullNN = str_replace('/', '', $full);
     // Insert placeholders for any missing/unknown names
     if (strpos($full, '@N.N.') !== false) {
         $full = str_replace('@N.N.', $UNKNOWN_NN, $full);
     }
     if (strpos($full, '@P.N.') !== false) {
         $full = str_replace('@P.N.', $UNKNOWN_PN, $full);
     }
     $full = '<span class="NAME" dir="auto" translate="no">' . preg_replace('/\\/([^\\/]*)\\//', '<span class="SURN">$1</span>', WT_Filter::escapeHtml($full)) . '</span>';
     // The standards say you should use a suffix of '*' for preferred name
     $full = preg_replace('/([^ >]*)\\*/', '<span class="starredname">\\1</span>', $full);
     // Remove prefered-name indicater - they don’t go in the database
     $GIVN = str_replace('*', '', $GIVN);
     $fullNN = str_replace('*', '', $fullNN);
     foreach ($SURNS as $SURN) {
         // Scottish 'Mc and Mac ' prefixes both sort under 'Mac'
         if (strcasecmp(substr($SURN, 0, 2), 'Mc') == 0) {
             $SURN = substr_replace($SURN, 'Mac', 0, 2);
         } elseif (strcasecmp(substr($SURN, 0, 4), 'Mac ') == 0) {
             $SURN = substr_replace($SURN, 'Mac', 0, 4);
         }
         $this->_getAllNames[] = array('type' => $type, 'sort' => $SURN . ',' . $GIVN, 'full' => $full, 'fullNN' => $fullNN, 'surname' => $surname, 'givn' => $GIVN, 'surn' => $SURN);
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:Individual.php

示例5: print_time_fact

 function print_time_fact(WT_Fact $event)
 {
     global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION, $WT_IMAGES, $placements;
     $desc = $event->getValue();
     // check if this is a family fact
     $gdate = $event->getDate();
     $date = $gdate->MinDate();
     $date = $date->convert_to_cal('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = (int) $yoffset;
     $place = (int) ($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i == $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = (int) (($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     echo "<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">";
     echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>";
     echo "<img src=\"" . $WT_IMAGES["hline"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" width=\"10\" alt=\"\" style=\"padding-";
     if ($TEXT_DIRECTION == "ltr") {
         echo "left";
     } else {
         echo "right";
     }
     echo ": 3px;\">";
     $col = $event->temp % 6;
     echo "</td><td valign=\"top\" class=\"person" . $col . "\">";
     if (count($this->pids) > 6) {
         echo $event->getParent()->getFullName() . ' — ';
     }
     $record = $event->getParent();
     echo $event->getLabel();
     echo ' — ';
     if ($record instanceof WT_Individual) {
         echo format_fact_date($event, $record, false, false);
     } elseif ($record instanceof WT_Family) {
         echo $gdate->Display(false);
         if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) {
             $ageh = get_age_at_event(WT_Date::GetAgeGedcom($record->getHusband()->getBirthDate(), $gdate), false);
         } else {
             $ageh = null;
         }
         if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) {
             $agew = get_age_at_event(WT_Date::GetAgeGedcom($record->getWife()->getBirthDate(), $gdate), false);
         } else {
             $agew = null;
         }
         if ($ageh && $agew) {
             echo '<span class="age"> ', WT_I18N::translate('Husband’s age'), ' ', $ageh, ' ', WT_I18N::translate('Wife’s age'), ' ', $agew, '</span>';
         } elseif ($ageh) {
             echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>';
         } elseif ($agew) {
             echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>';
         }
     }
     echo ' ' . WT_Filter::escapeHtml($desc);
     if (!$event->getPlace()->isEmpty()) {
         echo ' — ' . $event->getPlace()->getShortName();
     }
     // print spouse name for marriage events
     if (isset($event->spouse)) {
         $spouse = $event->spouse;
     } else {
         $spouse = null;
     }
     if ($spouse) {
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $spouse->getXref()) {
                 break;
             }
         }
         if ($p == count($this->pids)) {
             $p = $event->temp;
         }
         if ($spouse->getXref() != $this->pids[$p]) {
             echo ' <a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a>';
         } else {
             echo ' <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>';
         }
     }
     echo "</td></tr></table>";
     echo "</div>";
     if ($TEXT_DIRECTION == 'ltr') {
//.........这里部分代码省略.........
开发者ID:sadr110,项目名称:webtrees,代码行数:101,代码来源:Timeline.php

示例6: print_findindi_link

function print_findindi_link($element_id, $indiname = '', $ged = WT_GEDCOM)
{
    return '<a href="#" onclick="findIndi(document.getElementById(\'' . $element_id . '\'), document.getElementById(\'' . $indiname . '\'), \'' . WT_Filter::escapeHtml($ged) . '\'); return false;" class="icon-button_indi" title="' . WT_I18N::translate('Find an individual') . '"></a>';
}
开发者ID:brambravo,项目名称:webtrees,代码行数:4,代码来源:functions_print.php

示例7: array

     $falpha = '';
     $show_all_firstnames = 'no';
 } else {
     $givn_initials = WT_Query_Name::givenAlpha($surname, $alpha, $show_marnm, true, WT_GED_ID);
     // Break long lists by initial letter of given name
     if ($surname || $show_all == 'yes') {
         // Don't show the list until we have some filter criteria
         $show = $falpha || $show_all_firstnames == 'yes' ? 'indi' : 'none';
         $list = array();
         foreach ($givn_initials as $givn_initial => $count) {
             switch ($givn_initial) {
                 case '@':
                     $html = $UNKNOWN_PN;
                     break;
                 default:
                     $html = WT_Filter::escapeHtml($givn_initial);
                     break;
             }
             if ($count) {
                 if ($show == 'indi' && $givn_initial == $falpha && $show_all_firstnames == 'no') {
                     $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                 } else {
                     $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                 }
             } else {
                 $list[] = $html;
             }
         }
         // Search spiders don't get the "show all" option as the other links give them everything.
         if (!$SEARCH_SPIDER) {
             if ($show_all_firstnames == 'yes') {
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:famlist.php

示例8: media_object_info

function media_object_info(WT_Media $media)
{
    $xref = $media->getXref();
    $gedcom = WT_Tree::getNameFromId($media->getGedcomId());
    $name = $media->getFullName();
    $html = '<b>' . $name . '</b>' . '<div><i>' . WT_Filter::escapeHtml($media->getNote()) . '</i></div>' . '<br>' . '<a href="' . $media->getHtmlUrl() . '">' . WT_I18N::translate('View') . '</a>';
    $html .= ' - ' . '<a onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=' . $xref . '&ged=' . WT_Filter::escapeJs($gedcom) . '\', \'_blank\', edit_window_specs)" href="#">' . WT_I18N::Translate('Edit') . '</a>' . ' - ' . '<a onclick="return delete_media(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($media->getFullName()))) . '\', \'' . $media->getXref() . '\', \'' . WT_Filter::escapeJs($gedcom) . '\');" href="#">' . WT_I18N::Translate('Delete') . '</a>' . ' - ';
    if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
        $html .= '<a onclick="return ilinkitem(\'' . $xref . '\', \'manage\', \'' . $gedcom . '\')" href="#">' . WT_I18N::Translate('Manage links') . '</a>';
    } else {
        global $TEXT_DIRECTION;
        $classSuffix = $TEXT_DIRECTION == 'rtl' ? '_rtl' : '';
        $menu = new WT_Menu();
        $menu->addLabel(WT_I18N::translate('Set link'));
        $menu->addClass('', 'submenu');
        $submenu = new WT_Menu(WT_I18N::translate('To individual'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'person', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $submenu = new WT_Menu(WT_I18N::translate('To family'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'family', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $submenu = new WT_Menu(WT_I18N::translate('To source'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'source', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $html .= '<div style="display:inline-block;">' . $menu->getMenu() . '</div>';
    }
    $html .= '<br><br>';
    $linked = array();
    foreach ($media->linkedIndividuals('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedFamilies('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedSources('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedNotes('OBJE') as $link) {
        // Invalid GEDCOM - you cannot link a NOTE to an OBJE
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedRepositories('OBJE') as $link) {
        // Invalid GEDCOM - you cannot link a REPO to an OBJE
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    if ($linked) {
        $html .= '<ul>';
        foreach ($linked as $link) {
            $html .= '<li>' . $link . '</li>';
        }
        $html .= '</ul>';
    } else {
        $html .= '<div class="error">' . WT_I18N::translate('This media object is not linked to any other record.') . '</div>';
    }
    return $html;
}
开发者ID:brambravo,项目名称:webtrees,代码行数:59,代码来源:admin_media.php

示例9: array

<?php 
    $menu_items = array(WT_MenuBar::getGedcomMenu(), WT_MenuBar::getMyPageMenu(), WT_MenuBar::getChartsMenu(), WT_MenuBar::getListsMenu(), WT_MenuBar::getCalendarMenu(), WT_MenuBar::getReportsMenu(), WT_MenuBar::getSearchMenu());
    foreach (WT_MenuBar::getModuleMenus() as $menu) {
        $menu_items[] = $menu;
    }
    // Print the menu bar
    echo '<div id="topMenu">', '<ul id="main-menu">';
    foreach ($menu_items as $menu) {
        if ($menu) {
            echo getMenuAsCustomList($menu);
        }
    }
    echo '</ul>';
    echo '<div id="menu-right">', '<ul class="makeMenu">';
    if (WT_USER_ID) {
        echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
        if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
            echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
        }
    } else {
        echo '<li>', login_link(), '</li>';
    }
    $menu = WT_MenuBar::getFavoritesMenu();
    if ($menu) {
        echo $menu->getMenuAsList();
    }
    $menu = WT_MenuBar::getLanguageMenu();
    if ($menu) {
        echo $menu->getMenuAsList();
    }
    $menu = WT_MenuBar::getThemeMenu();
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:header.php

示例10: configureBlock


//.........这里部分代码省略.........
									<td class="facts_value" align="right">#lastBirthYear#</td>
									<td class="facts_value">#lastBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td>
									<td class="facts_value" align="right">#firstDeathYear#</td>
									<td class="facts_value">#firstDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td>
									<td class="facts_value" align="right">#lastDeathYear#</td>
									<td class="facts_value">#lastDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td>
									<td class="facts_value" align="right">#longestLifeAge#</td>
									<td class="facts_value">#longestLife#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td>
									<td class="facts_value" align="right">#averageLifespan#</td>
									<td class="facts_value"></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td>
									<td class="facts_value" align="right">#largestFamilySize#</td>
									<td class="facts_value">#largestFamily#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td>
									<td class="facts_value" align="right">#averageChildren#</td>
									<td class="facts_value"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table><br>
				<span style="font-weight: bold">' . WT_I18N::translate('Most common surnames') . '</span><br>
				#commonSurnames#
			</div>');
        $title = get_block_setting($block_id, 'title');
        $html = get_block_setting($block_id, 'html');
        // title
        echo '<tr><td class="descriptionbox wrap">', WT_Gedcom_Tag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>';
        // templates
        echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Templates'), help_link('block_html_template', $this->getName()), '</td><td class="optionbox">';
        // The CK editor needs lots of help to load/save data :-(
        if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
            $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);';
        } else {
            $ckeditor_onchange = '';
        }
        echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">';
        echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>';
        foreach ($templates as $title => $template) {
            echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>';
        }
        echo '</select></td></tr>';
        // gedcom
        $gedcom = get_block_setting($block_id, 'gedcom');
        if (count(WT_Tree::getAll()) > 1) {
            if ($gedcom == '__current__') {
                $sel_current = ' selected="selected"';
            } else {
                $sel_current = '';
            }
            if ($gedcom == '__default__') {
                $sel_default = ' selected="selected"';
            } else {
                $sel_default = '';
            }
            echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>', '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
            foreach (WT_Tree::getAll() as $tree) {
                if ($tree->tree_name == $gedcom) {
                    $sel = ' selected="selected"';
                } else {
                    $sel = '';
                }
                echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
            }
            echo '</select></td></tr>';
        }
        // html
        echo '<tr><td colspan="2" class="descriptionbox">', WT_I18N::translate('Content'), help_link('block_html_content', $this->getName()), '</td></tr><tr>', '<td colspan="2" class="optionbox">';
        echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>';
        echo '</td></tr>';
        $show_timestamp = get_block_setting($block_id, 'show_timestamp', false);
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show the date and time of update');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('show_timestamp', $show_timestamp);
        echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">';
        echo '</td></tr>';
        $languages = get_block_setting($block_id, 'languages');
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show this block for which languages?');
        echo '</td><td class="optionbox">';
        echo edit_language_checkboxes('lang_', $languages);
        echo '</td></tr>';
    }
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:module.php

示例11: myplot


//.........这里部分代码省略.........
                    }
                    if (!($j == count($ydata[$i]) - 1)) {
                        $datastring .= ',';
                    }
                }
                if (!($i == $stop - 1)) {
                    $datastring .= '|';
                }
            }
        }
    } else {
        for ($i = 0; $i < $stop; $i++) {
            for ($j = 0; $j < count($ydata[$i]); $j++) {
                if ($ydata[$i][$j] > $ymax) {
                    $ymax = $ydata[$i][$j];
                }
            }
        }
        if ($ymax > 0) {
            $scalefactor = 100.0 / $ymax;
        } else {
            $scalefactor = 0;
        }
        $datastring = 'chd=t:';
        for ($i = 0; $i < $stop; $i++) {
            for ($j = 0; $j < count($ydata[$i]); $j++) {
                $datastring .= round($ydata[$i][$j] * $scalefactor, 1);
                if (!($j == count($ydata[$i]) - 1)) {
                    $datastring .= ',';
                }
            }
            if (!($i == $stop - 1)) {
                $datastring .= '|';
            }
        }
    }
    $colors = array('0000FF', 'FFA0CB', '9F00FF', 'FF7000', '905030', 'FF0000', '00FF00', 'F0F000');
    $colorstring = 'chco=';
    for ($i = 0; $i < $stop; $i++) {
        if (isset($colors[$i])) {
            $colorstring .= $colors[$i];
            if ($i != $stop - 1) {
                $colorstring .= ',';
            }
        }
    }
    $titleLength = strpos($mytitle . "\n", "\n");
    $title = substr($mytitle, 0, $titleLength);
    $imgurl = 'https://chart.googleapis.com/chart?cht=bvg&amp;chs=950x300&amp;chf=bg,s,ffffff00|c,s,ffffff00&amp;chtt=' . rawurlencode($title) . '&amp;' . $datastring . '&amp;' . $colorstring . '&amp;chbh=';
    if (count($ydata) > 3) {
        $imgurl .= '5,1';
    } else {
        if (count($ydata) < 2) {
            $imgurl .= '45,1';
        } else {
            $imgurl .= '20,3';
        }
    }
    $imgurl .= '&amp;chxt=x,x,y,y&amp;chxl=0:|';
    for ($i = 0; $i < count($xdata); $i++) {
        $imgurl .= $xdata[$i] . '|';
    }
    $imgurl .= '1:||||' . rawurlencode($xtitle) . '|2:|';
    $imgurl .= '0|';
    if ($percentage) {
        for ($i = 1; $i < 11; $i++) {
            if ($ymax < 11) {
                $imgurl .= round($ymax * $i / 10, 1) . '|';
            } else {
                $imgurl .= round($ymax * $i / 10, 0) . '|';
            }
        }
        $imgurl .= '3:||%|';
    } else {
        if ($ymax < 11) {
            for ($i = 1; $i < $ymax + 1; $i++) {
                $imgurl .= round($ymax * $i / $ymax, 0) . '|';
            }
        } else {
            for ($i = 1; $i < 11; $i++) {
                $imgurl .= round($ymax * $i / 10, 0) . '|';
            }
        }
        $imgurl .= '3:||' . rawurlencode($ytitle) . '|';
    }
    //only show legend if y-data is non-2-dimensional
    if (count($ydata) > 1) {
        $imgurl .= '&amp;chdl=';
        for ($i = 0; $i < count($legend); $i++) {
            $imgurl .= rawurlencode($legend[$i]);
            if (!($i == count($legend) - 1)) {
                $imgurl .= '|';
            }
        }
    }
    // in PHP 5.3.0 we can use
    //$title = strstr($mytitle, '|', true);
    $title = substr($mytitle, 0, strpos($mytitle, '|'));
    echo '<img src="', $imgurl, '" width="950" height="300" alt="', WT_Filter::escapeHtml($title), '" title="', WT_Filter::escapeHtml($title), '">';
}
开发者ID:brambravo,项目名称:webtrees,代码行数:101,代码来源:statisticsplot.php

示例12: array

    // Look for PGV in some nearby directories
    $pgv_dirs = array();
    $dir = opendir(realpath('..'));
    while (($subdir = readdir($dir)) !== false) {
        if (is_dir('../' . $subdir) && file_exists('../' . $subdir . '/config.php')) {
            $pgv_dirs[] = '../' . $subdir;
        }
    }
    closedir($dir);
    echo '<form action="', WT_SCRIPT_NAME, '" method="post">', '<p>', WT_I18N::translate('Where is your PhpGedView installation?'), '</p>', '<dl>', '<dt>', WT_I18N::translate('Installation directory'), '</dt>';
    switch (count($pgv_dirs)) {
        case '0':
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="" autofocus></dd>';
            break;
        case '1':
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="' . WT_Filter::escapeHtml($pgv_dirs[0]) . '" autofocus></dd>';
            break;
        default:
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="" autofocus></dd>';
            echo '<dt>', 'PhpGedView might be found in these locations', '</dt>';
            echo '<dd>';
            foreach ($pgv_dirs as $pgvpath) {
                echo '<p class="pgv">', $pgvpath, '</p>';
            }
            echo '</dd>';
            break;
    }
    echo '</dl>', '<div class="center"><input type="submit" value="' . WT_I18N::translate('next') . '"></div>', '</form>', '</div>';
    exit;
}
// Run in a transaction
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_pgv_to_wt.php

示例13: edit

 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_USER_CAN_EDIT) {
         if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
             $block_id = WT_Filter::postInteger('block_id');
             if ($block_id) {
                 WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
             } else {
                 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                 $block_id = WT_DB::getInstance()->lastInsertId();
             }
             set_block_setting($block_id, 'title', WT_Filter::post('title'));
             set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
             $languages = array();
             foreach (WT_I18N::installed_languages() as $code => $name) {
                 if (WT_Filter::postBool('lang_' . $code)) {
                     $languages[] = $code;
                 }
             }
             set_block_setting($block_id, 'languages', implode(',', $languages));
             $this->config();
         } else {
             $block_id = WT_Filter::getInteger('block_id');
             $controller = new WT_Controller_Page();
             if ($block_id) {
                 $controller->setPageTitle(WT_I18N::translate('Edit story'));
                 $title = get_block_setting($block_id, 'title');
                 $story_body = get_block_setting($block_id, 'story_body');
                 $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                 $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             } else {
                 $controller->setPageTitle(WT_I18N::translate('Add a story'));
                 $title = '';
                 $story_body = '';
                 $gedcom_id = WT_GED_ID;
                 $xref = WT_Filter::get('xref', WT_REGEX_XREF);
             }
             $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
             if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
                 ckeditor_WT_Module::enableEditor($controller);
             }
             echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
             echo WT_Filter::getCsrf();
             echo '<input type="hidden" name="save" value="1">';
             echo '<input type="hidden" name="block_id" value="', $block_id, '">';
             echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
             echo '<table id="story_module">';
             echo '<tr><th>';
             echo WT_I18N::translate('Story title');
             echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
             echo '<tr><th>';
             echo WT_I18N::translate('Story');
             echo '</th></tr><tr><td>';
             echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
             echo '</td></tr>';
             echo '</table><table id="story_module2">';
             echo '<tr>';
             echo '<th>', WT_I18N::translate('Individual'), '</th>';
             echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
             echo '</tr>';
             echo '<tr>';
             echo '<td class="optionbox">';
             echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
             echo print_findindi_link('pid');
             if ($xref) {
                 $person = WT_Individual::getInstance($xref);
                 if ($person) {
                     echo ' ', $person->format_list('span');
                 }
             }
             echo '</td>';
             $languages = get_block_setting($block_id, 'languages');
             echo '<td class="optionbox">';
             echo edit_language_checkboxes('lang_', $languages);
             echo '</td></tr></table>';
             echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
             echo '</p>';
             echo '</form>';
             exit;
         }
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:86,代码来源:module.php

示例14: date

                }
            }
            break;
    }
}
if ($custom_themes) {
    echo '<br>', WT_I18N::translate('You should consult the theme’s author to confirm compatibility with this version of webtrees.');
    echo '<br>', '<button type="submit" name="themes" value="disable">', WT_I18N::translate('Disable these themes'), '</button> — ', WT_I18N::translate('You can re-enable these themes after the upgrade.');
    echo '<br>', '<button type="submit" name="themes" value="ignore">', WT_I18N::translate('Upgrade anyway'), '</button> — ', WT_I18N::translate('Caution: old themes may not work, or they may prevent webtrees from working.');
    echo '</li></ul></form>';
    exit;
} else {
    if ($themes_action != 'ignore') {
        echo '<br>', WT_I18N::translate('No custom themes are enabled.'), $icon_success;
    }
    echo '<input type="hidden" name="themes" value="', WT_Filter::escapeHtml($themes_action), '">';
}
echo '</li>';
flush();
////////////////////////////////////////////////////////////////////////////////
// Make a backup of genealogy data
////////////////////////////////////////////////////////////////////////////////
echo '<li>', WT_I18N::translate('Export all family trees to GEDCOM files…');
foreach (WT_Tree::getAll() as $tree) {
    reset_timeout();
    $filename = WT_DATA_DIR . $tree->tree_name . date('-Y-m-d') . '.ged';
    if ($tree->exportGedcom($filename)) {
        echo '<br>', WT_I18N::translate('Family tree exported to %s.', '<span dir="ltr">' . $filename . '</span>'), $icon_success;
    } else {
        echo '<br>', WT_I18N::translate('Unable to create %s.  Check the permissions.', '<span dir="ltr">' . $filename . '</span>'), $icon_failure;
    }
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_site_upgrade.php

示例15: IN

        WT_DB::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        try {
            WT_DB::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn, comment, updated)" . " SELECT ?, xref, tag_type, resn, comment, updated FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?")->execute(array($ged2_id, WT_GED_ID));
            // This table may contain old (deleted) references, which could clash.  IGNORE these.
            WT_DB::prepare("INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?")->execute(array($ged2_id, WT_GED_ID));
            // This table may contain old (deleted) references, which could clash.  IGNORE these.
            WT_DB::prepare("INSERT IGNORE INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count)" . " SELECT ?, page_name, page_parameter, page_count FROM `##hit_counter` AS hit_counter2 WHERE gedcom_id = ? AND page_name <> 'index.php'")->execute(array($ged2_id, WT_GED_ID));
            echo '<p>', WT_I18N::translate('The family trees were merged successfully.'), '</p>';
        } catch (Exception $ex) {
            WT_DB::exec("ROLLBACK");
            echo '<p>', WT_I18N::translate('Oops!  An unexpected database error occurred.'), '</p>';
            echo '<pre>', $ex, '</pre>';
        }
        WT_DB::exec("UNLOCK TABLES");
        WT_DB::exec("COMMIT");
    }
}
echo '<form method="POST" action="', WT_SCRIPT_NAME, '">';
echo '<input type="hidden" name="go" value="1">';
echo '<p>', WT_I18N::translate('Copy all the records from %1$s into %2$s.', WT_Filter::escapeHtml($WT_TREE->tree_title), select_edit_control('ged2_id', WT_Tree::getIdList(), null, $ged2_id)), '</p>';
echo '<input type="submit" value="', WT_I18N::translate('continue'), '">';
echo '</form>';
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_trees_merge.php


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