1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Code Cleanup

This commit is contained in:
Cameron
2019-05-20 14:53:43 -07:00
parent 6a2fdab074
commit bdb45485ee
27 changed files with 55 additions and 44 deletions

View File

@@ -4808,7 +4808,7 @@ TEMPLATE;
} }
// Guess Default Field Type based on name of field. // Guess Default Field Type based on name of field.
function guess($data, $val='',$mode = 'type') function guess($data, $val=null,$mode = 'type')
{ {
$tmp = explode("_",$data); $tmp = explode("_",$data);

View File

@@ -1696,7 +1696,7 @@ class users_ext
} }
function show_extended($current = '') // Show Add fields List. function show_extended($current = null) // Show Add fields List.
{ {
global $ue, $curtype,$mySQLdefaultdb, $action, $sub_action; global $ue, $curtype,$mySQLdefaultdb, $action, $sub_action;

View File

@@ -94,7 +94,7 @@ class contact_shortcodes extends e_shortcode
/* example {CONTACT_NAME: class=form-control} */ /* example {CONTACT_NAME: class=form-control} */
/* example {CONTACT_NAME: class=col-md-12&placeholder=".LANCONTACT_03." *} */ /* example {CONTACT_NAME: class=col-md-12&placeholder=".LANCONTACT_03." *} */
function sc_contact_name($parm='') function sc_contact_name($parm=null)
{ {
$userName = deftrue('USERNAME'); $userName = deftrue('USERNAME');
$class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control'; $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
@@ -109,7 +109,7 @@ class contact_shortcodes extends e_shortcode
/* example {CONTACT_EMAIL: class=form-control} */ /* example {CONTACT_EMAIL: class=form-control} */
/* example {CONTACT_EMAIL: class=col-md-12&placeholder=".LANCONTACT_04." *} */ /* example {CONTACT_EMAIL: class=col-md-12&placeholder=".LANCONTACT_04." *} */
function sc_contact_email($parm='') function sc_contact_email($parm=null)
{ {
$userEmail = deftrue('USEREMAIL'); $userEmail = deftrue('USEREMAIL');
$disabled = (!empty($userEmail)) ? 'readonly' : ''; // don't allow change from a verified email address. $disabled = (!empty($userEmail)) ? 'readonly' : ''; // don't allow change from a verified email address.
@@ -126,7 +126,7 @@ class contact_shortcodes extends e_shortcode
/* example {CONTACT_SUBJECT: class=form-control} */ /* example {CONTACT_SUBJECT: class=form-control} */
/* example {CONTACT_SUBJECT: class=col-md-12&placeholder=".LANCONTACT_05." *} */ /* example {CONTACT_SUBJECT: class=col-md-12&placeholder=".LANCONTACT_05." *} */
function sc_contact_subject($parm='') function sc_contact_subject($parm=null)
{ {
$class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control'; $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
$placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : ''; $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : '';
@@ -161,14 +161,14 @@ class contact_shortcodes extends e_shortcode
/* example {CONTACT_SUBMIT_BUTTON} */ /* example {CONTACT_SUBMIT_BUTTON} */
/* example {CONTACT_SUBMIT_BUTTON: class=contact submit btn btn-minimal} */ /* example {CONTACT_SUBMIT_BUTTON: class=contact submit btn btn-minimal} */
function sc_contact_submit_button($parm='') function sc_contact_submit_button($parm=null)
{ {
$class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-primary button'; $class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-primary button';
return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='".$class."' />"; return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='".$class."' />";
} }
function sc_contact_gdpr_check($parm='') function sc_contact_gdpr_check($parm=null)
{ {
$parm['class'] = (!empty($parm['class'])) ? $parm['class'] : ''; $parm['class'] = (!empty($parm['class'])) ? $parm['class'] : '';
$parm = array_merge(array('required'=>1), $parm); $parm = array_merge(array('required'=>1), $parm);
@@ -176,7 +176,7 @@ class contact_shortcodes extends e_shortcode
} }
/* {CONTACT_GDPR_LINK} */ /* {CONTACT_GDPR_LINK} */
function sc_contact_gdpr_link($parm='') function sc_contact_gdpr_link($parm=null)
{ {
$pp = e107::getPref('gdpr_privacypolicy', ''); $pp = e107::getPref('gdpr_privacypolicy', '');
if (!$pp) if (!$pp)

View File

@@ -44,7 +44,7 @@ class login_shortcodes extends e_shortcode
/* example: {LOGIN_TABLE_USERNAME} */ /* example: {LOGIN_TABLE_USERNAME} */
/* example: {LOGIN_TABLE_USERNAME: class=form-control} */ /* example: {LOGIN_TABLE_USERNAME: class=form-control} */
function sc_login_table_username($parm='') //FIXME use $frm function sc_login_table_username($parm=null) //FIXME use $frm
{ {
if(empty($this->userReg)) if(empty($this->userReg))
@@ -63,7 +63,7 @@ class login_shortcodes extends e_shortcode
/* example: {LOGIN_TABLE_PASSWORD} */ /* example: {LOGIN_TABLE_PASSWORD} */
/* example: {LOGIN_TABLE_PASSWORD: class=form-control} */ /* example: {LOGIN_TABLE_PASSWORD: class=form-control} */
function sc_login_table_password($parm='') //FIXME use $frm function sc_login_table_password($parm=null) //FIXME use $frm
{ {
if(empty($this->userReg)) if(empty($this->userReg))
{ {
@@ -165,7 +165,7 @@ class login_shortcodes extends e_shortcode
/* example: {LOGIN_TABLE_SUBMIT=large} */ /* example: {LOGIN_TABLE_SUBMIT=large} */
/* example: {LOGIN_TABLE_SUBMIT: class=btn submit_but} */ /* example: {LOGIN_TABLE_SUBMIT: class=btn submit_but} */
function sc_login_table_submit($parm="") //FIXME use $frm function sc_login_table_submit($parm=null) //FIXME use $frm
{ {
if(empty($this->userReg)) if(empty($this->userReg))
@@ -198,7 +198,7 @@ class login_shortcodes extends e_shortcode
/* example {LOGIN_TABLE_SIGNUP_LINK} */ /* example {LOGIN_TABLE_SIGNUP_LINK} */
/* example {LOGIN_TABLE_SIGNUP_LINK: class=hover-black dg-btn-2 radius-3px btn-white hover-accent size-lg} */ /* example {LOGIN_TABLE_SIGNUP_LINK: class=hover-black dg-btn-2 radius-3px btn-white hover-accent size-lg} */
function sc_login_table_signup_link($parm='') function sc_login_table_signup_link($parm=null)
{ {
if($this->userReg === 1) if($this->userReg === 1)
@@ -214,13 +214,14 @@ class login_shortcodes extends e_shortcode
/* example {LOGIN_TABLE_FPW_LINK} */ /* example {LOGIN_TABLE_FPW_LINK} */
/* example {LOGIN_TABLE_FPW_LINK: class=dg-btn-2 btn-white radius-3px hover-white size-xl} */ /* example {LOGIN_TABLE_FPW_LINK: class=dg-btn-2 btn-white radius-3px hover-white size-xl} */
function sc_login_table_fpw_link($parm='') function sc_login_table_fpw_link($parm=null)
{ {
if(empty($this->userReg)) if(empty($this->userReg))
{ {
return null; return null;
} }
$class = (!empty($parm['class'])) ? "class='".$parm['class']."'" : "";
$class = (!empty($parm['class'])) ? "class='".$parm['class']."'" : "";
return "<a href='".e_HTTP."fpw.php' ".$class.">".LAN_LOGIN_12."</a>"; return "<a href='".e_HTTP."fpw.php' ".$class.">".LAN_LOGIN_12."</a>";
} }

View File

@@ -1150,7 +1150,7 @@ class news_shortcodes extends e_shortcode
return $info; return $info;
} }
function sc_newstags($parm='') function sc_newstags($parm=null)
{ {
$tmp = explode(",",$this->news_item['news_meta_keywords']); $tmp = explode(",",$this->news_item['news_meta_keywords']);
$words = array(); $words = array();

View File

@@ -161,7 +161,7 @@ class signup_shortcodes extends e_shortcode
/* example: {SIGNUP_SIGNUP_TEXT} /* example: {SIGNUP_SIGNUP_TEXT}
/* example: {SIGNUP_SIGNUP_TEXT: class=custom} */ /* example: {SIGNUP_SIGNUP_TEXT: class=custom} */
function sc_signup_signup_text($parm='') function sc_signup_signup_text($parm=null)
{ {
$pref = e107::getPref(); $pref = e107::getPref();
$tp = e107::getParser(); $tp = e107::getParser();
@@ -650,7 +650,7 @@ class signup_shortcodes extends e_shortcode
* @example {SIGNUP_GDPR_PRIVACYPOLICY_LINK} * @example {SIGNUP_GDPR_PRIVACYPOLICY_LINK}
* @example {SIGNUP_GDPR_PRIVACYPOLICY_LINK: class=label label-info} * @example {SIGNUP_GDPR_PRIVACYPOLICY_LINK: class=label label-info}
*/ */
function sc_signup_gdpr_privacypolicy_link($parm='') function sc_signup_gdpr_privacypolicy_link($parm=null)
{ {
$pp = e107::getPref('gdpr_privacypolicy', ''); $pp = e107::getPref('gdpr_privacypolicy', '');
if (!$pp) if (!$pp)
@@ -668,7 +668,7 @@ class signup_shortcodes extends e_shortcode
* @example {SIGNUP_GDPR_TERMSANDCONDITIONS_LINK} * @example {SIGNUP_GDPR_TERMSANDCONDITIONS_LINK}
* @example {SIGNUP_GDPR_TERMSANDCONDITIONS_LINK: class=label label-info} * @example {SIGNUP_GDPR_TERMSANDCONDITIONS_LINK: class=label label-info}
*/ */
function sc_signup_gdpr_termsandconditions_link($parm='') function sc_signup_gdpr_termsandconditions_link($parm=null)
{ {
$pp = e107::getPref('gdpr_termsandconditions', ''); $pp = e107::getPref('gdpr_termsandconditions', '');
if (!$pp) if (!$pp)

View File

@@ -666,7 +666,7 @@ function sc_user_email($parm='')
* @param string $parm * @param string $parm
* @return string * @return string
*/ */
function sc_user_euf($parm='') function sc_user_euf($parm=null)
{ {
if(!empty($parm['field'])) if(!empty($parm['field']))

View File

@@ -1628,7 +1628,7 @@ class e_form
* @param string label * @param string label
* @param mixed sc_parameters * @param mixed sc_parameters
*/ */
function filepicker($name, $default, $label = '', $sc_parameters = '') function filepicker($name, $default, $label = '', $sc_parameters = null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$name_id = $this->name2id($name); $name_id = $this->name2id($name);

View File

@@ -107,7 +107,7 @@ class eIPHandler
* Host name of current user * Host name of current user
* Initialised when requested * Initialised when requested
*/ */
private $_host_name_cache = ''; private $_host_name_cache = array();
/** /**

View File

@@ -67,7 +67,7 @@ class _blank_search extends e_search // include plugin-folder in the name.
* Optional - Advanced Where * Optional - Advanced Where
* @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' ) * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
*/ */
function where($parm='') function where($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -48,7 +48,7 @@ class banner_shortcodes extends e_shortcode
} }
// Also used by banner_menu.php // Also used by banner_menu.php
public function renderBanner($row, $parm = '') public function renderBanner($row, $parm = null)
{ {
$sql = e107::getDb('banner'); $sql = e107::getDb('banner');
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -67,7 +67,7 @@ class chatbox_menu_search extends e_search // include plugin-folder in the name.
* Optional - Advanced Where * Optional - Advanced Where
* @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' ) * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
*/ */
function where($parm='') function where($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -52,7 +52,7 @@ class faqs_search extends e_search // include plugin-folder in the name.
* Optional - Advanced Where * Optional - Advanced Where
* @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' ) * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
*/ */
function where($parm='') function where($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -132,7 +132,7 @@ class featurebox_shortcodes// must match the plugin's folder name. ie. [PLUGIN_F
* @param string $parm parameters * @param string $parm parameters
* @param string $mod category template * @param string $mod category template
*/ */
function sc_featurebox_navigation($parm, $mod = '') function sc_featurebox_navigation($parm=null, $mod = '')
{ {
// TODO cache // TODO cache
//TODO default $parm values. eg. assume 'tabs' when included in the 'tabs' template. //TODO default $parm values. eg. assume 'tabs' when included in the 'tabs' template.

View File

@@ -46,7 +46,7 @@ class plugin_featurebox_item extends e_model
* @param string $parm * @param string $parm
* @return string * @return string
*/ */
public function sc_featurebox_title($parm = '') public function sc_featurebox_title($parm = null)
{ {
if(!empty($parm) && is_string($parm)) if(!empty($parm) && is_string($parm))
{ {
@@ -77,7 +77,7 @@ class plugin_featurebox_item extends e_model
* @param string $parm * @param string $parm
* @return string * @return string
*/ */
public function sc_featurebox_url($parm = '') public function sc_featurebox_url($parm = null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$url = $tp->replaceConstants($this->get('fb_imageurl'), 'full'); $url = $tp->replaceConstants($this->get('fb_imageurl'), 'full');
@@ -126,7 +126,7 @@ class plugin_featurebox_item extends e_model
* @param string $parm * @param string $parm
* @return string * @return string
*/ */
public function sc_featurebox_image($parm = '') public function sc_featurebox_image($parm = null)
{ {
if(!$this->get('fb_image') && $parm != 'placeholder') if(!$this->get('fb_image') && $parm != 'placeholder')
{ {
@@ -168,7 +168,7 @@ class plugin_featurebox_item extends e_model
return '<a id="featurebox-imageurl-'.$this->getId().'" href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], 'external')).'">'.$tag.'</a>'; return '<a id="featurebox-imageurl-'.$this->getId().'" href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], 'external')).'">'.$tag.'</a>';
} }
public function sc_featurebox_thumb($parm='') public function sc_featurebox_thumb($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
if(!$this->get('fb_image')) if(!$this->get('fb_image'))

View File

@@ -107,7 +107,7 @@ class forum_search extends e_search // include plugin-folder in the name.
* Optional - Advanced Where * Optional - Advanced Where
* @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' ) * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
*/ */
function where($parm='') function where($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -278,7 +278,7 @@ class forum_post_handler
$poll = new poll; $poll = new poll;
require_once(HEADERF); require_once(HEADERF);
$template = $this->getTemplate('posted'); $template = (array) $this->getTemplate('posted');
echo $template['poll']; echo $template['poll'];
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
@@ -389,7 +389,7 @@ class forum_post_handler
/** /**
* @return string * @return array|string
*/ */
function getTemplate($type = 'post') function getTemplate($type = 'post')
{ {

View File

@@ -296,7 +296,7 @@
/** /**
* @example {JOINED: dateformat=relative} - long|short|relative * @example {JOINED: dateformat=relative} - long|short|relative
*/ */
function sc_joined($parm = '') function sc_joined($parm = null)
{ {
$gen = e107::getDate(); $gen = e107::getDate();
if($this->postInfo['post_user']) if($this->postInfo['post_user'])

View File

@@ -307,7 +307,7 @@
} }
function sc_search($parm='') function sc_search($parm=null)
{ {
if(!deftrue('FONTAWESOME') || !$srchIcon = e107::getParser()->toGlyph('fa-search')) if(!deftrue('FONTAWESOME') || !$srchIcon = e107::getParser()->toGlyph('fa-search'))
@@ -679,7 +679,7 @@
------*/ ------*/
function sc_views($parm='') function sc_views($parm=null)
{ {
$val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0' ; $val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0' ;
@@ -692,7 +692,7 @@
} }
function sc_replies($parm='') function sc_replies($parm=null)
{ {
$val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0'; $val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0';

View File

@@ -94,7 +94,7 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_username_input($parm='') function sc_lm_username_input($parm=null)
{ {
$pref = e107::getPref(); $pref = e107::getPref();
@@ -113,7 +113,7 @@ e107::getLanguage()->bcDefs($bcDefs);
} }
function sc_lm_password_input($parm='') function sc_lm_password_input($parm=null)
{ {
$pref = e107::getPref(); $pref = e107::getPref();
$t_password = " $t_password = "

View File

@@ -64,7 +64,7 @@ class news_rss // plugin-folder + '_rss'
* @param string $parms * @param string $parms
* @return array * @return array
*/ */
function data($parms='') function data($parms=null)
{ {
$pref = e107::getConfig()->getPref(); $pref = e107::getConfig()->getPref();

View File

@@ -89,7 +89,7 @@ class news_search extends e_search // include plugin-folder in the name.
* Optional - Advanced Where * Optional - Advanced Where
* @param $parm - data returned from $parm (ie. advanced fields included. in this case 'date' and 'author' ) * @param $parm - data returned from $parm (ie. advanced fields included. in this case 'date' and 'author' )
*/ */
function where($parm='') function where($parm=null)
{ {
$tp = e107::getParser(); $tp = e107::getParser();

View File

@@ -142,6 +142,11 @@ if(!defined("OTHERNEWS2_SPACING")){
// define("OTHERNEWS2_SPACING","0"); // define("OTHERNEWS2_SPACING","0");
} }
if(!isset($param))
{
$param = array();
}
$param['itemlink'] = defset('OTHERNEWS2_ITEMLINK',''); $param['itemlink'] = defset('OTHERNEWS2_ITEMLINK','');
$param['thumbnail'] = OTHERNEWS2_THUMB; $param['thumbnail'] = OTHERNEWS2_THUMB;
$param['catlink'] = defset('OTHERNEWS2_CATLINK',''); $param['catlink'] = defset('OTHERNEWS2_CATLINK','');

View File

@@ -128,6 +128,11 @@ if(!defined("OTHERNEWS_SPACING")){
define("OTHERNEWS_SPACING","0"); define("OTHERNEWS_SPACING","0");
} }
if(!isset($param))
{
$param = array();
}
$param['itemlink'] = defset('OTHERNEWS_ITEMLINK'); $param['itemlink'] = defset('OTHERNEWS_ITEMLINK');
$param['thumbnail'] = defset('OTHERNEWS_THUMB'); $param['thumbnail'] = defset('OTHERNEWS_THUMB');
$param['catlink'] = defset('OTHERNEWS_CATLINK'); $param['catlink'] = defset('OTHERNEWS_CATLINK');

View File

@@ -76,7 +76,7 @@ class theme_shortcodes extends e_shortcode
function sc_bootstrap_usernav($parm='') function sc_bootstrap_usernav($parm=null)
{ {
$placement = e107::pref('theme', 'usernav_placement', 'top'); $placement = e107::pref('theme', 'usernav_placement', 'top');

View File

@@ -229,7 +229,7 @@ class theme_shortcodes extends e_shortcode
return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='btn btn-primary btn-block btn-lg' />"; return "<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='btn btn-primary btn-block btn-lg' />";
} }
function sc_bootstrap_usernav($parm='') function sc_bootstrap_usernav($parm=null)
{ {
$placement = e107::pref('theme', 'usernav_placement', 'top'); $placement = e107::pref('theme', 'usernav_placement', 'top');

View File

@@ -90,7 +90,7 @@ class theme_shortcodes extends e_shortcode
function sc_bootstrap_usernav($parm='') function sc_bootstrap_usernav($parm=null)
{ {
$placement = e107::pref('theme', 'usernav_placement', 'bottom'); $placement = e107::pref('theme', 'usernav_placement', 'bottom');