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() { |
||
77 | |||
78 | function apply_query_args( $query_args ) { |
||
93 | |||
94 | function build_attachment( $attachment_post ) { |
||
98 | |||
99 | /** |
||
100 | * This forces the attachments to be fetched using the correct ordering. |
||
101 | * Some plugins / themes override this globally for some reason, so this is a preventative measure to ensure sorting is correct |
||
102 | * @param $query WP_Query |
||
103 | */ |
||
104 | public function force_gallery_ordering( $query ) { |
||
112 | |||
113 | /** |
||
114 | * Returns the featured FooGalleryAttachment from the datasource |
||
115 | * @return bool|FooGalleryAttachment |
||
116 | */ |
||
117 | public function getFeaturedAttachment() { |
||
126 | |||
127 | private function find_featured_attachment_id() { |
||
137 | } |
||
138 | } |
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.