RTMediaModel::get_media PHP Method

get_media() public method

public get_media ( array $columns, mixed $offset = false, mixed $per_page = false, string $order_by = 'media_id desc', $count_flag = false ) : array
$columns array
$offset mixed
$per_page mixed
$order_by string
return array
    function get_media($columns, $offset = false, $per_page = false, $order_by = 'media_id desc', $count_flag = false)
    {
        if (is_multisite()) {
            $order_by = 'blog_id' . ($order_by ? ',' . $order_by : '');
        }
        $results = $this->get($columns, $offset, $per_page, $order_by, $count_flag);
        return $results;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Delete Media
  * @since 1.4
  * @version 1.0
  */
 public function delete_media($media_id)
 {
     // Get media details from id
     $model = new RTMediaModel();
     $media = $model->get_media(array('id' => $media_id), 0, 1);
     if (!isset($media->media_type)) {
         return;
     }
     // If this media type awards zero, bail
     if ($this->prefs['delete_media'][$media->media_type] == $this->core->zero()) {
         return;
     }
     // Check for exclusion
     if ($this->core->exclude_user($media->media_author) === true) {
         return;
     }
     // Only deduct if user gained points for this
     if ($this->core->has_entry($media->media_type . '_upload', $media->media_author, $media_id)) {
         // Execute
         $this->core->add_creds($media->media_type . '_deletion', $media->media_author, $this->prefs['delete_media'][$media->media_type], $this->prefs['delete_media'][$media->media_type . '_log'], $media_id, array('ref_type' => 'media', 'attachment_id' => $media->media_id), $this->mycred_type);
     }
 }
All Usage Examples Of RTMediaModel::get_media