admin
3 years ago
compatibility
3 years ago
extensions
3 years ago
foopluginbase
3 years ago
public
3 years ago
thumbs
3 years ago
class-attachment-filters.php
3 years ago
class-foogallery-animated-gif-support.php
3 years ago
class-foogallery-attachment-custom-class.php
3 years ago
class-foogallery-attachment.php
3 years ago
class-foogallery-cache.php
3 years ago
class-foogallery-common-fields.php
3 years ago
class-foogallery-crop-position.php
3 years ago
class-foogallery-datasource-media_library.php
3 years ago
class-foogallery-debug.php
3 years ago
class-foogallery-extensions-compatibility.php
3 years ago
class-foogallery-force-https.php
3 years ago
class-foogallery-lazyload.php
3 years ago
class-foogallery-paging.php
3 years ago
class-foogallery-sitemaps.php
3 years ago
class-foogallery-widget.php
3 years ago
class-foogallery.php
3 years ago
class-gallery-advanced-settings.php
3 years ago
class-il8n.php
3 years ago
class-override-thumbnail.php
3 years ago
class-posttypes.php
3 years ago
class-retina.php
3 years ago
class-thumbnail-dimensions.php
3 years ago
class-thumbnails.php
3 years ago
class-version-check.php
3 years ago
constants.php
3 years ago
functions.php
3 years ago
includes.php
3 years ago
index.php
3 years ago
render-functions.php
3 years ago
class-posttypes.php
110 lines
| 1 | <?php |
| 2 | /* |
| 3 | * FooGallery Custom Post Types and Custom Taxonomy Registration class |
| 4 | */ |
| 5 | |
| 6 | if ( ! class_exists( 'FooGallery_PostTypes' ) ) { |
| 7 | |
| 8 | class FooGallery_PostTypes { |
| 9 | |
| 10 | function __construct() { |
| 11 | //register the post types |
| 12 | add_action( 'init', array( $this, 'register' ) ); |
| 13 | |
| 14 | //update post type messages |
| 15 | add_filter( 'post_updated_messages', array( $this, 'update_messages' ) ); |
| 16 | |
| 17 | //update post bulk messages |
| 18 | add_filter( 'bulk_post_updated_messages', array( $this, 'update_bulk_messages' ), 10, 2 ); |
| 19 | } |
| 20 | |
| 21 | function register() { |
| 22 | //allow extensions to override the gallery post type |
| 23 | $args = apply_filters( 'foogallery_gallery_posttype_register_args', |
| 24 | array( |
| 25 | 'labels' => array( |
| 26 | 'name' => __( 'Galleries', 'foogallery' ), |
| 27 | 'singular_name' => __( 'Gallery', 'foogallery' ), |
| 28 | 'add_new' => __( 'Add Gallery', 'foogallery' ), |
| 29 | 'add_new_item' => __( 'Add New Gallery', 'foogallery' ), |
| 30 | 'edit_item' => __( 'Edit Gallery', 'foogallery' ), |
| 31 | 'new_item' => __( 'New Gallery', 'foogallery' ), |
| 32 | 'view_item' => __( 'View Gallery', 'foogallery' ), |
| 33 | 'search_items' => __( 'Search Galleries', 'foogallery' ), |
| 34 | 'not_found' => __( 'No Galleries found', 'foogallery' ), |
| 35 | 'not_found_in_trash' => __( 'No Galleries found in Trash', 'foogallery' ), |
| 36 | 'menu_name' => foogallery_plugin_name(), |
| 37 | 'all_items' => __( 'Galleries', 'foogallery' ) |
| 38 | ), |
| 39 | 'hierarchical' => false, |
| 40 | 'public' => false, |
| 41 | 'rewrite' => false, |
| 42 | 'show_ui' => true, |
| 43 | 'show_in_menu' => true, |
| 44 | 'menu_icon' => 'dashicons-format-gallery', |
| 45 | 'supports' => array( 'title', 'thumbnail', ), |
| 46 | ) |
| 47 | ); |
| 48 | |
| 49 | register_post_type( FOOGALLERY_CPT_GALLERY, $args ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Customize the update messages for a gallery |
| 54 | * |
| 55 | * @global object $post The current post object. |
| 56 | * |
| 57 | * @param array $messages Array of default post updated messages. |
| 58 | * |
| 59 | * @return array $messages Amended array of post updated messages. |
| 60 | */ |
| 61 | public function update_messages( $messages ) { |
| 62 | |
| 63 | global $post; |
| 64 | |
| 65 | // Add our gallery messages |
| 66 | $messages[FOOGALLERY_CPT_GALLERY] = apply_filters( 'foogallery_gallery_posttype_update_messages', |
| 67 | array( |
| 68 | 0 => '', |
| 69 | 1 => __( 'Gallery updated.', 'foogallery' ), |
| 70 | 2 => __( 'Gallery custom field updated.', 'foogallery' ), |
| 71 | 3 => __( 'Gallery custom field deleted.', 'foogallery' ), |
| 72 | 4 => __( 'Gallery updated.', 'foogallery' ), |
| 73 | 5 => isset($_GET['revision']) ? sprintf( __( 'Gallery restored to revision from %s.', 'foogallery' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
| 74 | 6 => __( 'Gallery published.', 'foogallery' ), |
| 75 | 7 => __( 'Gallery saved.', 'foogallery' ), |
| 76 | 8 => __( 'Gallery submitted.', 'foogallery' ), |
| 77 | 9 => sprintf( __( 'Gallery scheduled for: <strong>%1$s</strong>.', 'foogallery' ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ), |
| 78 | 10 => __( 'Gallery draft updated.', 'foogallery' ) |
| 79 | ) |
| 80 | ); |
| 81 | |
| 82 | return $messages; |
| 83 | |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Customize the bulk update messages for a gallery |
| 88 | * |
| 89 | * @param array $bulk_messages Array of default bulk updated messages. |
| 90 | * @param array $bulk_counts Array containing count of posts involved in the action. |
| 91 | * |
| 92 | * @return array mixed Amended array of bulk updated messages. |
| 93 | */ |
| 94 | function update_bulk_messages( $bulk_messages, $bulk_counts ) { |
| 95 | |
| 96 | $bulk_messages[FOOGALLERY_CPT_GALLERY] = apply_filters( 'foogallery_gallery_posttype_bulk_update_messages', |
| 97 | array( |
| 98 | 'updated' => _n( '%s Gallery updated.', '%s Galleries updated.', $bulk_counts['updated'], 'foogallery' ), |
| 99 | 'locked' => _n( '%s Gallery not updated, somebody is editing it.', '%s Galleries not updated, somebody is editing them.', $bulk_counts['locked'], 'foogallery' ), |
| 100 | 'deleted' => _n( '%s Gallery permanently deleted.', '%s Galleries permanently deleted.', $bulk_counts['deleted'], 'foogallery' ), |
| 101 | 'trashed' => _n( '%s Gallery moved to the Trash.', '%s Galleries moved to the Trash.', $bulk_counts['trashed'], 'foogallery' ), |
| 102 | 'untrashed' => _n( '%s Gallery restored from the Trash.', '%s Galleries restored from the Trash.', $bulk_counts['untrashed'], 'foogallery' ), |
| 103 | ) |
| 104 | ); |
| 105 | |
| 106 | return $bulk_messages; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 |