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


PHP e107::getBB方法代码示例

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


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

示例1: display_help

function display_help($tagid = "helpb", $mode = 1, $addtextfunc = "addtext", $helpfunc = "help", $helpsize = '')
{
    return e107::getBB()->renderButtons($mode, 'data');
    // guessing the name of the textarea as 'data' no indicator unfortunately.
    // may cause pre-image and pre-file selector issues.
    //  if(defsettrue('e_WYSIWYG')) { return; }
    global $tp, $pref, $eplug_bb, $bbcode_func, $register_bb, $bbcode_help, $bbcode_helpactive, $bbcode_helptag, $bbcode_helpsize;
    $bbcode_helpsize = $helpsize;
    $bbcode_func = $addtextfunc;
    $bbcode_help = $helpfunc;
    $bbcode_helptag = $tagid;
    // $arr = get_defined_vars();
    // print_a($arr);
    // load the template
    if (is_readable(THEME . "bbcode_template.php")) {
        include THEME . "bbcode_template.php";
    } else {
        include e_THEME . "templates/bbcode_template.php";
    }
    if ($mode != 2 && $mode != "forum") {
        $bbcode_helpactive = TRUE;
    }
    // Load the Plugin bbcode AFTER the templates, so they can modify or replace.
    if (!empty($pref['e_bb_list'])) {
        foreach ($pref['e_bb_list'] as $val) {
            if (is_readable(e_PLUGIN . $val . "/e_bb.php")) {
                require e_PLUGIN . $val . "/e_bb.php";
            }
        }
    }
    $temp = array();
    $temp['news'] = $BBCODE_TEMPLATE_NEWSPOST;
    $temp['submitnews'] = $BBCODE_TEMPLATE_SUBMITNEWS;
    $temp['extended'] = $BBCODE_TEMPLATE_NEWSPOST;
    $temp['admin'] = $BBCODE_TEMPLATE_ADMIN;
    $temp['mailout'] = $BBCODE_TEMPLATE_MAILOUT;
    $temp['page'] = $BBCODE_TEMPLATE_CPAGE;
    $temp['maintenance'] = $BBCODE_TEMPLATE_ADMIN;
    $temp['comment'] = $BBCODE_TEMPLATE;
    $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE;
    if (isset($temp[$mode])) {
        $BBCODE_TEMPLATE = $temp[$mode];
    }
    $visible = deftrue('e_WYSIWYG') ? "style='display:none'" : "";
    if (is_readable(e_CORE . "shortcodes/batch/bbcode_shortcodes.php")) {
        $sc = e107::getScBatch('bbcode');
        if ($tagid == 'data') {
            $tagid = 'data_';
        }
        $data = array('tagid' => $tagid, 'template' => $mode, 'trigger' => $addtextfunc, 'hint_func' => $helpfunc, 'hint_active' => $bbcode_helpactive, 'size' => $helpsize);
        $sc->setVars($data);
        return "<div id='bbcode-panel-" . $tagid . "' class='mceToolbar bbcode-panel' {$visible}>" . $tp->parseTemplate($BBCODE_TEMPLATE) . "</div>";
    } else {
        return "ERROR: " . e_CORE . "shortcodes/batch/bbcode_shortcodes.php IS NOT READABLE.";
    }
}
开发者ID:notzen,项目名称:e107,代码行数:56,代码来源:ren_help.php

示例2: sc_newsbody

 function sc_newsbody($parm)
 {
     e107::getBB()->setClass("news");
     $news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
     if ($this->news_item['news_extended'] && (isset($_POST['preview']) || $this->param['current_action'] == 'extend') && $parm != 'noextend') {
         $news_body .= $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
     }
     e107::getBB()->clearClass();
     return $news_body;
 }
开发者ID:notzen,项目名称:e107,代码行数:10,代码来源:news_shortcodes.php

示例3: toHTML

 /**
  *	Translate to <p> tag
  */
 function toHTML($code_text, $parm)
 {
     if ($parm && !strpos($parm, '=')) {
         $parm = 'class=' . $parm;
     }
     $code_text = trim($code_text);
     $parms = eHelper::scParams($parm);
     $class = " " . e107::getBB()->getClass('p');
     // consistent classes across all themes.
     $id = varsettrue($parms['id']) ? ' id="' . eHelper::secureIdAttr($parms['id']) . '"' : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     return "<p{$id}{$class}{$style}>" . $code_text . '</p>';
 }
开发者ID:notzen,项目名称:e107,代码行数:16,代码来源:bb_p.php

示例4: toHTML

 /**
  *	Send output to browser. 
  */
 function toHTML($code_text, $parm)
 {
     global $e107cache;
     $class = e107::getBB()->getClass('code');
     $pref = e107::getPref();
     $tp = e107::getParser();
     if ($pref['smiley_activate']) {
         if (!is_object($tp->e_emote)) {
             $tp->e_emote = new e_emoteFilter();
         }
         $code_text = $tp->e_emote->filterEmotesRev($code_text);
     }
     $search = array(E_NL, '&#092;', '&#036;', '&lt;');
     $replace = array("\r\n", "\\", '$', '<');
     $code_text = str_replace($search, $replace, $code_text);
     if (isset($pref['useGeshi']) && $pref['useGeshi'] && file_exists(e_PLUGIN . "geshi/geshi.php")) {
         $code_md5 = md5($code_text);
         if (!($CodeCache = $e107cache->retrieve('GeshiParsed_' . $code_md5))) {
             require_once e_PLUGIN . "geshi/geshi.php";
             if ($parm) {
                 $geshi = new GeSHi($code_text, $parm, e_PLUGIN . "geshi/geshi/");
             } else {
                 $geshi = new GeSHi($code_text, $pref['defaultLanGeshi'] ? $pref['defaultLanGeshi'] : 'php', e_PLUGIN . "geshi/geshi/");
             }
             $geshi->line_style1 = "font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;";
             $geshi->set_encoding('utf-8');
             $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
             $geshi->set_header_type(GESHI_HEADER_DIV);
             $CodeCache = $geshi->parse_code();
             $e107cache->set('GeshiParsed_' . $code_md5, $CodeCache);
         }
         $ret = "<code class='code_highlight code-box {$class}' style='unicode-bidi: embed; direction: ltr'>" . str_replace("&amp;", "&", $CodeCache) . "</code>";
     } else {
         $code_text = html_entity_decode($code_text, ENT_QUOTES, 'utf-8');
         $code_text = trim($code_text);
         $code_text = htmlspecialchars($code_text, ENT_QUOTES, 'utf-8');
         $srch = array('{', '}');
         $repl = array('&lbrace;', '&rbrace;');
         $code_text = str_replace($srch, $repl, $code_text);
         // avoid code getting parsed as templates or shortcodes.
         if ($parm == 'inline') {
             return "<code style='unicode-bidi: embed; direction: ltr'>" . $code_text . "</code>";
         }
         //	$highlighted_text = highlight_string($code_text, TRUE);
         // highlighted_text = str_replace(array("<code>","</code>"),"",$highlighted_text);
         $divClass = $parm ? $parm : 'code_highlight';
         $ret = "<pre class='prettyprint linenums " . $tp->toAttribute($divClass) . " code-box {$class}' style='unicode-bidi: embed; direction: ltr'>" . $code_text . "</pre>";
     }
     $ret = str_replace("[", "&#091;", $ret);
     return $ret;
 }
开发者ID:armpit,项目名称:e107,代码行数:54,代码来源:bb_code.php

示例5: sc_newsbody

 function sc_newsbody($parm = null)
 {
     $tp = e107::getParser();
     e107::getBB()->setClass("news");
     // For automatic bbcode image resizing.
     if ($parm != 'extended') {
         $news_body = $tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
     }
     if ($this->news_item['news_extended'] && (isset($_POST['preview']) || $this->param['current_action'] == 'extend') && ($parm != 'noextend' && $parm != 'body')) {
         $news_body .= $tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
     }
     e107::getBB()->clearClass();
     return $news_body;
 }
开发者ID:gitye,项目名称:e107,代码行数:14,代码来源:news_shortcodes.php

示例6: toHTML

 /**
  *	Translate youtube bbcode into the appropriate HTML
  */
 function toHTML($code_text, $parm)
 {
     // transform to class, equal sign at 0 position is not well formed parm string
     if ($parm && !strpos($parm, '=')) {
         $parm = 'class=' . $parm;
     }
     $parms = eHelper::scParams($parm);
     $class = " " . e107::getBB()->getClass('block');
     $id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     if (empty($code_text)) {
         $code_text = '<!-- -->';
     }
     return '<div' . $id . $class . $style . '>' . $code_text . '</div>';
 }
开发者ID:notzen,项目名称:e107,代码行数:18,代码来源:bb_block.php

示例7: toHTML

 /**
  *	Translate to <h*> tag
  */
 function toHTML($code_text, $parm)
 {
     $code_text = trim($code_text);
     if (empty($code_text)) {
         return '';
     }
     $bparms = eHelper::scDualParams($parm);
     $h = 'h' . ($bparms[1] ? intval($bparms[1]) : 2);
     $parms = $bparms[2];
     unset($bparms);
     $class = " " . e107::getBB()->getClass('h2');
     // consistent classes across all themes.
     $id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     return "<{$h}{$id}{$class}{$style}>" . $code_text . "</{$h}>";
 }
开发者ID:notzen,项目名称:e107,代码行数:19,代码来源:bb_h.php

示例8: parsePage

 public function parsePage()
 {
     $tp = e107::getParser();
     e107::getBB()->setClass("page");
     $this->pageTitles = array();
     // Notice removal
     if (preg_match_all('/\\[newpage.*?\\]/si', $this->pageText, $pt)) {
         if (substr($this->pageText, 0, 6) == '[html]') {
             // Need to strip html bbcode from wysiwyg on multi-page docs (handled automatically on single pages)
             if (substr($this->pageText, -7, 7) == '[/html]') {
                 $this->pageText = substr($this->pageText, 6, -7);
             } else {
                 $this->pageText = substr($this->pageText, 6);
             }
         }
         $pages = preg_split("/\\[newpage.*?\\]/si", $this->pageText, -1, PREG_SPLIT_NO_EMPTY);
         $this->multipageFlag = TRUE;
     } else {
         // $this->pageToRender = $tp->toHTML($this->pageText, TRUE, 'BODY');
         // Remove double parsing - it breaks HTML (inserts <br> as [html] is already removed)
         $this->pageToRender = $this->pageText;
         return;
     }
     foreach ($pt[0] as $title) {
         $this->pageTitles[] = $title;
     }
     if (!trim($pages[0])) {
         $count = 0;
         foreach ($pages as $page) {
             $pages[$count] = $pages[$count + 1];
             $count++;
         }
         unset($pages[count($pages) - 1]);
     }
     $pageCount = count($pages);
     $titleCount = count($this->pageTitles);
     /* if the vars above don't match, page 1 has no [newpage] tag, so we need to create one ... */
     if ($pageCount != $titleCount) {
         array_unshift($this->pageTitles, "[newpage]");
     }
     /* ok, titles now match pages, rename the titles if needed ... */
     $count = 0;
     foreach ($this->pageTitles as $title) {
         $titlep = preg_replace("/\\[newpage=(.*?)\\]/", "\\1", $title);
         $this->pageTitles[$count] = $titlep == "[newpage]" ? LAN_PAGE_13 . " " . ($count + 1) : $tp->toHTML($titlep, TRUE, 'TITLE');
         $count++;
     }
     $this->pageToRender = $tp->toHTML($pages[$this->pageSelected], TRUE, 'BODY');
     $this->title = substr($this->pageTitles[$this->pageSelected], -1) == ";" ? "" : $this->pageTitles[$this->pageSelected];
     if ($this->debug) {
         echo "<b>multipageFlag</b> " . $this->multipageFlag . " <br />";
         if ($this->multipageFlag) {
             echo "<pre>";
             print_r($pages);
             echo "</pre>";
             echo "<b>pageCount</b> " . $pageCount . " <br />";
             echo "<b>titleCount</b> " . $titleCount . " <br />";
             echo "<pre>";
             print_r($this->pageTitles);
             echo "</pre>";
         }
     }
     e107::getBB()->clearClass();
 }
开发者ID:armpit,项目名称:e107,代码行数:64,代码来源:page.php

示例9: stripslashes

<?php

/*
 * e107 website system
 *
 * Copyright (C) e107 Inc (e107.org)
 * Released under the terms and conditions of the
 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
 *
 * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_handlers/bbcode_handler.php $
 * $Id: bbcode_handler.php 12778 2012-06-02 08:12:16Z e107coders $
 */
require_once "../../../../class2.php";
if ($_POST['mode'] == 'tohtml') {
    $content = $tp->toDB($_POST['content']);
    e107::getBB()->setClass($_SESSION['media_category']);
    echo $tp->toHtml($content, true);
    e107::getBB()->clearClass();
}
if ($_POST['mode'] == 'tobbcode') {
    // echo $_POST['content'];
    $content = stripslashes($_POST['content']);
    echo e107::getBB()->htmltoBBcode($content);
}
开发者ID:notzen,项目名称:e107,代码行数:24,代码来源:parser.php

示例10: setNewsFrontMeta

function setNewsFrontMeta($news, $type = 'news')
{
    $tp = e107::getParser();
    if ($type == 'news') {
        if ($news['news_title'] && !defined('e_PAGETITLE')) {
            define('e_PAGETITLE', $news['news_title']);
            e107::meta('og:title', $news['news_title']);
            e107::meta('og:type', 'article');
        }
        if ($news['news_meta_description'] && !defined('META_DESCRIPTION')) {
            e107::meta('description', $news['news_meta_description']);
            e107::meta('og:description', $news['news_meta_description']);
            //define('META_DESCRIPTION', $news['news_meta_description']); // deprecated
        } elseif ($news['news_summary']) {
            e107::meta('og:description', $news['news_summary']);
        }
        // grab all images in news-body and add to meta.
        $images = e107::getBB()->getContent('img', $news['news_body'], SITEURL . e_IMAGE . "newspost_images/");
        foreach ($images as $im) {
            e107::meta('og:image', $im);
        }
        // grab all youtube videos in news-body and add thumbnails to meta.
        $youtube = e107::getBB()->getContent('youtube', $news['news_body']);
        foreach ($youtube as $yt) {
            list($img, $tmp) = explode("?", $yt);
            e107::meta('og:image', "http://img.youtube.com/vi/" . $img . "/0.jpg");
        }
        // include news-thumbnail/image in meta.
        if ($news['news_thumbnail']) {
            $iurl = substr($news['news_thumbnail'], 0, 3) == "{e_" ? $tp->replaceConstants($news['news_thumbnail'], 'full') : SITEURL . e_IMAGE . "newspost_images/" . $news['news_thumbnail'];
            $tmp = explode(",", $iurl);
            foreach ($tmp as $mimg) {
                if (substr($mimg, -8) == '.youtube') {
                    continue;
                }
                e107::meta('og:image', $mimg);
            }
        }
        $url = e107::getUrl()->create('news/view/item', $news, 'full=1');
        e107::meta('og:url', $url);
        e107::meta('article:section', $news['category_name']);
        if ($news['news_meta_keywords'] && !defined('META_KEYWORDS')) {
            e107::meta('keywords', $news['news_meta_keywords']);
            $tmp = explode(",", $news['news_meta_keywords']);
            foreach ($tmp as $t) {
                e107::meta('article:tag', trim($t));
            }
            //	define('META_KEYWORDS', $news['news_meta_keywords']); // deprecated
        }
        /* Facebook reference. 
         * http://developers.facebook.com/docs/opengraph/objects/builtin/
         */
        return;
    }
    if ($news['category_name'] && !defined('e_PAGETITLE')) {
        define('e_PAGETITLE', $tp->toHtml($news['category_name'], false, 'TITLE_PLAIN'));
    }
    if ($news['category_meta_keywords'] && !defined('META_KEYWORDS')) {
        define('META_KEYWORDS', $news['category_meta_keywords']);
    }
    if ($news['category_meta_description'] && !defined('META_DESCRIPTION')) {
        define('META_DESCRIPTION', $news['category_meta_description']);
    }
}
开发者ID:xxlinkexx,项目名称:e107,代码行数:64,代码来源:news.php

示例11: mediaSelect

 public function mediaSelect($category = '', $tagid = null, $att = null)
 {
     parse_str($att, $option);
     // grab 'onclick' .
     $frm = $option['from'] ? $option['from'] : 0;
     $limit = $option['limit'] ? $option['limit'] : 20;
     $newfrm = $frm + $limit;
     $bbcode = $option['bbcode'] ? $option['bbcode'] : null;
     $navMode = $option['nav'] ? TRUE : FALSE;
     $search = $option['search'] ? $option['search'] : null;
     if ($category != '_icon') {
         $cat = $category ? $category . "+" : "";
         // the '+' loads category '_common' as well as the chosen category.
         $images = $this->getImages($cat, $frm, $limit, $search);
         $class = "media-select-image";
         $w = 120;
         $h = 100;
         $total = $this->countImages($cat, $search);
     } else {
         $cat = "";
         $images = $this->getIcons($cat, 0, 200);
         $class = "media-select-icon";
         $w = 64;
         $h = 64;
         $total = 500;
         // $total	= $this->countIcons($cat); //TODO
     }
     //	$total_images 	= $this->getImages($cat); // for use by next/prev in filter at some point.
     $att = 'aw=120&ah=100';
     $prevId = $tagid . "_prev";
     // EXAMPLE of FILTER GUI.
     //	$text .= "CAT=".$cat;
     $dipTotal = $frm + $limit < $total ? $frm + $limit : $total;
     if ($navMode === false) {
         /*
         *     <div class="input-append">
             <input class="span2" id="appendedInputButtons" type="text">
             <button class="btn" type="button">Search</button>
             <button class="btn" type="button">Options</button>
             </div>
         */
         $text .= "<div style='margin-top:10px'>Filter: <input type='text' id='media-search' title='Enter some text to filter results' name='search' value='' class='e-tip' data-target='media-select-container' data-src='" . $this->mediaSelectNav($category, "tagid=" . $tagid . "&bbcode=" . $bbcode) . "&amp;from=0' />";
         //	$text .= "<input type='button' value='Go' class='btn btn-primary e-media-nav' data-target='media-select-container' data-src='".$this->mediaSelectNav($category,"tagid=".$tagid."&bbcode=".$bbcode)."&amp;from=0' /> "; // Manual filter, if onkeyup ajax fails for some reason.
         $text .= "<button type='button' value='Go' class='btn btn-primary e-media-nav' data-target='media-select-container' data-src='" . $this->mediaSelectNav($category, "tagid=" . $tagid . "&bbcode=" . $bbcode) . "&amp;from=0' >Go</button>";
         // Manual filter, if onkeyup ajax fails for some reason.
         $text .= "&nbsp;<button type='button' title='previous page' class='btn button e-nav e-media-nav e-tip'  data-target='media-select-container' data-nav-total='" . $total . "' data-nav-dir='down' data-nav-inc='" . $limit . "' data-src='" . $this->mediaSelectNav($category, "tagid=" . $tagid . "&bbcode=" . $bbcode) . "&amp;from=0' >&laquo;</button>";
         // see next page of images.
         $text .= "<button type='button' title='next page' class='btn button e-nav e-media-nav e-tip' style='text-align:center'  data-target='media-select-container' data-nav-total='" . $total . "' data-nav-dir='up' data-nav-inc='" . $limit . "' data-src='" . $this->mediaSelectNav($category, "tagid=" . $tagid . "&bbcode=" . $bbcode) . "&amp;from=0' >&raquo;</button>";
         // see next page of images.
         $text .= "</div>\r\n\t\t\t<div id='media-select-container'>";
     }
     $text .= "\r\n\t\t<div style='text-align:right; display:block'> Displaying " . ($frm + 1) . "-" . $dipTotal . " of " . $total . " images.</div>\n";
     if ($bbcode == null) {
         $onclick_clear = "parent.document.getElementById('{$tagid}').value = '';\r\n\t\t \tparent.document.getElementById('" . $prevId . "').src = '" . e_IMAGE_ABS . "generic/blank.gif';\r\n\t\t \t return false;";
         $text .= "<a class='{$class} media-select-none e-dialog-close' data-src='{$im['media_url']}' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >\r\n\t\t\t<div style='text-align:center;position: relative; top: 30%'>No image</div>\r\n\t\t\t</a>";
     }
     $srch = array("{MEDIA_URL}", "{MEDIA_PATH}");
     $w = false;
     $h = false;
     if ($bbcode) {
         e107::getBB()->setClass($category);
         $w = e107::getBB()->resizeWidth();
         // resize the image according to prefs.
         $h = e107::getBB()->resizeHeight();
         e107::getBB()->clearclass();
     }
     $tp = e107::getParser();
     //	e107::getParser()
     foreach ($images as $im) {
         $class = $category != '_icon' ? "media-select-image" : "media-select-icon";
         $media_path = $w || $h ? $tp->thumbUrl($im['media_url'], "w={$w}&h={$h}") : $tp->replaceConstants($im['media_url'], 'full');
         // max-size
         $realPath = $tp->thumbUrl($im['media_url'], $att);
         $diz = $tp->toAttribute($im['media_title']) . "\n" . $im['media_dimensions'];
         $repl = array($im['media_url'], $media_path);
         if ($bbcode == null) {
             $onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}';\r\n\t\t \t\tparent.document.getElementById('" . $prevId . "').src = '{$realPath}';\r\n\t\t \t\treturn false;";
             //$onclicki = "";
             $class .= " e-media-select e-dialog-close";
         } else {
             //TODO Add a preview window
             $onclicki = "document.getElementById('src').value = '{$im['media_url']}';\r\n\t\t\t\tdocument.getElementById('preview').src = '{$realPath}';\r\n\t\t \t\t\r\n\t\t\t\treturn false;";
             //$onclicki = "";
             $class .= " e-media-select";
             $onclicki = "";
         }
         $data_bb = $bbcode ? "img" : "";
         $img_url = $cat != '_icon' ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path;
         $text .= "<a class='{$class} e-tip' data-id='{$im['media_id']}' data-src='{$media_path}' data-bbcode='{$data_bb}' data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"" . $diz . "\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
         $text .= "<img src='" . $img_url . "' alt=\"" . $im['media_title'] . "\" title=\"{$diz}\" />";
         $text .= "</a>\n\n";
     }
     $text .= "<div style='clear:both'><!-- --></div>";
     $mes = e107::getMessage();
     $mes->addDebug("Target: {$tagid}");
     if ($navMode === false) {
         $text .= "</div>";
     }
     return $text;
 }
开发者ID:notzen,项目名称:e107,代码行数:100,代码来源:media_class.php

示例12: bbarea

 /**
  * Bbcode Area. Name, value, template, media-Cat, size, options array eg. counter
  * IMPORTANT: $$mediaCat is also used is the media-manager category identifier
  * @param $name
  * @param $value
  * @param $template
  * @param $mediaCat _common
  * @param $size : small | medium | large
  * @param $options array(); 
  */
 function bbarea($name, $value, $template = '', $mediaCat = '_common', $size = 'large', $options = array())
 {
     if (is_string($options)) {
         parse_str($options, $options);
     }
     //size - large|medium|small
     //width should be explicit set by current admin theme
     //	$size = 'input-large';
     switch ($size) {
         case 'tiny':
             $rows = '3';
             //	$height = "style='height:250px'"; // inline required for wysiwyg
             break;
         case 'small':
             $rows = '7';
             $height = "style='height:230px'";
             // inline required for wysiwyg
             $size = "input-block-level";
             break;
         case 'medium':
             $rows = '10';
             $height = "style='height:375px'";
             // inline required for wysiwyg
             $size = "input-block-level";
             break;
         case 'large':
         default:
             $rows = '15';
             $size = 'large input-block-level';
             //	$height = "style='height:500px;width:1025px'"; // inline required for wysiwyg
             break;
     }
     // auto-height support
     $options['class'] = 'tbox bbarea ' . ($size ? ' ' . $size : '') . ' e-wysiwyg e-autoheight form-control';
     $bbbar = '';
     $help_tagid = $this->name2id($name) . "--preview";
     if (e107::wysiwyg(true) === false) {
         $options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' {$height}";
     } else {
         $options['other'] = " " . $height;
     }
     $counter = vartrue($options['counter'], false);
     $ret = "<div class='bbarea {$size}'>\r\n\t\t<div class='field-spacer'><!-- --></div>\n";
     $ret .= e107::getBB()->renderButtons($template, $help_tagid);
     $ret .= $this->textarea($name, $value, $rows, 70, $options, $counter);
     // higher thank 70 will break some layouts.
     $ret .= "</div>\n";
     $_SESSION['media_category'] = $mediaCat;
     // used by TinyMce.
     return $ret;
     // Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler
     /*
     
     		e107::getJs()->footerInline("
     				if(typeof tinyMCE === 'undefined')
     				{
     					\$$('a.e-wysiwyg-switch').invoke('hide');
     				}
     		");
     */
 }
开发者ID:armpit,项目名称:e107,代码行数:71,代码来源:form_handler.php

示例13: mediaSelect

 public function mediaSelect($category = '', $tagid = null, $att = null)
 {
     if (is_string($att)) {
         parse_str($att, $option);
         // grab 'onclick' .
     } else {
         $option = $att;
     }
     $frm = varset($option['from']) ? $option['from'] : 0;
     $limit = varset($option['limit']) ? $option['limit'] : 20;
     $newfrm = $frm + $limit;
     $bbcode = varset($option['bbcode']) ? $option['bbcode'] : null;
     $navMode = varset($option['nav']) ? TRUE : FALSE;
     $search = varset($option['search']) ? $option['search'] : null;
     if ($category != '_icon') {
         $cat = $category ? $category . "+" : "";
         // the '+' loads category '_common' as well as the chosen category.
         $images = $this->getImages($cat, $frm, $limit, $search);
         $class = "media-select-image";
         $w = 120;
         $h = 100;
         $total = $this->countImages($cat, $search);
     } else {
         $cat = "";
         $images = $this->getIcons($cat, 0, 200);
         $class = "media-select-icon";
         $w = 64;
         $h = 64;
         $total = 500;
         $total = $this->countImages("_icon_16|_icon_32|_icon_48|_icon_64", $search);
         // $total	= $this->countIcons($cat); //TODO
     }
     //	$total_images 	= $this->getImages($cat); // for use by next/prev in filter at some point.
     $prevAtt = '&aw=' . vartrue($option['w'], $w);
     // .'&ah=100';	// Image Parsed back to Form as PREVIEW image.
     $prevId = $tagid . "_prev";
     // ID of image in Form.
     $thumbAtt = 'aw=120&ah=120';
     // Thumbnail of the Media-Manager Preview.
     // EXAMPLE of FILTER GUI.
     $text = "";
     $dipTotal = $frm + $limit < $total ? $frm + $limit : $total;
     if ($navMode === false) {
         //	$data_src = $this->mediaSelectNav($category,$tagid, "bbcode=".$bbcode)."&amp;from=0";
         $data_src = $this->mediaSelectNav($category, $tagid, $option);
         // ."&amp;from=0";
         // Inline style to override jquery-ui stuff.
         $text .= "<div>\r\n\t\t\t<div id='admin-ui-media-manager-search' class='input-append form-inline' style='margin-top:10px;font-size:12px'>\r\n\t\t\t<input type='text' id='media-search' placeholder='Search...' name='search' value='' class='e-tip' data-target='media-select-container' data-src='" . $data_src . "' />\r\n\t\t\t";
         //	$text .= "<input type='button' value='Go' class='btn btn-primary e-media-nav' data-target='media-select-container' data-src='".$this->mediaSelectNav($category,"tagid=".$tagid."&bbcode=".$bbcode)."&amp;from=0' /> "; // Manual filter, if onkeyup ajax fails for some reason.
         $text .= "<button type='button'  class='btn btn-primary e-media-nav' data-target='media-select-container' data-src='" . $data_src . "' >Go</button>";
         // Manual filter, if onkeyup ajax fails for some reason.
         $text .= "<button id='admin-ui-media-nav-down' type='button' title='previous page' class='btn btn-default e-nav e-media-nav e-tip' style='outline:0' data-target='media-select-container' data-nav-total='" . $total . "' data-nav-dir='down' data-nav-inc='" . $limit . "' data-src='" . $data_src . "'>&laquo;</button>";
         // see next page of images.
         $text .= "<button id='admin-ui-media-nav-up' type='button' title='next page' class='btn btn-default e-nav e-media-nav e-tip' style='outline:0;text-align:center'  data-target='media-select-container' data-nav-total='" . $total . "' data-nav-dir='up' data-nav-inc='" . $limit . "' data-src='" . $data_src . "' >&raquo;</button>";
         // see next page of images.
         $text .= "</div></div>";
         $text .= "<div id='admin-ui-media-select-count' class='media-select-count' style='text-align:right; display:block'> Displaying " . ($frm + 1) . "-" . $dipTotal . " of " . $total . " images.</div>\n";
         $text .= "\r\n\t\t\t<div id='media-select-container'>";
     }
     $text .= "<div id='admin-ui-media-select-count-hidden' class='media-select-count' data-media-select-current-limit='" . $dipTotal . "' style='text-align:right; display:none'> Displaying " . ($frm + 1) . "-" . $dipTotal . " of " . $total . " images.</div>\n";
     if ($bbcode == null) {
         $onclick_clear = "parent.document.getElementById('{$tagid}').value = '';\r\n\t\t \tparent.document.getElementById('" . $prevId . "').src = '" . e_IMAGE_ABS . "generic/blank.gif';\r\n\t\t \t return false;";
         $text .= "<a class='thumbnail {$class} media-select-none e-dialog-close' data-src='" . varset($im['media_url']) . "' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >\r\n\t\t\t<div style='text-align:center;position: relative; top: 30%'>No image</div>\r\n\t\t\t</a>";
     }
     $srch = array("{MEDIA_URL}", "{MEDIA_PATH}");
     $w = false;
     //
     $h = false;
     $defaultResizeWidth = 400;
     if ($bbcode) {
         e107::getBB()->setClass($category);
         $defaultResizeWidth = e107::getBB()->resizeWidth();
         // resize the image according to prefs.
         $h = e107::getBB()->resizeHeight();
         e107::getBB()->clearclass();
     }
     //		print_a($option);
     $tp = e107::getParser();
     /*
         $media_path : Inserted into html tags eg. <img src='here'...
     */
     //	print_a($images);
     //	return;
     foreach ($images as $im) {
         list($dbWidth, $dbHeight) = explode(" x ", $im['media_dimensions']);
         $w = $dbWidth > $defaultResizeWidth ? $defaultResizeWidth : intval($dbWidth);
         //	$w = vartrue($w,0);
         //     $h = vartrue($w,0);
         $class = $category != '_icon' ? "media-select-image" : "media-select-icon";
         $media_path = $w || $h ? $tp->thumbUrl($im['media_url'], "&w={$w}") : $tp->thumbUrl($im['media_url']);
         // $tp->replaceConstants($im['media_url'],'full'); // max-size
         $realPath = $tp->thumbUrl($im['media_url'], $prevAtt);
         // Parsed back to Form as Preview Image.
         $diz = $tp->toAttribute(varset($im['media_name'])) . " (" . str_replace(" ", "", varset($im['media_dimensions'])) . ")";
         $repl = array($im['media_url'], $media_path);
         $media_alt = $tp->toAttribute(vartrue($im['media_caption']));
         if ($bbcode == null) {
             $onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}';\r\n\t\t\t\tparent.document.getElementById('" . $prevId . "').src = '{$realPath}';\r\n\t\t\t\treturn false;";
             //$onclicki = "";
             $class .= " e-media-select e-dialog-close";
//.........这里部分代码省略.........
开发者ID:KonzolozZ,项目名称:e107,代码行数:101,代码来源:media_class.php

示例14: toBBcode

 function toBBcode($content)
 {
     // echo $_POST['content'];
     global $pref, $tp;
     $content = stripslashes($content);
     if (check_class($pref['post_html'])) {
         $srch = array('src="' . e_HTTP . 'thumb.php?', 'src="/{e_MEDIA_IMAGE}');
         $repl = array('src="{e_BASE}thumb.php?', 'src="{e_BASE}thumb.php?src=e_MEDIA_IMAGE/');
         $content = str_replace($srch, $repl, $content);
         // resize the thumbnail to match wysiwyg width/height.
         //    $psrch 		= '/<img[^>]*src="{e_BASE}thumb.php\?src=([\S]*)w=([\d]*)&amp;h=([\d]*)"(.*)width="([\d]*)" height="([\d]*)"/i';
         //    $prepl 		= '<img src="{e_BASE}thumb.php?src=$1w=$5&amp;h=$6"$4width="$5" height="$6" ';
         //	$content 	= preg_replace($psrch, $prepl, $content);
         $content = $this->updateImg($content);
         $content = $tp->parseBBTags($content, true);
         // replace html with bbcode equivalent
         if (strip_tags($content, '<i>') == '&nbsp;') {
             exit;
         }
         $text = $content ? "[html]" . $content . "[/html]" : "";
         // Add the tags before saving to DB.
     } else {
         //   [img width=400]/e107_2.0/thumb.php?src={e_MEDIA_IMAGE}2012-12/e107org_white_stripe.png&w=400&h=0[/img]
         // $content = str_replace("{e_BASE}","", $content); // We want {e_BASE} in the final data going to the DB, but not the editor.
         $text = e107::getBB()->htmltoBBcode($content);
         // not reliable enough yet.
     }
     return $text;
 }
开发者ID:KonzolozZ,项目名称:e107,代码行数:29,代码来源:parser.php

示例15: toHTML


//.........这里部分代码省略.........
            case 'medium':
                $params['w'] = 640;
                // 500;
                $params['h'] = 385;
                // 405;
                break;
            case 'big':
            case 'large':
                $params['w'] = 853;
                // 660;
                $params['h'] = 505;
                // 525;
                break;
            case 'huge':
                $params['w'] = 1280;
                // 980;
                $params['h'] = 745;
                // 765;
                break;
            default:
                // maximum 1920 x 1080 (+25)
                $dim = explode(',', $dimensions, 2);
                $params['w'] = (int) varset($dim[0], 445);
                if ($params['w'] > 1920 || $params['w'] < 100) {
                    $params['w'] = 640;
                }
                $params['h'] = (int) varset($dim[1], 364);
                if ($params['h'] > 1105 || $params['h'] < 67) {
                    $params['h'] = 385;
                }
                break;
        }
        $yID = preg_replace('/[^0-9a-z\\-_\\&\\?]/i', '', $code_text);
        $url = isset($bbparm['privacy']) ? 'https://www.youtube-nocookie.com/v/' : 'https://www.youtube.com/v/';
        $url .= $yID . '?';
        if (isset($params['nofull']) || !varset($params['fs'])) {
            $fscr = 'false';
            $url = $url . 'fs=' . intval($params['fs']);
        } else {
            $fscr = 'true';
            $url = $url . 'fs=1';
        }
        if (isset($params['border'])) {
            $url = $url . '&amp;border=' . intval($params['border']);
        }
        if (isset($params['norel'])) {
            $url = $url . '&amp;rel=0';
        } elseif (isset($params['rel'])) {
            $url = $url . '&amp;rel=' . intval($params['rel']);
        }
        if (isset($params['hd'])) {
            $url = $url . '&amp;hd=' . intval($params['hd']);
        }
        $hl = 'en_US';
        if (isset($params['hl'])) {
            $params['hl'] = preg_replace('/[^0-9a-z\\-_]/i', '', $params['hl']);
            if (strlen($params['hl']) == 2 || strlen($params['hl']) == 5) {
                $hl = $params['hl'];
            }
        }
        $url = $url . '&amp;hl=' . $hl;
        $color = array();
        if (isset($params['color1'])) {
            $color[1] = $params['color1'];
        }
        if (isset($params['color2'])) {
            $color[2] = $params['color2'];
        }
        foreach ($color as $key => $value) {
            if (ctype_xdigit($value) && strlen($value) == 6) {
                $url = $url . '&amp;color' . $key . '=' . $value;
            }
        }
        if (isset($params['cc_load_policy'])) {
            $url .= "&amp;cc_load_policy=" . intval($params['cc_load_policy']);
        }
        if (isset($params['autoplay'])) {
            $url .= "&amp;autoplay=" . intval($params['autoplay']);
        }
        $class = "bbcode " . e107::getBB()->getClass('youtube');
        // consistent classes across all themes.
        $ret = "<!-- Start YouTube-" . $dimensions . "-" . $yID . " -->\n";
        // <-- DO NOT MODIFY - used for detection by bbcode handler.
        if (e107::getConfig()->get('youtube_bbcode_responsive') == 1) {
            $ret .= e107::getParser()->toVideo($yID . ".youtube");
        } else {
            $ret .= '<object class="' . $class . '" width="' . $params['w'] . '" height="' . $params['h'] . '" >
				<param name="movie" value="' . $url . '" />
				<param name="allowFullScreen" value="' . $fscr . '" />
				<param name="allowscriptaccess" value="always" />
				<param name="wmode" value="transparent" />
			';
            // Not XHTML - but needed for compatibility.
            $ret .= '<embed class="' . $class . '" src="' . $url . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="' . $fscr . '" wmode="transparent" width="' . $params['w'] . '" height="' . $params['h'] . '" />';
            $ret .= '</object>';
        }
        $ret .= "<!-- End YouTube -->";
        // <-- DO NOT MODIFY.
        return $ret;
    }
开发者ID:KonzolozZ,项目名称:e107,代码行数:101,代码来源:bb_youtube.php


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