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() { |
||
31 | |||
32 | /** |
||
33 | * Returns the number of attachments used from the media library |
||
34 | * @return int |
||
35 | */ |
||
36 | public function getCount() { |
||
39 | |||
40 | /** |
||
41 | * Returns a serialized string that represents the media in the datasource. |
||
42 | * This string is persisted when saving a FooGallery |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getSerializedData() { |
||
53 | |||
54 | /** |
||
55 | * Returns an array of FooGalleryAttachments from the datasource |
||
56 | * @return array(FooGalleryAttachment) |
||
57 | */ |
||
58 | public function getAttachments() { |
||
82 | |||
83 | function build_attachment( $attachment_post ) { |
||
87 | |||
88 | /** |
||
89 | * This forces the attachments to be fetched using the correct ordering. |
||
90 | * Some plugins / themes override this globally for some reason, so this is a preventative measure to ensure sorting is correct |
||
91 | * @param $query WP_Query |
||
92 | */ |
||
93 | public function force_gallery_ordering( $query ) { |
||
101 | |||
102 | /** |
||
103 | * Returns the featured FooGalleryAttachment from the datasource |
||
104 | * @return bool|FooGalleryAttachment |
||
105 | */ |
||
106 | public function getFeaturedAttachment() { |
||
115 | |||
116 | private function find_featured_attachment_id() { |
||
126 | } |
||
127 | } |
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.