Changes using empty instead of strlen.
This commit is contained in:
parent
2c6b5128c6
commit
7195d3d1f3
@ -255,8 +255,11 @@ class Image {
|
|||||||
*/
|
*/
|
||||||
public function get_image_link() {
|
public function get_image_link() {
|
||||||
global $config;
|
global $config;
|
||||||
if(strlen($config->get_string('image_ilink')) > 0) {
|
|
||||||
return $this->parse_link_template($config->get_string('image_ilink'));
|
$image_ilink = $config->get_string('image_ilink'); // store a copy for speed.
|
||||||
|
|
||||||
|
if( !empty($image_ilink) ) { /* empty is faster than strlen */
|
||||||
|
return $this->parse_link_template($image_ilink);
|
||||||
}
|
}
|
||||||
else if($config->get_bool('nice_urls', false)) {
|
else if($config->get_bool('nice_urls', false)) {
|
||||||
return $this->parse_link_template(make_link('_images/$hash/$id - $tags.$ext'));
|
return $this->parse_link_template(make_link('_images/$hash/$id - $tags.$ext'));
|
||||||
@ -560,7 +563,7 @@ class Image {
|
|||||||
// various types of querylet
|
// various types of querylet
|
||||||
foreach($terms as $term) {
|
foreach($terms as $term) {
|
||||||
$positive = true;
|
$positive = true;
|
||||||
if((strlen($term) > 0) && ($term[0] == '-')) {
|
if( is_string($term) && !empty($term) && ($term[0] == '-')) {
|
||||||
$positive = false;
|
$positive = false;
|
||||||
$term = substr($term, 1);
|
$term = substr($term, 1);
|
||||||
}
|
}
|
||||||
@ -605,7 +608,7 @@ class Image {
|
|||||||
if(count($tag_querylets) == 0) {
|
if(count($tag_querylets) == 0) {
|
||||||
$query = new Querylet("SELECT images.* FROM images ");
|
$query = new Querylet("SELECT images.* FROM images ");
|
||||||
|
|
||||||
if(strlen($img_search->sql) > 0) {
|
if(!empty($img_search->sql)) {
|
||||||
$query->append_sql(" WHERE ");
|
$query->append_sql(" WHERE ");
|
||||||
$query->append($img_search);
|
$query->append($img_search);
|
||||||
}
|
}
|
||||||
@ -622,7 +625,7 @@ class Image {
|
|||||||
)
|
)
|
||||||
"), array("tag"=>$tag_querylets[0]->tag));
|
"), array("tag"=>$tag_querylets[0]->tag));
|
||||||
|
|
||||||
if(strlen($img_search->sql) > 0) {
|
if(!empty($img_search->sql)) {
|
||||||
$query->append_sql(" AND ");
|
$query->append_sql(" AND ");
|
||||||
$query->append($img_search);
|
$query->append($img_search);
|
||||||
}
|
}
|
||||||
@ -724,7 +727,7 @@ class Image {
|
|||||||
// turn each term into a specific type of querylet
|
// turn each term into a specific type of querylet
|
||||||
foreach($terms as $term) {
|
foreach($terms as $term) {
|
||||||
$negative = false;
|
$negative = false;
|
||||||
if((strlen($term) > 0) && ($term[0] == '-')) {
|
if( !empty($term) && ($term[0] == '-')) {
|
||||||
$negative = true;
|
$negative = true;
|
||||||
$term = substr($term, 1);
|
$term = substr($term, 1);
|
||||||
}
|
}
|
||||||
@ -781,7 +784,7 @@ class Image {
|
|||||||
if($positive_tag_count + $negative_tag_count == 0) {
|
if($positive_tag_count + $negative_tag_count == 0) {
|
||||||
$query = new Querylet("SELECT images.*,UNIX_TIMESTAMP(posted) AS posted_timestamp FROM images ");
|
$query = new Querylet("SELECT images.*,UNIX_TIMESTAMP(posted) AS posted_timestamp FROM images ");
|
||||||
|
|
||||||
if(strlen($img_search->sql) > 0) {
|
if(!empty($img_search->sql)) {
|
||||||
$query->append_sql(" WHERE ");
|
$query->append_sql(" WHERE ");
|
||||||
$query->append($img_search);
|
$query->append($img_search);
|
||||||
}
|
}
|
||||||
@ -802,7 +805,7 @@ class Image {
|
|||||||
",
|
",
|
||||||
$tag_search->variables);
|
$tag_search->variables);
|
||||||
|
|
||||||
if(strlen($img_search->sql) > 0) {
|
if(!empty($img_search->sql)) {
|
||||||
$query->append_sql(" AND ");
|
$query->append_sql(" AND ");
|
||||||
$query->append($img_search);
|
$query->append($img_search);
|
||||||
}
|
}
|
||||||
@ -841,7 +844,7 @@ class Image {
|
|||||||
SELECT *, UNIX_TIMESTAMP(posted) AS posted_timestamp
|
SELECT *, UNIX_TIMESTAMP(posted) AS posted_timestamp
|
||||||
FROM ('.$subquery->sql.') AS images ', $subquery->variables);
|
FROM ('.$subquery->sql.') AS images ', $subquery->variables);
|
||||||
|
|
||||||
if(strlen($img_search->sql) > 0) {
|
if(!empty($img_search->sql)) {
|
||||||
$query->append_sql(" WHERE ");
|
$query->append_sql(" WHERE ");
|
||||||
$query->append($img_search);
|
$query->append($img_search);
|
||||||
}
|
}
|
||||||
@ -895,7 +898,7 @@ class Tag {
|
|||||||
|
|
||||||
$tag_array = array();
|
$tag_array = array();
|
||||||
foreach($tags as $tag) {
|
foreach($tags as $tag) {
|
||||||
if(is_string($tag) && strlen($tag) > 0) {
|
if(is_string($tag) && !empty($tag)) {
|
||||||
$tag_array[] = $tag;
|
$tag_array[] = $tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user