From 16654bc4bf276fcacb230c5788becff9deecd531 Mon Sep 17 00:00:00 2001 From: Justin Sternberg Date: Sat, 30 May 2015 22:07:36 -0400 Subject: [PATCH] Cleanup plugin a bit --- cmb2-attached-posts-field.php | 45 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/cmb2-attached-posts-field.php b/cmb2-attached-posts-field.php index fb7596d..2e2aa4e 100644 --- a/cmb2-attached-posts-field.php +++ b/cmb2-attached-posts-field.php @@ -3,35 +3,36 @@ Plugin Name: CMB2 Field Type: Attached Posts Plugin URI: https://github.com/WebDevStudios/cmb2-attached-posts Description: Attached posts field type for CMB2. -Version: 1.0.0 -Author: Web Dev Studios +Version: 1.2.0 +Author: WebDevStudios Author URI: http://webdevstudios.com License: GPLv2+ */ /** - * Class WDS_CMB2_Field_Attached_Posts + * Class WDS_CMB2_Attached_Posts_Field */ -class WDS_CMB2_Field_Attached_Posts { - +class WDS_CMB2_Attached_Posts_Field { + /** * Current version number */ - const VERSION = '2.1.1'; + const VERSION = '1.2.0'; /** * Initialize the plugin by hooking into CMB2 */ public function __construct() { - add_action( 'cmb2_render_custom_attached_posts', array( $this, 'cmb2_attached_posts_fields_render' ), 10, 5 ); - add_action( 'cmb2_sanitize_custom_attached_posts', array( $this, 'cmb2_attached_posts_fields_sanitize' ), 10, 2 ); + add_action( 'cmb2_render_custom_attached_posts', array( $this, 'render' ), 10, 5 ); + add_action( 'cmb2_sanitize_custom_attached_posts', array( $this, 'sanitize' ), 10, 2 ); } /** * Add a CMB custom field to allow for the selection of multiple posts * attached to a single page */ - public function cmb2_attached_posts_fields_render( $field, $escaped_value, $object_id, $object_type, $field_type ) { + public function render( $field, $escaped_value, $object_id, $object_type, $field_type ) { + $this->setup_admin_scripts(); // Setup our args @@ -102,7 +103,7 @@ public function cmb2_attached_posts_fields_render( $field, $escaped_value, $obje echo '