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


PHP HTML::em方法代码示例

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


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

示例1: displayContent

    /**
     * Display the content
     * @see PluginPanel::displayContent()
     */
    protected function displayContent()
    {
        echo $this->getStyle();
        echo '<div id="schuhe">';
        // TODO: Use data from shoe factory
        $inuse = true;
        $schuhe = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'shoe` WHERE accountid = ' . SessionAccountHandler::getId() . ' ORDER BY `inuse` DESC, `km` DESC')->fetchAll();
        foreach ($schuhe as $schuh) {
            $Shoe = new Shoe($schuh);
            if ($inuse && $Shoe->isInUse() == 0) {
                echo '<div id="hiddenschuhe" style="display:none;">';
                $inuse = false;
            }
            echo '<p style="position:relative;">
				<span class="right">' . $Shoe->getKmString() . '</span>
				<strong>' . ShoeFactory::getSearchLink($schuh['id']) . '</strong>
				' . $this->getShoeUsageImage($Shoe->getKm()) . '
			</p>';
        }
        if (empty($schuhe)) {
            echo HTML::em(__('You don\'t have any shoes'));
        }
        if (!$inuse) {
            echo '</div>';
        }
        echo '</div>';
        if (!$inuse) {
            echo Ajax::toggle('<a class="right" href="#schuhe" name="schuhe">' . __('Show unused shoes') . '</a>', 'hiddenschuhe');
        }
        echo HTML::clearBreak();
    }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:35,代码来源:class.RunalyzePluginPanel_Schuhe.php

示例2: displayAfterInsert

 /**
  * Display after insert
  */
 public function displayAfterInsert()
 {
     if ($this->EditorRequested) {
         $MultiEditor = new MultiEditor($this->InsertedIDs);
         $MultiEditor->display();
     } else {
         echo HTML::em(__('The activities have been successfully imported.'));
         echo Ajax::closeOverlay();
     }
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:13,代码来源:class.MultiImporter.php

示例3: displayContent

 /**
  * Display the content
  * @see PluginStat::displayContent()
  */
 protected function displayContent()
 {
     if (!$this->dataIsMissing) {
         $this->displayImages();
     } else {
         echo HTML::em(__('No data available.'));
     }
     if ($this->Configuration()->value('show_extreme_times')) {
         $this->displayTable();
     }
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:15,代码来源:class.RunalyzePluginStat_Trainingszeiten.php

示例4: __date

 function __date($dbi, $time)
 {
     $args =& $this->args;
     $page_for_date = $args['prefix'] . strftime($args['date_format'], $time);
     $t = localtime($time, 1);
     $td = HTML::td(array('align' => 'center'));
     $mday = $t['tm_mday'];
     if ($mday == $this->_today) {
         $mday = HTML::strong($mday);
         $td->setAttr('class', 'cal-today');
     } else {
         if ($dbi->isWikiPage($page_for_date)) {
             $this->_links[] = $page_for_date;
             $td->setAttr('class', 'cal-day');
         }
     }
     if ($dbi->isWikiPage($page_for_date)) {
         $this->_links[] = $page_for_date;
         $date = HTML::a(array('class' => 'cal-day', 'href' => WikiURL($page_for_date), 'title' => $page_for_date), HTML::em($mday));
     } else {
         $date = HTML::a(array('class' => 'cal-hide', 'rel' => 'nofollow', 'href' => WikiURL($page_for_date, array('action' => 'edit')), 'title' => sprintf(_("Edit %s"), $page_for_date)), $mday);
     }
     $td->pushContent(HTML::raw('&nbsp;'), $date, HTML::raw('&nbsp;'));
     return $td;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:25,代码来源:Calendar.php

示例5: showListFor

    /**
     * @param \Runalyze\Model\EquipmentType\Object $EquipmentType
     * @param boolean $inuse
     */
    protected function showListFor(Model\EquipmentType\Object $EquipmentType, &$inuse)
    {
        $max = 0;
        $showDistance = $EquipmentType->hasMaxDistance();
        $hasMaxDuration = $showDistance || $EquipmentType->hasMaxDuration();
        $allEquipment = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'equipment` WHERE `typeid`="' . $EquipmentType->id() . '" AND `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY ISNULL(`date_end`) DESC, `distance` DESC')->fetchAll();
        foreach ($allEquipment as $data) {
            $Object = new Model\Equipment\Object($data);
            $Distance = new Distance($Object->totalDistance());
            $Duration = new Duration($Object->duration());
            if ($inuse && !$Object->isInUse()) {
                echo '<div id="hiddenequipment" style="display:none;">';
                $inuse = false;
            }
            if ($max == 0) {
                $max = $Object->duration();
            }
            echo '<p style="position:relative;">
				<span class="right">' . ($showDistance ? $Distance->string() : $Duration->string()) . '</span>
				<strong>' . SearchLink::to('equipmentid', $Object->id(), $Object->name()) . '</strong>
				' . $this->getUsageImage($showDistance ? $Object->totalDistance() / $EquipmentType->maxDistance() : $Object->duration() / ($hasMaxDuration ? $EquipmentType->maxDuration() : $max)) . '
			</p>';
        }
        if (empty($allEquipment)) {
            echo HTML::em(__('You don\'t have any equipment'));
        }
        if (!$inuse) {
            echo '</div>';
        }
    }
开发者ID:Nugman,项目名称:Runalyze,代码行数:34,代码来源:class.RunalyzePluginPanel_Equipment.php

示例6: displayCities

    /**
     * Display most visited cities
     */
    private function displayCities()
    {
        echo '<table style="width:25%;" class="right zebra-style">';
        echo '<thead><tr><th colspan="2">' . __('Most frequent places') . '</th></tr></thead>';
        echo '<tbody>';
        $i = 1;
        if (empty($this->Cities)) {
            echo HTML::emptyTD(2, HTML::em(__('There are no routes.')));
        }
        foreach ($this->Cities as $city => $num) {
            $i++;
            echo '<tr class="a' . ($i % 2 + 1) . '">
					<td>' . $num . 'x</td>
					<td>' . SearchLink::to('route', $city, $city, 'like') . '</td>
				</tr>';
            if ($i == 11) {
                break;
            }
        }
        echo '</tbody>';
        echo '</table>';
    }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:25,代码来源:class.RunalyzePluginStat_Strecken.php

示例7: SavePage

function SavePage(&$request, &$pageinfo, $source, $filename)
{
    static $overwite_all = false;
    $pagedata = $pageinfo['pagedata'];
    // Page level meta-data.
    $versiondata = $pageinfo['versiondata'];
    // Revision level meta-data.
    if (empty($pageinfo['pagename'])) {
        PrintXML(HTML::dt(HTML::strong(_("Empty pagename!"))));
        return;
    }
    if (empty($versiondata['author_id'])) {
        $versiondata['author_id'] = $versiondata['author'];
    }
    $pagename = $pageinfo['pagename'];
    $content = $pageinfo['content'];
    if ($pagename == _("InterWikiMap")) {
        $content = _tryinsertInterWikiMap($content);
    }
    $dbi =& $request->_dbi;
    $page = $dbi->getPage($pagename);
    // Try to merge if updated pgsrc contents are different. This
    // whole thing is hackish
    //
    // TODO: try merge unless:
    // if (current contents = default contents && pgsrc_version >=
    // pgsrc_version) then just upgrade this pgsrc
    $needs_merge = false;
    $merging = false;
    //    $overwrite = true;
    $overwrite = true;
    if ($request->getArg('merge')) {
        $merging = true;
    } else {
        if ($request->getArg('overwrite')) {
            $overwrite = true;
        }
    }
    $current = $page->getCurrentRevision();
    if ($current and !$current->hasDefaultContents() && $current->getPackedContent() != $content && $merging == true) {
        include_once 'lib/editpage.php';
        $request->setArg('pagename', $pagename);
        $r = $current->getVersion();
        $request->setArg('revision', $current->getVersion());
        $p = new LoadFileConflictPageEditor($request);
        $p->_content = $content;
        $p->_currentVersion = $r - 1;
        $p->editPage($saveFailed = true);
        return;
        //early return
    }
    foreach ($pagedata as $key => $value) {
        if (!empty($value)) {
            $page->set($key, $value);
        }
    }
    $mesg = HTML::dd();
    $skip = false;
    if ($source) {
        $mesg->pushContent(' ', fmt("from %s", $source));
    }
    if (!$current) {
        //FIXME: This should not happen! (empty vdata, corrupt cache or db)
        $current = $page->getCurrentRevision();
    }
    if ($current->getVersion() == 0) {
        $mesg->pushContent(' - ', _("New page"));
        $isnew = true;
    } else {
        if (!$current->hasDefaultContents() && $current->getPackedContent() != $content) {
            if ($overwrite) {
                $mesg->pushContent(' ', fmt("has edit conflicts - overwriting anyway"));
                $skip = false;
                if (substr_count($source, 'pgsrc')) {
                    $versiondata['author'] = _("The PhpWiki programming team");
                    // but leave authorid as userid who loaded the file
                }
            } else {
                $mesg->pushContent(' ', fmt("has edit conflicts - skipped"));
                $needs_merge = true;
                // hackish
                $skip = true;
            }
        } else {
            if ($current->getPackedContent() == $content && $current->get('author') == $versiondata['author']) {
                // The page metadata is already changed, we don't need a new revision.
                // This was called previously "is identical to current version %d - skipped"
                // which is wrong, since the pagedata was stored, not skipped.
                $mesg->pushContent(' ', fmt("content is identical to current version %d - no new revision created", $current->getVersion()));
                $skip = true;
            }
        }
        $isnew = false;
    }
    if (!$skip) {
        // in case of failures print the culprit:
        if (!isa($request, 'MockRequest')) {
            PrintXML(HTML::dt(WikiLink($pagename)));
            flush();
        }
//.........这里部分代码省略.........
开发者ID:neymanna,项目名称:fusionforge,代码行数:101,代码来源:loadsave.php

示例8: getFormElements

 function getFormElements()
 {
     global $WikiTheme;
     $request =& $this->request;
     $page =& $this->page;
     $h = array('action' => 'edit', 'pagename' => $page->getName(), 'version' => $this->version, 'edit[pagetype]' => $this->meta['pagetype'], 'edit[current_version]' => $this->_currentVersion);
     $el['HIDDEN_INPUTS'] = HiddenInputs($h);
     $el['EDIT_TEXTAREA'] = $this->getTextArea();
     if (ENABLE_CAPTCHA) {
         $el = array_merge($el, $this->Captcha->getFormElements());
     }
     $el['SUMMARY_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit[summary]', 'name' => 'edit[summary]', 'size' => 50, 'maxlength' => 256, 'value' => $this->meta['summary']));
     $el['MINOR_EDIT_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[minor_edit]', 'id' => 'edit[minor_edit]', 'checked' => (bool) $this->meta['is_minor_edit']));
     $el['OLD_MARKUP_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[markup]', 'value' => 'old', 'checked' => $this->meta['markup'] < 2.0, 'id' => 'useOldMarkup', 'onclick' => 'showOldMarkupRules(this.checked)'));
     $el['OLD_MARKUP_CONVERT'] = $this->meta['markup'] < 2.0 ? Button('submit:edit[edit_convert]', _("Convert"), 'wikiaction') : '';
     $el['LOCKED_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[locked]', 'id' => 'edit[locked]', 'disabled' => (bool) (!$this->user->isadmin()), 'checked' => (bool) $this->locked));
     $el['PREVIEW_B'] = Button('submit:edit[preview]', _("Preview"), 'wikiaction');
     //if (!$this->isConcurrentUpdate() && $this->canEdit())
     $el['SAVE_B'] = Button('submit:edit[save]', _("Save"), 'wikiaction');
     $el['IS_CURRENT'] = $this->version == $this->current->getVersion();
     $el['WIDTH_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editWidth]', 'id' => 'pref[editWidth]', 'value' => $request->getPref('editWidth'), 'onchange' => 'this.form.submit();'));
     $el['HEIGHT_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editHeight]', 'id' => 'pref[editHeight]', 'value' => $request->getPref('editHeight'), 'onchange' => 'this.form.submit();'));
     $el['SEP'] = $WikiTheme->getButtonSeparator();
     $el['AUTHOR_MESSAGE'] = fmt("Author will be logged as %s.", HTML::em($this->user->getId()));
     return $el;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:26,代码来源:editpage.php

示例9: _showvalue

 function _showvalue($key, $val, $prefix = '')
 {
     if (is_array($val) or is_object($val)) {
         return $val;
     }
     if (in_array($key, $this->hidden_pagemeta)) {
         return '';
     }
     if ($prefix) {
         $fullkey = $prefix . '[' . $key . ']';
         if (substr($fullkey, 0, 1) == '[') {
             $meta = "meta" . $fullkey;
             $fullkey = preg_replace("/\\]\\[/", "[", substr($fullkey, 1), 1);
         } else {
             $meta = preg_replace("/^([^\\[]+)\\[/", "meta[\$1][", $fullkey, 1);
         }
     } else {
         $fullkey = $key;
         $meta = "meta[" . $key . "]";
     }
     //$meta = "meta[".$fullkey."]";
     $arr = array('name' => $meta, 'value' => $val);
     if (strlen($val) > 20) {
         $arr['size'] = strlen($val);
     }
     if (in_array($key, $this->readonly_pagemeta)) {
         $arr['readonly'] = 'readonly';
         return HTML::input($arr);
     } else {
         return HTML(HTML::em($fullkey), HTML::br(), HTML::input($arr));
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:32,代码来源:EditMetaData.php

示例10: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (!$file) {
         return $this->error(sprintf(_("A required argument '%s' is missing."), 'file'));
     }
     if (!$display) {
         return $this->error(sprintf(_("A required argument '%s' is missing."), 'display'));
     }
     if (string_starts_with($file, "Upload:")) {
         $file = preg_replace("/^Upload:(.*)\$/", getUploadFilePath() . "\\1", $file);
         $is_Upload = 1;
     }
     $dir = getcwd();
     if (defined('PHPWIKI_DIR')) {
         chdir(PHPWIKI_DIR);
     }
     if (!file_exists($file)) {
         if ($quiet) {
             return HTML::raw('');
         } else {
             return $this->error(sprintf(_("File '%s' not found."), $file));
         }
     }
     // sanify $file name
     $realfile = realpath($file);
     // Hmm, allow ADMIN to check a local file? Only if its locked
     if (string_starts_with($realfile, realpath(getUploadDataPath()))) {
         $isuploaded = 1;
     } else {
         $page = $dbi->getPage($basepage);
         $user = $request->getUser();
         if ($page->getOwner() != ADMIN_USER or !$page->get('locked')) {
             // For convenience we warn the admin
             if ($quiet and $user->isAdmin()) {
                 return HTML::span(array('title' => _("Output suppressed. FileInfoPlugin with local files require a locked page.")), HTML::em(_("page not locked")));
             } else {
                 return $this->error("Invalid path \"{$file}\". Only ADMIN can allow local paths, and the page must be locked.");
             }
         }
     }
     $s = array();
     $modes = explode(",", $display);
     foreach ($modes as $mode) {
         switch ($mode) {
             case 'version':
                 $s[] = $this->exeversion($file);
                 break;
             case 'size':
                 $s[] = filesize($file);
                 break;
             case 'phonysize':
                 $s[] = $this->phonysize(filesize($file));
                 break;
             case 'date':
                 $s[] = strftime("%x %X", filemtime($file));
                 break;
             case 'mtime':
                 $s[] = filemtime($file);
                 break;
             case 'owner':
                 $o = posix_getpwuid(fileowner($file));
                 $s[] = $o['name'];
                 break;
             case 'group':
                 $o = posix_getgrgid(filegroup($file));
                 $s[] = $o['name'];
                 break;
             case 'name':
                 $s[] = basename($file);
                 break;
             case 'path':
                 $s[] = $file;
                 break;
             case 'dirname':
                 $s[] = dirname($file);
                 break;
             case 'magic':
                 $s[] = $this->magic($file);
                 break;
             case 'mime-typ':
                 $s[] = $this->mime_type($file);
                 break;
             case 'link':
                 if ($is_Upload) {
                     $s[] = " [" . $args['file'] . "]";
                 } elseif ($isuploaded) {
                     // will fail with user uploads
                     $s[] = " [Upload:" . basename($file) . "]";
                 } else {
                     $s[] = " [" . basename($file) . "] ";
                 }
                 break;
             default:
                 if (!$quiet) {
                     return $this->error(sprintf(_("Unsupported argument: %s=%s"), 'display', $mode));
                 } else {
                     return HTML::raw('');
                 }
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:FileInfo.php

示例11: MacOSX_PH_revision_formatter

function MacOSX_PH_revision_formatter(&$fmt, &$rev)
{
    $class = 'rc-' . $fmt->importance($rev);
    return HTML::li(array('class' => $class), $fmt->diffLink($rev), ' ', $fmt->pageLink($rev), ' ', $rev->get('is_minor_edit') ? $fmt->time($rev) : HTML::strong($fmt->time($rev)), ' . . . ', $fmt->summaryAsHTML($rev), ' -- ', $fmt->authorLink($rev), $rev->get('is_minor_edit') ? HTML::em(" (" . _("minor edit") . ")") : '');
}
开发者ID:hugcoday,项目名称:wiki,代码行数:5,代码来源:RecentChanges.php

示例12: getFormElements

 function getFormElements()
 {
     global $WikiTheme;
     $request =& $this->request;
     $page =& $this->page;
     $h = array('action' => 'edit', 'pagename' => $page->getName(), 'version' => $this->version, 'edit[pagetype]' => $this->meta['pagetype'], 'edit[current_version]' => $this->_currentVersion);
     $el['HIDDEN_INPUTS'] = HiddenInputs($h);
     $el['EDIT_TEXTAREA'] = $this->getTextArea();
     if (ENABLE_CAPTCHA) {
         $el = array_merge($el, $this->Captcha->getFormElements());
     }
     $el['SUMMARY_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit-summary', 'name' => 'edit[summary]', 'size' => 50, 'maxlength' => 256, 'value' => $this->meta['summary']));
     $el['MINOR_EDIT_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[minor_edit]', 'id' => 'edit-minor_edit', 'checked' => (bool) $this->meta['is_minor_edit']));
     $el['OLD_MARKUP_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[markup]', 'value' => 'old', 'checked' => $this->meta['markup'] < 2.0, 'id' => 'useOldMarkup', 'onclick' => 'showOldMarkupRules(this.checked)'));
     $el['OLD_MARKUP_CONVERT'] = $this->meta['markup'] < 2.0 ? Button('submit:edit[edit_convert]', _("Convert"), 'wikiaction') : '';
     $el['LOCKED_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[locked]', 'id' => 'edit-locked', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->locked));
     if (ENABLE_PAGE_PUBLIC) {
         $el['PUBLIC_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[public]', 'id' => 'edit-public', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->page->get('public')));
     }
     if (ENABLE_EXTERNAL_PAGES) {
         $el['EXTERNAL_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[external]', 'id' => 'edit-external', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->page->get('external')));
     }
     if (ENABLE_WYSIWYG) {
         if ($this->version == 0 and $request->getArg('mode') != 'wysiwyg') {
             $el['WYSIWYG_B'] = Button(array("action" => "edit", "mode" => "wysiwyg"), "Wysiwyg Editor");
         }
     }
     $el['PREVIEW_B'] = Button('submit:edit[preview]', _("Preview"), 'wikiaction', array('accesskey' => 'p', 'title' => 'Preview the current content [alt-p]'));
     //if (!$this->isConcurrentUpdate() && $this->canEdit())
     $el['SAVE_B'] = Button('submit:edit[save]', _("Save"), 'wikiaction', array('accesskey' => 's', 'title' => 'Save the current content as wikipage [alt-s]'));
     $el['CHANGES_B'] = Button('submit:edit[diff]', _("Changes"), 'wikiaction', array('accesskey' => 'c', 'title' => 'Preview the current changes as diff [alt-c]'));
     $el['UPLOAD_B'] = Button('submit:edit[upload]', _("Upload"), 'wikiaction', array('title' => 'Select a local file and press Upload to attach into this page'));
     $el['SPELLCHECK_B'] = Button('submit:edit[SpellCheck]', _("Spell Check"), 'wikiaction', array('title' => 'Check the spelling'));
     $el['IS_CURRENT'] = $this->version == $this->current->getVersion();
     $el['WIDTH_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editWidth]', 'id' => 'pref-editWidth', 'value' => $request->getPref('editWidth'), 'onchange' => 'this.form.submit();'));
     $el['HEIGHT_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editHeight]', 'id' => 'pref-editHeight', 'value' => $request->getPref('editHeight'), 'onchange' => 'this.form.submit();'));
     $el['SEP'] = $WikiTheme->getButtonSeparator();
     $el['AUTHOR_MESSAGE'] = fmt("Author will be logged as %s.", HTML::em($this->user->getId()));
     return $el;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:40,代码来源:editpage.php

示例13: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     // allow plugin-form
     if (!empty($s)) {
         $page = $s;
     }
     if (!$page) {
         return '';
     }
     if (!$dbi->isWikiPage($page)) {
         return fmt("Page %s not found.", WikiLink($page, 'unknown'));
     }
     $p = $dbi->getPage($page);
     include_once "lib/loadsave.php";
     $mailified = MailifyPage($p, $format == 'backup' ? 99 : 1);
     // fixup_headers massages the page dump headers depending on
     // the 'format' argument, 'normal'(default) or 'forcvs'.
     //
     // Normal: Don't add X-Rcs-Id, add unique Message-Id, don't
     // strip any fields from Content-Type.
     //
     // ForCVS: Add empty X-Rcs-Id, strip attributes from
     // Content-Type field: "author", "version", "lastmodified",
     // "author_id", "hits".
     $this->pagename = $page;
     $this->generateMessageId($mailified);
     if ($format == 'forcvs') {
         $this->fixup_headers_forcvs($mailified);
     } else {
         // backup or normal
         $this->fixup_headers($mailified);
     }
     if ($download) {
         // TODO: we need a way to hook into the generated headers, to override
         // Content-Type, Set-Cookie, Cache-control, ...
         $request->discardOutput();
         // Hijack the http request from PhpWiki.
         ob_end_clean();
         // clean up after hijacking $request
         //ob_end_flush(); //debugging
         Header("Content-disposition: attachment; filename=\"" . FilenameForPage($page) . "\"");
         // Read charset from generated page itself.
         // Inconsequential at the moment, since loadsave.php
         // always generates headers
         $charset = $p->get('charset');
         if (!$charset) {
             $charset = $GLOBALS['charset'];
         }
         // We generate 3 Content-Type headers! first in loadsave,
         // then here and the mimified string $mailified also has it!
         Header("Content-Type: text/plain; name=\"" . FilenameForPage($page) . "\"; charset=\"" . $charset . "\"");
         $request->checkValidators();
         // let $request provide last modifed & etag
         Header("Content-Id: <" . $this->MessageId . ">");
         // be nice to http keepalive~s
         // FIXME: he length is wrong BTW. must strip the header.
         Header("Content-Length: " . strlen($mailified));
         // Here comes our prepared mime file
         echo $mailified;
         exit;
         // noreturn! php exits.
         return;
     }
     // We are displaing inline preview in a WikiPage, so wrap the
     // text if it is too long--unless quoted-printable (TODO).
     $mailified = safe_wordwrap($mailified, 70);
     $dlcvs = Button(array('action' => $this->getName(), 'format' => 'forcvs', 'download' => true), _("Download for CVS"), $page);
     $dl = Button(array('action' => $this->getName(), 'download' => true), _("Download for backup"), $page);
     $dlall = Button(array('action' => $this->getName(), 'format' => 'backup', 'download' => true), _("Download all revisions for backup"), $page);
     $h2 = HTML::h2(fmt("Preview: Page dump of %s", WikiLink($page, 'auto')));
     global $WikiTheme;
     if (!($Sep = $WikiTheme->getButtonSeparator())) {
         $Sep = " ";
     }
     if ($format == 'forcvs') {
         $desc = _("(formatted for PhpWiki developers as pgsrc template, not for backing up)");
         $altpreviewbuttons = HTML(Button(array('action' => $this->getName()), _("Preview as normal format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page));
     } elseif ($format == 'backup') {
         $desc = _("(formatted for backing up: all revisions)");
         // all revisions
         $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => ''), _("Preview as normal format"), $page));
     } else {
         $desc = _("(normal formatting: latest revision only)");
         $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page));
     }
     $warning = HTML(_("Please use one of the downloadable versions rather than copying and pasting from the above preview.") . " " . _("The wordwrap of the preview doesn't take nested markup or list indentation into consideration!") . " ", HTML::em(_("PhpWiki developers should manually inspect the downloaded file for nested markup before rewrapping with emacs and checking into CVS.")));
     return HTML($h2, HTML::em($desc), HTML::pre($mailified), $altpreviewbuttons, HTML::div(array('class' => 'errors'), HTML::strong(_("Warning:")), " ", $warning), $dl, $Sep, $dlall, $Sep, $dlcvs);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:89,代码来源:PageDump.php

示例14: _work

 function _work($pagename, $args, $dbi, &$request)
 {
     if (empty($args['s'])) {
         if ($request->isPost()) {
             if ($pagename != _("AppendText")) {
                 return HTML($request->redirect(WikiURL($pagename, false, 'absurl'), false));
             }
         }
         return '';
     }
     $page = $dbi->getPage($pagename);
     $message = HTML();
     if (!$page->exists()) {
         // We might want to create it?
         $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!\n"), $pagename));
         return $message;
     }
     $current = $page->getCurrentRevision();
     $oldtext = $current->getPackedContent();
     $text = $args['s'];
     // If a "before" or "after" is specified but not found, we simply append text to the end.
     if (!empty($args['before'])) {
         $before = preg_quote($args['before'], "/");
         // Insert before
         $newtext = preg_match("/\n{$before}/", $oldtext) ? preg_replace("/(\n{$before})/", "\n" . preg_quote($text, "/") . "\\1", $oldtext) : $this->_fallback($text, $oldtext, $args['before'], $message);
     } elseif (!empty($args['after'])) {
         // Insert after
         $after = preg_quote($args['after'], "/");
         $newtext = preg_match("/\n{$after}/", $oldtext) ? preg_replace("/(\n{$after})/", "\\1\n" . preg_quote($text, "/"), $oldtext) : $this->_fallback($text, $oldtext, $args['after'], $message);
     } else {
         // Append at the end
         $newtext = $oldtext . "\n" . $text;
     }
     require_once "lib/loadsave.php";
     $meta = $current->_data;
     $meta['summary'] = sprintf(_("AppendText to %s"), $pagename);
     if ($page->save($newtext, $current->getVersion() + 1, $meta)) {
         $message->pushContent(_("Page successfully updated."), HTML::br());
     }
     // AppendText has been called from the same page that got modified
     // so we directly show the page.
     if ($request->getArg($pagename) == $pagename) {
         // TODO: Just invalidate the cache, if AppendText didn't
         // change anything before.
         //
         return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
         // The user asked to be redirected to the modified page
     } elseif ($args['redirect']) {
         return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
     } else {
         $link = HTML::em(WikiLink($pagename));
         $message->pushContent(HTML::Raw(sprintf(_("Go to %s."), $link->asXml())));
     }
     return $message;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:55,代码来源:AppendText.php

示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     // no action=replace support yet
     if ($request->getArg('action') != 'browse') {
         return $this->disabled("(action != 'browse')");
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     //TODO: support p from <!plugin-list !>
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_replace');
     $next_action = 'select';
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     }
     if ($p && $request->isPost() && empty($post_args['cancel'])) {
         // without individual PagePermissions:
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         if ($post_args['action'] == 'verify' and !empty($post_args['from'])) {
             // Real action
             return $this->searchReplacePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to']);
         }
         if ($post_args['action'] == 'select') {
             if (!empty($post_args['from'])) {
                 $next_action = 'verify';
             }
             foreach ($p as $name => $c) {
                 $pages[$name] = 1;
             }
         }
     }
     if ($next_action == 'select' and empty($pages)) {
         // List all pages to select from.
         //TODO: check for permissions and list only the allowed
         $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
     }
     if ($next_action == 'verify') {
         $args['info'] = "checkbox,pagename,hi_content";
     }
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array_merge($args, array('types' => array('hi_content' => new _PageList_Column_content('rev:hi_content', _("Content"))))));
     $pagelist->addPageList($pages);
     $header = HTML::p();
     if (empty($post_args['from'])) {
         $header->pushContent(HTML::p(HTML::em(_("Warning: The search string cannot be empty!"))));
     }
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently search & replace text in the selected files?"))));
         $this->replaceForm($header, $post_args);
     } else {
         $button_label = _("Search & Replace");
         $this->replaceForm($header, $post_args);
         $header->pushContent(HTML::p(_("Select the pages to search:")));
     }
     $buttons = HTML::p(Button('submit:admin_replace[rename]', $button_label, 'wikiadmin'), Button('submit:admin_replace[cancel]', _("Cancel"), 'button'));
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_replace')), HiddenInputs(array('admin_replace[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:65,代码来源:WikiAdminSearchReplace.php


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