HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/lcc.kaunokolegija.lt/wp-content/plugins/photo-gallery/frontend/models/BWGModelWidget.php
<?php
class BWGModelWidgetFrontEnd {
  public function get_tags_data($count = 0) {
    global $wpdb;
    $count = abs(intval($count));
    $query = 'SELECT
									`image`.`thumb_url` AS `thumb_url`,
									`image`.`id` AS `image_id`,
									`tags`.`name`,
									`tags`.`slug`,
									`tags`.`term_id`,
									`image`.`filetype`
								FROM ' . $wpdb->prefix . 'terms AS tags
								INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id
								INNER JOIN
								(SELECT `image`.`thumb_url`, `tag`.`tag_id`, `image`.`id`, `image`.`filetype` FROM ' . $wpdb->prefix . 'bwg_image AS image
								INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id';
    if ( $count ) {
      $query .= ' LIMIT %d';
      $query = $wpdb->prepare($query, $count);
    }
    $rows = $wpdb->get_results($query);
    foreach ( $rows as $row ) {
      $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'tag' ));
    }

    return $rows;
  }
}