1 | <?php |
||
7 | class FooGalleryDatasource_MediaLibrary implements IFooGalleryDatasource { |
||
|
|||
8 | |||
9 | /** |
||
10 | * @var FooGallery |
||
11 | */ |
||
12 | private $foogallery; |
||
13 | |||
14 | /** |
||
15 | * Sets the FooGallery object we are dealing with |
||
16 | * |
||
17 | * @param $foogallery FooGallery |
||
18 | */ |
||
19 | public function setGallery( $foogallery ) { |
||
22 | |||
23 | function __construct() { |
||
26 | |||
27 | /** |
||
28 | * Returns the number of attachments used from the media library |
||
29 | * @return int |
||
30 | */ |
||
31 | public function getCount() { |
||
34 | |||
35 | /** |
||
36 | * Returns a serialized string that represents the media in the datasource. |
||
37 | * This string is persisted when saving a FooGallery |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | public function getSerializedData() { |
||
48 | |||
49 | /** |
||
50 | * Returns an array of FooGalleryAttachments from the datasource |
||
51 | * @return array(FooGalleryAttachment) |
||
52 | */ |
||
53 | public function getAttachments() { |
||
86 | |||
87 | function apply_query_args( $query_args ) { |
||
102 | |||
103 | function build_attachment( $attachment_post ) { |
||
107 | |||
108 | /** |
||
109 | * This forces the attachments to be fetched using the correct ordering. |
||
110 | * Some plugins / themes override this globally for some reason, so this is a preventative measure to ensure sorting is correct |
||
111 | * @param $query WP_Query |
||
112 | */ |
||
113 | public function force_gallery_ordering( $query ) { |
||
121 | |||
122 | /** |
||
123 | * This forces the attachments to be fetched without any other filters. |
||
124 | * Some plugins override attachment queries, so this is a preventative measure to ensure sorting is correct |
||
125 | * @param $query WP_Query |
||
126 | */ |
||
127 | public function force_suppress_filters( $query ) { |
||
134 | |||
135 | /** |
||
136 | * Returns the featured FooGalleryAttachment from the datasource |
||
137 | * @return bool|FooGalleryAttachment |
||
138 | */ |
||
139 | public function getFeaturedAttachment() { |
||
148 | |||
149 | private function find_featured_attachment_id() { |
||
159 | } |
||
160 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.