1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<?php
namespace MatthiasWeb\RealMediaLibrary\folder;
use MatthiasWeb\RealMediaLibrary\attachment;
use MatthiasWeb\RealMediaLibrary\general;
use MatthiasWeb\RealMediaLibrary\order;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
class Gallery extends order\Sortable {
protected function singleCheckInsert($id) {
if (!wp_attachment_is_image($id)) {
throw new \Exception(__("You can only move images to a gallery.", RML_TD));
}
}
public static function create($rowData) {
$result = new Gallery($rowData->id);
$result->setParent($rowData->parent);
$result->setName($rowData->name, $rowData->supress_validation);
$result->setRestrictions($rowData->restrictions);
return $result;
}
public static function instance($rowData) {
return new Gallery($rowData->id, $rowData->parent, $rowData->name, $rowData->slug, $rowData->absolute,
$rowData->ord, $rowData->cnt_result, $rowData);
}
public function getAllowedChildrenTypes() {
return array();
}
public function getTypeName($default = null) {
return parent::getTypeName($default === null ? __('Gallery', RML_TD) : $default);
}
public function getTypeDescription($default = null) {
return parent::getTypeDescription($default === null ? __('A gallery can contain only images. If you want to display a gallery go to a post and have a look at the visual editor buttons.', RML_TD) : $default);
}
public function getType() {
return RML_TYPE_GALLERY;
}
}
?>