mirror of
https://github.com/e107inc/e107.git
synced 2025-06-02 00:45:03 +02:00
Optimization
This commit is contained in:
parent
46e89d103e
commit
b6d9507aca
@ -13,7 +13,7 @@ if(is_numeric($parm)) // Media-Manager file.
|
||||
|
||||
|
||||
|
||||
if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
|
||||
if ((e_PAGE === 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
|
||||
{
|
||||
list($fname, $uc) = explode("^", $parm."^");
|
||||
if($uc)
|
||||
|
@ -45,7 +45,7 @@ global $pref;
|
||||
return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
|
||||
}
|
||||
|
||||
if (substr($code_text,0,1) == ']')
|
||||
if (substr($code_text,0,1) === ']')
|
||||
{ // Special fix for E107 urls including a language (not nice, really)
|
||||
$code_text = substr($code_text,1);
|
||||
$parm .= ']';
|
||||
|
@ -25,7 +25,7 @@ else
|
||||
$listitems = explode("*", $code_text);
|
||||
}
|
||||
|
||||
if ($parm == '')
|
||||
if (empty($parm))
|
||||
{ /* unordered list */
|
||||
$listtext = "<ul class='bbcode'>";
|
||||
$trailer = "</ul>";
|
||||
|
@ -8,13 +8,13 @@ $external = ($pref['links_new_window'] || strpos($parm, 'external') === 0) ? ' r
|
||||
if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
|
||||
{
|
||||
$parm = preg_replace('#^external.#is', '', $parm);
|
||||
if (strtolower(substr($parm, 0, 11)) == 'javascript:')
|
||||
if (strtolower(substr($parm, 0, 11)) === 'javascript:')
|
||||
return '';
|
||||
return '<a href="'.$tp->toAttribute($parm).'" class="bbcode '.$class.'"'.$external.'>'.$code_text.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strtolower(substr($code_text, 0, 11)) == 'javascript:')
|
||||
if (strtolower(substr($code_text, 0, 11)) === 'javascript:')
|
||||
return '';
|
||||
return '<a href="'.$tp->toAttribute($code_text).'" class="bbcode '.$class.'"'.$external.'>'.$code_text.'</a>';
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
|
||||
|
||||
global $tp;
|
||||
if (substr($parm, -5) == '-link')
|
||||
if (substr($parm, -5) === '-link')
|
||||
{
|
||||
$parm = substr($parm, 0, -5);
|
||||
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($parm,TRUE);
|
||||
|
@ -28,7 +28,7 @@ $text = '';
|
||||
$name_id = e107::getForm()->name2id($name);
|
||||
|
||||
//Get Select Box Only!
|
||||
if($scaction == 'select' || $scaction == 'all')
|
||||
if($scaction === 'select' || $scaction === 'all')
|
||||
{
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
@ -86,7 +86,7 @@ if($scaction == 'select' || $scaction == 'all')
|
||||
$text .= "</select>";
|
||||
|
||||
|
||||
if($scaction == 'select') return $text;
|
||||
if($scaction === 'select') return $text;
|
||||
}
|
||||
|
||||
$hide = '';
|
||||
|
@ -2119,7 +2119,7 @@ class e_admin_controller
|
||||
|
||||
// e107::getDebug()->log("Admin-ui Action: <b>".$action."</b>");
|
||||
|
||||
if($action == 'Edit')
|
||||
if($action === 'Edit')
|
||||
{
|
||||
$this->addTitle('#'.$this->getId()); // Inform user of which record is being edited.
|
||||
}
|
||||
@ -2827,7 +2827,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
return null;
|
||||
}
|
||||
|
||||
if($this->getAction() == 'list')
|
||||
if($this->getAction() === 'list')
|
||||
{
|
||||
return $this->getListModel()->get($key);
|
||||
}
|
||||
@ -3188,7 +3188,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$field = $trigger[1];
|
||||
$value = $trigger[2];
|
||||
|
||||
if($trigger[0] == 'addAll')
|
||||
if($trigger[0] === 'addAll')
|
||||
{
|
||||
$parms = $this->getFieldAttr($field, 'writeParms', array());
|
||||
if(!is_array($parms)) parse_str($parms, $parms);
|
||||
@ -3221,7 +3221,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
|
||||
if(method_exists($this, 'handleCommaBatch'))
|
||||
{
|
||||
$trigger[0] = $trigger[0] == 'ucadd' ? 'attach' : 'deattach';
|
||||
$trigger[0] = $trigger[0] === 'ucadd' ? 'attach' : 'deattach';
|
||||
$this->handleCommaBatch($selected, $field, $class, $trigger[0]);
|
||||
}
|
||||
break;
|
||||
@ -3799,7 +3799,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$_dataType = $this->fields[$filterField]['data'];
|
||||
$_fieldType = $this->fields[$filterField]['type'];
|
||||
|
||||
if($_fieldType === 'comma' || $_fieldType === 'checkboxes' || $_fieldType == 'userclasses' || ($_fieldType == 'dropdown' && !empty($this->fields[$filterField]['writeParms']['multiple'])))
|
||||
if($_fieldType === 'comma' || $_fieldType === 'checkboxes' || $_fieldType === 'userclasses' || ($_fieldType === 'dropdown' && !empty($this->fields[$filterField]['writeParms']['multiple'])))
|
||||
{
|
||||
$_dataType = 'set';
|
||||
}
|
||||
@ -3812,7 +3812,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
|
||||
case 'int':
|
||||
case 'integer':
|
||||
if($_fieldType == 'datestamp') // Past Month, Past Year etc.
|
||||
if($_fieldType === 'datestamp') // Past Month, Past Year etc.
|
||||
{
|
||||
$searchQry[] = $this->fields[$filterField]['__tableField']." > ".intval($filterValue);
|
||||
}
|
||||
@ -3826,14 +3826,14 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
|
||||
default: // string usually.
|
||||
|
||||
if($filterValue == '_ISEMPTY_')
|
||||
if($filterValue === '_ISEMPTY_')
|
||||
{
|
||||
$searchQry[] = $this->fields[$filterField]['__tableField']." = '' ";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($_fieldType == 'method') // More flexible filtering.
|
||||
if($_fieldType === 'method') // More flexible filtering.
|
||||
{
|
||||
|
||||
$searchQry[] = $this->fields[$filterField]['__tableField']." LIKE \"%".$tp->toDB($filterValue)."%\"";
|
||||
@ -3879,14 +3879,14 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
// filter for WHERE and FROM clauses
|
||||
$searchable_types = array('text', 'textarea', 'bbarea', 'url', 'ip', 'tags', 'email', 'int', 'integer', 'str', 'string', 'number'); //method? 'user',
|
||||
|
||||
if($var['type'] == 'method' && !empty($var['data']) && ($var['data'] == 'string' || $var['data'] == 'str'))
|
||||
if($var['type'] === 'method' && !empty($var['data']) && ($var['data'] === 'string' || $var['data'] === 'str'))
|
||||
{
|
||||
$searchable_types[] = 'method';
|
||||
}
|
||||
|
||||
if(trim($searchQuery) !== '' && in_array($var['type'], $searchable_types) && $var['__tableField'])
|
||||
{
|
||||
if($var['data'] == 'int' || $var['data'] == 'integer' || $var['type'] == 'int' || $var['type'] == 'integer')
|
||||
if($var['data'] === 'int' || $var['data'] === 'integer' || $var['type'] === 'int' || $var['type'] === 'integer')
|
||||
{
|
||||
if(is_numeric($searchQuery))
|
||||
{
|
||||
@ -3895,7 +3895,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
continue;
|
||||
}
|
||||
|
||||
if($var['type'] == 'ip')
|
||||
if($var['type'] === 'ip')
|
||||
{
|
||||
$ipSearch = e107::getIpHandler()->ipEncode($searchQuery);
|
||||
if(!empty($ipSearch))
|
||||
@ -4013,7 +4013,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$rawData['joins'] = $joins;
|
||||
$rawData['groupField'] = $groupField;
|
||||
$rawData['orderField'] = isset($this->fields[$orderField]) ? $this->fields[$orderField]['__tableField'] : '';
|
||||
$rawData['orderType'] = $request->getQuery('asc') == 'desc' ? 'DESC' : 'ASC';
|
||||
$rawData['orderType'] = $request->getQuery('asc') === 'desc' ? 'DESC' : 'ASC';
|
||||
$rawData['limitFrom'] = false === $forceFrom ? intval($request->getQuery('from', 0)) : intval($forceFrom);
|
||||
$rawData['limitTo'] = false === $forceTo ? intval($this->getPerPage()) : intval($forceTo);
|
||||
return $rawData;
|
||||
@ -4072,7 +4072,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
if(isset($this->fields[$orderField]) && strpos($this->listQry,'ORDER BY')==FALSE) //override ORDER using listQry (admin->sitelinks)
|
||||
{
|
||||
// no need of sanitize - it's found in field array
|
||||
$qry .= ' ORDER BY '.$this->fields[$orderField]['__tableField'].' '.(strtolower($orderDef) == 'desc' ? 'DESC' : 'ASC');
|
||||
$qry .= ' ORDER BY '.$this->fields[$orderField]['__tableField'].' '.(strtolower($orderDef) === 'desc' ? 'DESC' : 'ASC');
|
||||
}
|
||||
}
|
||||
|
||||
@ -4147,7 +4147,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
|
||||
// - Autoincrement sortField on 'Create'.
|
||||
|
||||
if(($_posted['etrigger_submit'] == 'create') && !empty($this->sortField) && empty($this->sortParent) && empty($_posted[$this->sortField]) )
|
||||
if(($_posted['etrigger_submit'] === 'create') && !empty($this->sortField) && empty($this->sortParent) && empty($_posted[$this->sortField]) )
|
||||
{
|
||||
|
||||
$incVal = e107::getDb()->max($this->table, $this->sortField) + 1;
|
||||
@ -4254,7 +4254,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
return false;
|
||||
}
|
||||
|
||||
if($when == 'after')
|
||||
if($when === 'after')
|
||||
{
|
||||
$type .= 'd'; // ie. 'created' or 'updated'.
|
||||
}
|
||||
@ -4392,7 +4392,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
$fieldName = 'x_'.$plug.'_'.$k;
|
||||
|
||||
if($v['type'] == 'method' && method_exists($form,$fieldName))
|
||||
if($v['type'] === 'method' && method_exists($form,$fieldName))
|
||||
{
|
||||
$v['method'] = $plug."_admin_form::".$fieldName;
|
||||
//echo "Found method ".$fieldName." in ".$plug."_menu_form";
|
||||
@ -4948,12 +4948,12 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
{
|
||||
// special exceptions
|
||||
|
||||
if($value == '#delete') // see admin->users
|
||||
if($value === '#delete') // see admin->users
|
||||
{
|
||||
$val = "''";
|
||||
$value = "(empty)";
|
||||
}
|
||||
elseif($value == "#null")
|
||||
elseif($value === "#null")
|
||||
{
|
||||
$val = null;
|
||||
$value = "(empty)";
|
||||
@ -4963,7 +4963,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$val = "'".$value."'";
|
||||
}
|
||||
|
||||
if($field == 'options') // reserved field type. see: admin -> media-manager - batch rotate image.
|
||||
if($field === 'options') // reserved field type. see: admin -> media-manager - batch rotate image.
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -5505,7 +5505,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
foreach($this->prefs as $k=>$v) // fix for empty checkboxes - need to save a value.
|
||||
{
|
||||
if(!isset($data[$k]) && $v['data'] !== false && ($v['type'] == 'checkboxes' || $v['type'] == 'checkbox'))
|
||||
if(!isset($data[$k]) && $v['data'] !== false && ($v['type'] === 'checkboxes' || $v['type'] === 'checkbox'))
|
||||
{
|
||||
$data[$k] = null;
|
||||
}
|
||||
@ -5634,7 +5634,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
*/
|
||||
protected function _setConfig()
|
||||
{
|
||||
$this->_pref = $this->pluginName == 'core' ? e107::getConfig() : e107::getPlugConfig($this->pluginName);
|
||||
$this->_pref = $this->pluginName === 'core' ? e107::getConfig() : e107::getPlugConfig($this->pluginName);
|
||||
|
||||
$dataFields = $validateRules = array();
|
||||
foreach ($this->prefs as $key => $att)
|
||||
@ -5678,7 +5678,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
continue;
|
||||
}
|
||||
|
||||
if(varset($att['type']) == 'comma' && (empty($att['data']) || empty($att['rule'])))
|
||||
if(varset($att['type']) === 'comma' && (empty($att['data']) || empty($att['rule'])))
|
||||
{
|
||||
$att['data'] = 'set';
|
||||
$att['validate'] = 'set';
|
||||
@ -5689,7 +5689,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
unset($_parms);
|
||||
}
|
||||
|
||||
if(!empty($att['data']) && $att['data'] == 'array' && ($this->getAction() == 'inline')) // FIX for arrays being saved incorrectly with inline editing.
|
||||
if(!empty($att['data']) && $att['data'] === 'array' && ($this->getAction() === 'inline')) // FIX for arrays being saved incorrectly with inline editing.
|
||||
{
|
||||
$att['data'] = 'set';
|
||||
}
|
||||
@ -6123,13 +6123,13 @@ class e_admin_form_ui extends e_form
|
||||
$get = $this->getController()->getQuery();
|
||||
foreach ($get as $key => $value)
|
||||
{
|
||||
if($key == 'searchquery' || $key == 'filter_options' || $key == 'etrigger_filter')
|
||||
if($key === 'searchquery' || $key === 'filter_options' || $key === 'etrigger_filter')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reset pager after filtering.
|
||||
if ($key == 'from')
|
||||
if ($key === 'from')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -6467,7 +6467,7 @@ class e_admin_form_ui extends e_form
|
||||
$option['bool__'.$key.'__0'] = LAN_NO;
|
||||
}
|
||||
|
||||
if($type == 'batch')
|
||||
if($type === 'batch')
|
||||
{
|
||||
$option['boolreverse__'.$key] = LAN_BOOL_REVERSE;
|
||||
}
|
||||
@ -6485,7 +6485,7 @@ class e_admin_form_ui extends e_form
|
||||
if(empty($options)) continue;
|
||||
|
||||
|
||||
if($type == 'batch')
|
||||
if($type === 'batch')
|
||||
{
|
||||
$_option = array();
|
||||
|
||||
@ -6570,7 +6570,7 @@ class e_admin_form_ui extends e_form
|
||||
|
||||
if(!is_array(varset($parms['__options']))) parse_str($parms['__options'], $parms['__options']);
|
||||
$opts = $parms['__options'];
|
||||
if(vartrue($opts['multiple']) && $type == 'batch')
|
||||
if(vartrue($opts['multiple']) && $type === 'batch')
|
||||
{
|
||||
// no batch support for multiple, should have some for filters soon
|
||||
continue;
|
||||
@ -6632,7 +6632,7 @@ class e_admin_form_ui extends e_form
|
||||
$classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes'));
|
||||
$_option = array();
|
||||
|
||||
if($type == 'batch')
|
||||
if($type === 'batch')
|
||||
{
|
||||
// FIXME Lan
|
||||
foreach ($classes as $k => $v)
|
||||
@ -6722,7 +6722,7 @@ class e_admin_form_ui extends e_form
|
||||
public function getElementId()
|
||||
{
|
||||
$controller = $this->getController();
|
||||
$name = str_replace('_', '-', ($controller->getPluginName() == 'core' ? 'core-'.$controller->getTableName() : 'plugin-'.$controller->getPluginName()));
|
||||
$name = str_replace('_', '-', ($controller->getPluginName() === 'core' ? 'core-'.$controller->getTableName() : 'plugin-'.$controller->getPluginName()));
|
||||
return e107::getForm()->name2id($name); // prevent invalid ids.
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ class db_verify
|
||||
// $debugB = $rawSqlData;
|
||||
$debugB = $sqlDataArr['data'][0]; // Extracted Raw Field Text
|
||||
|
||||
if(isset($debugA) && (e_PAGE == 'db.php'))
|
||||
if(isset($debugA) && (e_PAGE === 'db.php'))
|
||||
{
|
||||
|
||||
$debug = "<table class='table' border='1'>
|
||||
@ -365,7 +365,7 @@ class db_verify
|
||||
foreach($this->results as $tabs => $field)
|
||||
{
|
||||
$file = varset($this->results[$tabs]['_file']);
|
||||
if(varset($this->errors[$tabs]['_status']) == 'missing_table') // Missing Table
|
||||
if(varset($this->errors[$tabs]['_status']) === 'missing_table') // Missing Table
|
||||
{
|
||||
$this->fixList[$file][$tabs]['all'][] = 'create';
|
||||
}
|
||||
@ -451,7 +451,7 @@ class db_verify
|
||||
foreach($this->results as $tabs => $field)
|
||||
{
|
||||
|
||||
if($this->errors[$tabs]['_status'] == 'missing_table') // Missing Table
|
||||
if($this->errors[$tabs]['_status'] === 'missing_table') // Missing Table
|
||||
{
|
||||
$text .= "
|
||||
<tr>
|
||||
@ -590,7 +590,7 @@ class db_verify
|
||||
|
||||
if(!$data) return;
|
||||
|
||||
if($mode == 'index')
|
||||
if($mode === 'index')
|
||||
{
|
||||
// print_a($data);
|
||||
if($data['type'])
|
||||
@ -776,7 +776,7 @@ class db_verify
|
||||
|
||||
foreach($match[1] as $c=>$k)
|
||||
{
|
||||
if(substr($k,0, 5) == 'e107_') // remove prefix if found in sql dump.
|
||||
if(strpos($k,'e107_' === 0) // remove prefix if found in sql dump.
|
||||
{
|
||||
$k = substr($k, 5);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ class e107
|
||||
return self::$_registry[$id];
|
||||
}
|
||||
|
||||
if($id == '_all_')
|
||||
if($id === '_all_')
|
||||
{
|
||||
return self::$_registry;
|
||||
}
|
||||
@ -934,7 +934,7 @@ class e107
|
||||
e107_require_once(e_HANDLER.'pref_class.php');
|
||||
self::$_core_config_arr[$name] = new e_core_pref($name, $load);
|
||||
|
||||
if($name == 'core') // prevent loop between pref and cache handlers.
|
||||
if($name === 'core') // prevent loop between pref and cache handlers.
|
||||
{
|
||||
self::getCache()->UserCacheActive = self::getPref('cachestatus');
|
||||
self::getCache()->SystemCacheActive = self::getPref('syscachestatus');
|
||||
@ -2208,12 +2208,12 @@ class e107
|
||||
*/
|
||||
public static function meta($name = null, $content = null, $extended = array())
|
||||
{
|
||||
if($name == 'description')
|
||||
if($name === 'description')
|
||||
{
|
||||
self::getUrl()->response()->addMetaDescription($content); //Cam: TBD
|
||||
}
|
||||
|
||||
if($name == 'keywords')
|
||||
if($name === 'keywords')
|
||||
{
|
||||
self::getUrl()->response()->addMetaKeywords($content); //Cam: TBD
|
||||
}
|
||||
@ -2251,7 +2251,7 @@ class e107
|
||||
|
||||
$elist = self::getPref($filename.'_list');
|
||||
|
||||
if($filename == 'e_menu')
|
||||
if($filename === 'e_menu')
|
||||
{
|
||||
if(!in_array($pluginName, $elist)) return null;
|
||||
}
|
||||
@ -2828,7 +2828,7 @@ class e107
|
||||
{
|
||||
if (!is_readable($path))
|
||||
{
|
||||
if (self::getPref('noLanguageSubs') || (e_LANGUAGE == 'English'))
|
||||
if (self::getPref('noLanguageSubs') || (e_LANGUAGE === 'English'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -3168,11 +3168,11 @@ class e107
|
||||
{
|
||||
$rawUrl = $tp->simpleParse($tmp[$plugin][$key]['sef'], $row);
|
||||
|
||||
if($options['mode'] == 'full')
|
||||
if($options['mode'] === 'full')
|
||||
{
|
||||
$sefUrl = SITEURL.$rawUrl;
|
||||
}
|
||||
elseif($options['mode'] == 'raw')
|
||||
elseif($options['mode'] === 'raw')
|
||||
{
|
||||
$sefUrl = $rawUrl;
|
||||
}
|
||||
@ -3407,7 +3407,7 @@ class e107
|
||||
return (isset($ret)) ? $ret : "";
|
||||
}
|
||||
}
|
||||
if (self::getPref('noLanguageSubs') || (e_LANGUAGE == 'English'))
|
||||
if (self::getPref('noLanguageSubs') || (e_LANGUAGE === 'English'))
|
||||
{
|
||||
return FALSE; // No point looking for the English files twice
|
||||
}
|
||||
@ -3446,7 +3446,7 @@ class e107
|
||||
if (isset($_REQUEST)) array_walk($_REQUEST, array('self', 'filter_request'), '_REQUEST');
|
||||
|
||||
// A better way to detect an AJAX request. No need for "ajax_used=1";
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest')
|
||||
{
|
||||
define('e_AJAX_REQUEST', true);
|
||||
}
|
||||
@ -3603,7 +3603,7 @@ class e107
|
||||
|
||||
}
|
||||
|
||||
if($type == '_GET') // Basic XSS check.
|
||||
if($type === '_GET') // Basic XSS check.
|
||||
{
|
||||
if(stripos($input, "<script")!==false || stripos($input, "%3Cscript")!==false)
|
||||
{
|
||||
@ -4129,8 +4129,8 @@ class e107
|
||||
|| ($isPluginDir && (strpos(e_PAGE,'_admin.php') !== false || strpos(e_PAGE,'admin_') === 0 || strpos($e107Path, 'admin/') !== FALSE)) // Plugin admin file or directory
|
||||
|| (vartrue($eplug_admin) || deftrue('ADMIN_AREA')) // Admin forced
|
||||
|| (preg_match('/^\/(.*?)\/user(settings\.php|\/edit)(\?|\/)(\d+)$/i', $_SERVER['REQUEST_URI']) && ADMIN)
|
||||
|| ($isPluginDir && e_PAGE == 'prefs.php') //BC Fix for old plugins
|
||||
|| ($isPluginDir && e_PAGE == 'config.php') // BC Fix for old plugins
|
||||
|| ($isPluginDir && e_PAGE === 'prefs.php') //BC Fix for old plugins
|
||||
|| ($isPluginDir && e_PAGE === 'config.php') // BC Fix for old plugins
|
||||
)
|
||||
{
|
||||
$inAdminDir = TRUE;
|
||||
|
@ -337,7 +337,7 @@
|
||||
$fld['writeParms'] .= "&glyphs=1";
|
||||
}
|
||||
|
||||
if($fld['type'] == 'checkboxes')
|
||||
if($fld['type'] === 'checkboxes')
|
||||
{
|
||||
if($tmp = e107::getParser()->isJSON($fld['writeParms']))
|
||||
{
|
||||
|
@ -2408,7 +2408,7 @@ class e_parse extends e_parser
|
||||
{
|
||||
if(!empty($this->thumbCrop) && !empty($this->thumbWidth) && !empty($this->thumbHeight)) // dimensions are known.
|
||||
{
|
||||
return ($type == 'double') ? 'width="'.$this->thumbWidth.'" height="'.$this->thumbHeight.'"' : "width='".$this->thumbWidth."' height='".$this->thumbHeight."'";
|
||||
return ($type === 'double') ? 'width="'.$this->thumbWidth.'" height="'.$this->thumbHeight.'"' : "width='".$this->thumbWidth."' height='".$this->thumbHeight."'";
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -2617,7 +2617,7 @@ class e_parse extends e_parser
|
||||
return implode(", ",$links);
|
||||
|
||||
}
|
||||
elseif($multiply == '2x' || $multiply == '3x' || $multiply == '4x')
|
||||
elseif($multiply === '2x' || $multiply === '3x' || $multiply === '4x')
|
||||
{
|
||||
|
||||
if(empty($parm['w']) && isset($parm['h']))
|
||||
@ -2664,7 +2664,7 @@ class e_parse extends e_parser
|
||||
|
||||
// $parms['x'] = $encode;
|
||||
|
||||
if(!empty($parm['return']) && $parm['return'] == 'src')
|
||||
if(!empty($parm['return']) && $parm['return'] === 'src')
|
||||
{
|
||||
return $this->thumbUrl($src, $parms);
|
||||
}
|
||||
@ -3194,7 +3194,7 @@ class e_parse extends e_parser
|
||||
foreach($tmp as $key=>$val)
|
||||
{
|
||||
// Fix - don't break the CDN '//cdn.com' URLs
|
||||
if ($hasCDN && $val == '/') {
|
||||
if ($hasCDN && $val === '/') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3638,11 +3638,11 @@ class e_parser
|
||||
$parm = array();
|
||||
}
|
||||
|
||||
if(substr($text,0,2) == 'e-') // e107 admin icon.
|
||||
if(substr($text,0,2) === 'e-') // e107 admin icon.
|
||||
{
|
||||
$size = (substr($text,-3) == '-32') ? 'S32' : 'S16';
|
||||
$size = (substr($text,-3) === '-32') ? 'S32' : 'S16';
|
||||
|
||||
if(substr($text,-3) == '-24')
|
||||
if(substr($text,-3) === '-24')
|
||||
{
|
||||
$size = 'S24';
|
||||
}
|
||||
@ -3838,7 +3838,7 @@ class e_parser
|
||||
$title = (ADMIN) ? $image : $tp->toAttribute($userData['user_name']);
|
||||
$shape = (!empty($options['shape'])) ? "img-".$options['shape'] : "img-rounded rounded";
|
||||
|
||||
if(!empty($options['type']) && $options['type'] == 'url')
|
||||
if(!empty($options['type']) && $options['type'] === 'url')
|
||||
{
|
||||
return $img;
|
||||
}
|
||||
@ -3895,7 +3895,7 @@ class e_parser
|
||||
$path = $this->thumbUrl($icon);
|
||||
$dimensions = $this->thumbDimensions();
|
||||
}
|
||||
elseif($icon[0] == '{')
|
||||
elseif($icon[0] === '{')
|
||||
{
|
||||
$path = $this->replaceConstants($icon,'full');
|
||||
}
|
||||
@ -4007,7 +4007,7 @@ class e_parser
|
||||
{
|
||||
$path = $file;
|
||||
}
|
||||
elseif($file[0] == '{') // Legacy v1.x path. Example: {e_PLUGIN}myplugin/images/fixedimage.png
|
||||
elseif($file[0] === '{') // Legacy v1.x path. Example: {e_PLUGIN}myplugin/images/fixedimage.png
|
||||
{
|
||||
$path = $tp->replaceConstants($file,'abs');
|
||||
}
|
||||
@ -4171,7 +4171,7 @@ class e_parser
|
||||
{
|
||||
$ext = pathinfo($file,PATHINFO_EXTENSION);
|
||||
|
||||
return ($ext == 'youtube' || $ext == 'youtubepl') ? true : false;
|
||||
return ($ext === 'youtube' || $ext === 'youtubepl') ? true : false;
|
||||
|
||||
}
|
||||
|
||||
@ -4190,7 +4190,7 @@ class e_parser
|
||||
|
||||
$ext = pathinfo($file,PATHINFO_EXTENSION);
|
||||
|
||||
return ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') ? true : false;
|
||||
return ($ext === 'jpg' || $ext === 'png' || $ext === 'gif' || $ext === 'jpeg') ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@ -4215,7 +4215,7 @@ class e_parser
|
||||
$ytpref = array();
|
||||
foreach($pref as $k=>$v) // Find all Youtube Prefs.
|
||||
{
|
||||
if(substr($k,0,8) == 'youtube_')
|
||||
if(substr($k,0,8) === 'youtube_')
|
||||
{
|
||||
$key = substr($k,8);
|
||||
$ytpref[$key] = $v;
|
||||
@ -4234,19 +4234,19 @@ class e_parser
|
||||
$defClass = (deftrue('BOOTSTRAP')) ? "embed-responsive embed-responsive-16by9" : "video-responsive"; // levacy backup.
|
||||
|
||||
|
||||
if($type == 'youtube')
|
||||
if($type === 'youtube')
|
||||
{
|
||||
// $thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg";
|
||||
$thumbSrc = "https://i1.ytimg.com/vi/".$id."/mqdefault.jpg";
|
||||
$video = '<iframe class="embed-responsive-item" width="560" height="315" src="//www.youtube.com/embed/'.$id.'?'.$ytqry.'" style="background-size: 100%;background-image: url('.$thumbSrc.');border:0px" allowfullscreen></iframe>';
|
||||
|
||||
|
||||
if($thumb == 'tag')
|
||||
if($thumb === 'tag')
|
||||
{
|
||||
return "<img class='img-responsive img-fluid' src='".$thumbSrc."' alt='Youtube Video' style='width:".vartrue($parm['w'],'80')."px'/>";
|
||||
}
|
||||
|
||||
if($thumb == 'email')
|
||||
if($thumb === 'email')
|
||||
{
|
||||
$thumbSrc = "http://i1.ytimg.com/vi/".$id."/maxresdefault.jpg"; // 640 x 480
|
||||
$filename = 'temp/yt-thumb-'.md5($id).".jpg";
|
||||
@ -4262,14 +4262,14 @@ class e_parser
|
||||
<div class='video-thumbnail-caption'><small>".LAN_CLICK_TO_VIEW."</small></div></a>";
|
||||
}
|
||||
|
||||
if($thumb == 'src')
|
||||
if($thumb === 'src')
|
||||
{
|
||||
return $thumbSrc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($thumb == 'video')
|
||||
if($thumb === 'video')
|
||||
{
|
||||
return '<div class="'.$defClass.' video-thumbnail thumbnail">'.$video.'</div>';
|
||||
}
|
||||
@ -4278,10 +4278,10 @@ class e_parser
|
||||
}
|
||||
|
||||
|
||||
if($type =='youtubepl')
|
||||
if($type === 'youtubepl')
|
||||
{
|
||||
|
||||
if($thumb == 'tag')
|
||||
if($thumb === 'tag')
|
||||
{
|
||||
$thumbSrc = e107::getMedia()->getThumb($id);
|
||||
|
||||
@ -4293,7 +4293,7 @@ class e_parser
|
||||
|
||||
}
|
||||
|
||||
if($thumb == 'src')
|
||||
if($thumb === 'src')
|
||||
{
|
||||
$thumb = e107::getMedia()->getThumb($id);
|
||||
if(!empty($thumb))
|
||||
@ -4311,7 +4311,7 @@ class e_parser
|
||||
return '<div class="'.$defClass.' '.vartrue($parm['class']).'">'.$video.'</div>';
|
||||
}
|
||||
|
||||
if($type == 'mp4') //TODO FIXME
|
||||
if($type === 'mp4') //TODO FIXME
|
||||
{
|
||||
return '
|
||||
<div class="video-responsive">
|
||||
@ -4608,17 +4608,17 @@ return;
|
||||
return $text;
|
||||
}
|
||||
|
||||
if($type == 'w') // words only.
|
||||
if($type === 'w') // words only.
|
||||
{
|
||||
return preg_replace('/[^\w]/',"",$text);
|
||||
}
|
||||
|
||||
if($type == 'wds') // words, digits and spaces only.
|
||||
if($type === 'wds') // words, digits and spaces only.
|
||||
{
|
||||
return preg_replace('/[^\w\d ]/',"",$text);
|
||||
}
|
||||
|
||||
if($type == 'file')
|
||||
if($type === 'file')
|
||||
{
|
||||
return preg_replace('/[^\w\d_\.-]/',"",$text);
|
||||
}
|
||||
@ -4814,7 +4814,7 @@ return;
|
||||
|
||||
$value = str_replace("
", "\r", $value);
|
||||
|
||||
if($node->nodeName == 'pre')
|
||||
if($node->nodeName === 'pre')
|
||||
{
|
||||
$value = preg_replace('/^<pre[^>]*>/', '', $value);
|
||||
$value = str_replace("</pre>", "", $value);
|
||||
@ -4822,7 +4822,7 @@ return;
|
||||
|
||||
}
|
||||
|
||||
if($node->nodeName == 'code')
|
||||
if($node->nodeName === 'code')
|
||||
{
|
||||
$value = preg_replace('/^<code[^>]*>/', '', $value);
|
||||
$value = str_replace("</code>", "", $value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user