@@ -72,8 +72,8 @@ public function beforeSendResponse(Http $response)
72
72
$ exclude = $ this ->helper ->getConfigModule ('general/exclude_img ' );
73
73
// $exclude = 'product-image-photo';
74
74
if ($ exclude ){
75
- $ exclude = str_replace (' ' , '' , $ exclude );
76
- $ this ->exclude = explode (', ' , $ exclude );
75
+ $ exclude = str_replace (' ' , '' , ( string ) $ exclude );
76
+ $ this ->exclude = explode (', ' , ( string ) $ exclude );
77
77
}
78
78
79
79
$ placeholder = $ this ->helper ->getConfigModule ('general/placeholder ' );
@@ -109,9 +109,9 @@ public function addBodyClass( $content, $class )
109
109
'/<body([\s\S]*?)(?:class="(.*?)")([\s\S]*?)?([^>]*)>/ ' ,
110
110
function ($ match ) use ($ class ) {
111
111
if ($ match [2 ]){
112
- return $ lazy = str_replace ('class=" ' , 'class=" ' . $ class . ' ' , $ match [0 ]);
112
+ return $ lazy = str_replace ('class=" ' , 'class=" ' . $ class . ' ' , ( string ) $ match [0 ]);
113
113
}else {
114
- return str_replace ('<body ' , '<body class=" ' . $ class . '" ' , $ match [0 ]);
114
+ return str_replace ('<body ' , '<body class=" ' . $ class . '" ' , ( string ) $ match [0 ]);
115
115
}
116
116
},
117
117
$ content
@@ -169,7 +169,7 @@ public function addLazyloadPlaceholder( $content, $addJs=false )
169
169
170
170
public function isExclude ($ class )
171
171
{
172
- if (is_string ($ class )) $ class = explode (' ' , $ class );
172
+ if (is_string ($ class )) $ class = explode (' ' , ( string ) $ class );
173
173
$ excludeExist = array_intersect ($ this ->exclude , $ class );
174
174
return !empty ($ excludeExist );
175
175
}
@@ -221,15 +221,15 @@ function($match) use ($placeholder) {
221
221
222
222
if (stripos ($ match [0 ], ' class=" ' ) !== false ){
223
223
if ( $ this ->isExclude ($ match [1 ]) ) return $ match [0 ];
224
- $ lazy = str_replace (' class=" ' , ' class="lazyload ' , $ match [0 ]);
224
+ $ lazy = str_replace (' class=" ' , ' class="lazyload ' , ( string ) $ match [0 ]);
225
225
}else {
226
- $ lazy = str_replace ('<img ' , '<img class="lazyload" ' , $ match [0 ]);
226
+ $ lazy = str_replace ('<img ' , '<img class="lazyload" ' , ( string ) $ match [0 ]);
227
227
}
228
228
229
229
/* break if exist data-src */
230
230
// if(strpos($lazy, ' data-src="')) return $lazy;
231
231
232
- return str_replace (' src=" ' , ' src=" ' .$ placeholder . '" data-src=" ' , $ lazy );
232
+ return str_replace (' src=" ' , ' src=" ' .$ placeholder . '" data-src=" ' , ( string ) $ lazy );
233
233
},
234
234
$ content
235
235
);
@@ -246,15 +246,15 @@ function($match) use ($placeholder) {
246
246
247
247
if (stripos ($ match [0 ], ' class=" ' ) !== false ){
248
248
if ( $ this ->isExclude ($ match [1 ]) ) return $ match [0 ];
249
- $ lazy = str_replace (' class=\" ' , ' class=\"lazyload ' , $ match [0 ]);
249
+ $ lazy = str_replace (' class=\" ' , ' class=\"lazyload ' , ( string ) $ match [0 ]);
250
250
}else {
251
- $ lazy = str_replace ('<img ' , '<img class=\"lazyload\" ' , $ match [0 ]);
251
+ $ lazy = str_replace ('<img ' , '<img class=\"lazyload\" ' , ( string ) $ match [0 ]);
252
252
}
253
253
254
254
/* break if exist data-src */
255
255
// if(strpos($lazy, ' data-src=\"')) return $lazy;
256
256
257
- return str_replace (' src=\" ' , ' src=\" ' . $ placeholder . '\" data-src=\" ' , $ lazy );
257
+ return str_replace (' src=\" ' , ' src=\" ' . $ placeholder . '\" data-src=\" ' , ( string ) $ lazy );
258
258
},
259
259
$ content
260
260
);
@@ -263,7 +263,7 @@ function($match) use ($placeholder) {
263
263
/* Not Placeholder so can't keep layout original while loading */
264
264
public function addLazyloadAll ( $ content , $ addJs =false )
265
265
{
266
- $ placeholder = str_replace (['$width ' , '$height ' ], [1 , 1 ], $ this ->placeholder );
266
+ $ placeholder = str_replace (['$width ' , '$height ' ], [1 , 1 ], ( string ) $ this ->placeholder );
267
267
268
268
$ content = $ this ->addLazyloadImage ($ content , $ placeholder );
269
269
0 commit comments