Commit 31e998d6 authored by Radek Suski's avatar Radek Suski

(#) Count on non-arrays (Issue #103)

parent 0b246396
......@@ -85,24 +85,24 @@ class Header
{
if ( $adm ) {
$this->addCssFile( [ 'bootstrap.bootstrap', 'admicons', 'adm.sobipro' ] )
->addJsFile( [ 'sobipro', 'adm.sobipro', 'jquery', 'jqnc', 'bootstrap', 'adm.interface' ] );
->addJsFile( [ 'sobipro', 'adm.sobipro', 'jquery', 'jqnc', 'bootstrap', 'adm.interface' ] );
}
else {
$this->addCssFile( [ 'sobipro' ] )
->addJsFile( [ 'sobipro', 'jquery', 'jqnc' ] );
->addJsFile( [ 'sobipro', 'jquery', 'jqnc' ] );
if ( Framework::Cfg( 'template.bootstrap3-load', false ) && !defined( 'SOBIPRO_ADM' ) ) {
if ( Framework::Cfg( 'template.bootstrap3-source', true ) ) { //true=local, false=CDN
$this->addCssFile( 'b3bootstrap.b3bootstrap' )
->addJsFile( 'b3bootstrap' );
->addJsFile( 'b3bootstrap' );
}
else {
$this->addHeadLink( Framework::Cfg( 'template.bs3_css', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' ), null, null, 'stylesheet' )
->addJsUrl( Framework::Cfg( 'template.bs3_js', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' ) );
->addJsUrl( Framework::Cfg( 'template.bs3_js', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' ) );
}
}
else {
$this->addCssFile( 'bootstrap.bootstrap' )
->addJsFile( 'bootstrap' );
->addJsFile( 'bootstrap' );
}
$fonts = Framework::Cfg( 'template.icon_fonts_arr', [] );
if ( count( $fonts ) ) {
......@@ -351,7 +351,7 @@ class Header
$this->_checksums[ __FUNCTION__ ][ $checksum ] = true;
$this->store( get_defined_vars(), __FUNCTION__ );
$title = $title ? " title=\"{$title}\" " : null;
if ( $params && count( $params ) ) {
if ( is_array( $params ) && count( $params ) ) {
$arr = new Arr();
$params = $arr->toString( $params );
}
......
......@@ -28,6 +28,7 @@ use Sobi\Utils\StringUtils;
class Joomla
{
use Instance;
/**
* @param string $title
* @param bool $forceAdd
......@@ -53,7 +54,7 @@ class Joomla
}
//if ( Sobi::Cfg( 'browser.full_title', true ) || true ) {
//browser.full_title = true: if title is array, use only the last. That's e.g. the entry name without categories for SobiPro standard title
if ( count( $title ) ) {
if ( is_array( $title ) && count( $title ) ) {
if ( is_array( $title ) ) {
if ( Framework::Cfg( 'browser.reverse_title', false ) ) {
$title = array_reverse( $title );
......@@ -84,6 +85,7 @@ class Joomla
/**
* @param array $head
*
* @return bool
*/
public function addHead( $head )
......
......@@ -278,7 +278,7 @@ class MySQLi
* Creates a "delete" SQL query
*
* @param string $table - in which table
* @param string $where - SQL delete condition
* @param string | array $where - SQL delete condition
* @param int $limit - maximal number of rows to delete
*
* @throws Exception
......@@ -356,7 +356,7 @@ class MySQLi
$equal = '=';
$not = false;
// sort of workaround for incompatibility between RC3 and RC4
if ( $col == 'language' && !( count( $val ) ) ) {
if ( $col == 'language' && !( count( (array) $val ) ) ) {
$val = 'en-GB';
}
/* like:
......
......@@ -178,8 +178,6 @@ abstract class FileSystem
}
$return = \Jfile::write( $file, $buffer );
if ( $return === false ) {
/**
* @todo how to translate from here */
throw new Exception( Framework::Txt( 'CANNOT_WRITE_TO_FILE_AT', $file ) );
}
else {
......
......@@ -215,10 +215,10 @@ abstract class Input
$config = new Configuration();
$filter = new HTMLFilter();
if ( count( $tags ) ) {
if ( is_array( $tags ) && count( $tags ) ) {
foreach ( $tags as $tag ) {
$config->allowTag( $tag );
if ( count( $attributes ) ) {
if ( is_array( $attributes ) && count( $attributes ) ) {
foreach ( $attributes as $attribute ) {
$config->allowAttribute( $tag, $attribute );
}
......@@ -399,7 +399,7 @@ abstract class Input
public static function TransformToRequest()
{
$data = json_decode( file_get_contents( 'php://input' ), true );
if ( count( $data ) ) {
if ( is_array( $data ) && count( $data ) ) {
foreach ( $data as $index => $value ) {
self::Set( $index, $value );
}
......
......@@ -26,6 +26,9 @@ Legend:
- (-) - Removed
- (!) - Change
1.0.7 (X YYY 2018)
------------------
(#) Count on non-arrays (Issue #103)
1.0.6 (4 May 2018)
-------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment