本文整理汇总了PHP中varset函数的典型用法代码示例。如果您正苦于以下问题:PHP varset函数的具体用法?PHP varset怎么用?PHP varset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了varset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
*
*/
public function create($route, $params = array())
{
if (!$params) {
return 'page.php';
}
if (is_string($route)) {
$route = explode('/', $route, 2);
}
if (!varset($route[1])) {
$route[1] = 'index';
}
## aliases as retrieved from the DB, map vars to proper values
if (isset($params['page_title']) && !empty($params['page_title'])) {
$params['name'] = $params['page_title'];
}
if (isset($params['page_id']) && !empty($params['page_id'])) {
$params['id'] = $params['page_id'];
}
$url = 'page.php?';
if ('--FROM--' != vartrue($params['page'])) {
$page = varset($params['page']) ? intval($params['page']) : '0';
} else {
$page = '--FROM--';
}
$url .= intval($params['id']) . ($page ? '.' . $page : '');
return $url;
}
示例2: init
function init()
{
$pref = e107::getPref();
$sql = e107::getDb();
if (vartrue($_POST['cron_execute'])) {
$executeID = key($_POST['cron_execute']);
$this->cronExecute($executeID);
}
if (!vartrue(e107::getPref('e_cron_pwd')) || varset($_POST['generate_pwd'])) {
$pwd = $this->setCronPwd();
}
$sql->gen("SELECT cron_function,cron_active FROM #cron ");
while ($row = $sql->fetch(MYSQL_ASSOC)) {
$this->curCrons[] = $row['cron_function'];
if ($row['cron_active'] == 1) {
$this->activeCrons++;
}
}
$this->lastRefresh();
// Import Core and Plugin e_cron data
$cronDefaults['_system'] = array(0 => array('name' => LAN_CRON_01_1, 'function' => 'sendEmail', 'category' => 'mail', 'description' => str_replace("[eml]", $pref['siteadminemail'], LAN_CRON_01_2) . "<br />" . LAN_CRON_01_3), 1 => array('name' => LAN_CRON_02_1, 'category' => 'mail', 'function' => 'procEmailQueue', 'description' => LAN_CRON_02_2), 2 => array('name' => LAN_CRON_03_1, 'category' => 'mail', 'function' => 'procEmailBounce', 'description' => LAN_CRON_03_2), 3 => array('name' => LAN_CRON_04_1, 'category' => 'user', 'function' => 'procBanRetrigger', 'description' => LAN_CRON_04_2 . "<br />" . LAN_CRON_04_3, 'available' => e107::getPref('ban_retrigger')), 4 => array('name' => LAN_CRON_05_1, 'category' => 'backup', 'function' => 'dbBackup', 'description' => LAN_CRON_05_2 . ' ' . e_SYSTEM . 'backups/'), 5 => array('name' => LAN_CRON_06_1, 'category' => 'user', 'function' => 'procBanRetrigger', 'description' => LAN_CRON_06_2 . "<br />" . LAN_CRON_06_3), 6 => array('name' => LAN_CRON_20_1, 'category' => 'update', 'function' => 'checkCoreUpdate', 'description' => LAN_CRON_20_2 . "<br />" . LAN_CRON_20_3));
if (is_dir(e_BASE . ".git")) {
$cronDefaults['_system'][7] = array('name' => LAN_CRON_20_4, 'category' => 'update', 'function' => 'gitrepo', 'description' => LAN_CRON_20_5 . "<br />" . LAN_CRON_20_6 . "<br /><span class='label label-warning'>" . LAN_CRON_20_7 . "</span> " . LAN_CRON_20_8);
}
if (!vartrue($_GET['action']) || $_GET['action'] == 'refresh') {
$this->cronImport($cronDefaults);
// import Core Crons (if missing)
$this->cronImport(e107::getAddonConfig('e_cron'));
// Import plugin Crons
$this->cronImportLegacy();
// Import Legacy Cron Tab Settings
}
}
示例3: sc_gallery_thumb
/**
* All possible parameters
* {GALLERY_THUMB=w=200&h=200&thumburl&thumbsrc&imageurl&orig}
* w and h - optional width and height of the thumbnail
* thumburl - return only the URL of the destination image (large one)
* thumbsrc - url to the thumb, as it's written in the src attribute of the image
* imageurl - full path to the destination image (no proxy)
* actualPreview - large preview will use the original path to the image (no proxy)
*/
function sc_gallery_thumb($parm = '')
{
$tp = e107::getParser();
$parms = eHelper::scParams($parm);
$w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth();
// 190; // 160;
$h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight();
// 130;
$class = $this->slideMode == TRUE ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'], 'gallery-thumb img-responsive');
// $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
$rel = $this->slideMode == TRUE ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
$att = 'aw=' . $w . '&ah=' . $h . '&x=1';
// 'aw=190&ah=150';
$srcFull = $tp->thumbUrl($this->var['media_url'], $this->attFull);
if (vartrue($parms['actualPreview'])) {
$srcFull = $tp->replaceConstants($this->var['media_url'], 'full');
}
if (isset($parms['thumburl'])) {
return $srcFull;
} elseif (isset($parms['thumbsrc'])) {
return $tp->thumbUrl($this->var['media_url'], $att);
} elseif (isset($parms['imageurl'])) {
return $tp->replaceConstants($this->var['media_url'], 'full');
}
$caption = $tp->toAttribute($this->var['media_caption']);
$description = $this->downloadable ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='Right-click > Save Link As' href='" . $srcFull . "'>Download</a>" : "";
$description .= $tp->toAttribute($this->var['media_description']);
$text = "<a class='" . $class . "' title=\"" . $description . "\" href='" . $srcFull . "' data-gal='{$rel}' >";
$text .= "<img class='" . $class . "' src='" . $tp->thumbUrl($this->var['media_url'], $att) . "' alt=\"" . $caption . "\" />";
$text .= "</a>";
return $text;
}
示例4: beforeUpdate
public function beforeUpdate($new_data)
{
if (!varset($new_data['fb_category_template'])) {
$new_data['fb_category_template'] = 'default';
}
return $new_data;
}
示例5: registerEvents
/**
* Register core and plugin notification events.
*/
public function registerEvents()
{
$active = e107::getConfig()->get('notify');
if (empty($active) && e_PAGE == 'notify.php') {
e107::getMessage()->addDebug('Notify is disabled!');
return false;
}
$e_event = e107::getEvent();
if (varset($this->notify_prefs['event'])) {
foreach ($this->notify_prefs['event'] as $id => $status) {
$include = null;
if ($status['class'] != e_UC_NOBODY) {
if (varset($status['include'])) {
$include = e_PLUGIN . $status['include'] . "/e_notify.php";
if (varset($status['legacy']) != 1) {
$class = $status['include'] . "_notify";
$method = $id;
$e_event->register($id, array($class, $method), $include);
} else {
$e_event->register($id, 'notify_' . $id, $include);
}
} else {
if (method_exists($this, 'notify_' . $id)) {
$e_event->register($id, array('notify', 'notify_' . $id));
} else {
$e_event->register($id, array('notify', 'generic'));
// use generic notification.
}
}
}
}
}
// e107::getEvent()->debug();
}
示例6: iconpicker_shortcode
function iconpicker_shortcode($parm)
{
$parms = array();
parse_str($parm, $parms);
$name = varset($parms['id']);
$sql = e107::getDb();
$frm = e107::getForm();
$tp = e107::getParser();
// $sc_parameters is currently being used to select the media-category.
$qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") ";
$qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
$qry .= "ORDER BY media_category,media_name";
$str = "";
$size_section = array();
$lastsize = "16";
if ($sql->db_Select_gen($qry)) {
while ($row = $sql->db_Fetch()) {
list($tmp, $tmp2, $size) = explode("_", $row['media_category']);
if ($str != '' && $size != $lastsize) {
$size_section[] = $str;
$str = "";
}
$str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>";
$lastsize = $size;
}
return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>';
}
}
示例7: __construct
/**
* Constructor - init paths
* @todo FIX e107 (new folder structure), simplify all this, e.g. e107::getInstance()->initMinimal($path_to_e107_config);
*
* @return void
*/
public function __construct()
{
// initial path
$self = realpath(dirname(__FILE__));
// Config
include $self . '/e107_config.php';
$tmp = $self . '/' . $HANDLERS_DIRECTORY;
//Core functions - now API independent
@(require $tmp . '/core_functions.php');
//e107 class
@(require $tmp . '/e107_class.php');
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY', 'MEDIA_DIRECTORY', 'CACHE_DIRECTORY', 'LOGS_DIRECTORY', 'WEB_DIRECTORY', 'SYSTEM_DIRECTORY', 'CORE_DIRECTORY');
// $sql_info = array(); //compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLcharset');
//e107::getInstance()->initCore($e107_paths, $self, $sql_info, varset($e107_CONFIG, array()));
$e107 = e107::getInstance();
$e107->site_path = substr(md5($mySQLdefaultdb . "." . $mySQLprefix), 0, 10);
$e107->prepare_request();
$e107->setDirs($e107_paths, varset($E107_CONFIG, array()));
$e107->set_constants();
$e107->set_paths();
$e107->file_path = $e107->fix_windows_paths($self) . "/";
$e107->set_base_path();
$e107->set_request(false);
$e107->set_urls(false);
unset($tmp, $self);
// basic Admin area detection - required for proper path parsing
define('ADMIN', strpos(e_SELF, $e107->getFolder('admin') !== false || strpos(e_PAGE, 'admin') !== false));
$e107->set_urls(false);
$pref = $e107->getPref();
//TODO optimize/benchmark
$this->_watermark = array('activate' => vartrue($pref['watermark_activate'], false), 'text' => vartrue($pref['watermark_text']), 'size' => vartrue($pref['watermark_size'], 20), 'pos' => vartrue($pref['watermark_pos'], "BR"), 'color' => vartrue($pref['watermark_color'], 'fff'), 'font' => vartrue($pref['watermark_font']), 'margin' => vartrue($pref['watermark_margin'], 30), 'shadowcolor' => vartrue($pref['watermark_shadowcolor'], '000000'), 'opacity' => vartrue($pref['watermark_opacity'], 20));
$this->_thumbQuality = vartrue($pref['thumbnail_quality'], 65);
// parse request
$this->parseRequest();
}
示例8: init
/**
* Process submitted form data.
*/
function init()
{
if (isset($_POST['saveConfig']) && (int) $_POST['saveConfig'] === 1) {
$prefs = e107::getPlugConfig('google_analytics');
$prefs->set('account', varset($_POST['account'], ''))->save();
$prefs->set('domain_mode', (int) vartrue($_POST['domain_mode'], 0))->save();
$prefs->set('cross_domains', varset($_POST['cross_domains'], ''))->save();
$prefs->set('visibility_pages', (int) vartrue($_POST['visibility_pages'], 0))->save();
$prefs->set('pages', varset($_POST['pages'], ''))->save();
$prefs->set('visibility_roles', (int) vartrue($_POST['visibility_roles'], 0))->save();
$prefs->set('track_user_id', (int) vartrue($_POST['track_user_id'], 0))->save();
$prefs->set('track_outbound', (int) vartrue($_POST['track_outbound'], 0))->save();
$prefs->set('track_mailto', (int) vartrue($_POST['track_mailto'], 0))->save();
$prefs->set('track_files', (int) vartrue($_POST['track_files'], 0))->save();
$prefs->set('track_files_extensions', varset($_POST['track_files_extensions']))->save();
$prefs->set('track_link_id', (int) vartrue($_POST['track_link_id'], 0))->save();
$prefs->set('track_url_fragments', (int) vartrue($_POST['track_url_fragments'], 0))->save();
$prefs->set('track_adsense', (int) vartrue($_POST['track_adsense'], 0))->save();
$prefs->set('track_double_click', (int) vartrue($_POST['track_double_click'], 0))->save();
$prefs->set('tracker_anonymize_ip', (int) vartrue($_POST['tracker_anonymize_ip'], 0))->save();
$prefs->set('privacy_do_not_track', (int) vartrue($_POST['privacy_do_not_track'], 0))->save();
$prefs->set('cache', (int) vartrue($_POST['cache'], 0))->save();
$prefs->set('debug', (int) vartrue($_POST['debug'], 0))->save();
}
}
示例9: pm_getInfo
/**
* Get the box-related information for inbox or outbox - limits, message count etc
* The information read from the DB is cached internally for efficiency
*
* @param string $which = inbox|outbox|clear
*
* @return array
*
*/
function pm_getInfo($which = 'inbox')
{
static $pm_info;
if ('clear' == $which) {
unset($pm_info['inbox']);
unset($pm_info['outbox']);
return;
}
if ('inbox' == $which) {
$qry = "SELECT count(pm.pm_id) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM `#private_msg` as pm WHERE pm.pm_to = " . USERID . " AND pm.pm_read_del = 0";
} else {
$qry = "SELECT count(pm.pm_from) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM `#private_msg` as pm WHERE pm.pm_from = " . USERID . " AND pm.pm_sent_del = 0";
}
if (!isset($pm_info[$which]['total'])) {
$this->pmDB->gen($qry);
$pm_info[$which] = $this->pmDB->fetch();
if ($which == 'inbox' && ($this->pmPrefs['animate'] == 1 || $this->pmPrefs['popup'] == 1)) {
if ($new = $this->pmDB->db_Count('private_msg', '(*)', "WHERE pm_sent > '" . USERLV . "' AND pm_read = 0 AND pm_to = '" . USERID . "' AND pm_read_del != 1")) {
$pm_info['inbox']['new'] = $new;
} else {
$pm_info['inbox']['new'] = 0;
}
}
}
if (!isset($pm_info[$which]['limit'])) {
if (varset($this->pmPrefs['pm_limits'], 0) > 0) {
if ($this->pmPrefs['pm_limits'] == 1) {
$qry = "SELECT MAX(gen_user_id) AS inbox_limit, MAX(gen_ip) as outbox_limit FROM `#generic` WHERE gen_type='pm_limit' AND gen_datestamp IN (" . USERCLASS_LIST . ")";
} else {
$qry = "SELECT MAX(gen_intdata) AS inbox_limit, MAX(gen_chardata) as outbox_limit FROM `#generic` WHERE gen_type='pm_limit' AND gen_datestamp IN (" . USERCLASS_LIST . ")";
}
if ($this->pmDB->gen($qry)) {
$row = $this->pmDB->fetch();
$pm_info['inbox']['limit'] = $row['inbox_limit'];
$pm_info['outbox']['limit'] = $row['outbox_limit'];
}
$pm_info['inbox']['limit_val'] = $this->pmPrefs['pm_limits'] == 1 ? varset($pm_info['inbox']['total'], '') : varset($pm_info['inbox']['size'], '');
if (!$pm_info['inbox']['limit'] || !$pm_info['inbox']['limit_val']) {
$pm_info['inbox']['filled'] = 0;
} else {
$pm_info['inbox']['filled'] = number_format($pm_info['inbox']['limit_val'] / $pm_info['inbox']['limit'] * 100, 2);
}
$pm_info['outbox']['limit_val'] = $this->pmPrefs['pm_limits'] == 1 ? varset($pm_info['outbox']['total'], '') : varset($pm_info['outbox']['size'], '');
if (!$pm_info['outbox']['limit'] || !$pm_info['outbox']['limit_val']) {
$pm_info['outbox']['filled'] = 0;
} else {
$pm_info['outbox']['filled'] = number_format($pm_info['outbox']['limit_val'] / $pm_info['outbox']['limit'] * 100, 2);
}
} else {
$pm_info['inbox']['limit'] = '';
$pm_info['outbox']['limit'] = '';
$pm_info['inbox']['filled'] = '';
$pm_info['outbox']['filled'] = '';
}
}
return $pm_info;
}
示例10: init
function init()
{
if (!empty($_GET['filter'])) {
$action = $_GET['filter'];
$this->adminMenu['main/' . $action]['selected'] = true;
}
$pref = e107::pref('faqs');
$this->access = array('main/create' => varset($pref['admin_faq_create'], e_UC_ADMIN), 'main/edit' => varset($pref['admin_faq_edit'], e_UC_ADMIN), 'main/delete' => varset($pref['admin_faq_delete'], e_UC_ADMIN), 'cat/list' => check_class($pref['admin_cat_create']) || check_class($pref['admin_cat_edit']) ? e_UC_ADMIN : e_UC_NOBODY, 'cat/create' => varset($pref['admin_cat_create'], e_UC_ADMIN), 'cat/edit' => varset($pref['admin_cat_edit'], e_UC_ADMIN), 'cat/delete' => varset($pref['admin_cat_delete'], e_UC_ADMIN));
}
示例11: sc_login_table_password
function sc_login_table_password($parm = '')
{
$pref = e107::getPref();
$text = "<input class='tbox form-control input-block-level' type='password' name='userpass' id='userpass' size='40' maxlength='100' placeholder=\"" . LAN_LOGIN_2 . "\" />";
if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'], 0)) {
$text .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='" . e107::getSession()->get('challenge') . "' />\n\n";
}
return $text;
}
示例12: sc_contact_body
function sc_contact_body($parm = '')
{
parse_str($parm, $parm);
$rows = vartrue($parm['rows'], 10);
$cols = vartrue($parm['cols'], 70);
if ($cols > 60) {
$size = 'input-xxlarge';
}
return "<textarea cols='{$cols}' style='max-width:99%' id='contactBody' rows='{$rows}' name='body' required='required' class='tbox {$size} form-control'>" . stripslashes(varset($_POST['body'])) . "</textarea>";
}
示例13: navigation_shortcode
function navigation_shortcode($parm = '')
{
$types = array('main' => 1, 'side' => 2, 'footer' => 3, 'alt' => 4, 'alt5' => 5, 'alt6' => 6);
$category = varset($types[$parm], 1);
$tmpl = vartrue($parm, 'main');
$nav = e107::getNav();
$template = e107::getCoreTemplate('navigation', $tmpl);
$data = $nav->initData($category);
// $data = $nav->collection($category);
return $nav->render($data, $template);
}
示例14: create
/**
* Query mapping in format route?params:
* - profile/view?id=xxx -> user.php?id.xxx
* - profile/list?page=xxx -> user.php?xxx
* - myprofile/view -> user.php
* - profile/edit?id=xxx -> usersettings.php?xxx
* - myprofile/edit -> usersettings.php
* - login/index (or just 'login') -> login.php
* - register/index (or just 'register') -> signup.php
*/
public function create($route, $params = array())
{
if (!$params) {
return 'user.php';
}
if (is_string($route)) {
$route = explode('/', $route, 2);
}
if (!varset($route[1])) {
$route[1] = 'index';
}
## aliases as retrieved from the DB, map vars to proper values
if (isset($params['user_name']) && !empty($params['user_name'])) {
$params['id'] = $params['user_name'];
}
if (isset($params['user_id']) && !empty($params['user_id'])) {
$params['id'] = $params['user_id'];
}
$url = 'user.php';
$page = vartrue($params['page']) ? intval($params['page']) : '0';
if ($route[0] == 'profile') {
switch ($route[1]) {
case '':
case 'view':
$url .= '?id.' . $params['id'];
break;
case 'list':
$url .= $page ? '?' . $page : '';
break;
case 'edit':
$url = e_ADMIN_ABS . "user.php?mode=main&action=edit&id=" . $params['id'];
// 'usersettings.php?'.$params['id'];
break;
}
} elseif ($route[0] == 'myprofile') {
switch ($route[1]) {
case '':
case 'view':
// user.php
break;
case 'edit':
$url = 'usersettings.php';
break;
}
} elseif ($route[0] == 'login') {
$url = 'login.php';
} elseif ($route[0] == 'register') {
$url = 'signup.php';
}
// XXX signup URL parameters
return $url;
}
示例15: __construct
function __construct()
{
$this->request = e107::getRegistry('core/pages/request');
$action = varset($this->request['action']);
if (($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id'])) {
$this->var = e107::getDb()->retrieve('page_chapters', 'chapter_name, chapter_meta_description, chapter_sef', 'chapter_id = ' . intval($this->request['id']) . ' LIMIT 1');
}
if ($action == 'showPage' && vartrue($this->request['id'])) {
$query = "SELECT p.page_id,c.chapter_name,c.chapter_meta_description FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id WHERE p.page_id = " . intval($this->request['id']) . " LIMIT 1 ";
$rows = e107::getDb()->retrieve($query, true);
$this->var = $rows[0];
}
}