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


PHP defset函数代码示例

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


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

示例1: showImages

 function showImages($cat)
 {
     $mes = e107::getMessage();
     $tp = e107::getParser();
     $template = e107::getTemplate('gallery');
     $template = array_change_key_case($template);
     $sc = e107::getScBatch('gallery', TRUE);
     if (defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) {
         $template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
     }
     $sc->total = e107::getMedia()->countImages($cat);
     $sc->amount = 12;
     // TODO Add Pref. amount per page.
     $sc->curCat = $cat;
     $sc->from = $_GET['frm'] ? intval($_GET['frm']) : 0;
     $list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount);
     $catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs');
     $inner = "";
     foreach ($list as $row) {
         $sc->setVars($row);
         $inner .= $tp->parseTemplate($template['list_item'], TRUE, $sc);
     }
     $text = $tp->parseTemplate($template['list_start'], TRUE, $sc);
     $text .= $inner;
     $text .= $tp->parseTemplate($template['list_end'], TRUE, $sc);
     e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text);
 }
开发者ID:armpit,项目名称:e107,代码行数:27,代码来源:gallery.php

示例2: cache_fname

 /**
  * @return string
  * @param string $query
  * @desc Internal class function that returns the filename of a cache file based on the query.
  * @scope private
  * If the tag begins 'menu_', e_QUERY is not included in the hash which creates the file name
  */
 function cache_fname($CacheTag, $syscache = false)
 {
     if (strpos($CacheTag, "nomd5_") === 0) {
         // Add 'nomd5' to indicate we are not calculating an md5
         $CheckTag = '_nomd5';
     } elseif (isset($this) && $this instanceof ecache) {
         if (defined("THEME")) {
             if (strpos($CacheTag, "nq_") === 0) {
                 // We do not care about e_QUERY, so don't use it in the md5 calculation
                 if (!$this->CachenqMD5) {
                     $this->CachenqMD5 = md5(e_BASE . (defined("ADMIN") && ADMIN == true ? "admin" : "") . e_LANGUAGE . THEME . USERCLASS_LIST . filemtime(THEME . 'theme.php'));
                 }
                 // Add 'nq' to indicate we are not using e_QUERY
                 $CheckTag = '_nq_' . $this->CachenqMD5;
             } else {
                 // It's a page - need the query in the hash
                 if (!$this->CachePageMD5) {
                     $this->CachePageMD5 = md5(e_BASE . e_LANGUAGE . THEME . USERCLASS_LIST . defset('e_QUERY') . filemtime(THEME . 'theme.php'));
                 }
                 $CheckTag = '_' . $this->CachePageMD5;
             }
         } else {
             // Check if a custom CachePageMD5 is in use in e_module.php.
             $CheckTag = $this->CachePageMD5 ? "_" . $this->CachePageMD5 : "";
         }
     } else {
         $CheckTag = '';
     }
     $q = ($syscache ? "S_" : "C_") . preg_replace("#\\W#", "_", $CacheTag);
     $fname = e_CACHE_CONTENT . $q . $CheckTag . '.cache.php';
     //echo "cache f_name = $fname <br />";
     return $fname;
 }
开发者ID:notzen,项目名称:e107,代码行数:40,代码来源:cache_handler.php

示例3: gitrepo

 /**
  * Update the current Repo. of this e107 installation.  (eg. e107 on github)
  */
 function gitrepo()
 {
     $mes = e107::getMessage();
     $fl = e107::getFile();
     if (is_dir(e_BASE . ".git")) {
         $gitPath = defset('e_GIT', 'git');
         // addo to e107_config.php to
         // Change Dir.
         $cmd = 'cd ' . e_ROOT;
         $mes->addDebug($cmd);
         $text = `{$cmd} 2>&1`;
         // Remove any local changes.
         $cmd = $gitPath . ' reset --hard';
         $mes->addDebug($cmd);
         $text .= `{$cmd} 2>&1`;
         // Run Pull request
         $cmd = $gitPath . ' pull';
         $mes->addDebug($cmd);
         $text .= `{$cmd} 2>&1`;
         $return = print_a($text, true);
         $mes->addSuccess($return);
         if (unlink(e_BASE . "install.php")) {
             $mes->addDebug("Removed install.php");
         }
     } else {
         $mes->addError("No git repo found");
         //TODO LAN
     }
     $fl->chmod(e_BASE . "cron.php", 0755);
     $fl->chmod(e_HANDLER . "bounce_handler.php", 0755);
 }
开发者ID:KonzolozZ,项目名称:e107,代码行数:34,代码来源:cron_class.php

示例4: js

function js()
{
    //FIXME
    include_once e_LANGUAGEDIR . e_LANGUAGE . "/lan_user_extended.php";
    $text = "\n\n\n\t\tfunction changeHelp(type) {\n\t //<![CDATA[\n\t\tvar ftype;\n\t\tvar helptext;\n\n\n\t\t";
    for ($i = 1; $i <= 9; $i++) {
        $type_const = "UE_LAN_{$i}";
        $help_const = "\"" . str_replace("/", "\\/", "EXTLAN_HELP_{$i}") . "\"";
        $text .= "\n\t\t\t\tif(type == \"{$i}\")\n\t\t\t\t{\n\t\t\t\t\txtype=\"" . defset($type_const) . "\";\n\t\t\t\t\twhat=\"" . defset($help_const) . "\";\n\t\t\t\t}";
    }
    $text .= "\n\t\t//\tdocument.getElementById('ue_type').innerHTML=''+xtype+'';\n\t\t//\tdocument.getElementById('ue_help').innerHTML=''+what+'';\n\n\t\t\tif(type == 4){\n\t\t\t\tdocument.getElementById('db_mode').style.display = '';\n\t\t\t\tdocument.getElementById('values').style.display = 'none';\n\t\t\t}else{\n\t            document.getElementById('values').style.display = '';\n\t\t\t\tdocument.getElementById('db_mode').style.display = 'none';\n\t\t\t}\n\t\t\t   // ]]>\n\t\t}\n\n\n";
    return $text;
}
开发者ID:gitter-badger,项目名称:e107,代码行数:13,代码来源:users_extended.php

示例5: sc_cm_comment

 function sc_cm_comment($parm = '')
 {
     $menu_pref = e107::getConfig('menu')->getPref();
     $tp = e107::getParser();
     $COMMENT = '';
     if ($menu_pref['comment_characters'] > 0) {
         $COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
         if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters']) {
             $COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'], '') . ($this->var['comment_url'] ? " <a href='" . $this->var['comment_url'] . "'>" : "") . defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']) . ($this->var['comment_url'] ? "</a>" : "");
         }
     }
     return $COMMENT;
 }
开发者ID:armpit,项目名称:e107,代码行数:13,代码来源:comment_menu_shortcodes.php

示例6: sc_featurebox_url

 /**
  * Parameter list (GET string format):
  * - text: used if href is true
  * - href (1/0): return only URL if false, else return tag
  * - rel: rel tag attribute
  *
  * @param string $parm
  * @return string
  */
 public function sc_featurebox_url($parm = '')
 {
     $tp = e107::getParser();
     $url = $tp->replaceConstants($this->get('fb_imageurl'), 'full');
     if (empty($url)) {
         return '';
     }
     parse_str($parm, $parm);
     if (!vartrue($parm['href'])) {
         return $tp->replaceConstants($url);
     }
     $title = vartrue($parm['text']) ? defset($parm['text']) : FBLAN_02;
     $alt = $tp->toAttribute($this->get('fb_title'), false, 'TITLE');
     return '<a id="featurebox-url-' . $this->getId() . '" href="' . $url . '" title="' . $alt . '" rel="' . $tp->toAttribute(vartrue($parm['rel'], '')) . '">' . $title . '</a>';
 }
开发者ID:notzen,项目名称:e107,代码行数:24,代码来源:item.php

示例7: sc_featurebox_url

 /**
  * Parameter list (GET string format):
  * - text: used if href is true
  * - href (1/0): return only URL if false, else return tag
  * - rel: rel tag attribute
  *
  * @param string $parm
  * @return string
  */
 public function sc_featurebox_url($parm = '')
 {
     $tp = e107::getParser();
     $url = $tp->replaceConstants($this->get('fb_imageurl'), 'full');
     if (empty($url)) {
         return '';
     }
     parse_str($parm, $parm);
     if (vartrue($parm['href'])) {
         return $tp->replaceConstants($url);
     }
     $title = vartrue($parm['text']) ? defset($parm['text']) : LAN_MORE;
     $alt = $tp->toAttribute($this->get('fb_title'), false, 'TITLE');
     $buttonCls = vartrue($parm['button']) ? 'class="btn btn-primary btn-featurebox" ' : "";
     return '<a ' . $buttonCls . 'id="featurebox-url-' . $this->getId() . '" href="' . $url . '" title="' . $alt . '" rel="' . $tp->toAttribute(vartrue($parm['rel'], '')) . '">' . $title . '</a>';
 }
开发者ID:armpit,项目名称:e107,代码行数:25,代码来源:item.php

示例8: renderPollForm

 /**
  * Render a Poll creation Form
  * @param $mode string - admin | forum | front 
  */
 function renderPollForm($mode = 'admin')
 {
     $tp = e107::getParser();
     $frm = e107::getForm();
     //	echo "MODE=".$mode;
     //XXX New v2.x default for front-end. Currently used by forum-post in bootstrap mode.
     // TODO LAN - Needs a more generic LAN rewrite when used on another area than forum
     if ($mode == 'front') {
         $text = "\n\t\t\t\n\t\t\t<div class='alert alert-info'>\n\t\t\t\t<small >" . LAN_FORUM_3029 . "</small>\n\t\t\t</div>";
         //		$text .= "<form>";
         $text .= "\n\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label for='poll_title'>Poll question</label>\n\t\t\t\t\t" . $frm->text('poll_title', $tp->post_toForm(vartrue($_POST['poll_title'])), '200', array('placeholder' => LAN_FORUM_3030, 'id' => 'poll_title')) . " \n\t\t\t\t</div>";
         $option_count = vartrue($_POST['poll_option']) ? count($_POST['poll_option']) : 2;
         $text .= "\t\t\n\t\t\t\t<div id='pollsection'>\n\t\t\t\t\t<label for='pollopt'>Poll answers</label>";
         for ($count = 1; $count <= $option_count; $count++) {
             // if ($count != 1 && $_POST['poll_option'][($count-1)] =="")
             // {
             // //	break;
             // }
             $opt = $count == 1 ? "id='poll_answer'" : "";
             $text .= "<div class='form-group' " . $opt . ">\n\t\t\t\t\t\t\t\t" . $frm->text('poll_option[]', $_POST['poll_option'][$count - 1], '200', array('placeholder' => LAN_FORUM_3031, 'id' => $opt)) . "\n\t\t\t\t\t\t\t  </div>";
         }
         $text .= "</div>";
         // end pollsection div
         $text .= "<div  class='form-group control-group'>\n\t\t\t\t\t\t\t<input class='btn btn-default' type='button' id='addoption' name='addoption' value='" . LAN_FORUM_3032 . "' />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t";
         //FIXME - get this looking good with Bootstrap CSS only.
         $opts = array(1 => LAN_YES, 0 => LAN_NO);
         // Set to IP address.. Can add a pref to Poll admin for 'default front-end storage method' if demand is there for it.
         $text .= "<br />\n\t\t\t <div class='form-horizontal control-group'>\n\t\t\t\t<label class='control-label'>" . LAN_FORUM_3033 . "</label>\n\t\t\t\t<div class='radio controls'>\n\t\t\t\t\t" . $frm->radio('multipleChoice', $opts, vartrue($_POST['multipleChoice'], 0)) . $frm->hidden('storageMethod', 1) . "\n\t\t\t\t</div>\n\t\t\t</div>\t\t\t\n\t\t";
         //	$text .= "</form>";
         return $text;
         /*
         $text .= "
         	<div class='controls controls-row'>".POLL_506."
         	
         	<input type='radio' name='multi/pleChoice' value='1'".(vartrue($_POST['multipleChoice']) ? " checked='checked'" : "")." /> ".POLL_507."&nbsp;&nbsp;
         	<input type='radio' name='multi/pleChoice' value='0'".(!$_POST['multipleChoice'] ? " checked='checked'" : "")." /> ".POLL_508."
         	
         	</div>";
         */
         //XXX Should NOT be decided by USER
         /*
         $text .= "
         
         <div>
         ".POLLAN_16."
         
         <input type='radio' name='storageMethod' value='0'".(!vartrue($_POST['storageMethod']) ? " checked='checked'" : "")." /> ".POLLAN_17."<br />
         <input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] == 1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br />
         <input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19."
         </div>
         ";
         */
     }
     //TODO Hardcoded FORUM code needs to be moved somewhere.
     if ($mode == 'forum') {
         $text = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><span class='smalltext'>" . LAN_FORUM_3029 . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'><div class='normaltext'>" . LAN_FORUM_3030 . ": </div></td>\n\t\t\t\t<td style='width:80%'class='forumheader3'><input class='tbox' type='text' name='poll_title' size='70' value='" . $tp->post_toForm(vartrue($_POST['poll_title'])) . "' maxlength='200' /></td>\n\t\t\t</tr>";
         $option_count = count(vartrue($_POST['poll_option'])) ? count($_POST['poll_option']) : 1;
         $text .= "\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'>" . LAN_FORUM_3031 . "</td>\n\t\t\t\t<td style='width:80%'>\n\t\t\t\t<div id='pollsection'>";
         for ($count = 1; $count <= $option_count; $count++) {
             if ($count != 1 && $_POST['poll_option'][$count - 1] == "") {
                 break;
             }
             $opt = $count == 1 ? "id='pollopt'" : "";
             $text .= "<span {$opt}><input  class='tbox' type='text' name='poll_option[]' size='40' value=\"" . $_POST['poll_option'][$count - 1] . "\" maxlength='200' />";
             $text .= "</span><br />";
         }
         $text .= "\n\t\t\t\t</div>\n\t\t\t\t<input class='btn btn-default button' type='button' name='addoption' value='" . LAN_FORUM_3032 . "' onclick=\"duplicateHTML('pollopt','pollsection')\" /><br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'>" . LAN_FORUM_3033 . "</td>\n\t\t\t\t<td style='width:80%'>\n\t\t\t\t<input type='radio' name='multipleChoice' value='1'" . (vartrue($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . LAN_YES . "&nbsp;&nbsp;\n\t\t\t\t<input type='radio' name='multipleChoice' value='0'" . (!$_POST['multipleChoice'] ? " checked='checked'" : "") . " /> " . LAN_NO . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:30%'>" . LAN_FORUM_3034 . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='storageMethod' value='0'" . (!vartrue($_POST['storageMethod']) ? " checked='checked'" : "") . " /> " . LAN_FORUM_3035 . "<br />\n\t\t\t\t\t<input type='radio' name='storageMethod' value='1'" . ($_POST['storageMethod'] == 1 ? " checked='checked'" : "") . " /> " . LAN_FORUM_3036 . "<br />\n\t\t\t\t\t<input type='radio' name='storageMethod' value='2'" . ($_POST['storageMethod'] == 2 ? " checked='checked'" : "") . " /> " . LAN_FORUM_3037 . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t";
         return $text;
     }
     $formgo = e_SELF . (e_QUERY && !defined("RESET") && strpos(e_QUERY, 'delete') === FALSE ? "?" . e_QUERY : "");
     $text = "<div>\n\t\t<form method='post' action='{$formgo}'>\n\t\t<table class='table adminform'>\n        <colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tr>\n\t\t<td style='width:30%'><div class='normaltext'>" . POLLAN_3 . ":</div></td>\n\t\t<td style='width:70%'>\n\t\t<input class='tbox input-xxlarge' type='text' name='poll_title' size='70' value='" . $tp->post_toForm(varset($_POST['poll_title'])) . "' maxlength='200' />";
     $option_count = varset($_POST['poll_option']) && count($_POST['poll_option']) ? count($_POST['poll_option']) : 2;
     $text .= "</td></tr><tr>\n\t\t<td style='width:30%;vertical-align:top'>" . LAN_OPTIONS . " :</td>\n\t\t<td style='width:70%'>\n\t\t<div id='pollsection'>";
     for ($count = 1; $count <= $option_count; $count++) {
         $opt = $count == 1 ? "id='pollopt'" : "";
         $text .= "<span class='form-inline' style='display:inline-block; padding-bottom:5px' {$opt}><input  class='tbox input-large' type='text' name='poll_option[]' size='40' value=\"" . $tp->post_toForm($_POST['poll_option'][$count - 1]) . "\" maxlength='200' />";
         $text .= "</span><br />";
     }
     $text .= "</div><input class='btn btn-default' type='button' name='addoption' value='" . POLLAN_8 . "' onclick=\"duplicateHTML('pollopt','pollsection')\" /><br />\n\t\t</td></tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_9 . "</td>\n\t\t<td style='width:70%'>\n\t\t<input type='radio' name='multipleChoice' value='1'" . (varset($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . POLLAN_10 . "&nbsp;&nbsp;\n\t\t<input type='radio' name='multipleChoice' value='0'" . (!varset($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . POLLAN_11 . "\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_12 . "</td>\n\t\t<td style='width:70%'>\n\t\t<input type='radio' name='showResults' value='0'" . (!varset($_POST['showResults']) ? " checked='checked'" : "") . " /> " . POLLAN_13 . "<br />\n\t\t<input type='radio' name='showResults' value='1'" . (varset($_POST['showResults']) ? " checked='checked'" : "") . " /> " . POLLAN_14 . "\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_15 . "</td>";
     $uclass = ADMIN ? "" : "public,member,admin,classes,matchclass";
     $text .= "\n\t\t<td>" . r_userclass("pollUserclass", vartrue($_POST['pollUserclass']), 'off', $uclass) . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_16 . "</td>\n\t\t<td>\n\t\t<input type='radio' name='storageMethod' value='0'" . (!varset($_POST['storageMethod']) ? " checked='checked'" : "") . " /> " . POLLAN_17 . "<br />\n\t\t<input type='radio' name='storageMethod' value='1'" . (varset($_POST['storageMethod']) == 1 ? " checked='checked'" : "") . " /> " . POLLAN_18 . "<br />\n\t\t<input type='radio' name='storageMethod' value='2'" . (varset($_POST['storageMethod']) == 2 ? " checked='checked'" : "") . " /> " . POLLAN_19 . "\n\t\t</td></tr>\n\n\t\t<tr>\n\t\t<td>" . POLLAN_20 . ": </td><td>\n\t\t<input type='radio' name='poll_comment' value='1'" . (varset($_POST['poll_comment']) ? " checked='checked'" : "") . " /> " . POLLAN_10 . "\n\t\t<input type='radio' name='poll_comment' value='0'" . (!varset($_POST['poll_comment']) ? " checked='checked'" : "") . " /> " . POLLAN_11 . "\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div class='buttons-bar center'>";
     if (isset($_POST['preview']) || varset($_POST['edit'])) {
         // $text .= "<input  type='submit' name='preview' value='".POLLAN_24."' /> ";
         $text .= $frm->admin_button('preview', POLLAN_24, 'other');
         if (POLLACTION == 'edit') {
             $text .= $frm->admin_button('submit', LAN_UPDATE, 'update') . "\n\t\t\t\t\n\t\t\t\t<input type='hidden' name='poll_id' value='" . intval($_POST['poll_id']) . "' /> ";
         } else {
             $text .= $frm->admin_button('submit', 'no-value', 'submit', LAN_CREATE);
             //	$text .= "<input type='submit' name='submit' value='".POLLAN_23."' /> ";
         }
     } else {
         $text .= $frm->admin_button('preview', 'no-value', 'other', POLLAN_24);
         //	$text .= "<input  type='submit' name='preview' value='".POLLAN_24."' /> ";
     }
     if (defset('POLLID')) {
         $text .= $frm->admin_button('reset', 'no-value', 'reset', POLLAN_25);
//.........这里部分代码省略.........
开发者ID:armpit,项目名称:e107,代码行数:101,代码来源:poll_class.php

示例9: renderCreateFieldset

 /**
  * Create form fieldset, called internal by {@link renderCreateForm())
  *
  * @param string $id field id
  * @param array $fdata fieldset data
  * @param e_admin_model $model
  * @return string
  */
 function renderCreateFieldset($id, $fdata, $model, $tab = 0)
 {
     $text = vartrue($fdata['fieldset_pre']) . "\r\n\t\t\t<fieldset id='{$id}'>\r\n\t\t\t\t<legend>" . vartrue($fdata['legend']) . "</legend>\r\n\t\t\t\t" . vartrue($fdata['table_pre']) . "\r\n\t\t\t\t<table class='table adminform'>\r\n\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t<col class='col-label' />\r\n\t\t\t\t\t\t<col class='col-control' />\r\n\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t<tbody>\r\n\t\t";
     // 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' || $att['type'] === null || $att['type'] === false) {
             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 (!empty($att['writeParms']) && !is_array($att['writeParms'])) {
             parse_str(varset($att['writeParms']), $writeParms);
         } else {
             $writeParms = varset($att['writeParms']);
         }
         if ('hidden' === $att['type']) {
             if (!vartrue($writeParms['show'])) {
                 $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()));
                 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']);
                 }
             }
             /*
             if('hidden' === $att['type'])
             {
             	parse_str(varset($att['writeParms']), $tmp);
             	if(!vartrue($tmp['show']))
             	{
             		$hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()));
             		unset($tmp);
             		continue;
             	}
             	unset($tmp);
             }
             */
             $leftCell = $required . "<span{$required_class}>" . defset(vartrue($att['title']), vartrue($att['title'])) . "</span>" . $label;
             $rightCell = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId()) . " {$help}";
             if (vartrue($att['type']) == 'bbarea' || varset($writeParms['nolabel']) == true) {
                 $text .= "\r\n\t\t\t\t\t<tr><td colspan='2'>";
                 $text .= "<div style='padding-bottom:8px'>" . $leftCell . "</div>";
                 $text .= $rightCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
             } else {
                 // rightCellClass
                 //			leftCellClass
                 $leftCellClass = !empty($writeParms['tdClassLeft']) ? " class='" . $writeParms['tdClassLeft'] . "'" : "";
                 $rightCellClass = !empty($writeParms['tdClassRight']) ? " class='" . $writeParms['tdClassRight'] . "'" : "";
                 $trClass = !empty($writeParms['trClass']) ? " class='" . $writeParms['trClass'] . "'" : "";
                 $text .= "\r\n\t\t\t\t\t<tr{$trClass}>\r\n\t\t\t\t\t\t<td{$leftCellClass}>\r\n\t\t\t\t\t\t\t" . $leftCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td{$rightCellClass}>\r\n\t\t\t\t\t\t\t" . $rightCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
             }
         }
         //if($bckp) $model->remove($bckp);
//.........这里部分代码省略.........
开发者ID:armpit,项目名称:e107,代码行数:101,代码来源:form_handler.php

示例10: _init

 /**
  * Get and parse core preference values (if available)
  *
  * @return void
  */
 protected function _init()
 {
     // Try to auto-detect runtime location
     $this->setInAdmin(defset('e_ADMIN_AREA', false));
     if ($this->isInAdmin()) {
         $this->_libraries['jquery'] = array("https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.min.js", "https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.js", "https://cdn.jsdelivr.net/jquery.ui/1.11.4/themes/smoothness/jquery-ui.min.css");
         //		"https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js",
         //	"https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css",
         //https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css
     }
     if (isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true') {
         $this->_libraries['jquery'] = array("jquery/jquery.min.js");
     }
     $customJqueryUrls = e107::getPref('library-jquery-urls');
     if (vartrue($customJqueryUrls) && $this->_in_admin === false) {
         $this->_libraries['jquery'] = explode("\n", $customJqueryUrls);
     }
     // Try to load browser cache id from core preferences
     //$this->setCacheId(deftrue('e_NOCACHE') ? time() : e107::getPref('e_jslib_browser_cache'));
     $this->setCacheId(e107::getPref('e_jslib_browser_cache'), 0);
     // Load stored in preferences core lib paths ASAP - FIXME - find better way to store libs - array structure and separate table row
     //	$core_libs = e107::getPref('e_jslib_core');
     $this->_core_prefs = e107::getPref('e_jslib_core');
     $core = array();
     if (is_array($this->_core_prefs)) {
         foreach ($this->_core_prefs as $id => $vis) {
             $this->_dependence = $id;
             if (!$this->libDisabled($id, $vis)) {
                 //echo "<h2>FRAMEWORK Loaded: ".$id."  :: ".$vis."</h2>";
                 if (vartrue($this->_libraries[$id])) {
                     foreach ($this->_libraries[$id] as $path) {
                         //echo "<h4>Loaded: ".$path."  :: ".$vis."</h4>";
                         $core[$path] = $vis;
                     }
                 }
             }
         }
     }
     $this->_dependence = null;
     if ($vis != 'auto') {
         $this->checkLibDependence(null, $core);
     }
     // Load stored in preferences plugin lib paths ASAP
     $plug_libs = e107::getPref('e_jslib_plugin');
     if (!$plug_libs) {
         $plug_libs = array();
     }
     foreach ($plug_libs as $plugname => $lib_paths) {
         $this->pluginLib($plugname, $lib_paths);
     }
     // Load stored in preferences theme lib paths ASAP
     // TODO - decide if THEME should directly use themeLib() or
     // we store paths in 'e_jslib_theme' on theme installation only (theme.xml)!
     $theme_libs = e107::getPref('e_jslib_theme');
     if (!$theme_libs) {
         $theme_libs = array();
     }
     $this->themeLib($theme_libs);
     // TEST VALUES
     // $this->_e_jslib_plugin[] = '{e_PLUGIN}myplug/test.js';
     // $this->_e_jslib_plugin[] = 'http://somesite/myplug/test.js';
     // $this->_e_jslib_theme[] = '{THEME}js/test.js';
     // $this->_e_jslib_theme[] = 'http://somesite/js/test.js';
 }
开发者ID:gitter-badger,项目名称:e107,代码行数:69,代码来源:js_manager.php

示例11: set

 /**
  * Set the Language (Constants, $_SESSION and $_COOKIE) for the current page. 
  * @param string $language force set
  * @return void
  */
 function set($language = null)
 {
     $pref = e107::getPref();
     $session = e107::getSession();
     // default core session namespace
     if ($language && ($language = $this->isValid($language))) {
         $this->detect = $language;
     }
     if ($this->detect) {
         // new - e_language moved to e107 namespace - $_SESSION['e107']['e_language']
         if (!$session->has('e_language') || $session->get('e_language') != $this->detect && $this->isValid($session->get('e_language'))) {
             $session->set('e_language', $this->detect);
         }
         if (varset($_COOKIE['e107_language']) != $this->detect && defset('MULTILANG_SUBDOMAIN') != TRUE) {
             setcookie('e107_language', $this->detect, time() + 86400, e_HTTP);
             $_COOKIE['e107_language'] = $this->detect;
             // Used only when a user returns to the site. Not used during this session.
         } else {
             if (isset($_COOKIE['e107_language'])) {
                 unset($_COOKIE['e107_language']);
             }
         }
         $user_language = $this->detect;
     } else {
         if ($session->has('e_language')) {
             $user_language = $session->get('e_language');
         } elseif (isset($_COOKIE['e107_language']) && ($user_language = $this->isValid($_COOKIE['e107_language']))) {
             $session->set('e_language', $user_language);
         } else {
             $user_language = $pref['sitelanguage'];
             if ($session->is('e_language')) {
                 $session->clear('e_language');
             }
             if (isset($_COOKIE['e107_language'])) {
                 unset($_COOKIE['e107_language']);
             }
         }
     }
     $this->e_language = $user_language;
     $this->setDefs();
     return;
 }
开发者ID:notzen,项目名称:e107,代码行数:47,代码来源:language_class.php

示例12: define

     define('e_PAGETITLE', $tp->toHTML($category_name, FALSE, 'TITLE'));
 }
 $currentNewsAction = $action;
 require_once HEADERF;
 $action = $currentNewsAction;
 if (vartrue($NEWSLISTSTYLE)) {
     $template = array('start' => '', 'item' => $NEWSLISTSTYLE, 'end' => '');
 } else {
     $template = e107::getTemplate('news', 'news', 'list');
 }
 // Legacy Styling..
 $param = array();
 $param['itemlink'] = defined("NEWSLIST_ITEMLINK") ? NEWSLIST_ITEMLINK : "";
 $param['thumbnail'] = defined("NEWSLIST_THUMB") ? NEWSLIST_THUMB : "border:0px";
 $param['catlink'] = defined("NEWSLIST_CATLINK") ? NEWSLIST_CATLINK : "";
 $param['caticon'] = defined("NEWSLIST_CATICON") ? NEWSLIST_CATICON : defset('ICONSTYLE', '');
 $param['current_action'] = $action;
 // NEW - allow news batch shortcode override (e.g. e107::getScBatch('news', 'myplugin', true); )
 e107::getEvent()->trigger('news_list_parse', $newsList);
 $text = '';
 if (vartrue($template['start'])) {
     $text .= $tp->parseTemplate($template['start'], true);
 }
 foreach ($newsList as $row) {
     $text .= $ix->render_newsitem($row, 'return', '', $template['item'], $param);
 }
 if (vartrue($template['end'])) {
     $text .= $tp->parseTemplate($template['end'], true);
 }
 $icon = $row['category_icon'] ? "<img src='" . e_IMAGE . "icons/" . $row['category_icon'] . "' alt='' />" : "";
 // Deprecated.
开发者ID:xxlinkexx,项目名称:e107,代码行数:31,代码来源:news.php

示例13: replaceConstants

 /**
  * Replace e107 path constants
  * Note: only an ADMIN user can convert {e_ADMIN}
  * TODO - runtime cache of search/replace arrays (object property) when $mode !== ''
  * @param string $text
  * @param string $mode [optional]	abs|full "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc
  * 									TRUE = produce truncated URL path, e.g. e107plugins/etc
  * 									"" (default) = URL's get relative path e.g. ../e107_plugins/etc
  * @param mixed $all [optional] 	if TRUE, then when $mode is "full" or TRUE, USERID is also replaced...
  * 									when $mode is "" (default), ALL other e107 constants are replaced
  * @return string
  */
 public function replaceConstants($text, $mode = '', $all = FALSE)
 {
     if ($mode != "") {
         $e107 = e107::getInstance();
         $replace_relative = array($e107->getFolder('media_files'), $e107->getFolder('media_video'), $e107->getFolder('media_image'), $e107->getFolder('media_icon'), $e107->getFolder('media_avatar'), $e107->getFolder('web_js'), $e107->getFolder('web_css'), $e107->getFolder('web_image'), $e107->getFolder('web_pack'), e_IMAGE_ABS, e_THEME_ABS, $e107->getFolder('images'), $e107->getFolder('plugins'), $e107->getFolder('files'), $e107->getFolder('themes'), $e107->getFolder('handlers'), $e107->getFolder('media'), $e107->getFolder('web'), $e107->site_theme ? $e107->getFolder('themes') . $e107->site_theme . '/' : '', defset('THEME_ABS'), ADMIN ? $e107->getFolder('admin') : '', '', $e107->getFolder('core'), $e107->getFolder('system'));
         switch ($mode) {
             case 'abs':
                 $replace_absolute = array(e_MEDIA_FILE_ABS, e_MEDIA_VIDEO_ABS, e_MEDIA_IMAGE_ABS, e_MEDIA_ICON_ABS, e_MEDIA_AVATAR_ABS, e_JS_ABS, e_CSS_ABS, e_WEB_IMAGE_ABS, e_PACK_ABS, e_IMAGE_ABS, e_THEME_ABS, e_IMAGE_ABS, e_PLUGIN_ABS, e_FILE_ABS, e_THEME_ABS, '', e_MEDIA_ABS, e_WEB_ABS, defset('THEME_ABS'), defset('THEME_ABS'), ADMIN ? e_ADMIN_ABS : '', $e107->server_path, '', '');
                 break;
             case 'full':
                 $replace_absolute = array(SITEURLBASE . e_MEDIA_FILE_ABS, SITEURLBASE . e_MEDIA_VIDEO_ABS, SITEURLBASE . e_MEDIA_IMAGE_ABS, SITEURLBASE . e_MEDIA_ICON_ABS, SITEURLBASE . e_MEDIA_AVATAR_ABS, SITEURLBASE . e_JS_ABS, SITEURLBASE . e_CSS_ABS, SITEURLBASE . e_WEB_IMAGE_ABS, SITEURLBASE . e_PACK_ABS, SITEURLBASE . e_IMAGE_ABS, SITEURLBASE . e_THEME_ABS, SITEURLBASE . e_IMAGE_ABS, SITEURLBASE . e_PLUGIN_ABS, SITEURLBASE . e_FILE_ABS, SITEURLBASE . e_THEME_ABS, '', SITEURLBASE . e_MEDIA_ABS, SITEURLBASE . e_WEB_ABS, defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', ADMIN ? SITEURLBASE . e_ADMIN_ABS : '', SITEURL, '', '');
                 break;
         }
         // sub-folders first!
         $search = array('{e_MEDIA_FILE}', '{e_MEDIA_VIDEO}', '{e_MEDIA_IMAGE}', '{e_MEDIA_ICON}', '{e_MEDIA_AVATAR}', '{e_WEB_JS}', '{e_WEB_CSS}', '{e_WEB_IMAGE}', '{e_WEB_PACK}', "{e_IMAGE_ABS}", "{e_THEME_ABS}", "{e_IMAGE}", "{e_PLUGIN}", "{e_FILE}", "{e_THEME}", "{e_HANDLER}", "{e_MEDIA}", "{e_WEB}", "{THEME}", "{THEME_ABS}", "{e_ADMIN}", "{e_BASE}", "{e_CORE}", "{e_SYSTEM}");
         /*if (ADMIN)
         		{
         			$replace_relative[] = $e107->getFolder('admin');
         			$replace_absolute[] = SITEURL.$e107->getFolder('admin');
         			$search[] = "{e_ADMIN}";
         		}*/
         if ($all) {
             if (USER) {
                 // Can only replace with valid number for logged in users
                 $replace_relative[] = USERID;
                 $replace_absolute[] = USERID;
             } else {
                 $replace_relative[] = '';
                 $replace_absolute[] = '';
             }
             $search[] = "{USERID}";
         }
         // current THEME
         /*if(!defined('THEME'))
         		{
         			//if not already parsed by doReplace
         			$text = str_replace(array('{THEME}', '{THEME_ABS}'), '', $text);
         		}
         		else
         		{
         			$replace_relative[] = THEME;
         			$replace_absolute[] = THEME_ABS;
         			$search[] = "{THEME}";
         			$replace_relative[] = THEME;
         			$replace_absolute[] = THEME_ABS;
         			$search[] = "{THEME_ABS}";
         		}*/
         $replace = (string) $mode == "full" || (string) $mode == 'abs' ? $replace_absolute : $replace_relative;
         return str_replace($search, $replace, $text);
     }
     //		$pattern = ($all ? "#\{([A-Za-z_0-9]*)\}#s" : "#\{(e_[A-Z]*)\}#s");
     $pattern = $all ? '#\\{([A-Za-z_0-9]*)\\}#s' : '#\\{(e_[A-Z]*(?:_IMAGE|_VIDEO|_FILE|_CONTENT|_ICON|_AVATAR|_JS|_CSS|_PACK|_DB|_ABS){0,1})\\}#s';
     $text = preg_replace_callback($pattern, array($this, 'doReplace'), $text);
     if (!defined('THEME')) {
         //if not already parsed by doReplace
         $text = str_replace(array('{THEME}', '{THEME_ABS}'), '', $text);
     } else {
         $srch = array('{THEME}', '{THEME_ABS}');
         $repl = array(THEME, THEME_ABS);
         $text = str_replace($srch, $repl, $text);
     }
     return $text;
 }
开发者ID:notzen,项目名称:e107,代码行数:75,代码来源:e_parse_class.php

示例14: while

        }
        $text .= "</table>\n</div>";
        $ns->tablerender(TOP_LAN_3, $text);
    }
    if ($subaction == 'chat' || $subaction == 'all') {
        $top_forum_posters = $sql->db_Select("user", "*", "`user_chats` > 0 ORDER BY user_chats DESC LIMIT 0, 10");
        $text = "\r\n\t\t\t<div style='text-align:center'>\r\n\t\t\t<table style='width:95%' class='fborder'>\r\n\t\t\t<tr>\r\n\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>&nbsp;</td>\r\n\t\t\t<td style='width:20%' class='forumheader3'>" . TOP_LAN_1 . "</td>\r\n\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>" . TOP_LAN_2 . "</td>\r\n\t\t\t<td style='width:30%; text-align:center' class='forumheader3'>" . TOP_LAN_6 . "</td>\r\n\t\t\t</tr>\n";
        $counter = 1;
        if ($top_forum_posters) {
            while ($row = $sql->db_Fetch()) {
                // TODO - Custom ranking (chat), LANs
                $ldata = $rank->getRanks($row);
                if (vartrue($ldata['special'])) {
                    $r = $ldata['special'];
                } else {
                    $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']);
                }
                if (!$r) {
                    $r = 'n/a';
                }
                $text .= "<tr>\r\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$counter}</td>\r\n\t\t\t\t\t<td style='width:50%' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', 'id=' . $row['user_id'] . '&name=' . $row['user_name']) . "'>{$row['user_name']}</a></td>\r\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$row['user_chats']}</td>\r\n\t\t\t\t\t<td style='width:30%; text-align:center' class='forumheader3'>{$r}</td>\r\n\t\t\t\t\t</tr>";
                $counter++;
            }
        } else {
            $text .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='forumheader3' colspan='4'>No results</td>\r\n\t\t\t\t</tr>";
        }
        $text .= "</table>\n</div>";
        $ns->tablerender(TOP_LAN_5, $text);
    }
}
require_once FOOTERF;
开发者ID:gitter-badger,项目名称:e107,代码行数:31,代码来源:top.php

示例15: createCategory

 /**
  * Create media category.
  * 'class' data is optional, 'id' key is ignored
  * 
  * @param array $data associative array, db keys should be passed without the leading 'media_cat_' e.g. 'class', 'type', etc.
  * @return integer last inserted ID or false on error
  */
 public function createCategory($datas)
 {
     foreach ($datas as $k => $v) {
         $data['media_cat_' . $k] = $v;
     }
     $data['media_cat_id'] = 0;
     if (!isset($data['media_cat_class']) || '' === $data['media_cat_class']) {
         $data['media_cat_class'] = defset('e_UC_MEMBER', 253);
     }
     return e107::getDb()->insert('core_media_cat', $data);
 }
开发者ID:KonzolozZ,项目名称:e107,代码行数:18,代码来源:media_class.php


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