diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php
index 386d4461c..8a08e6696 100644
--- a/e107_admin/admin_log.php
+++ b/e107_admin/admin_log.php
@@ -1717,7 +1717,7 @@ if(isset($page_title[$action]))
}
// Now put up the events
$delete_button = FALSE;
- while($row = $sql->db_Fetch())
+ while($row = $sql->fetch())
{
$text .= '
";
- while($row = $sql->db_Fetch())
+ while($row = $sql->fetch())
{
//extract($row);//FIXME - kill extract()
$row['banlist_reason'] = str_replace('LAN_LOGIN_18', BANLAN_11, $row['banlist_reason']);
@@ -1863,7 +1863,7 @@ function process_csv($filename, $override_imports, $override_expiry, $separator
// echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote} override imports: {$override_imports} override expiry: {$override_expiry}
";
// Renumber imported bans
if ($override_imports)
- $sql->db_Update('banlist', "`banlist_bantype`=".eIPHandler::BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".eIPHandler::BAN_TYPE_IMPORTED);
+ $sql->update('banlist', "`banlist_bantype`=".eIPHandler::BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".eIPHandler::BAN_TYPE_IMPORTED);
$temp = file($filename);
$line_num = 0;
foreach ($temp as $line)
@@ -1932,7 +1932,7 @@ function process_csv($filename, $override_imports, $override_expiry, $separator
}
// Success here - may need to delete old imported bans
if ($override_imports)
- $sql->db_Delete('banlist', "`banlist_bantype` = ".eIPHandler::BAN_TYPE_TEMPORARY);
+ $sql->delete('banlist', "`banlist_bantype` = ".eIPHandler::BAN_TYPE_TEMPORARY);
@unlink($filename); // Delete file once done
$mes->addSuccess(str_replace('[y]', $line_num, BANLAN_51).$filename);
return str_replace('[y]', $line_num, BANLAN_51).$filename;
diff --git a/e107_admin/banlist_export.php b/e107_admin/banlist_export.php
index 68fcd71ed..96f107fba 100644
--- a/e107_admin/banlist_export.php
+++ b/e107_admin/banlist_export.php
@@ -79,7 +79,7 @@ function do_export($filename, $type_list='',$format_array=array(), $sep = ',', $
$qry = "SELECT * FROM `#banlist` ";
if ($type_list != '') $qry .= " WHERE`banlist_bantype` IN ({$type_list})";
if (!$sql->gen($qry)) return 'No data: '.$qry;
- while ($row = $sql->db_Fetch())
+ while ($row = $sql->fetch())
{
$line = '';
$spacer = '';
diff --git a/e107_admin/image.php b/e107_admin/image.php
index fdae4fca1..873fa1748 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -507,7 +507,7 @@ class media_form_ui extends e_admin_form_ui
if($this->resizeImage($path,$img_import_w,$img_import_h))
{
- $info = $fl->get_file_info($path);
+ $info = $fl->getFileInfo($path);
$mes->addSuccess(LAN_IMA_004.": ".basename($path));
$mes->addSuccess(print_a($info,true));
$dim = intval($info['img-width'])." x ".intval($info['img-height']);
@@ -3045,7 +3045,7 @@ class media_admin_ui extends e_admin_ui
$f = e107::getFile()->get_file_info($oldpath,TRUE);
$mes->addDebug("checkDupe(): newpath=".$newpath."
oldpath=".$oldpath."
".print_r($newpath,TRUE));
- if(file_exists($newpath) || e107::getDb()->db_Select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
+ if(file_exists($newpath) || e107::getDb()->select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
{
$mes->addWarning($newpath." already exists.");
$file = $f['pathinfo']['filename']."_.".$f['pathinfo']['extension'];
@@ -3594,7 +3594,7 @@ if (isset($_POST['submit_show_deleteall']))
{
$image_name = basename($image_name);
$image_todb = $tp->toDB($image_name);
- if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) {
+ if (!$sql->count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) {
unlink(e_AVATAR_UPLOAD.$image_name);
$imgList .= '[!br!]'.$image_name;
$count++;
@@ -3626,7 +3626,7 @@ if (isset($_POST['submit_avdelete_multi']))
$multiaction = $tp->filter($_POST['multiaction'], 'int');
//sql queries significant reduced
- if(!empty($multiaction) && $sql->db_Select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $multiaction).")"))
+ if(!empty($multiaction) && $sql->select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $multiaction).")"))
{
$search_users = $sql->db_getList('ALL', FALSE, FALSE, 'user_id');
foreach($multiaction as $uid)
@@ -3648,7 +3648,7 @@ if (isset($_POST['submit_avdelete_multi']))
//sql queries significant reduced
if(!empty($uids))
{
- $sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")");
+ $sql->update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")");
}
$mes->addSuccess(IMALAN_51.''.implode(', ', $tmp).' '.IMALAN_28);
@@ -3703,13 +3703,13 @@ if (isset($_POST['check_avatar_sizes']))
//
// Loop through avatar field for every user
//
- $iUserCount = $sql->db_Count("user");
+ $iUserCount = $sql->count("user");
$found = false;
$allowedWidth = intval($pref['im_width']);
$allowedHeight = intval($pref['im_width']);
- if ($sql->db_Select("user", "*", "user_image!=''")) {
+ if ($sql->select("user", "*", "user_image!=''")) {
- while ($row = $sql->db_Fetch())
+ while ($row = $sql->fetch())
{
//Check size
$avname=avatar($row['user_image']);
diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php
index 09b6834e3..236dd3577 100755
--- a/e107_admin/includes/infopanel.php
+++ b/e107_admin/includes/infopanel.php
@@ -692,7 +692,7 @@ class adminstyle_infopanel
if (e107::getDb()->gen($menu_qry))
{
- while ($row = e107::getDb()->db_Fetch())
+ while ($row = e107::getDb()->fetch())
{
// Custom menu (core).
if(is_numeric($row['menu_path']))
diff --git a/e107_admin/links.php b/e107_admin/links.php
index 2d536bc4c..783c5980e 100644
--- a/e107_admin/links.php
+++ b/e107_admin/links.php
@@ -661,9 +661,9 @@ class links_admin_form_ui extends e_admin_form_ui
{
if(null === $this->current_parent)
{
- if(e107::getDb()->db_Select('links', 'link_name', 'link_id='.$current))
+ if(e107::getDb()->select('links', 'link_name', 'link_id='.$current))
{
- $tmp = e107::getDb()->db_Fetch();
+ $tmp = e107::getDb()->fetch();
$this->current_parent = $tmp['link_name'];
}
}
diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php
index 07564f557..156d18c33 100644
--- a/e107_admin/newspost.php
+++ b/e107_admin/newspost.php
@@ -1337,7 +1337,7 @@ class news_admin_ui extends e_admin_ui
$_POST['cat_id'] = $row['news_category'];
$_POST['news_start'] = $row['news_start'];
$_POST['news_end'] = $row['news_end'];
- $_POST['comment_total'] = e107::getDb()->db_Count("comments", "(*)", " WHERE comment_item_id={$row['news_id']} AND comment_type='0'");
+ $_POST['comment_total'] = e107::getDb()->count("comments", "(*)", " WHERE comment_item_id={$row['news_id']} AND comment_type='0'");
$_POST['news_render_type'] = $row['news_render_type'];
$_POST['news_thumbnail'] = $row['news_thumbnail'];
$_POST['news_meta_keywords'] = $row['news_meta_keywords'];
diff --git a/e107_admin/search.php b/e107_admin/search.php
index 9bdb4ab62..42437ecec 100644
--- a/e107_admin/search.php
+++ b/e107_admin/search.php
@@ -136,9 +136,9 @@ if (isset($_POST['update_handler']))
$search_prefs[$handler_type][$query[2]]['pre_title_alt'] = $tp -> toDB($_POST['pre_title_alt']);
// $tmp = addslashes(serialize($search_prefs));
- $tmp = e107::getArrayStorage()->writeArray($search_prefs, true);
+ $tmp = e107::serialize($search_prefs, true);
- $check = $sql -> db_Update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'");
+ $check = $sql ->update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'");
if($check)
{
$mes->addSuccess(LAN_UPDATED);
diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php
index 6b3fad260..6923eb533 100644
--- a/e107_admin/update_routines.php
+++ b/e107_admin/update_routines.php
@@ -1006,11 +1006,11 @@ function update_706_to_800($type='')
// Leave this one here.. just in case..
//delete record for online_extended_menu (now only using one online menu)
- if($sql->db_Select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'"))
+ if($sql->select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'"))
{
if ($just_check) return update_needed("The Menu table needs to have some paths corrected in its data.");
- $row=$sql->db_Fetch();
+ $row=$sql->fetch();
//if online_extended is activated, we need to activate the new 'online' menu, and delete this record
if($row['menu_location']!=0)
@@ -1028,7 +1028,7 @@ function update_706_to_800($type='')
}
//change menu_path for online_menu (if it still exists)
- if($sql->db_Select('menus', 'menu_path', "menu_path='online_menu' || menu_path='online_menu/'"))
+ if($sql->select('menus', 'menu_path', "menu_path='online_menu' || menu_path='online_menu/'"))
{
if ($just_check) return update_needed('change menu_path for online menu');
@@ -1961,7 +1961,7 @@ function update_70x_to_706($type='')
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp"))
{
- $row = $sql -> db_Fetch();
+ $row = $sql ->fetch();
if (!in_array('tmp_ip', $row))
{
if ($just_check) return update_needed();
@@ -2027,9 +2027,9 @@ function copy_user_timezone()
e107::getMessage()->addDebug("Line:".__LINE__);
// Created the field - now copy existing data
- if ($sql->db_Select('user','user_id, user_timezone'))
+ if ($sql->select('user','user_id, user_timezone'))
{
- while ($row = $sql->db_Fetch())
+ while ($row = $sql->fetch())
{
$sql2->update('user_extended',"`user_timezone`='{$row['user_timezone']}' WHERE `user_extended_id`={$row['user_id']}");
}
@@ -2075,7 +2075,7 @@ function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages, $op
if ($sql->gen("SHOW INDEX FROM ".MPREFIX.$target))
{
$found = FALSE;
- while ($row = $sql -> db_Fetch())
+ while ($row = $sql ->fetch())
{ // One index per field
if (in_array($indexSpec, $row))
{
diff --git a/e107_admin/upload.php b/e107_admin/upload.php
index 5bbf3504b..36f849291 100644
--- a/e107_admin/upload.php
+++ b/e107_admin/upload.php
@@ -523,8 +523,8 @@ if (e_QUERY)
if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) )
{
- $res = $sql -> db_Select("upload", "*", "upload_id='".intval($id)."'");
- $row = $sql -> db_Fetch();
+ $res = $sql ->select("upload", "*", "upload_id='".intval($id)."'");
+ $row = $sql ->fetch();
if (preg_match("#Binary (.*?)/#", $row['upload_file'], $match))
{
$sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
@@ -535,7 +535,7 @@ if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) )
}
if (preg_match("#Binary (.*?)/#", $row['upload_ss'], $match))
{
- $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
+ $sql ->delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
}
else if ($row['upload_ss'] && file_exists(e_FILE."public/".$row['upload_ss']))
{
diff --git a/e107_admin/users.php b/e107_admin/users.php
index 4c5c049fe..1a892e2a8 100644
--- a/e107_admin/users.php
+++ b/e107_admin/users.php
@@ -1951,7 +1951,7 @@ class users_admin_ui extends e_admin_ui
}
// TODO - move to e_userinfo.php
$obj = new convert;
- $sql->db_Select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20");
+ $sql->select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20");
$host = $e107->get_host_name($ipd);
$text = USFLAN_3." ".$ipd." [ ".USFLAN_4.": $host ]
".USFLAN_5."
@@ -1974,7 +1974,7 @@ class users_admin_ui extends e_admin_ui
$text .= "
";
- $sql->db_Select("comments", "*", "comment_ip='$ipd' LIMIT 0,20");
+ $sql->select("comments", "*", "comment_ip='$ipd' LIMIT 0,20");
while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->fetch())
{
$datestamp = $obj->convert_date($comment_datestamp, "short");
diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php
index af95d5c13..f5cba9115 100644
--- a/e107_core/shortcodes/batch/admin_shortcodes.php
+++ b/e107_core/shortcodes/batch/admin_shortcodes.php
@@ -1634,6 +1634,7 @@ Inverse 10 10
/**
* Old Admin Navigation Routine.
*/
+ /*
function sc_admin_navigationOld($parm=null)
{
@@ -1902,7 +1903,7 @@ Inverse 10 10
return e107::getNav()->admin('', $active, $menu_vars, $$tmpl, FALSE, FALSE);
//return e_admin_men/u('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE);
}
-
+*/
/**
* New Admin Navigation Routine. v2.1.5
diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php
index 793c508a4..c3d76355a 100644
--- a/e107_core/shortcodes/batch/user_shortcodes.php
+++ b/e107_core/shortcodes/batch/user_shortcodes.php
@@ -317,14 +317,11 @@ class user_shortcodes extends e_shortcode
case 'location':
return ($boot) ? $tp->toGlyph('fa-map-marker') : '';
break;
-
+
+ case 'msn':
case 'icq':
return ($boot) ? $tp->toGlyph('fa-comment') : '';
- break;
-
- case 'msn':
- return ($boot) ? $tp->toGlyph('fa-comment') : '';
- break;
+ break;
default:
case 'realname':
diff --git a/e107_core/shortcodes/single/news_categories.sc b/e107_core/shortcodes/single/news_categories.sc
index f3c9b6fb1..0d4e0492a 100644
--- a/e107_core/shortcodes/single/news_categories.sc
+++ b/e107_core/shortcodes/single/news_categories.sc
@@ -126,7 +126,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
return '';
}
$cats = array();
- while ($row = $sql2->db_Fetch())
+ while ($row = $sql2->fetch())
{
if($row['ccount'] > 0) $cats[$row['category_id']] = $row;
}
diff --git a/e107_core/shortcodes/single/user_extended_old.sc b/e107_core/shortcodes/single/user_extended_old.sc
index 88c7a4cbe..a01b941c9 100644
--- a/e107_core/shortcodes/single/user_extended_old.sc
+++ b/e107_core/shortcodes/single/user_extended_old.sc
@@ -117,9 +117,9 @@ if ($parms[1] == 'value')
case EUF_DB_FIELD : // check for db_lookup type
$tmp = explode(',',$ueStruct['user_'.$parms[0]]['user_extended_struct_values']);
$sql_ue = new db; // Use our own DB object to avoid conflicts
- if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
+ if($sql_ue->select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
{
- $row = $sql_ue->db_Fetch();
+ $row = $sql_ue->fetch();
$ret_data = $row[$tmp[2]];
}
else
diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php
index 31aca1159..6b8376e9e 100644
--- a/e107_handlers/admin_log_class.php
+++ b/e107_handlers/admin_log_class.php
@@ -415,7 +415,7 @@ class e_admin_log
* @param array $event_data is an array of data fields whose keys and values are logged (usually user data, but doesn't have to be - can add messages here)
* @param int $id
* @param string $u_name
- * both $id and $u_name are left blank except for admin edits and user login, where they specify the id and login name of the 'target' user
+ * both $id and $u_name are left blank except for admin edits and user login, where they specify the id and login name of the 'target' user
*
* @return bool
*/
diff --git a/e107_handlers/chart_class.php b/e107_handlers/chart_class.php
index 991d98fe9..24a619609 100644
--- a/e107_handlers/chart_class.php
+++ b/e107_handlers/chart_class.php
@@ -577,21 +577,15 @@ class e_chart
$js .= 'var myLine = new Chart(document.getElementById("'.$id.'").getContext("2d")).Bar(ChartData, ChartOptions);';
break;
- case 'radar':
- //TODO
- break;
-
case 'polar':
+ case 'pie':
+ case 'radar':
//TODO
break;
case 'doughnut':
$js .= 'var myDoughnut = new Chart(document.getElementById("'.$id.'").getContext("2d")).Doughnut(ChartData, ChartOptions);';
break;
-
- case 'pie':
- //TODO
- break;
default:
case 'line':
diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php
index c6ef67844..7e728de7a 100644
--- a/e107_handlers/comment_class.php
+++ b/e107_handlers/comment_class.php
@@ -1464,7 +1464,7 @@ class comment
}
}
- cachevars('e_comment', $data);
+ e107::setRegistry('e_comment', $data);
return $data;
}
}
diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php
index c9c667333..c6616657b 100644
--- a/e107_handlers/core_functions.php
+++ b/e107_handlers/core_functions.php
@@ -152,10 +152,9 @@ function print_a($var, $return = FALSE)
echo ''.htmlspecialchars(print_r($var, TRUE), ENT_QUOTES, 'utf-8').'
';
return TRUE;
}
- else
- {
- return ''.htmlspecialchars(print_r($var, true), ENT_QUOTES, 'utf-8').'
';
- }
+
+ return ''.htmlspecialchars(print_r($var, true), ENT_QUOTES, 'utf-8').'
';
+
}
function e_print($expr = null)
@@ -186,14 +185,13 @@ function e_dump($expr = null)
*/
function strip_if_magic($data)
{
- if (MAGIC_QUOTES_GPC == true)
+ if (MAGIC_QUOTES_GPC === true)
{
return array_stripslashes($data);
}
- else
- {
- return $data;
- }
+
+ return $data;
+
}
/**
@@ -272,9 +270,8 @@ function echo_gzipped_page()
if($encoding)
{
- $contents = ob_get_contents();
- ob_end_clean();
- header('Content-Encoding: '.$encoding);
+ $contents = ob_get_clean();
+ header('Content-Encoding: '.$encoding);
print("\x1f\x8b\x08\x00\x00\x00\x00\x00");
$size = strlen($contents);
$contents = gzcompress($contents, 9);
@@ -282,11 +279,10 @@ function echo_gzipped_page()
print($contents);
exit();
}
- else
- {
- ob_end_flush();
- exit();
- }
+
+ ob_end_flush();
+ exit();
+
}
@@ -336,7 +332,7 @@ if (!function_exists('r_emote'))
$value2 = substr($value, 0, strpos($value, " "));
$value = ($value2 ? $value2 : $value);
- $value = ($value == '&|') ? ':((' : $value;
+ $value = ($value === '&|') ? ':((' : $value;
$value = " ".$value." ";
// $str .= "\n
";
@@ -388,12 +384,12 @@ if (!function_exists('multiarray_sort'))
if(!$natsort)
{
- ($order=='asc')? asort($sort_values) : arsort($sort_values);
+ ($order==='asc')? asort($sort_values) : arsort($sort_values);
}
elseif(isset($sort_values))
{
$case ? natsort($sort_values) : natcasesort($sort_values);
- if($order != 'asc') $sort_values = array_reverse($sort_values, true);
+ if($order !== 'asc') $sort_values = array_reverse($sort_values, true);
}
@@ -445,8 +441,9 @@ class e_array {
return false;
}
- // Saftety mechanism for 0.7 -> 0.8 transition.
- if(substr($ArrayData,0,2)=='a:' || substr($ArrayData,0,2)=='s:') // php serialize.
+ // Saftety mechanism for 0.7 -> 0.8 transition.
+ $first2Chars = substr($ArrayData,0,2);
+ if($first2Chars === 'a:' || $first2Chars === 's:') // php serialize.
{
$dat = unserialize($ArrayData);
$ArrayData = $this->WriteArray($dat,FALSE);
@@ -457,7 +454,7 @@ class e_array {
// e107::getDebug()->log("Json data found");
- if(json_last_error() != JSON_ERROR_NONE && e_DEBUG === true && !e107::isCli())
+ if(e_DEBUG === true && json_last_error() != JSON_ERROR_NONE && !e107::isCli())
{
echo "e107::unserialize() Parser Error (json)
";
echo "";
@@ -478,12 +475,12 @@ class e_array {
$ArrayData = (string) substr($ArrayData,8);
}
- if(strtolower(substr($ArrayData,0,5)) != 'array')
+ if(strtolower(substr($ArrayData,0,5)) !== 'array')
{
return false;
}
- if(strpos($ArrayData,"0 => \'")!=false)
+ if(strpos($ArrayData,"0 => \'")!==false)
{
$ArrayData = stripslashes($ArrayData);
}
@@ -495,7 +492,7 @@ class e_array {
$ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. .
- if(trim($ArrayData) == 'Array') // Something went wrong with storage.
+ if(trim($ArrayData) === 'Array') // Something went wrong with storage.
{
$debug = debug_backtrace(false);
e107::getMessage()->addDebug("Bad Array Storage found: ". print_a($debug,true));
@@ -586,7 +583,7 @@ class e_array {
$Array = var_export($ArrayData, true);
- if ($mode == true)
+ if ($mode === true)
{
$Array = addslashes($Array);
}
diff --git a/e107_handlers/db_verify_class.php b/e107_handlers/db_verify_class.php
index 7fb77af2f..cc70fee45 100755
--- a/e107_handlers/db_verify_class.php
+++ b/e107_handlers/db_verify_class.php
@@ -1136,7 +1136,7 @@ class db_verify
function getSqlLanguages()
{
$sql = e107::getDb();
- $list = $sql->db_TableList('lan');
+ $list = $sql->tables('lan');
$array = array();
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 5c88d61ef..27a1c30e8 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -3296,7 +3296,7 @@ class e107
$cstring = 'corelan/'.e_LANGUAGE.'_'.$fname.($admin ? '_admin' : '_front');
if(self::getRegistry($cstring)) return null;
- $fname = ($admin ? 'admin/' : '').'lan_'.preg_replace('/[^\w]/', '', trim($fname, '/')).'.php';
+ $fname = ($admin ? 'admin/' : '').'lan_'.preg_replace('/[\W]/', '', trim($fname, '/')).'.php';
$path = e_LANGUAGEDIR.e_LANGUAGE.'/'.$fname;
self::setRegistry($cstring, true);
@@ -3337,7 +3337,7 @@ class e107
$cstring = 'pluglan/'.e_LANGUAGE.'_'.$plugin.'_'.$fname.($flat ? '_1' : '_0');
if(self::getRegistry($cstring)) return null;
- $plugin = preg_replace('/[^\w]/', '', $plugin);
+ $plugin = preg_replace('/[\W]/', '', $plugin);
if($fname === 'global') // fix ambiguity
{
@@ -4927,7 +4927,7 @@ class e107
/**
* Retrieve & cache host name
- * @deprecated but needed by some old plugins/menus.
+ * @deprecated Use getIPHandler()->get_host_name() instead. Still needed by some old plugins/menus.
* @todo Find old calls and replace with code within.
* @param string $ip_address
* @return string host name
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 7d692641c..7955432a0 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -15,7 +15,7 @@ if (!defined('e107_INIT')) { exit(); }
// Directory for the hard-coded utf-8 handling routines
define('E_UTF8_PACK', e_HANDLER.'utf8/');
-define("E_NL", chr(2));
+define('E_NL', chr(2));
class e_parse extends e_parser
{
@@ -116,7 +116,7 @@ class e_parse extends e_parser
);
// Super modifiers override default option values
- protected $e_SuperMods = array(
+ protected $e_SuperMods = array(
//text is part of a title (e.g. news title)
'TITLE' =>
array(
@@ -348,14 +348,12 @@ class e_parse extends e_parser
*/
public function ustrtoupper($str)
{
- switch($this->utfAction)
+ if($this->utfAction === 1)
{
-
- case 1:
- return mb_strtoupper($str);
- default:
- return strtoupper($str);
+ return mb_strtoupper($str);
}
+
+ return strtoupper($str);
}
@@ -374,15 +372,12 @@ class e_parse extends e_parser
*/
public function ustrpos($haystack, $needle, $offset = 0)
{
- switch($this->utfAction)
+ if($this->utfAction === 1)
{
-
- case 1:
- return mb_strpos($haystack, $needle, $offset);
- default:
- return strpos($haystack, $needle, $offset);
+ return mb_strpos($haystack, $needle, $offset);
}
-
+
+ return strpos($haystack, $needle, $offset);
}
@@ -400,15 +395,13 @@ class e_parse extends e_parser
*/
public function ustrrpos($haystack, $needle, $offset = 0)
{
- switch($this->utfAction)
+ if($this->utfAction === 1)
{
-
- case 1:
- return mb_strrpos($haystack, $needle, $offset);
- default:
- return strrpos($haystack, $needle, $offset);
+ return mb_strrpos($haystack, $needle, $offset);
}
+ return strrpos($haystack, $needle, $offset);
+
}
@@ -451,22 +444,12 @@ class e_parse extends e_parser
*/
public function usubstr($str, $start, $length = NULL)
{
- switch($this->utfAction)
+ if($this->utfAction === 1)
{
-
- case 1:
- if(is_null($length))
- {
- return mb_substr($str, $start);
- }
- else
- {
- return mb_substr($str, $start, $length);
- }
-
- default:
- return substr($str, $start, $length);
+ return ($length === null) ? mb_substr($str, $start) : mb_substr($str, $start, $length);
}
+
+ return substr($str, $start, $length);
}
@@ -508,7 +491,7 @@ class e_parse extends e_parser
}
- if (MAGIC_QUOTES_GPC == true && $nostrip == false)
+ if (MAGIC_QUOTES_GPC === true && $nostrip === false)
{
$data = stripslashes($data);
}
@@ -633,10 +616,10 @@ class e_parse extends e_parser
* @return boolean TRUE if an unopened closing tag found
* FALSE if nothing found
*/
- function htmlAbuseFilter($data, $tagList = '')
+ public function htmlAbuseFilter($data, $tagList = '')
{
- if ($tagList == '')
+ if (empty($tagList))
{
$checkTags = array('textarea', 'input', 'td', 'tr', 'table');
}
@@ -658,8 +641,11 @@ class e_parse extends e_parser
{
// $m[0] is the complete tag; $m[1] is '/' or empty; $m[2] is the tag and any attributes
list ($tag) = explode(' ', $m[2], 2);
- if (!isset($tagArray[$tag])) continue; // Not a tag of interest
- if ($m[1] == '/')
+ if (!isset($tagArray[$tag]))
+ {
+ continue;
+ } // Not a tag of interest
+ if ($m[1] === '/')
{ // Closing tag
if ($tagArray[$tag] == 0)
{
@@ -676,7 +662,10 @@ class e_parse extends e_parser
//print_a($tagArray);
foreach ($tagArray as $t)
{
- if ($t > 0) return TRUE; // More opening tags than closing tags
+ if ($t > 0)
+ {
+ return TRUE;
+ } // More opening tags than closing tags
}
return FALSE; // OK now
}
@@ -703,7 +692,7 @@ class e_parse extends e_parser
foreach ($ret as $s)
{
- if (substr($s, 0, 5) != '[code')
+ if (strpos($s, '[code') !== 0)
{
$vl = array();
$t = html_entity_decode(rawurldecode($s), ENT_QUOTES, CHARSET);
@@ -715,7 +704,7 @@ class e_parse extends e_parser
{
$vl[] = $vw; // Add to list of words found
}
- if (substr($vw, 0, 1) == '<')
+ if (strpos($vw, '<') === 0)
{
$vw = ''.substr($vw, 1);
if (strpos($t1, $vw) !== FALSE)
@@ -735,9 +724,9 @@ class e_parse extends e_parser
$ans .= $s;
}
- if($mode == 'link' && count($vl))
+ if($mode === 'link' && count($vl))
{
- return "#sanitized";
+ return '#sanitized';
}
return $ans;
@@ -794,7 +783,7 @@ class e_parse extends e_parser
- function toForm($text)
+ public function toForm($text)
{
if(empty($text)) // fix - handle proper 0, Space etc values.
@@ -803,7 +792,7 @@ class e_parse extends e_parser
}
- if(is_string($text) && substr($text,0,6) == '[html]')
+ if(is_string($text) && strpos($text, '[html]') === 0)
{
// $text = $this->toHTML($text,true);
$search = array('"',''','\', '&',); // '&' must be last.
@@ -832,7 +821,7 @@ class e_parse extends e_parser
}
- function post_toForm($text)
+ public function post_toForm($text)
{
if(is_array($text))
{
@@ -846,11 +835,11 @@ class e_parse extends e_parser
{
$text = stripslashes($text);
}
- return str_replace(array("'", '"', "<", ">"), array("'", """, "<", ">"), $text);
+ return str_replace(array("'", '"', '<', '>'), array(''', '"', '<', '>'), $text);
}
- function post_toHTML($text, $original_author = FALSE, $extra = '', $mod = FALSE)
+ public function post_toHTML($text, $original_author = FALSE, $extra = '', $mod = FALSE)
{
$text = $this->toDB($text, FALSE, FALSE, $mod, $original_author);
return $this->toHTML($text, TRUE, $extra);
@@ -863,12 +852,12 @@ class e_parse extends e_parser
* @param object $eVars - XXX more info needed.
* @return string
*/
- function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
+ public function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
{
if(!is_bool($parseSCFiles))
{
- trigger_error("\$parseSCFiles in parseTemplate() was given incorrect data");
+ trigger_error('$parseSCFiles in parseTemplate() was given incorrect data');
}
return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
@@ -895,18 +884,16 @@ class e_parse extends e_parser
{
return false;
}
- else
- {
- return true;
- }
- /* if(!strpos($code, 'return '))
- {
- return true;
- }
- else
- {
- return false;
- }*/
+
+ return true;
+ /* if(!strpos($code, 'return '))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }*/
}
}
@@ -920,7 +907,7 @@ class e_parse extends e_parser
* @param string $replaceUnset string to be used if replace variable is not set, false - don't replace
* @return string parsed content
*/
- function simpleParse($template, $vars, $replaceUnset='')
+ public function simpleParse($template, $vars, $replaceUnset='')
{
$this->replaceVars = $vars;
$this->replaceUnset = $replaceUnset;
@@ -942,7 +929,7 @@ class e_parse extends e_parser
}
- function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
+ public function htmlwrap($str, $width, $break = "\n", $nobreak = 'a', $nobr = 'pre', $utf = FALSE)
{
/*
Pretty well complete rewrite to try and handle utf-8 properly.
@@ -955,25 +942,27 @@ class e_parse extends e_parser
//return $str;
// Don't wrap if non-numeric width
- $width = intval($width);
+ $width = (int)$width;
// And trap stupid wrap counts
if ($width < 6)
+ {
return $str;
+ }
// Transform protected element lists into arrays
- $nobreak = explode(" ", strtolower($nobreak));
+ $nobreak = explode(' ', strtolower($nobreak));
// Variable setup
$innbk = array();
- $drain = "";
+ $drain = '';
// List of characters it is "safe" to insert line-breaks at
// It is not necessary to add < and > as they are automatically implied
$lbrks = "/?!%)-}]\\\"':;&";
// Is $str a UTF8 string?
- if ($utf || strtolower(CHARSET) == 'utf-8')
+ if ($utf || strtolower(CHARSET) === 'utf-8')
{
// 0x1680, 0x180e, 0x2000-0x200a, 0x2028, 0x205f, 0x3000 are 'non-ASCII' Unicode UCS-4 codepoints - see http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
// All convert to 3-byte utf-8 sequences:
@@ -1001,7 +990,7 @@ class e_parse extends e_parser
$content = preg_split('#(<.*?'.'>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
foreach($content as $value)
{
- if ($value[0] == "<")
+ if ($value[0] === '<')
{
// We are within an HTML tag
// Create a lowercase copy of this tag's contents
@@ -1010,14 +999,16 @@ class e_parse extends e_parser
{
// Tag of non-zero length
// If the first character is not a / then this is an opening tag
- if ($lvalue[0] != "/")
+ if ($lvalue[0] !== '/')
{
// Collect the tag name
preg_match("/^(\w*?)(\s|$)/", $lvalue, $t);
// If this is a protected element, activate the associated protection flag
if(in_array($t[1], $nobreak))
+ {
array_unshift($innbk, $t[1]);
+ }
}
else
{
@@ -1051,7 +1042,7 @@ class e_parse extends e_parser
if (!count($innbk))
{
// Use the ACK (006) ASCII symbol to replace all HTML entities temporarily
- $value = str_replace("\x06", "", $value);
+ $value = str_replace("\x06", '', $value);
preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
$value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
// echo "Found block length ".strlen($value).': '.substr($value,20).'
';
@@ -1088,7 +1079,9 @@ class e_parse extends e_parser
for($i = strlen($matches[1]) - 1; $i >= 0; $i--)
{
if(strpos($lbrks, $matches[1][$i]) !== FALSE)
+ {
break;
+ }
}
if($i < 0)
{
@@ -1114,7 +1107,9 @@ class e_parse extends e_parser
{
// No speed advantage to defining match character
if (strpos($lbrks, $sp[$i-1]) !== FALSE)
+ {
break;
+ }
}
if ($i == 0)
{
@@ -1138,7 +1133,9 @@ class e_parse extends e_parser
}
// Put captured HTML entities back into the string
foreach ($ents[0] as $ent)
+ {
$value = preg_replace("/\x06/", $ent, $value, 1);
+ }
}
}
// Send the modified segment down the drain
@@ -1162,7 +1159,7 @@ class e_parse extends e_parser
* @param boolean $exact If false, $text will not be cut mid-word
* @return string Trimmed string.
*/
- function html_truncate($text, $length = 100, $ending = '...', $exact = true)
+ public function html_truncate($text, $length = 100, $ending = '...', $exact = true)
{
if($this->ustrlen(preg_replace('/<.*?>/', '', $text)) <= $length)
{
@@ -1216,11 +1213,9 @@ class e_parse extends e_parser
$truncate .= $this->usubstr($tag[3], 0, $left + $entitiesLength);
break;
}
- else
- {
- $truncate .= $tag[3];
- $totalLength += $contentLength;
- }
+
+ $truncate .= $tag[3];
+ $totalLength += $contentLength;
if($totalLength >= $length)
{
break;
@@ -1272,8 +1267,8 @@ class e_parse extends e_parser
{
switch($text [$pos] )
{
- case "<":
- if($text [$pos + 1] == "/")
+ case '<':
+ if($text [$pos + 1] === '/')
{
$closing_tag = TRUE;
}
@@ -1283,8 +1278,8 @@ class e_parse extends e_parser
break;
- case ">":
- if($text [$pos - 1] == "/")
+ case '>':
+ if($text [$pos - 1] === '/')
{
$closing_tag = TRUE;
}
@@ -1298,10 +1293,10 @@ class e_parse extends e_parser
break;
- case "&":
- if($text [$pos + 1] == "#")
+ case '&':
+ if($text [$pos + 1] === '#')
{
- $end = strpos(substr($text, $pos, 7), ";");
+ $end = strpos(substr($text, $pos, 7), ';');
if($end !== FALSE)
{
$pos += ($end + 1);
@@ -1333,7 +1328,7 @@ class e_parse extends e_parser
$ret = ($tmp_pos > 0 ? substr($text, 0, $tmp_pos+1) : substr($text, 0, $pos));
if($pos < strlen($text))
{
- $ret = $ret.$more;
+ $ret .= $more;
}
return $ret;
}
@@ -1381,7 +1376,7 @@ class e_parse extends e_parser
}
- function textclean ($text, $wrap = 100)
+ public function textclean ($text, $wrap = 100)
{
$text = str_replace("\n\n\n", "\n\n", $text);
$text = $this->htmlwrap($text, $wrap);
@@ -1393,7 +1388,7 @@ class e_parse extends e_parser
// Test for text highlighting, and determine the text highlighting transformation
// Returns TRUE if highlighting is active for this page display
- function checkHighlighting()
+ public function checkHighlighting()
{
global $pref;
@@ -1406,7 +1401,7 @@ class e_parse extends e_parser
if(!isset($this->e_highlighting))
{
$this->e_highlighting = FALSE;
- $shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
+ $shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
if($pref['search_highlight'] && (strpos(e_SELF, 'search.php') === FALSE) && ((strpos($shr, 'q=') !== FALSE) || (strpos($shr, 'p=') !== FALSE)))
{
$this->e_highlighting = TRUE;
@@ -1448,7 +1443,7 @@ class e_parse extends e_parser
switch($type)
{
default:
- case "email":
+ case 'email':
preg_match_all("#(?:[\n\r ]|^)?([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", $text, $match);
@@ -1468,14 +1463,14 @@ class e_parse extends e_parser
}
break;
- case "url":
+ case 'url':
$linktext = (!empty($textReplace)) ? $textReplace : '$3';
$external = (!empty($opts['ext'])) ? 'target="_blank"' : '';
- $text= preg_replace("/(^|[\n \(])([\w]*?)([\w]*?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2".$linktext."", $text);
- $text= preg_replace("/(^|[\n \(])([\w]*?)((www)\.[^ \,\"\t\n\r\)<]*)/is", "$1$2".$linktext."", $text);
- $text= preg_replace("/(^|[\n ])([\w]*?)((ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2".$linktext."", $text);
+ $text= preg_replace("/(^|[\n \(])([\w]*?)([\w]*?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", '$1$2' .$linktext. '', $text);
+ $text= preg_replace("/(^|[\n \(])([\w]*?)((www)\.[^ \,\"\t\n\r\)<]*)/is", '$1$2' .$linktext. '', $text);
+ $text= preg_replace("/(^|[\n ])([\w]*?)((ftp)\.[^ \,\"\t\n\r<]*)/is", '$1$2' .$linktext. '', $text);
break;
@@ -1489,7 +1484,7 @@ class e_parse extends e_parser
- function parseBBCodes($text, $postID)
+ public function parseBBCodes($text, $postID)
{
if (!is_object($this->e_bb))
{
@@ -1601,8 +1596,7 @@ class e_parse extends e_parser
if(strpos($text,'[center]') === 0) // quick bc fix TODO Find a better solution. [center][/center] containing HTML.
{
- $text = str_replace("[center]","",$text);
- $text = str_replace("[/center]","
",$text);
+ $text = str_replace(array('[center]', '[/center]'), array("", '
'), $text);
}
}
@@ -1726,9 +1720,9 @@ class e_parse extends e_parser
// $code_text = str_replace("\r\n", " ", $code_text);
// $code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET);
// $code_text = str_replace('&','&',$code_text); // validation safe.
- $html_start = ""; // markers for html-to-bbcode replacement.
- $html_end = "";
- $full_text = str_replace(array("[html]","[/html]"), "",$code_text); // quick fix.. security issue?
+ $html_start = ''; // markers for html-to-bbcode replacement.
+ $html_end = '';
+ $full_text = str_replace(array('[html]', '[/html]'), '',$code_text); // quick fix.. security issue?
$full_text = $this->parseBBCodes($full_text, $postID); // parse any embedded bbcodes eg. [img]
$full_text = $this->replaceConstants($full_text,'abs'); // parse any other paths using {e_....
@@ -1903,7 +1897,7 @@ class e_parse extends e_parser
if ($parseBB === TRUE)
{
// 'Normal' or 'legacy' processing
- if($modifiers == "WYSIWYG")
+ if($modifiers === 'WYSIWYG')
{
$sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID, 'wysiwyg');
}
@@ -1962,17 +1956,13 @@ class e_parse extends e_parser
if ( varset($pref['tohtml_hook']))
{
//Process the older tohtml_hook pref (deprecated)
- foreach(explode(",", $pref['tohtml_hook']) as $hook)
+ foreach(explode(',', $pref['tohtml_hook']) as $hook)
{
- if (!is_object($this->e_hook[$hook]))
+ if (!is_object($this->e_hook[$hook]) && is_readable(e_PLUGIN . $hook . "/" . $hook . ".php"))
{
- if(is_readable(e_PLUGIN.$hook."/".$hook.".php"))
- {
- require_once(e_PLUGIN.$hook."/".$hook.".php");
- $hook_class = "e_".$hook;
- $this->e_hook[$hook] = new $hook_class;
- }
-
+ require_once(e_PLUGIN.$hook."/".$hook.".php");
+ $hook_class = "e_".$hook;
+ $this->e_hook[$hook] = new $hook_class;
}
if(is_object($this->e_hook[$hook])) // precaution for old plugins.
@@ -1994,16 +1984,13 @@ class e_parse extends e_parser
continue;
}
- if (empty($this->e_hook[$hook]) /*&& !is_object($this->e_hook[$hook])*/)
+ if (empty($this->e_hook[$hook]) && is_readable(e_PLUGIN . $hook . "/e_tohtml.php") /*&& !is_object($this->e_hook[$hook])*/)
{
- if(is_readable(e_PLUGIN.$hook."/e_tohtml.php"))
- {
- require_once(e_PLUGIN.$hook."/e_tohtml.php");
+ require_once(e_PLUGIN.$hook."/e_tohtml.php");
- $hook_class = "e_tohtml_".$hook;
+ $hook_class = "e_tohtml_".$hook;
- $this->e_hook[$hook] = new $hook_class;
- }
+ $this->e_hook[$hook] = new $hook_class;
}
if(is_object( $this->e_hook[$hook]))
@@ -2047,12 +2034,9 @@ class e_parse extends e_parser
// Search highlighting
- if ($opts['emotes']) // Why??
+ if ($opts['emotes'] && $this->checkHighlighting()) // Why??
{
- if ($this->checkHighlighting())
- {
- $sub_blk = $this->e_highlight($sub_blk, $this->e_query);
- }
+ $sub_blk = $this->e_highlight($sub_blk, $this->e_query);
}
@@ -2093,8 +2077,8 @@ class e_parse extends e_parser
foreach($this->blockTags as $val)
{
- $srch[] = "".$val.">
";
- $repl[] = "".$val.">";
+ $srch[] = '' .$val. '>
';
+ $repl[] = '' .$val. '>';
}
$ret_parser = str_replace($srch, $repl, $ret_parser);
@@ -2156,7 +2140,7 @@ class e_parse extends e_parser
}
- function toASCII($text)
+ public function toASCII($text)
{
$char_map = array(
@@ -2231,7 +2215,7 @@ class e_parse extends e_parser
* @param string $text
* @example echo "Hello";
*/
- function toAttribute($text)
+ public function toAttribute($text)
{
// URLs posted without HTML access may have an & in them.
@@ -2258,8 +2242,8 @@ class e_parse extends e_parser
*/
public function toJS($stringarray)
{
- $search = array("\r\n", "\r", "
", "'");
- $replace = array("\\n", "", "\\n", "\'");
+ $search = array("\r\n", "\r", '
', "'");
+ $replace = array("\\n", '', "\\n", "\'");
$stringarray = str_replace($search, $replace, $stringarray);
$stringarray = strip_tags($stringarray);
@@ -2403,7 +2387,7 @@ class e_parse extends e_parser
$output = array();
foreach($var as $k => $v)
{
- $output[] = $this->toJSONhelper(strval($k)) . ':' . $this->toJSONhelper($v);
+ $output[] = $this->toJSONhelper((string)$k) . ':' . $this->toJSONhelper($v);
}
return '{' . implode(', ', $output) . '}';
@@ -2420,7 +2404,7 @@ class e_parse extends e_parser
* @param boolean $tags [optional]
* @return string
*/
- function toRss($text, $tags = false)
+ public function toRss($text, $tags = false)
{
if($tags != true)
{
@@ -2430,15 +2414,15 @@ class e_parse extends e_parser
$text = $this->toEmail($text);
- $search = array("'", "$", "'", "$", e_BASE, "href='request.php","","");
- $replace = array("'", '$', "'", '$', SITEURL, "href='".SITEURL."request.php", '', '' );
+ $search = array(''', '$', ''', '$', e_BASE, "href='request.php", '', '');
+ $replace = array("'", '$', "'", '$', SITEURL, "href='".SITEURL. 'request.php', '', '' );
$text = str_replace($search, $replace, $text);
$text = $this->ampEncode($text);
if($tags == true && ($text))
{
- $text = "";
+ $text = '';
}
return $text;
@@ -2451,7 +2435,7 @@ class e_parse extends e_parser
* @param string $value
* @return int|float
*/
- function toNumber($value)
+ public function toNumber($value)
{
// adapted from: https://secure.php.net/manual/en/function.floatval.php#114486
$dotPos = strrpos($value, '.');
@@ -2460,12 +2444,12 @@ class e_parse extends e_parser
((($commaPos > $dotPos) && $commaPos) ? $commaPos : false);
if (!$sep) {
- return preg_replace("/[^-0-9]/", "", $value);
+ return preg_replace('/[^-0-9]/', '', $value);
}
return (
- preg_replace("/[^-0-9]/", "", substr($value, 0, $sep)) . '.' .
- preg_replace("/[^0-9]/", "", substr($value, $sep+1, strlen($value)))
+ preg_replace('/[^-0-9]/', '', substr($value, 0, $sep)) . '.' .
+ preg_replace('/[^0-9]/', '', substr($value, $sep+1, strlen($value)))
);
}
@@ -2476,11 +2460,11 @@ class e_parse extends e_parser
* @param string $text
* @return mixed|string
*/
- function ampEncode($text='')
+ public function ampEncode($text='')
{
// Fix any left-over '&'
- $text = str_replace('&', '&', $text); //first revert any previously converted.
- $text = str_replace('&', '&', $text);
+ //first revert any previously converted.
+ $text = str_replace(array('&', '&'), array('&', '&'), $text);
return $text;
}
@@ -2491,7 +2475,7 @@ class e_parse extends e_parser
* @param $text
* @return mixed|string
*/
- function toText($text)
+ public function toText($text)
{
if($this->isBBcode($text) === true) // convert any bbcodes to html
@@ -2502,12 +2486,12 @@ class e_parse extends e_parser
if($this->isHtml($text) === true) // strip any html.
{
$text = $this->toHTML($text,true);
- $text = str_replace("\n","",$text); // clean-out line-breaks.
- $text = str_ireplace( array("
","
","
"), "\n", $text);
+ $text = str_replace("\n", '',$text); // clean-out line-breaks.
+ $text = str_ireplace( array('
', '
', '
'), "\n", $text);
$text = strip_tags($text);
}
- $search = array("'", "$", "'", "$", "\", "\");
+ $search = array(''', '$', ''', '$', '\', '\');
$replace = array("'", '$', "'", '$', "\\", "\\");
$text = str_replace($search, $replace, $text);
return $text;
@@ -2648,7 +2632,8 @@ class e_parse extends e_parser
if(!empty($options['type']))
{
- $ext = $newOpts['type'] = $options['type'];
+ $newOpts['type'] = $options['type'];
+ $ext = $newOpts['type'];
}
@@ -2686,7 +2671,7 @@ class e_parse extends e_parser
if($log !== null)
{
file_put_contents(e_LOG.$log, "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n", FILE_APPEND);
- $message = "Name: ".$fname."\n";
+ $message = 'Name: ' .$fname."\n";
$message .= $path."\n".var_export($newOpts,true)."\n\n\n";
file_put_contents(e_LOG.$log, $message, FILE_APPEND);
@@ -2711,10 +2696,10 @@ class e_parse extends e_parser
}
elseif($val !== false)
{
- $this->staticCount = $this->staticCount + (int) $val;
+ $this->staticCount += (int)$val;
}
- return (int) $count;
+ return $count;
}
@@ -2734,10 +2719,8 @@ class e_parse extends e_parser
{
return !empty($opts['full']) ? SITEURL : e_HTTP;
}
- else
- {
- return !empty($opts['full']) ? self::replaceConstants($path, 'full') : self::replaceConstants($path, 'abs'); // self::replaceConstants($path, 'full');
- }
+
+ return !empty($opts['full']) ? $this->replaceConstants($path, 'full') : $this->replaceConstants($path, 'abs'); // self::replaceConstants($path, 'full');
}
$staticArray = $this->staticUrl; // e_HTTP_STATIC;
@@ -2769,7 +2752,7 @@ class e_parse extends e_parser
$base = '';
- $path = self::replaceConstants($path, 'abs'); // replace any {THEME} etc.
+ $path = $this->replaceConstants($path, 'abs'); // replace any {THEME} etc.
$srch = array(
e_PLUGIN_ABS,
@@ -2831,7 +2814,7 @@ class e_parse extends e_parser
return $this->replaceConstants($url, 'abs');
}
- if(strpos($url,"{e_") === 0) // Fix for broken links that use {e_MEDIA} etc.
+ if(strpos($url, '{e_') === 0) // Fix for broken links that use {e_MEDIA} etc.
{
//$url = $this->replaceConstants($url,'abs');
// always switch to 'nice' urls when SC is used
@@ -2858,7 +2841,10 @@ class e_parse extends e_parser
$raw = true;
}
- if($raw) $url = $this->createConstants($url, 'mix');
+ if($raw)
+ {
+ $url = $this->createConstants($url, 'mix');
+ }
$baseurl = ($full ? SITEURL : e_HTTP).'thumb.php?';
@@ -2973,13 +2959,13 @@ class e_parse extends e_parser
* @param $src
* @return array
*/
- function thumbUrlDecode($src)
+ public function thumbUrlDecode($src)
{
- list($url,$qry) = array_pad(explode("?",$src), 2, null);
+ list($url,$qry) = array_pad(explode('?',$src), 2, null);
$ret = array();
- if(strstr($url,"thumb.php") && !empty($qry)) // Regular
+ if(strstr($url, 'thumb.php') && !empty($qry)) // Regular
{
parse_str($qry,$val);
$ret = $val;
@@ -3009,7 +2995,7 @@ class e_parse extends e_parser
}
elseif(defined('TINYMCE_DEBUG'))
{
- print_a("thumbUrlDecode: No Matches");
+ print_a('thumbUrlDecode: No Matches');
}
@@ -3025,10 +3011,11 @@ class e_parse extends e_parser
* @param int|string|array $width - desired size in px or '2x' or '3x' or null for all or array (
* @return string
*/
- function thumbSrcSet($src='', $width=null)
+ public function thumbSrcSet($src='', $width=null)
{
$multiply = null;
$encode = false;
+ $parm = array();
if(is_array($width))
{
@@ -3040,7 +3027,7 @@ class e_parse extends e_parser
// $encode = $this->thumbEncode();;
- if($width == null || $width=='all')
+ if($width == null || $width === 'all')
{
$links = array();
$mag = ($width == null) ? array(1, 2) : array(160,320,460,600,780,920,1100);
@@ -3049,14 +3036,14 @@ class e_parse extends e_parser
$w = ($this->thumbWidth * $v);
$h = ($this->thumbHeight * $v);
- $att = (!empty($this->thumbCrop)) ? array('aw' => $w, 'ah' => $h) : array('w' => $w, 'h' => $h);
+ $att = (!empty($this->thumbCrop)) ? array('aw' => $w, 'ah' => $h) : compact('w', 'h');
$att['x'] = $encode;
- $add = ($width == null) ? " ".$v."x" : " ".$v."w";
+ $add = ($width == null) ? ' ' .$v. 'x' : ' ' .$v. 'w';
$links[] = $this->thumbUrl($src, $att).$add; // " w".$width; //
}
- return implode(", ",$links);
+ return implode(', ',$links);
}
elseif($multiply === '2x' || $multiply === '3x' || $multiply === '4x')
@@ -3066,7 +3053,7 @@ class e_parse extends e_parser
if(empty($parm['w']) && isset($parm['h']))
{
$parm['h'] = ($parm['h'] * $multiInt) ;
- return $this->thumbUrl($src, $parm)." ".$multiply;
+ return $this->thumbUrl($src, $parm). ' ' .$multiply;
}
if(isset($parm['w']) && !isset($parm['h'])) // if w set, assume h value of 0 is set.
@@ -3123,7 +3110,7 @@ class e_parse extends e_parser
$ret = $this->thumbUrl($src, $parms);
- $ret .= ($multiply) ? " ".$multiply : " ".$width."w";
+ $ret .= ($multiply) ? ' ' .$multiply : ' ' .$width. 'w';
return $ret;
@@ -3163,7 +3150,7 @@ class e_parse extends e_parser
if(!empty($options['x']) && !empty($options['ext'])) // base64 encoded. Build URL for: RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1
{
$ext = strtolower($options['ext']);
- return $base.'media/img/'.base64_encode($options['thurl']).'.'.str_replace("jpeg", "jpg", $ext);
+ return $base.'media/img/'.base64_encode($options['thurl']).'.'.str_replace('jpeg', 'jpg', $ext);
}
elseif(strstr($url, 'e_MEDIA_IMAGE')) // media images.
{
@@ -3278,7 +3265,7 @@ class e_parse extends e_parser
}
- function getEmotes()
+ public function getEmotes()
{
return $this->e_emote->emotes;
}
@@ -3309,36 +3296,36 @@ class e_parse extends e_parser
return $new;
}
- if($mode != "")
+ 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('avatars'),
- $e107->getFolder('web_js'),
- $e107->getFolder('web_css'),
- $e107->getFolder('web_image'),
+ $e107::getFolder('media_files'),
+ $e107::getFolder('media_video'),
+ $e107::getFolder('media_image'),
+ $e107::getFolder('media_icon'),
+ $e107::getFolder('avatars'),
+ $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('images'),
+ $e107::getFolder('plugins'),
+ $e107::getFolder('files'),
+ $e107::getFolder('themes'),
// $e107->getFolder('downloads'),
- $e107->getFolder('handlers'),
- $e107->getFolder('media'),
- $e107->getFolder('web'),
- $e107->site_theme ? $e107->getFolder('themes').$e107->site_theme.'/' : '',
+ $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') : ''),
+ (ADMIN ? $e107::getFolder('admin') : ''),
'',
- $e107->getFolder('core'),
- $e107->getFolder('system'),
+ $e107::getFolder('core'),
+ $e107::getFolder('system'),
);
switch ($mode)
@@ -3414,22 +3401,22 @@ class e_parse extends e_parser
'{e_WEB_CSS}',
'{e_WEB_IMAGE}',
// '{e_WEB_PACK}',
- "{e_IMAGE_ABS}",
- "{e_THEME_ABS}",
- "{e_IMAGE}",
- "{e_PLUGIN}",
- "{e_FILE}",
- "{e_THEME}",
+ '{e_IMAGE_ABS}',
+ '{e_THEME_ABS}',
+ '{e_IMAGE}',
+ '{e_PLUGIN}',
+ '{e_FILE}',
+ '{e_THEME}',
//,"{e_DOWNLOAD}"
- "{e_HANDLER}",
- "{e_MEDIA}",
- "{e_WEB}",
- "{THEME}",
- "{THEME_ABS}",
- "{e_ADMIN}",
- "{e_BASE}",
- "{e_CORE}",
- "{e_SYSTEM}",
+ '{e_HANDLER}',
+ '{e_MEDIA}',
+ '{e_WEB}',
+ '{THEME}',
+ '{THEME_ABS}',
+ '{e_ADMIN}',
+ '{e_BASE}',
+ '{e_CORE}',
+ '{e_SYSTEM}',
);
/*if (ADMIN)
@@ -3451,7 +3438,7 @@ class e_parse extends e_parser
$replace_relative[] = '';
$replace_absolute[] = '';
}
- $search[] = "{USERID}";
+ $search[] = '{USERID}';
}
// current THEME
@@ -3470,7 +3457,7 @@ class e_parse extends e_parser
$search[] = "{THEME_ABS}";
}*/
- $replace = ((string)$mode == "full" || (string)$mode=='abs' ) ? $replace_absolute : $replace_relative;
+ $replace = ((string)$mode === 'full' || (string)$mode === 'abs' ) ? $replace_absolute : $replace_relative;
return str_replace($search,$replace,$text);
}
@@ -3494,7 +3481,7 @@ class e_parse extends e_parser
}
- function doReplace($matches)
+ public function doReplace($matches)
{
if(defined($matches[1]) && (deftrue('ADMIN') || strpos($matches[1], 'ADMIN') === FALSE))
{
@@ -3530,26 +3517,26 @@ class e_parse extends e_parser
{
case 0: // folder name only.
$tmp = array(
- '{e_MEDIA_FILE}' => $e107->getFolder('media_files'),
- '{e_MEDIA_VIDEO}' => $e107->getFolder('media_videos'),
- '{e_MEDIA_IMAGE}' => $e107->getFolder('media_images'),
- '{e_MEDIA_ICON}' => $e107->getFolder('media_icons'),
- '{e_AVATAR}' => $e107->getFolder('avatars'),
- '{e_WEB_JS}' => $e107->getFolder('web_js'),
- '{e_WEB_CSS}' => $e107->getFolder('web_css'),
- '{e_WEB_IMAGE}' => $e107->getFolder('web_images'),
- // '{e_WEB_PACK}' => $e107->getFolder('web_packs'),
+ '{e_MEDIA_FILE}' => $e107::getFolder('media_files'),
+ '{e_MEDIA_VIDEO}' => $e107::getFolder('media_videos'),
+ '{e_MEDIA_IMAGE}' => $e107::getFolder('media_images'),
+ '{e_MEDIA_ICON}' => $e107::getFolder('media_icons'),
+ '{e_AVATAR}' => $e107::getFolder('avatars'),
+ '{e_WEB_JS}' => $e107::getFolder('web_js'),
+ '{e_WEB_CSS}' => $e107::getFolder('web_css'),
+ '{e_WEB_IMAGE}' => $e107::getFolder('web_images'),
+ // '{e_WEB_PACK}' => $e107::getFolder('web_packs'),
- '{e_IMAGE}' => $e107->getFolder('images'),
- '{e_PLUGIN}' => $e107->getFolder('plugins'),
- '{e_FILE}' => $e107->getFolder('files'),
- '{e_THEME}' => $e107->getFolder('themes'),
- '{e_DOWNLOAD}' => $e107->getFolder('downloads'),
- '{e_ADMIN}' => $e107->getFolder('admin'),
- '{e_HANDLER}' => $e107->getFolder('handlers'),
- '{e_MEDIA}' => $e107->getFolder('media'),
- '{e_WEB}' => $e107->getFolder('web'),
- '{e_UPLOAD}' => $e107->getFolder('uploads'),
+ '{e_IMAGE}' => $e107::getFolder('images'),
+ '{e_PLUGIN}' => $e107::getFolder('plugins'),
+ '{e_FILE}' => $e107::getFolder('files'),
+ '{e_THEME}' => $e107::getFolder('themes'),
+ '{e_DOWNLOAD}' => $e107::getFolder('downloads'),
+ '{e_ADMIN}' => $e107::getFolder('admin'),
+ '{e_HANDLER}' => $e107::getFolder('handlers'),
+ '{e_MEDIA}' => $e107::getFolder('media'),
+ '{e_WEB}' => $e107::getFolder('web'),
+ '{e_UPLOAD}' => $e107::getFolder('uploads'),
);
break;
@@ -3671,7 +3658,7 @@ class e_parse extends e_parser
//FIXME - $match not used?
- function e_highlight($text, $match)
+ public function e_highlight($text, $match)
{
$tags = array();
preg_match_all('#<[^>]+>#', $text, $tags);
@@ -3693,7 +3680,7 @@ class e_parse extends e_parser
* @param boolean $posted - if the text has been posted. (uses stripslashes etc)
* @param string $mods - flags for text transformation.
*/
- public function toEmail($text, $posted = "", $mods = "parse_sc, no_make_clickable")
+ public function toEmail($text, $posted = '', $mods = 'parse_sc, no_make_clickable')
{
if ($posted === TRUE)
{
@@ -3704,11 +3691,11 @@ class e_parse extends e_parser
$text = preg_replace('#\[(php)#i', '[\\1', $text);
}
- $text = (strtolower($mods) != "rawtext") ? $this->replaceConstants($text, "full") : $text;
+ $text = (strtolower($mods) !== 'rawtext') ? $this->replaceConstants($text, 'full') : $text;
if($this->isHtml($text))
{
- $text = str_replace(array("[html]","[/html]"), "", $text);
+ $text = str_replace(array('[html]', '[/html]'), '', $text);
$text = html_entity_decode( $text, ENT_COMPAT, 'UTF-8');
}
else
@@ -3731,7 +3718,7 @@ class e_parse extends e_parser
* @param null $subject [optional] default subject for email.
* @return string
*/
- function emailObfuscate($email, $words = null, $subject =null)
+ public function emailObfuscate($email, $words = null, $subject =null)
{
if(strpos($email, '@') === false)
{
@@ -3747,7 +3734,7 @@ class e_parse extends e_parser
if(empty($words))
{
- $words = "@";
+ $words = '@';
$user = "data-user='".$this->obfuscate($name)."'";
$dom = "data-dom='".$this->obfuscate($address)."'";
}
@@ -3757,7 +3744,7 @@ class e_parse extends e_parser
$dom = '';
}
- $url = "mailto:".$email.$subject;
+ $url = 'mailto:' .$email.$subject;
$safe = $this->obfuscate($url);
@@ -3776,7 +3763,7 @@ class e_parse extends e_parser
$ret = '';
foreach (str_split($text) as $letter)
{
- switch (rand(1, 3))
+ switch (mt_rand(1, 3))
{
// HTML entity code
case 1:
@@ -3933,7 +3920,7 @@ class e_parser
/**
* Used by e_parse to start
*/
- function init()
+ public function init()
{
if(defined('FONTAWESOME'))
@@ -4066,7 +4053,7 @@ class e_parser
*/
public function leadingZeros($num,$numDigits)
{
- return (string) sprintf("%0".$numDigits."d",$num);
+ return (string) sprintf('%0' .$numDigits. 'd',$num);
}
/**
@@ -4077,7 +4064,7 @@ class e_parser
* @example $tp->lanVars("My name is [x] and I own a [y]", array("John","Cat"));
* @return string
*/
- function lanVars($lan, $vals, $bold=false)
+ public function lanVars($lan, $vals, $bold=false)
{
$array = (!is_array($vals)) ? array('x'=>$vals) : $vals;
@@ -4094,8 +4081,8 @@ class e_parser
$k = $defaults[$k];
}
- $search[] = "[".$k."]";
- $replace[] = ($bold===true) ? "".$v."" : $v;
+ $search[] = '[' .$k. ']';
+ $replace[] = ($bold===true) ? '' .$v. '' : $v;
}
return str_replace($search, $replace, $lan);
@@ -4112,7 +4099,7 @@ class e_parser
if($header == false)
{
- $html = "".$html."";
+ $html = '' .$html. '';
}
$doc = $this->domObj;
@@ -4121,7 +4108,7 @@ class e_parser
libxml_use_internal_errors(true);
$doc->loadHTML($html);
- $tg = explode(",", $taglist);
+ $tg = explode(',', $taglist);
$ret = array();
foreach($tg as $find)
@@ -4136,7 +4123,7 @@ class e_parser
{
$tag = $node->nodeName;
$inner = $node->C14N();
- $inner = str_replace("
","",$inner);
+ $inner = str_replace('
', '',$inner);
foreach ($node->attributes as $attr)
{
@@ -4174,7 +4161,7 @@ class e_parser
* @example $tp->toGlyph('fa-spinner', array('spin'=>1));
* @example $tp->toGlyph('fa-shield', array('rotate'=>90, 'size'=>'2x'));
*/
- public function toGlyph($text, $options=" ")
+ public function toGlyph($text, $options= ' ')
{
if(empty($text))
@@ -4197,7 +4184,7 @@ class e_parser
$parm = array();
}
- if(substr($text,0,2) === 'e-') // e107 admin icon.
+ if(strpos($text, 'e-') === 0) // e107 admin icon.
{
$size = (substr($text,-3) === '-32') ? 'S32' : 'S16';
@@ -4206,7 +4193,7 @@ class e_parser
$size = 'S24';
}
- return "";
+ return "";
}
// Get Glyph names.
@@ -4266,23 +4253,23 @@ class e_parser
$size = (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
$tag = 'i';
$spin = !empty($parm['spin']) ? ' fa-spin' : '';
- $rotate = !empty($parm['rotate']) ? ' fa-rotate-'.intval($parm['rotate']) : '';
- $fixedW = !empty($parm['fw']) ? ' fa-fw' : "";
+ $rotate = !empty($parm['rotate']) ? ' fa-rotate-'. (int)$parm['rotate'] : '';
+ $fixedW = !empty($parm['fw']) ? ' fa-fw' : '';
if($this->fontawesome === 5)
{
$fab = e107::getMedia()->getGlyphs('fab');
- $fas = e107::getMedia()->getGlyphs('fas');;
+ $fas = e107::getMedia()->getGlyphs('fas');
$code = substr($id,3);
if(in_array($code,$fab))
{
- $prefix = "fab ";
+ $prefix = 'fab ';
}
elseif(in_array($code,$fas))
{
- $prefix = "fas ";
+ $prefix = 'fas ';
}
}
@@ -4300,7 +4287,7 @@ class e_parser
{
$prefix = 'glyphicon ';
$tag = 'span';
- $id = str_replace("icon-", "glyphicon-", $id);
+ $id = str_replace('icon-', 'glyphicon-', $id);
}
else
{
@@ -4315,7 +4302,7 @@ class e_parser
{
if(strpos($text, $glyphConfig['prefix']) === 0)
{
- $prefix = $glyphConfig['class'] . " ";
+ $prefix = $glyphConfig['class'] . ' ';
$tag = $glyphConfig['tag'];
continue;
}
@@ -4326,12 +4313,12 @@ class e_parser
$idAtt = (!empty($parm['id'])) ? "id='".$parm['id']."' " : '';
$style = (!empty($parm['style'])) ? "style='".$parm['style']."' " : '';
- $class = (!empty($parm['class'])) ? $parm['class']." " : '';
- $placeholder = isset($parm['placeholder']) ? $parm['placeholder'] : "";
+ $class = (!empty($parm['class'])) ? $parm['class']. ' ' : '';
+ $placeholder = isset($parm['placeholder']) ? $parm['placeholder'] : '';
$title = (!empty($parm['title'])) ? " title='".$this->toAttribute($parm['title'])."' " : '';
- $text = "<".$tag." {$idAtt}class='".$class.$prefix.$id.$size.$spin.$rotate.$fixedW."' ".$style.$title.">".$placeholder."".$tag.">" ;
- $text .= ($options !== false) ? $options : "";
+ $text = '<' .$tag." {$idAtt}class='".$class.$prefix.$id.$size.$spin.$rotate.$fixedW."' ".$style.$title. '>' .$placeholder. '' .$tag. '>';
+ $text .= ($options !== false) ? $options : '';
return $text;
@@ -4346,9 +4333,9 @@ class e_parser
*/
public function toBadge($text, $parm=null)
{
- $class = !empty($parm['class']) ? " ".$parm['class'] : ' badge-secondary';
+ $class = !empty($parm['class']) ? ' ' .$parm['class'] : ' badge-secondary';
- return "".$text."";
+ return "".$text. '';
}
@@ -4364,15 +4351,15 @@ class e_parser
$type = 'default';
}
- $tmp = explode(",",$text);
+ $tmp = explode(',',$text);
$opt = array();
foreach($tmp as $v)
{
- $opt[] = "".$v."";
+ $opt[] = "".$v. '';
}
- return implode(" ",$opt);
+ return implode(' ',$opt);
}
/**
@@ -4387,7 +4374,7 @@ class e_parser
'{e_PLUGIN}' => 'e_PLUGIN/'
);
- $link = e_HTTP."request.php?file=". str_replace(array_keys($srch), $srch,$text);
+ $link = e_HTTP. 'request.php?file=' . str_replace(array_keys($srch), $srch,$text);
if(!empty($parm['raw']))
{
@@ -4419,7 +4406,7 @@ class e_parser
{
$tp = e107::getParser();
$width = !empty($options['w']) ? intval($options['w']) : $tp->thumbWidth;
- $height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : "";
+ $height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : '';
$crop = !empty($options['crop']) ? $options['crop'] : $tp->thumbCrop;
$linkStart = '';
$linkEnd = '';
@@ -4437,8 +4424,8 @@ class e_parser
if(!empty($options['hd'])) // Fix resolution on Retina display.
{
- $width = $width * 2;
- $height = $height * 2;
+ $width *= 2;
+ $height *= 2;
}
@@ -4454,24 +4441,24 @@ class e_parser
$image = (!empty($userData['user_image'])) ? varset($userData['user_image']) : null;
- $genericFile = e_IMAGE."generic/blank_avatar.jpg";
- $genericImg = $tp->thumbUrl($genericFile,"w=".$width."&h=".$height,true, $full);
+ $genericFile = e_IMAGE. 'generic/blank_avatar.jpg';
+ $genericImg = $tp->thumbUrl($genericFile, 'w=' .$width. '&h=' .$height,true, $full);
if (!empty($image))
{
- if(strpos($image,"://")!==false) // Remote Image
+ if(strpos($image, '://')!==false) // Remote Image
{
$url = $image;
}
- elseif(substr($image,0,8) == "-upload-")
+ elseif(strpos($image, "-upload-") === 0)
{
$image = substr($image,8); // strip the -upload- from the beginning.
if(file_exists(e_AVATAR_UPLOAD.$image))
{
$file = e_AVATAR_UPLOAD.$image;
- $url = $tp->thumbUrl($file,"w=".$width."&h=".$height."&crop=".$crop, false, $full);
+ $url = $tp->thumbUrl($file, 'w=' .$width. '&h=' .$height. '&crop=' .$crop, false, $full);
}
else
{
@@ -4482,7 +4469,7 @@ class e_parser
elseif(file_exists(e_AVATAR_DEFAULT.$image)) // User-Uplaoded Image
{
$file = e_AVATAR_DEFAULT.$image;
- $url = $tp->thumbUrl($file,"w=".$width."&h=".$height."&crop=".$crop, false, $full);
+ $url = $tp->thumbUrl($file, 'w=' .$width. '&h=' .$height. '&crop=' .$crop, false, $full);
}
else // Image Missing.
{
@@ -4515,11 +4502,11 @@ class e_parser
if(($url == $genericImg) && !empty($userData['user_id'] ) && (($userData['user_id'] == USERID)) && !empty($options['link']))
{
$linkStart = "";
- $linkEnd = "";
+ $linkEnd = '';
}
$title = (ADMIN) ? $image : $tp->toAttribute($userData['user_name']);
- $shape = (!empty($options['shape'])) ? "img-".$options['shape'] : "img-rounded rounded";
+ $shape = (!empty($options['shape'])) ? 'img-' .$options['shape'] : 'img-rounded rounded';
if(!empty($options['type']) && $options['type'] === 'url')
@@ -4533,15 +4520,15 @@ class e_parser
}
$heightInsert = empty($height) ? '' : "height='".$height."'";
- $id = (!empty($options['id'])) ? "id='".$options['id']."' " : "";
+ $id = (!empty($options['id'])) ? "id='".$options['id']."' " : '';
- $classOnline = (!empty($userData['user_currentvisit']) && intval($userData['user_currentvisit']) > (time() - 300)) ? " user-avatar-online" : '';
+ $classOnline = (!empty($userData['user_currentvisit']) && intval($userData['user_currentvisit']) > (time() - 300)) ? ' user-avatar-online' : '';
- $class = !empty($options['class']) ? $options['class'] : $shape." user-avatar";
+ $class = !empty($options['class']) ? $options['class'] : $shape. ' user-avatar';
$style = !empty($options['style']) ? " style='".$options['style']."'" : '';
$text = $linkStart;
- $text .= "
";
+ $text .= '
';
$text .= $linkEnd;
// return $url;
return $text;
@@ -4568,7 +4555,7 @@ class e_parser
// return "Use \$tp->toImage() instead of toIcon() for ".$icon."
"; // debug info only.
// }
- if(substr($icon,0,3) == 'toGlyph($icon,$parm);
}
@@ -4625,7 +4612,7 @@ class e_parser
$alt = (!empty($parm['alt'])) ? $this->toAttribute($parm['alt']) : basename($path);
$class = (!empty($parm['class'])) ? $parm['class'] : 'icon';
- return "
";
+ return "
';
}
@@ -4643,7 +4630,7 @@ class e_parser
if(strpos($file,'e_AVATAR')!==false)
{
- return "Use \$tp->toAvatar() instead of toImage() for ".$file."
"; // debug info only.
+ return "Use \$tp->toAvatar() instead of toImage() for ".$file. '
'; // debug info only.
}
@@ -4731,7 +4718,7 @@ class e_parser
{
$log = e107::getAdminLog();
$log->addDebug('Broken Image Path: '.$legacyPath."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00');
- e107::getDebug()->log("Broken Image Path: ".$legacyPath);
+ e107::getDebug()->log('Broken Image Path: ' .$legacyPath);
}
}
@@ -4745,24 +4732,24 @@ class e_parser
$path = $tp->thumbUrl($file,$parm);
}
- $id = (!empty($parm['id'])) ? "id=\"".$parm['id']."\" " : "" ;
- $class = (!empty($parm['class'])) ? $parm['class'] : "img-responsive img-fluid";
+ $id = (!empty($parm['id'])) ? 'id="' .$parm['id']. '" ' : '';
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'img-responsive img-fluid';
$alt = (!empty($parm['alt'])) ? $tp->toAttribute($parm['alt']) : basename($file);
- $style = (!empty($parm['style'])) ? "style=\"".$parm['style']."\" " : "" ;
- $srcset = (!empty($parm['srcset'])) ? "srcset=\"".$parm['srcset']."\" " : "";
- $width = (!empty($parm['w'])) ? "width=\"".intval($parm['w'])."\" " : "";
- $title = (!empty($parm['title'])) ? "title=\"".$parm['title']."\" " : "";
- $height = !empty($parm['h']) ? "height=\"".intval($parm['h'])."\" " : "";
- $loading = !empty($parm['loading']) ? "loading=\"".$parm['loading']."\" " : ""; // eg. lazy, eager, auto
+ $style = (!empty($parm['style'])) ? 'style="' .$parm['style']. '" ' : '';
+ $srcset = (!empty($parm['srcset'])) ? 'srcset="' .$parm['srcset']. '" ' : '';
+ $width = (!empty($parm['w'])) ? 'width="' . (int)$parm['w'] . '" ' : '';
+ $title = (!empty($parm['title'])) ? 'title="' .$parm['title']. '" ' : '';
+ $height = !empty($parm['h']) ? 'height="' . (int)$parm['h'] . '" ' : '';
+ $loading = !empty($parm['loading']) ? 'loading="' .$parm['loading']. '" ' : ''; // eg. lazy, eager, auto
if(isset($parm['width'])) // width attribute override (while retaining w)
{
- $width = "width=\"".$parm['width']."\" " ;
+ $width = 'width="' .$parm['width']. '" ';
}
if(isset($parm['height'])) // height attribute override (while retaining h)
{
- $height = "height=\"".$parm['height']."\" " ;
+ $height = 'height="' .$parm['height']. '" ';
}
$html = '';
@@ -4787,7 +4774,7 @@ class e_parser
$html .= "\n";
}
- $html .= "
";
+ $html .= "
';
$html .= ($this->convertToWebP) ? "\n" : '';
@@ -4801,7 +4788,7 @@ class e_parser
* @param $text
* @return bool
*/
- function isBBcode($text)
+ public function isBBcode($text)
{
if(preg_match('#(?<=<)\w+(?=[^<]*?>)#', $text))
{
@@ -4830,7 +4817,7 @@ class e_parser
* @param $text
* @return bool
*/
- function isHtml($text)
+ public function isHtml($text)
{
if(strpos($text,'[html]') !==false)
@@ -4866,7 +4853,7 @@ class e_parser
return false;
}
- if(substr($text,0,1) === '{' || substr($text,0,1) === '[') // json
+ if(strpos($text, '{') === 0 || strpos($text, '[') === 0) // json
{
$dat = json_decode($text, true);
@@ -4931,7 +4918,7 @@ class e_parser
* @param $file string
* @return boolean
*/
- function isVideo($file)
+ public function isVideo($file)
{
$ext = pathinfo($file,PATHINFO_EXTENSION);
@@ -4944,9 +4931,9 @@ class e_parser
* @param $file string
* @return boolean
*/
- function isImage($file)
+ public function isImage($file)
{
- if(substr($file,0,3)=="{e_")
+ if(strpos($file, "{e_") === 0)
{
$file = e107::getParser()->replaceConstants($file);
}
@@ -4970,8 +4957,8 @@ class e_parser
$mime = varset($parm['mime'], 'audio/mpeg');
- $autoplay = !empty($parm['autoplay']) ? "autoplay " : "";
- $controls = !empty($parm['controls']) ? "controls" : "";
+ $autoplay = !empty($parm['autoplay']) ? 'autoplay ' : '';
+ $controls = !empty($parm['controls']) ? 'controls' : '';
$text = '