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


PHP deftrue函数代码示例

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


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

示例1: sc_contact_email

 function sc_contact_email($parm = '')
 {
     $userEmail = deftrue('USEREMAIL');
     $disabled = !empty($userEmail) ? 'readonly' : '';
     // don't allow change from a verified email address.
     return "<input type='email'   " . $disabled . " id='contactEmail' title='a valid email address' name='email_send' required='required' size='30' class='tbox form-control' value='" . (vartrue($_POST['email_send']) ? $_POST['email_send'] : USEREMAIL) . "' />";
 }
开发者ID:armpit,项目名称:e107,代码行数:7,代码来源:contact_shortcodes.php

示例2: sc_siteurl

 function sc_siteurl($parm = '')
 {
     if (strlen(deftrue('SITEURL')) < 3) {
         return e107::getPref('siteurl');
     }
     return SITEURL;
 }
开发者ID:hgz5w,项目名称:e107,代码行数:7,代码来源:e_shortcode.php

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

示例4: checkWritable

 function checkWritable()
 {
     $mes = e107::getMessage();
     if (deftrue('e_MEDIA') && is_dir(e_MEDIA) && !is_writable(e_MEDIA)) {
         $mes->addWarning("The folder " . e_MEDIA . " is not writable. Please correct before proceeding.");
     }
     if (deftrue('e_SYSTEM') && is_dir(e_SYSTEM) && !is_writable(e_SYSTEM)) {
         $mes->addWarning("The folder " . e_SYSTEM . " is not writable. Please correct before proceeding.");
     }
 }
开发者ID:gitye,项目名称:e107,代码行数:10,代码来源:admin.php

示例5: render_emailprint

 function render_emailprint($mode, $id, $look = 0, $parm = array())
 {
     // $look = 0  --->display all icons
     // $look = 1  --->display email icon only
     // $look = 2  --->display print icon only
     $tp = e107::getParser();
     $text_emailprint = "";
     //new method emailprint_class : (only news is core, rest is plugin: searched for e_emailprint.php which should hold $email and $print values)
     if ($mode == "news") {
         $email = "news";
         $print = "news";
     } else {
         //load the others from plugins
         $handle = opendir(e_PLUGIN);
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && is_dir(e_PLUGIN . $file)) {
                 $plugin_handle = opendir(e_PLUGIN . $file . "/");
                 while (false !== ($file2 = readdir($plugin_handle))) {
                     if ($file2 == "e_emailprint.php") {
                         require_once e_PLUGIN . $file . "/" . $file2;
                     }
                 }
             }
         }
     }
     if (deftrue('BOOTSTRAP')) {
         $genericMail = $tp->toGlyph('icon-envelope', false);
         // "<i class='icon-envelope'></i>";
         $genericPrint = $tp->toGlyph('fa-print', false);
         // "<i class='icon-print'></i>";
         $class = varset($parm['class']) ? $parm['class'] : "";
     } else {
         $genericMail = "<img src='" . e_IMAGE_ABS . "generic/email.png'  alt='" . LAN_EMAIL_7 . "'  />";
         $genericPrint = "<img src='" . e_IMAGE_ABS . "generic/printer.png'  alt='" . LAN_PRINT_1 . "'  />";
         $class = "";
     }
     if ($look == 0 || $look == 1) {
         $ico_mail = defined("ICONMAIL") && file_exists(THEME . "images/" . ICONMAIL) ? "<img src='" . THEME_ABS . "images/" . ICONMAIL . "'  alt='" . LAN_EMAIL_7 . "'  />" : $genericMail;
         //TDOD CSS class
         $text_emailprint .= "<a class='e-tip hidden-print" . $class . "' href='" . e_HTTP . "email.php?" . $email . "." . $id . "' title='" . LAN_EMAIL_7 . "'>" . $ico_mail . "</a> ";
     }
     if ($look == 0 || $look == 2) {
         $ico_print = defined("ICONPRINT") && file_exists(THEME . "images/" . ICONPRINT) ? "<img src='" . THEME_ABS . "images/" . ICONPRINT . "' alt='" . LAN_PRINT_1 . "'  />" : $genericPrint;
         //TODO CSS class
         $text_emailprint .= "<a class='e-tip " . $class . " hidden-print' href='" . e_HTTP . "print.php?" . $print . "." . $id . "' title='" . LAN_PRINT_1 . "'>" . $ico_print . "</a>";
     }
     return $text_emailprint;
 }
开发者ID:OSUser,项目名称:e107,代码行数:48,代码来源:emailprint_class.php

示例6: facebook

 function facebook($data)
 {
     if (!deftrue('SOCIAL_FACEBOOK_INIT')) {
         return "<div class='alert alert-important alert-danger'>Unable to render comments. Missing Facebook appID.</div>";
     }
     e107::js('footer-inline', SOCIAL_FACEBOOK_INIT);
     if (E107_DEBUG_LEVEL > 0) {
         $link = "http://developers.facebook.com/docs/plugins/comments/";
     } else {
         $link = e_REQUEST_URL;
     }
     $pref = e107::pref('social');
     $limit = vartrue($pref['facebook_comments_limit'], 10);
     $theme = vartrue($pref['facebook_comments_theme'], 'light');
     $loading = vartrue($pref['facebook_comments_loadingtext'], 'Loading...');
     $text = '<div class="fb-comments" data-href="' . $link . '" data-width="100%" data-numposts="' . $limit . '" data-colorscheme="' . $theme . '">' . $loading . '</div>';
     return $text;
 }
开发者ID:JBeezygit,项目名称:e107,代码行数:18,代码来源:e_comment.php

示例7: sc_rss_types

 function sc_rss_types()
 {
     global $row, $tp;
     //	$url1 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
     //	$url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
     //	$url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
     //	$url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
     $url2 = e107::url('rss_menu', 'rss', $row);
     $url4 = e107::url('rss_menu', 'atom', $row);
     if (deftrue('BOOTSTRAP') === 3) {
         $text = "\n\t\t\t<div>\n\t\t\t\t<a class='btn btn-sm btn-default'  href='" . e107::url('rss_menu', 'rss', $row) . "' title='RSS 2.0'>" . $tp->toGlyph('fa-rss') . " RSS</a>\n\t\t\t\t<a class='btn btn-sm btn-default'  href='" . e107::url('rss_menu', 'atom', $row) . "' title='ATOM'>" . $tp->toGlyph('fa-rss') . " Atom</a>\n\t\t\t</div>";
         return $text;
     }
     $text = "";
     //	$text .= "<a href='".$url1."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss1.png' class='icon' alt='RSS 0.92' /></a>";
     $text .= "<a href='" . $url2 . "' class='rss'><img src='" . e_PLUGIN_ABS . "rss_menu/images/rss2.png' class='icon' alt='RSS 2.0' /></a>";
     //	$text .= "<a href='".$url3."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss3.png' class='icon' alt='RDF' /></a>";
     $text .= "<a href='" . $url4 . "' class='rss'><img src='" . e_PLUGIN_ABS . "rss_menu/images/rss4.png' class='icon' alt='ATOM' /></a>";
     return $text;
 }
开发者ID:armpit,项目名称:e107,代码行数:20,代码来源:rss_shortcodes.php

示例8: __construct

 function __construct()
 {
     $this->search_prefs = e107::getConfig('search')->getPref();
     $this->search_info = $this->searchConfig();
     if (deftrue('BOOTSTRAP')) {
         $tmp = e107::getCoreTemplate('search', 'form');
         $SEARCH_TOP_TABLE = $tmp['start'];
         $SEARCH_BOT_TABLE = $tmp['end'];
         $SEARCH_CATS = $tmp['category'];
         $SEARCH_TYPE = $tmp['type'];
         $SEARCH_ADV = $tmp['advanced'];
         $SEARCH_ENHANCED = $tmp['enhanced'];
         $SEARCH_ADV_COMBO = $tmp['advanced-combo'];
         $this->template = $tmp;
         unset($tmp);
     } else {
         if (file_exists(THEME . "search_template.php")) {
             require THEME . "search_template.php";
         } else {
             require e_CORE . "templates/search_template.php";
         }
         $SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
         $tmp = array();
         $tmp['start'] = $SEARCH_TOP_TABLE;
         $tmp['end'] = $SEARCH_BOT_TABLE;
         $tmp['category'] = $SEARCH_CATS;
         $tmp['type'] = $SEARCH_TYPE;
         $tmp['advanced'] = $SEARCH_ADV;
         $tmp['enhanced'] = $SEARCH_ENHANCED;
         $tmp['advanced-combo'] = $SEARCH_ADV_COMBO;
         $this->template = $tmp;
     }
     if (e_AJAX_REQUEST) {
         if (vartrue($_POST['t'])) {
             echo $this->sc_search_advanced_block($_POST['t']);
         }
         exit;
     }
 }
开发者ID:gitye,项目名称:e107,代码行数:39,代码来源:search.php

示例9: str_replace

$phpinfo = str_replace("</body></html>", "", $phpinfo);
$phpinfo = str_replace('border="0"', '', $phpinfo);
//$phpinfo = str_replace('<table ','<table class="table table-striped adminlist" ',$phpinfo);
$phpinfo = str_replace('name=', 'id=', $phpinfo);
$phpinfo = str_replace('class="e"', 'class="forumheader2 text-left"', $phpinfo);
$phpinfo = str_replace('class="v"', 'class="forumheader3 text-left"', $phpinfo);
$phpinfo = str_replace('class="v"', 'class="forumheader3 text-left"', $phpinfo);
$phpinfo = str_replace('class="h"', 'class="fcaption"', $phpinfo);
$phpinfo = str_replace('<table  cellpadding="3" width="600">', '<table class="table table-striped adminlist"><colgroup><col style="width:30%" /><col style="width:auto" /></colgroup>', $phpinfo);
$mes = e107::getMessage();
$security_risks = array("allow_url_fopen" => 'If you have Curl enabled, you should consider disabling this feature.', "allow_url_include" => 'This is a security risk and is not needed by e107.', "display_errors" => 'On a production server, it is better to disable the displaying of errors in the browser.', "expose_php" => 'Disabling this will hide your PHP version from browsers.', "register_globals" => 'This is a security risk and should be disabled.');
foreach ($security_risks as $risk => $diz) {
    if (ini_get($risk)) {
        $srch = '<tr><td class="forumheader2 text-left">' . $risk . '</td><td class="forumheader3">';
        $repl = '<tr><td class="forumheader2 text-left">' . $risk . '</td><td  title="' . $tp->toAttribute($diz) . '" class="forumheader3 alert alert-danger">';
        $phpinfo = str_replace($srch, $repl, $phpinfo);
        $mes->addWarning("<b>" . $risk . "</b>: " . $diz);
    }
}
if ($sessionSavePath = ini_get('session.save_path')) {
    if (!is_writable($sessionSavePath)) {
        $mes->addError("<b>session.save_path</b> is not writable! That can cause major issues with your site.");
    }
}
// $phpinfo = preg_replace("#^.*<body>#is", "", $phpinfo);
ob_end_clean();
if (deftrue('e_DEBUG')) {
    $mes->addDebug("Session ID: " . session_id());
}
$ns->tablerender("PHPInfo", $mes->render() . $phpinfo);
require_once "footer.php";
开发者ID:gitter-badger,项目名称:e107,代码行数:31,代码来源:phpinfo.php

示例10: goOnline

 /**
  * Go online
  * @param boolean $online_tracking
  * @param boolean $flood_control
  * @return void
  */
 public function goOnline($online_tracking = false, $flood_control = false)
 {
     // global $pref, $e_event; // Not needed as globals
     //global $online_timeout, $online_warncount, $online_bancount;	// Not needed as globals
     //global $members_online, $total_online;						// Not needed as globals
     global $listuserson;
     // FIXME - remove it, make it property, call e_online signleton - e107::getOnline()
     $e107 = e107::getInstance();
     $sql = e107::getDb();
     $user = e107::getUser();
     if ($online_tracking || $flood_control) {
         $online_timeout = 300;
         list($ban_access_guest, $ban_access_member) = explode(',', e107::getPref('ban_max_online_access', '100,200'));
         $online_bancount = max($ban_access_guest, 50);
         // Safety net for incorrect values
         if ($user->isUser()) {
             $online_bancount = max($online_bancount, $ban_access_member);
         }
         $online_warncount = $online_bancount * 0.9;
         // Set warning threshold at 90% of ban threshold
         //TODO Add support for all queries.
         // $page = (strpos(e_SELF, 'forum_') !== FALSE) ? e_SELF.'.'.e_QUERY : e_SELF;
         // $page = (strpos(e_SELF, 'comment') !== FALSE) ? e_SELF.'.'.e_QUERY : $page;
         // $page = (strpos(e_SELF, 'content') !== FALSE) ? e_SELF.'.'.e_QUERY : $page;
         $page = e_REQUEST_URI;
         // mod rewrite & single entry support
         // FIXME parse url, trigger registered e_online callbacks
         $page = e107::getParser()->toDB($page, true);
         /// @todo - try not to use toDB() - triggers prefilter
         $ip = e107::getIPHandler()->getIP(FALSE);
         $udata = $user->isUser() && USER ? $user->getId() . '.' . $user->getName() : '0';
         // USER check required to make sure they logged in without an error.
         $agent = $_SERVER['HTTP_USER_AGENT'];
         // XXX - more exceptions, e.g. hide online location for admins/users (pref), e_jlsib.php, etc
         // XXX - more advanced flod timing when  e_AJAX_REQUEST, e.g. $ban_access_ajax = 300
         $update_page = deftrue('e_AJAX_REQUEST') ? '' : ", online_location='{$page}'";
         $insert_query = array('online_timestamp' => time(), 'online_flag' => 0, 'online_user_id' => $udata, 'online_ip' => $ip, 'online_location' => $page, 'online_pagecount' => 1, 'online_active' => 0, 'online_agent' => $agent, 'online_language' => e_LAN);
         // !deftrue('e_AJAX_REQUEST')
         // TODO add option to hide users from online list? boolean online_hide field?
         // don't do anything if main admin logged in as another user
         if ($user->isUser() && !$user->getParentId()) {
             // Find record that matches IP or visitor, or matches user info
             if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'")) {
                 $row = $sql->fetch();
                 if ($row['online_user_id'] == $udata) {
                     //Matching user record
                     if ($row['online_timestamp'] < time() - $online_timeout) {
                         //It has been at least 'online_timeout' seconds since this user's info last logged
                         //Update user record with timestamp, current IP, current page and set pagecount to 1
                         $query = "online_timestamp='" . time() . "', online_ip='{$ip}'{$update_page}, online_pagecount=1, `online_active` = 1 WHERE online_user_id='{$row['online_user_id']}'";
                     } else {
                         if (!$user->isAdmin()) {
                             $row['online_pagecount']++;
                         }
                         // Update user record with current IP, current page and increment pagecount
                         $query = "online_ip='{$ip}'{$update_page}, `online_pagecount` = '" . intval($row['online_pagecount']) . "', `online_active` = 1 WHERE `online_user_id` = '{$row['online_user_id']}'";
                     }
                 } else {
                     //Found matching visitor record (ip only) for this user
                     if ($row['online_timestamp'] < time() - $online_timeout) {
                         // It has been at least 'timeout' seconds since this user has connected
                         // Update record with timestamp, current IP, current page and set pagecount to 1
                         $query = "`online_timestamp` = '" . time() . "', `online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = 1,  `online_active` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
                     } else {
                         // Another visit within the timeout period
                         if (!$user->isAdmin()) {
                             $row['online_pagecount']++;
                         }
                         //Update record with current IP, current page and increment pagecount
                         $query = "`online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = " . intval($row['online_pagecount']) . ", `online_active` =1  WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
                     }
                 }
                 $sql->update('online', $query);
             } else {
                 $sql->insert('online', $insert_query);
             }
         } elseif (!$user->getParentId()) {
             //Current page request is from a guest
             if ($sql->select('online', '*', "`online_ip` = '{$ip}' AND `online_user_id` = '0'")) {
                 // Recent visitor
                 $row = $sql->fetch();
                 if ($row['online_timestamp'] < time() - $online_timeout) {
                     //Update record with timestamp, current page, and set pagecount to 1
                     $query = "`online_timestamp` = '" . time() . "'{$update_page}, `online_pagecount` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
                 } else {
                     //Update record with current page and increment pagecount
                     $row['online_pagecount']++;
                     //   echo "here {$online_pagecount}";
                     $query = "`online_pagecount` = {$row['online_pagecount']}{$update_page} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
                 }
                 $sql->update('online', $query);
             } else {
                 // New visitor
                 $sql->insert('online', $insert_query);
//.........这里部分代码省略.........
开发者ID:timscholten,项目名称:e107,代码行数:101,代码来源:online_class.php

示例11: pageIndex

 function pageIndex()
 {
     // Use always nextprev shortcode (with a special default 'page' tempalte)
     $titles = implode("|", $this->pageTitles);
     $total_items = count($this->pageTitles);
     //$parms = $total_items.",1,".$this->pageSelected.",".e_SELF."?".$this->pageID.".[FROM],,$titles";
     $row = $this->page;
     $row['page'] = '--FROM--';
     $url = rawurlencode(e107::getUrl()->create('page/view', $row, 'allow=page_id,page_title,page_sef,page'));
     $parms = 'nonavcount&bullet=' . rawurlencode($this->bullet . ' ') . '&caption=<!-- Empty -->&' . 'pagetitle=' . rawurlencode($titles) . '&tmpl_prefix=' . deftrue('PAGE_NEXTPREV_TMPL', 'page') . '&total=' . $total_items . '&amount=1&current=' . $this->pageSelected . '&url=' . $url;
     $itext = $total_items ? e107::getParser()->parseTemplate("{NEXTPREV={$parms}}") : "";
     return $itext;
 }
开发者ID:armpit,项目名称:e107,代码行数:13,代码来源:page.php

示例12: nextprev_shortcode

/**
 * Core NEXTPREV shortcode
 * Comma separated parameters are now deprecated.
 * Parameter string should be formatted as if it were the query string passed via a URL:
 * <code>$parm = 'total=10&amount=5&current=0&type=...'</code>
 *
 * Parameter list:
 * - total (integer) [required]: total records/pages
 * - amount (integer| string 'all') [required]: Records per page, always 1 when we counting pages (see 'type' parameter), ignored where tmpl_prefix is not set and 'old_np' pref is false
 * - current (integer)[required]: Current record/page
 * - type (string page|record) [optional]: What kind of navigation logic we need, default is 'record' (the old way)
 *
 * - url (rawurlencode'd string) [required]: URL template, will be rawurldecode'd after parameters are parsed to array, '--AMP--' strings will be replaced with '&amp;'
 * 	NOTE: URL should be DOUBLE encoded, which means you need to encode the query only of passed URL (W3C standards) and rawurlencode the whole URL string
 * The reason to do this is to not break the whole shortcode $parm string, shortcode itself is doing decode once, which means we'll end up with correct, W3C compliant URL string
 * 'url' now supports url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 and route::news/list/category::id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 formats
 *
 * Preffered 'FROM' template is now '--FROM--' (instead '[FROM]')
 * - caption (rawurlencode'd string) [optional]: Label, rawurldecode'd after parameters are parsed to array, language constants are supported
 * - pagetitle (rawurlencode'd string) [optional]: Page labels, rawurldecode'd after parameters are parsed to array,
 * separated by '|', if present they will be used as lablels instead page numbers; language constants are supported
 * - plugin (string) [optional]: plugin name used for template loading
 * - tmpl_prefix (string) [optional]: template keys prefix; core supported are 'default' and 'dropdown', default depends on 'old_np' pref
 * - navcount (integer) [optional]: number of navigation items to be shown, minimal allowed value is 4, default is 10
 * - nonavcount (no value) [optional]: if is set it'll disable navigation counting (navcount will be ignored)
 * - bullet (string) [optional]: currently it should contain the markup to be prepended to the navigation item title
 *
 * WARNING: You have to do rawuldecode() on url, caption and title parameter values (before passing them to the shortcode)
 * or you'll break the whole script
 *
 * TODO - add create URL support when new URL handler is ready
 *
 * @param string $parm
 * @return string page navigation bar HTML
 */
function nextprev_shortcode($parm = '')
{
    $e107 = e107::getInstance();
    $pref = e107::getPref();
    $tp = e107::getParser();
    e107::coreLan('np');
    /**
     * The NEW way.
     * New parameter requirements formatted as a GET string.
     * Template support.
     */
    if (strpos($parm, 'total=') !== false) {
        parse_str($parm, $parm);
        // Calculate
        $total_items = intval($parm['total']);
        $check_render = true;
        if (vartrue($parm['glyphs']) && deftrue('BOOTSTRAP')) {
            $LAN_NP_FIRST = $tp->toGlyph("icon-fast-backward.glyph", false);
            $LAN_NP_PREVIOUS = $tp->toGlyph("icon-backward.glyph", false);
            $LAN_NP_NEXT = $tp->toGlyph("icon-forward.glyph", false);
            $LAN_NP_LAST = $tp->toGlyph("icon-fast-forward", false);
        } else {
            $LAN_NP_FIRST = LAN_NP_FIRST;
            $LAN_NP_PREVIOUS = LAN_NP_PREVIOUS;
            $LAN_NP_NEXT = LAN_NP_NEXT;
            $LAN_NP_LAST = LAN_NP_LAST;
        }
        // search for template keys - default_start, default_end etc.
        if (isset($parm['tmpl_prefix'])) {
            // forced
            $tprefix = vartrue($parm['tmpl_prefix'], 'default');
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } elseif (isset($parm['tmpl'])) {
            // forced
            $tprefix = vartrue($parm['tmpl'], 'default');
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } elseif ($pref['old_np']) {
            $tprefix = 'default';
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } else {
            $tprefix = 'dropdown';
            //$parm['amount'] = 'all';
        }
        if ($tprefix == 'default' && deftrue('BOOTSTRAP')) {
            $tprefix = 'bootstrap';
        }
        $tprefix .= '_';
        if ($parm['amount'] === 'all') {
            $perpage = 1;
            // amount is ignored
            $check_render = $total_items > 1;
        } else {
            $perpage = intval($parm['amount']);
        }
        if (!$check_render) {
            return '';
        }
        // TODO - rename old_np to something more meaningful
        $current_start = intval($parm['current']);
        $nptype = varset($parm['type'], 'record');
        switch ($nptype) {
            case 'page':
                $perpage = 1;
                $current_page = $current_start;
                $first_page = 1;
//.........这里部分代码省略.........
开发者ID:KonzolozZ,项目名称:e107,代码行数:101,代码来源:nextprev.php

示例13: user_extended_edit

 function user_extended_edit($struct, $curval)
 {
     $tp = e107::getParser();
     $frm = e107::getForm();
     if (trim($curval) == "" && $struct['user_extended_struct_default'] != "") {
         $curval = $struct['user_extended_struct_default'];
     }
     $choices = explode(",", $struct['user_extended_struct_values']);
     foreach ($choices as $k => $v) {
         $choices[$k] = str_replace("[E_COMMA]", ",", $v);
     }
     $parms = explode("^,^", $struct['user_extended_struct_parms']);
     $include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
     $regex = $tp->toText($parms[1]);
     $regexfail = $tp->toText($parms[2]);
     $fname = "ue[user_" . $struct['user_extended_struct_name'] . "]";
     $required = vartrue($struct['user_extended_struct_required']) == 1 ? "required" : "";
     $fid = $frm->name2id($fname);
     if (strpos($include, 'class') === FALSE) {
         $include .= " class='form-control tbox' ";
     }
     switch ($struct['user_extended_struct_type']) {
         case EUF_TEXT:
             //textbox
         //textbox
         case EUF_INTEGER:
             //integer
             $ret = "<input id='{$fid}' type='text' name='{$fname}' value='{$curval}' {$include} {$required} />";
             return $ret;
             break;
         case EUF_RADIO:
             //radio
             $ret = '';
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 if (strpos($choice, "|") !== FALSE) {
                     list($val, $label) = explode("|", $choice);
                 } elseif (strpos($choice, " => ") !== FALSE) {
                     list($val, $label) = explode(" => ", $choice);
                 } else {
                     $val = $choice;
                     $label = $choice;
                 }
                 $label = deftrue($label, $label);
                 if (deftrue('BOOTSTRAP')) {
                     $ret .= $frm->radio($fname, $val, $curval == $val, array('label' => $label, 'required' => $struct['user_extended_struct_required']));
                 } else {
                     $chk = $curval == $val ? " checked='checked' " : "";
                     $ret .= "<input id='{$fid}' {$include} type='radio' name='{$fname}' value='{$val}' {$chk} {$required} /> {$label}";
                 }
             }
             return $ret;
             break;
         case EUF_CHECKBOX:
             //checkboxes
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 if (strpos($choice, "|") !== FALSE) {
                     list($val, $label) = explode("|", $choice);
                 } elseif (strpos($choice, " => ") !== FALSE) {
                     list($val, $label) = explode(" => ", $choice);
                 } else {
                     $val = $choice;
                     $label = $choice;
                 }
                 $label = deftrue($label, $label);
                 if (deftrue('BOOTSTRAP')) {
                     $ret .= $frm->checkbox($fname, $val, $curval == $val, array('label' => $label, 'required' => $struct['user_extended_struct_required']));
                 } else {
                     $chk = $curval == $val ? " checked='checked' " : "";
                     $ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />";
                 }
             }
             return $ret;
             break;
         case EUF_DROPDOWN:
             //dropdown
             $ret = "<select {$include} id='{$fid}' name='{$fname}' {$required} >\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 $choice = deftrue($choice, $choice);
                 $sel = $curval == $choice ? " selected='selected' " : "";
                 $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             return $ret;
             break;
         case EUF_PREDEFINED:
             // predefined list, shown in dropdown
             $listRoot = trim($struct['user_extended_struct_values']);
             // Base list name
             $filename = e_CORE . 'sql/extended_' . $listRoot . '.php';
             if (!is_readable($filename)) {
                 return 'No file: ' . $filename;
             }
             require_once $filename;
             $className = 'extended_' . $listRoot;
             if (!class_exists($className)) {
//.........这里部分代码省略.........
开发者ID:armpit,项目名称:e107,代码行数:101,代码来源:user_extended_class.php

示例14: generateBar

    function generateBar($perc)
    {
        if (deftrue('BOOTSTRAP', false)) {
            $val = intval($perc);
            return '
			 <div class="progress">
			 <div class="bar progress-bar" role="progressbar" aria-valuenow="' . $val . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $val . '%;">
			   <span class="sr-only">' . $val . '%</span>
			 </div>
			 </div>';
        } else {
            $barl = $this->barl;
            $barr = $this->barr;
            $bar = $this->bar;
            return $perc ? "<div style='width: 100%'><div style='background-image: url({$barl}); width: 5px; height: 14px; float: left;'></div><div style='background-image: url({$bar}); width: " . min(intval($perc), 90) . "%; height: 14px; float: left;'></div><div style='background-image: url({$barr}); width: 5px; height: 14px; float: left;'></div></div>" : "";
        }
    }
开发者ID:armpit,项目名称:e107,代码行数:17,代码来源:poll_class.php

示例15: renderCreateButtonsBar

    function renderCreateButtonsBar($id, $fdata, $model, $tab = 0)
    {
        /*
        $text = vartrue($fdata['fieldset_pre'])."
        	<fieldset id='{$id}'>
        		<legend>".vartrue($fdata['legend'])."</legend>
        		".vartrue($fdata['table_pre'])."
        		<table class='table adminform'>
        			<colgroup>
        				<col class='col-label' />
        				<col class='col-control' />
        			</colgroup>
        			<tbody>
        ";
        */
        $text = '';
        // required fields - model definition
        $model_required = $model->getValidationRules();
        $required_help = false;
        $hidden_fields = array();
        foreach ($fdata['fields'] as $key => $att) {
            if ($tab !== false && varset($att['tab'], 0) !== $tab) {
                continue;
            }
            // convert aliases - not supported in edit mod
            if (vartrue($att['alias']) && !$model->hasData($key)) {
                $key = $att['field'];
            }
            if ($key == 'checkboxes' || $key == 'options') {
                continue;
            }
            $parms = vartrue($att['formparms'], array());
            if (!is_array($parms)) {
                parse_str($parms, $parms);
            }
            $label = vartrue($att['note']) ? '<div class="label-note">' . deftrue($att['note'], $att['note']) . '</div>' : '';
            $help = vartrue($att['help']) ? '<div class="field-help">' . deftrue($att['help'], $att['help']) . '</div>' : '';
            $valPath = trim(vartrue($att['dataPath'], $key), '/');
            $keyName = $key;
            if (strpos($valPath, '/')) {
                $tmp = explode('/', $valPath);
                $keyName = array_shift($tmp);
                foreach ($tmp as $path) {
                    $keyName .= '[' . $path . ']';
                }
            }
            if ('hidden' === $att['type']) {
                if (!is_array($att['writeParms'])) {
                    parse_str(varset($att['writeParms']), $tmp);
                } else {
                    $tmp = $att['writeParms'];
                }
                if (!vartrue($tmp['show'])) {
                    $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId());
                    unset($tmp);
                    continue;
                }
                unset($tmp);
            }
            // type null - system (special) fields
            if (vartrue($att['type']) !== null && !vartrue($att['noedit']) && $key != $model->getFieldIdName()) {
                $required = '';
                $required_class = '';
                if (isset($model_required[$key]) || vartrue($att['validate'])) {
                    $required = $this->getRequiredString();
                    $required_class = ' class="required-label"';
                    // TODO - add 'required-label' to the core CSS definitions
                    $required_help = true;
                    if (vartrue($att['validate'])) {
                        // override
                        $model_required[$key] = array();
                        $model_required[$key][] = true === $att['validate'] ? 'required' : $att['validate'];
                        $model_required[$key][] = varset($att['rule']);
                        $model_required[$key][] = $att['title'];
                        $model_required[$key][] = varset($att['error']);
                    }
                }
                /*
                				$text .= "
                					<tr>
                						<td>
                							".$required."<span{$required_class}>".defset(vartrue($att['title']), vartrue($att['title']))."</span>".$label."
                						</td>
                						<td>
                							".$this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()))."
                							{$help}
                						</td>
                					</tr>
                				";
                				 * */
            }
            //if($bckp) $model->remove($bckp);
        }
        if ($required_help) {
            //	$required_help = '<div class="form-note">'.$this->getRequiredString().' - required fields</div>'; //TODO - lans
        }
        //	$text .= "
        //				</tbody>
        //			</table></fieldset>";
        $text .= "\r\n\t\t\t\t" . implode("\n", $hidden_fields) . "\r\n\t\t\t\t" . vartrue($fdata['table_post']) . "\r\n\t\t\t\t<div class='buttons-bar center'>\r\n\t\t";
//.........这里部分代码省略.........
开发者ID:armpit,项目名称:e107,代码行数:101,代码来源:form_handler.php


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