Skip to content
Browse files

Initial Commit

  • Loading branch information...
0 parents commit fe709e42af787d2f598fb07fbe816b183677720a @chrislema chrislema committed Oct 12, 2012
114 astridcta.css
@@ -0,0 +1,114 @@
+/**
+ * AstridCTA Styling
+ *
+ * PHP version 5
+ *
+ * @package AstridCTA
+ * @author Chris Lema (cflema@gmail.com) and Justin Kussow (jdkussow@gmail.com)
+ * @copyright Copyright (c)2011 ALL RIGHTS RESERVED
+ */
+
+root {
+ display: block;
+}
+
+.hndl > span {
+ width: 100%;
+ display: block;
+}
+
+.acta_action {
+ margin-top: 12px;
+}
+
+#acta_actions_0 {
+ margin-top: 0;
+}
+
+.acta_action_header {
+ display: block;
+ border-top-left-radius: 3px;
+ border-top-right-radius: 3px;
+ color: #464646;
+ padding: 3px 10px;
+ margin-bottom: 3px;
+ border: 1px solid #DFDFDF;
+ border-bottom-color: #DFDFDF;
+ box-shadow: 0 1px 0 #FFFFFF;
+ text-shadow: 0 1px 0 #FFFFFF;
+ background-color: #F1F1F1;
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
+}
+
+.acta_action_field {
+ display: table;
+ margin-top: 0;
+ width: 100%;
+}
+
+.acta_action_field label {
+ width: 100px;
+ display: table-cell;
+}
+
+.acta_action_field input[type=text].acta_action_text,
+.acta_action_field input[type=text].acta_action_reminder_days {
+ margin-top: 0;
+ display: table-cell;
+ width: 100%;
+}
+
+.acta_action_field input[type=text].acta_action_reminder_days {
+ width: 60px;
+}
+
+.acta_remove_action {
+ font-size: 11px;
+ font-weight: normal;
+ cursor: pointer;
+ float: right;
+}
+
+#acta_add_action {
+ display: block;
+ text-align: center;
+ margin-right: 20px;
+}
+
+#acta_actions_fe {
+ border: 1px solid #DFDFDF;
+ box-shadow: 0 1px 0 #FFFFFF;
+ text-shadow: 0 1px 0 #FFFFFF;
+ background-color: #F1F1F1;
+ border-radius: 3px;
+ -mozilla-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ padding: 10px 20px;
+}
+
+#acta_actions_fe h3 {
+ font-size: 14px;
+ font-weight: bold;
+}
+
+#acta_actions_fe ul {
+ margin: 0;
+ margin-left: 20px;
+}
+
+#acta_actions_fe ul li {
+ margin-top: 2px;
+}
+
+#acta_actions_fe ul li .acta_action_fe_header {
+ width: 75px;
+ font-weight: bold;
+ font-size: 12px;
+ font-family: sans-serif;
+ text-shadow: 0 1px 0 #FFFFFF;
+ display: table-cell;
+}
+
+#acta_actions_fe ul li .acta_action_fe_text {
+ display: table-cell;
+}
54 astridcta.js
@@ -0,0 +1,54 @@
+/**
+ * AstridCTA JS
+ *
+ * PHP version 5
+ *
+ * @package AstridCTA
+ * @author Chris Lema (cflema@gmail.com) and Justin Kussow (jdkussow@gmail.com)
+ * @copyright Copyright (c)2011 ALL RIGHTS RESERVED
+ */
+
+function addActaAction() {
+ var next = jQuery('.acta_action').length;
+
+ jQuery('.acta_remove_action').hide();
+
+ var html = '';
+ html += '<li id="acta_actions_' + next + '" class="acta_action">';
+ html += '<div class="acta_action_header">';
+ html += '<label for="acta_actions[' + next + ']">#' + (next + 1) + '</label>';
+
+ if (next > 0) {
+ html += '<a class="acta_remove_action" onclick="return removeActaAction(this);">Remove</a>';
+ }
+
+ html += '</div>';
+ html += '<div class="acta_action_field">';
+ html += '<label>Action</label>';
+ html += '<input type="text" class="acta_action_text" id="acta_actions[' + next + '][text]" name="acta_actions[' + next + '][text]" value="" />';
+ html += '</div>';
+ html += '<div class="acta_action_field">';
+ html += '<label>Reminder Days</label>';
+ html += '<input type="text" class="acta_action_reminder_days" id="acta_actions[' + next + '][reminder_days]" name="acta_actions[' + next + '][reminder_days]" value="" />';
+ html += '</div>';
+ html += '</li>';
+
+ jQuery('#acta_actions').append(html);
+
+ if (next >= 9) {
+ jQuery('#acta_add_action').closest('tr').hide();
+ }
+
+ jQuery('#acta_no_actions').hide();
+
+ return false;
+}
+
+function removeActaAction(e) {
+ jQuery(e).closest('li').remove();
+ jQuery('#acta_actions .acta_remove_action:last').show();
+ if (jQuery('.acta_action').length < 10) {
+ jQuery('#acta_add_action').closest('tr').show();
+ }
+ return false;
+}
183 astridcta.php
@@ -0,0 +1,183 @@
+<?php
+/*
+Plugin Name: AstridCTA
+Description: A WordPress plugin that lets bloggers create Astrid Calls to Action reminders at the bottom of each post.
+Version: 0.1
+Author: Chris Lema (cflema@gmail.com) with Justin Kussow (jdkussow@gmail.com) and using Custom Meta Box code from others.
+License: GPLv2
+*/
+
+/* Directories and URLs */
+define( 'ACTA_URL', plugin_dir_url(__FILE__) );
+define( 'ACTA_DIR', plugin_dir_path(__FILE__) );
+
+class AstridCTA {
+ static $instance = false;
+
+ function __construct() {
+ add_filter( 'cmb_meta_boxes', array( &$this, 'acta_meta_boxes' ) );
+ add_action( 'init', array( &$this, 'init_acta' ), 9999 );
+ add_action( 'wp_print_scripts', array( &$this, 'print_scripts' ) );
+
+ add_action( 'cmb_render_acta_actions', array( &$this, 'render_acta_actions' ), 10, 2 );
+ add_action( 'cmb_render_acta_button', array( &$this, 'render_acta_button' ), 10, 2 );
+
+ add_action( 'cmd_validate_acta_action', array( &$this, 'validate_acta_action' ), 10, 3 );
+
+ //add_action( 'wp_footer', array( &$this, 'acta_footer_actions' ), 100 );
+ add_action( 'the_content', array( &$this, 'acta_content_footer' ), 100 );
+ }
+
+ function acta_meta_boxes( $meta_boxes ) {
+ $prefix = 'acta_';
+
+ $acta_title = '';
+ $acta_title .= 'AstridCTA Options';
+
+ $meta_boxes[] = array(
+ 'id' => 'acta-options',
+ 'title' => $acta_title,
+ 'pages' => array('post'),
+ 'context' => 'normal',
+ 'priority' => 'low',
+ 'show_names' => true,
+ 'fields' => array(
+ array (
+ 'id' => $prefix . 'actions',
+ 'type' => 'acta_actions',
+ 'name' => 'Actions'
+ ),
+ array (
+ 'id' => $prefix . 'add_action',
+ 'type' => 'acta_button',
+ 'text' => 'Add New Action',
+ 'js_action' => 'return addActaAction();'
+ )
+ )
+ );
+
+ return $meta_boxes;
+ }
+
+ function init_acta() {
+ if ( !class_exists( 'cmb_Meta_Box' ) ) {
+ require_once( ACTA_DIR . '/metaboxes/init.php' );
+ }
+ }
+
+ function print_scripts() {
+ wp_register_script( 'astridcta', ACTA_URL . 'astridcta.js', array( 'jquery' ), '1.0' );
+ wp_enqueue_script( 'astridcta' );
+
+ wp_register_style( 'astridcta', ACTA_URL . 'astridcta.css' );
+ wp_enqueue_style( 'astridcta' );
+ }
+
+ function render_acta_actions( $field, $meta ) {
+ echo '<ul id="' . $field['id'] . '" name="' . $field['id'] . '">';
+ if ( $meta && is_array( $meta ) ) {
+ $i = 0;
+ foreach ( $meta as $val ) {
+ echo '
+<li id="acta_actions_' . $i . '" class="acta_action">
+ <div class="acta_action_header">
+ <label for="acta_actions[' . $i . ']">#' . ( $i + 1 ) . '</label>';
+
+ if ( $i > 0 ) {
+ $visible = 'display: none';
+ if ( ( $i + 1 ) >= count( $meta ) ) {
+ $visible = '';
+ }
+ echo '<a class="acta_remove_action" style="' . $visible . ';" onclick="return removeActaAction(this);">Remove</a>';
+ }
+
+ echo '
+ </div>
+ <div class="acta_action_field">
+ <label>Action</label>
+ <input type="text" class="acta_action_text" id="acta_actions[' . $i . '][text]" name="acta_actions[' . $i . '][text]" value="' . $val['text'] . '" />
+ </div>
+ <div class="acta_action_field">
+ <label>Reminder Days</label>
+ <input type="text" class="acta_action_reminder_days" id="acta_actions[' . $i . '][reminder_days]" name="acta_actions[' . $i . '][reminder_days]" value="' . $val['reminder_days'] . '" />
+ </div>
+</li>
+ ';
+ $i += 1;
+ }
+ } else {
+// echo '
+//<li id="acta_actions_0" class="acta_action">
+// <div class="acta_action_header"><label for="acta_actions[0]">#1</label></div>
+// <div class="acta_action_field">
+// <label>Action</label>
+// <input type="text" class="acta_action_text" id="acta_actions[0][text]" name="acta_actions[0][text]" value="" />
+// </div>
+// <div class="acta_action_field">
+// <label>Reminder Days</label>
+// <input type="text" class="acta_action_reminder_days" id="acta_actions[0][reminder_days]" name="acta_actions[0][reminder_days]" value="" />
+// </div>
+//</li>
+// ';
+ echo '<span id="acta_no_actions">Add your first action.</span>';
+ }
+ echo '</ul>';
+ }
+
+ function render_acta_button( $field, $meta ) {
+ echo '<a name="' . $field['id'] . '" id="' .
+ $field['id'] . '" class="button" onclick="' . $field['js_action'] . '">' . $field['text'] . '</a>';
+ echo $field['hidden_field'];
+ }
+
+ function validate_acta_action( $new, $post_id, $fields ) {
+ return $new;
+ }
+
+function acta_content_footer( $content ) {
+ global $post;
+
+ if ( is_singular() && is_main_query() ) {
+ $actions = get_post_meta( $post->ID, 'acta_actions', true );
+ if ( $actions && is_array( $actions ) && count( $actions ) > 0 ) {
+ $content .= '<div id="acta_actions_fe">';
+ $content .= '<h2>Want a Reminder?</h2>';
+ $content .= '<p>If you use <a href="//astrid.com">Astrid</a>, you can create reminders so that you remember to act on this post.</p>';
+ $content .= '<ul>';
+ $siteurl = get_site_url();
+ $step = 0;
+ foreach( $actions as $action ) {
+ $step += 1;
+ $content .= '<li id="acta_action_fe_' . $step . '" class="acta_action_fe">';
+ $content .= $action['text'];
+ $content .= '&nbsp;&nbsp;';
+ $content .= '<iframe allowtransparency="true" frameborder="0" scrolling="no"height="21px" width="116px" title="Astrid Remind Me"';
+ $content .= 'src="http://astrid.com/widgets/remind_me?title=';
+ $content .= urlencode($action['text']);
+ $content .= '&due_in_days=';
+ $content .= $action['reminder_days'];
+ $content .= '&source_name=ChrisLema';
+ $content .= '&source_url=';
+ $content .= $siteurl;
+ $content .= '&suggester_id=45&button_size=mini&button_style=astrid&button_title=Remind%20me"></iframe>';
+ $content .= '</li>';
+ }
+ $content .= '</ul>';
+ $content .= '</div>';
+ }
+ }
+
+ return $content;
+}
+
+ public static function get_instance() {
+ if ( !self::$instance ) {
+ self::$instance = new self;
+ }
+ return self::$instance;
+ }
+}
+
+AstridCTA::get_instance();
+
+?>
BIN images/white-grad-active.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/white-grad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
229 metaboxes/example-functions.php
@@ -0,0 +1,229 @@
+<?php
+/**
+ * Include and setup custom metaboxes and fields.
+ *
+ * @category YourThemeOrPlugin
+ * @package Metaboxes
+ * @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
+ * @link https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
+ */
+
+add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );
+/**
+ * Define the metabox and field configurations.
+ *
+ * @param array $meta_boxes
+ * @return array
+ */
+function cmb_sample_metaboxes( array $meta_boxes ) {
+
+ // Start with an underscore to hide fields from custom fields list
+ $prefix = '_cmb_';
+
+ $meta_boxes[] = array(
+ 'id' => 'test_metabox',
+ 'title' => 'Test Metabox',
+ 'pages' => array( 'page', ), // Post type
+ 'context' => 'normal',
+ 'priority' => 'high',
+ 'show_names' => true, // Show field names on the left
+ 'fields' => array(
+ array(
+ 'name' => 'Test Text',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_text',
+ 'type' => 'text',
+ ),
+ array(
+ 'name' => 'Test Text Small',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textsmall',
+ 'type' => 'text_small',
+ ),
+ array(
+ 'name' => 'Test Text Medium',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textmedium',
+ 'type' => 'text_medium',
+ ),
+ array(
+ 'name' => 'Test Date Picker',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textdate',
+ 'type' => 'text_date',
+ ),
+ array(
+ 'name' => 'Test Date Picker (UNIX timestamp)',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textdate_timestamp',
+ 'type' => 'text_date_timestamp',
+ ),
+ array(
+ 'name' => 'Test Date/Time Picker Combo (UNIX timestamp)',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_datetime_timestamp',
+ 'type' => 'text_datetime_timestamp',
+ ),
+ array(
+ 'name' => 'Test Time',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_time',
+ 'type' => 'text_time',
+ ),
+ array(
+ 'name' => 'Test Money',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textmoney',
+ 'type' => 'text_money',
+ ),
+ array(
+ 'name' => 'Test Color Picker',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_colorpicker',
+ 'type' => 'colorpicker',
+ 'std' => '#ffffff'
+ ),
+ array(
+ 'name' => 'Test Text Area',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textarea',
+ 'type' => 'textarea',
+ ),
+ array(
+ 'name' => 'Test Text Area Small',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textareasmall',
+ 'type' => 'textarea_small',
+ ),
+ array(
+ 'name' => 'Test Text Area Code',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_textarea_code',
+ 'type' => 'textarea_code',
+ ),
+ array(
+ 'name' => 'Test Title Weeeee',
+ 'desc' => 'This is a title description',
+ 'id' => $prefix . 'test_title',
+ 'type' => 'title',
+ ),
+ array(
+ 'name' => 'Test Select',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_select',
+ 'type' => 'select',
+ 'options' => array(
+ array( 'name' => 'Option One', 'value' => 'standard', ),
+ array( 'name' => 'Option Two', 'value' => 'custom', ),
+ array( 'name' => 'Option Three', 'value' => 'none', ),
+ ),
+ ),
+ array(
+ 'name' => 'Test Radio inline',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_radio_inline',
+ 'type' => 'radio_inline',
+ 'options' => array(
+ array( 'name' => 'Option One', 'value' => 'standard', ),
+ array( 'name' => 'Option Two', 'value' => 'custom', ),
+ array( 'name' => 'Option Three', 'value' => 'none', ),
+ ),
+ ),
+ array(
+ 'name' => 'Test Radio',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_radio',
+ 'type' => 'radio',
+ 'options' => array(
+ array( 'name' => 'Option One', 'value' => 'standard', ),
+ array( 'name' => 'Option Two', 'value' => 'custom', ),
+ array( 'name' => 'Option Three', 'value' => 'none', ),
+ ),
+ ),
+ array(
+ 'name' => 'Test Taxonomy Radio',
+ 'desc' => 'Description Goes Here',
+ 'id' => $prefix . 'text_taxonomy_radio',
+ 'type' => 'taxonomy_radio',
+ 'taxonomy' => '', // Taxonomy Slug
+ ),
+ array(
+ 'name' => 'Test Taxonomy Select',
+ 'desc' => 'Description Goes Here',
+ 'id' => $prefix . 'text_taxonomy_select',
+ 'type' => 'taxonomy_select',
+ 'taxonomy' => '', // Taxonomy Slug
+ ),
+ array(
+ 'name' => 'Test Taxonomy Multi Checkbox',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_multitaxonomy',
+ 'type' => 'taxonomy_multicheck',
+ 'taxonomy' => '', // Taxonomy Slug
+ ),
+ array(
+ 'name' => 'Test Checkbox',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_checkbox',
+ 'type' => 'checkbox',
+ ),
+ array(
+ 'name' => 'Test Multi Checkbox',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_multicheckbox',
+ 'type' => 'multicheck',
+ 'options' => array(
+ 'check1' => 'Check One',
+ 'check2' => 'Check Two',
+ 'check3' => 'Check Three',
+ ),
+ ),
+ array(
+ 'name' => 'Test wysiwyg',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_wysiwyg',
+ 'type' => 'wysiwyg',
+ 'options' => array( 'textarea_rows' => 5, ),
+ ),
+ array(
+ 'name' => 'Test Image',
+ 'desc' => 'Upload an image or enter an URL.',
+ 'id' => $prefix . 'test_image',
+ 'type' => 'file',
+ ),
+ ),
+ );
+
+ $meta_boxes[] = array(
+ 'id' => 'about_page_metabox',
+ 'title' => 'About Page Metabox',
+ 'pages' => array( 'page', ), // Post type
+ 'context' => 'normal',
+ 'priority' => 'high',
+ 'show_names' => true, // Show field names on the left
+ 'show_on' => array( 'key' => 'id', 'value' => array( 2, ), ), // Specific post IDs to display this metabox
+ 'fields' => array(
+ array(
+ 'name' => 'Test Text',
+ 'desc' => 'field description (optional)',
+ 'id' => $prefix . 'test_text',
+ 'type' => 'text',
+ ),
+ )
+ );
+
+ // Add other metaboxes as needed
+
+ return $meta_boxes;
+}
+
+add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );
+/**
+ * Initialize the metabox class.
+ */
+function cmb_initialize_cmb_meta_boxes() {
+
+ if ( ! class_exists( 'cmb_Meta_Box' ) )
+ require_once 'init.php';
+
+}
BIN metaboxes/images/ico-delete.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_flat_0_aaaaaa_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_flat_75_ffffff_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_glass_55_fbf9ee_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_glass_65_ffffff_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_glass_75_dadada_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_glass_75_e6e6e6_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_glass_95_fef1ec_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-bg_highlight-soft_75_cccccc_1x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-icons_222222_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-icons_2e83ff_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-icons_454545_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-icons_888888_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN metaboxes/images/ui-icons_cd0a0a_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
571 metaboxes/init.php
@@ -0,0 +1,571 @@
+<?php
+/*
+Script Name: Custom Metaboxes and Fields
+Contributors: Andrew Norcross (@norcross / andrewnorcross.com)
+ Jared Atchison (@jaredatch / jaredatchison.com)
+ Bill Erickson (@billerickson / billerickson.net)
+Description: This will create metaboxes with custom fields that will blow your mind.
+Version: 0.9
+*/
+
+/**
+ * Released under the GPL license
+ * http://www.opensource.org/licenses/gpl-license.php
+ *
+ * This is an add-on for WordPress
+ * http://wordpress.org/
+ *
+ * **********************************************************************
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * **********************************************************************
+ */
+
+/************************************************************************
+ You should not edit the code below or things might explode!
+*************************************************************************/
+
+$meta_boxes = array();
+$meta_boxes = apply_filters ( 'cmb_meta_boxes' , $meta_boxes );
+foreach ( $meta_boxes as $meta_box ) {
+ $my_box = new cmb_Meta_Box( $meta_box );
+}
+
+/**
+ * Validate value of meta fields
+ * Define ALL validation methods inside this class and use the names of these
+ * methods in the definition of meta boxes (key 'validate_func' of each field)
+ */
+class cmb_Meta_Box_Validate {
+ function check_text( $text ) {
+ if ($text != 'hello') {
+ return false;
+ }
+ return true;
+ }
+}
+
+/**
+ * Defines the url to which is used to load local resources.
+ * This may need to be filtered for local Window installations.
+ * If resources do not load, please check the wiki for details.
+ */
+define( 'CMB_META_BOX_URL', apply_filters( 'cmb_meta_box_url', trailingslashit( str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) ) ) ) );
+
+/**
+ * Create meta boxes
+ */
+class cmb_Meta_Box {
+ protected $_meta_box;
+
+ function __construct( $meta_box ) {
+ if ( !is_admin() ) return;
+
+ $this->_meta_box = $meta_box;
+
+ $upload = false;
+ foreach ( $meta_box['fields'] as $field ) {
+ if ( $field['type'] == 'file' || $field['type'] == 'file_list' ) {
+ $upload = true;
+ break;
+ }
+ }
+
+ global $pagenow;
+ if ( $upload && in_array( $pagenow, array( 'page.php', 'page-new.php', 'post.php', 'post-new.php' ) ) ) {
+ add_action( 'admin_head', array( &$this, 'add_post_enctype' ) );
+ }
+
+ add_action( 'admin_menu', array( &$this, 'add' ) );
+ add_action( 'save_post', array( &$this, 'save' ) );
+
+ add_filter( 'cmb_show_on', array( &$this, 'add_for_id' ), 10, 2 );
+ add_filter( 'cmb_show_on', array( &$this, 'add_for_page_template' ), 10, 2 );
+ }
+
+ function add_post_enctype() {
+ echo '
+ <script type="text/javascript">
+ jQuery(document).ready(function(){
+ jQuery("#post").attr("enctype", "multipart/form-data");
+ jQuery("#post").attr("encoding", "multipart/form-data");
+ });
+ </script>';
+ }
+
+ // Add metaboxes
+ function add() {
+ $this->_meta_box['context'] = empty($this->_meta_box['context']) ? 'normal' : $this->_meta_box['context'];
+ $this->_meta_box['priority'] = empty($this->_meta_box['priority']) ? 'high' : $this->_meta_box['priority'];
+ $this->_meta_box['show_on'] = empty( $this->_meta_box['show_on'] ) ? array('key' => false, 'value' => false) : $this->_meta_box['show_on'];
+
+ foreach ( $this->_meta_box['pages'] as $page ) {
+ if( apply_filters( 'cmb_show_on', true, $this->_meta_box ) )
+ add_meta_box( $this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']) ;
+ }
+ }
+
+ /**
+ * Show On Filters
+ * Use the 'cmb_show_on' filter to further refine the conditions under which a metabox is displayed.
+ * Below you can limit it by ID and page template
+ */
+
+ // Add for ID
+ function add_for_id( $display, $meta_box ) {
+ if ( 'id' !== $meta_box['show_on']['key'] )
+ return $display;
+
+ // If we're showing it based on ID, get the current ID
+ if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
+ elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
+ if( !isset( $post_id ) )
+ return false;
+
+ // If value isn't an array, turn it into one
+ $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
+
+ // If current page id is in the included array, display the metabox
+
+ if ( in_array( $post_id, $meta_box['show_on']['value'] ) )
+ return true;
+ else
+ return false;
+ }
+
+ // Add for Page Template
+ function add_for_page_template( $display, $meta_box ) {
+ if( 'page-template' !== $meta_box['show_on']['key'] )
+ return $display;
+
+ // Get the current ID
+ if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
+ elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
+ if( !( isset( $post_id ) || is_page() ) ) return false;
+
+ // Get current template
+ $current_template = get_post_meta( $post_id, '_wp_page_template', true );
+
+ // If value isn't an array, turn it into one
+ $meta_box['show_on']['value'] = !is_array( $meta_box['show_on']['value'] ) ? array( $meta_box['show_on']['value'] ) : $meta_box['show_on']['value'];
+
+ // See if there's a match
+ if( in_array( $current_template, $meta_box['show_on']['value'] ) )
+ return true;
+ else
+ return false;
+ }
+
+ // Show fields
+ function show() {
+
+ global $post;
+
+ // Use nonce for verification
+ echo '<input type="hidden" name="wp_meta_box_nonce" value="', wp_create_nonce( basename(__FILE__) ), '" />';
+ echo '<table class="form-table cmb_metabox">';
+
+ foreach ( $this->_meta_box['fields'] as $field ) {
+ // Set up blank or default values for empty ones
+ if ( !isset( $field['name'] ) ) $field['name'] = '';
+ if ( !isset( $field['desc'] ) ) $field['desc'] = '';
+ if ( !isset( $field['std'] ) ) $field['std'] = '';
+ if ( 'file' == $field['type'] && !isset( $field['allow'] ) ) $field['allow'] = array( 'url', 'attachment' );
+ if ( 'file' == $field['type'] && !isset( $field['save_id'] ) ) $field['save_id'] = false;
+ if ( 'multicheck' == $field['type'] ) $field['multiple'] = true;
+
+ $meta = get_post_meta( $post->ID, $field['id'], 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ );
+
+ echo '<tr>';
+
+ if ( $field['type'] == "title" ) {
+ echo '<td colspan="2">';
+ } else {
+ if( $this->_meta_box['show_names'] == true ) {
+ echo '<th style="width:18%"><label for="', $field['id'], '">', $field['name'], '</label></th>';
+ }
+ echo '<td>';
+ }
+
+ switch ( $field['type'] ) {
+
+ case 'text':
+ echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" />','<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'text_small':
+ echo '<input class="cmb_text_small" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'text_medium':
+ echo '<input class="cmb_text_medium" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'text_date':
+ echo '<input class="cmb_text_small cmb_datepicker" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'text_date_timestamp':
+ echo '<input class="cmb_text_small cmb_datepicker" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+
+ case 'text_datetime_timestamp':
+ echo '<input class="cmb_text_small cmb_datepicker" type="text" name="', $field['id'], '[date]" id="', $field['id'], '_date" value="', '' !== $meta ? date( 'm\/d\/Y', $meta ) : $field['std'], '" />';
+ echo '<input class="cmb_timepicker text_time" type="text" name="', $field['id'], '[time]" id="', $field['id'], '_time" value="', '' !== $meta ? date( 'h:i A', $meta ) : $field['std'], '" /><span class="cmb_metabox_description" >', $field['desc'], '</span>';
+ break;
+ case 'text_time':
+ echo '<input class="cmb_timepicker text_time" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'text_money':
+ echo '$ <input class="cmb_text_money" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', '' !== $meta ? $meta : $field['std'], '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'colorpicker':
+ $meta = '' !== $meta ? $meta : $field['std'];
+ $hex_color = '(([a-fA-F0-9]){3}){1,2}$';
+ if ( preg_match( '/^' . $hex_color . '/i', $meta ) ) // Value is just 123abc, so prepend #.
+ $meta = '#' . $meta;
+ elseif ( ! preg_match( '/^#' . $hex_color . '/i', $meta ) ) // Value doesn't match #123abc, so sanitize to just #.
+ $meta = "#";
+ echo '<input class="cmb_colorpicker cmb_text_small" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta, '" /><span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'textarea':
+ echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'textarea_small':
+ echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'textarea_code':
+ echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10" class="cmb_textarea_code">', '' !== $meta ? $meta : $field['std'], '</textarea>','<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'select':
+ if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
+ echo '<select name="', $field['id'], '" id="', $field['id'], '">';
+ foreach ($field['options'] as $option) {
+ echo '<option value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>';
+ }
+ echo '</select>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'radio_inline':
+ if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
+ echo '<div class="cmb_radio_inline">';
+ $i = 1;
+ foreach ($field['options'] as $option) {
+ echo '<div class="cmb_radio_inline_option"><input type="radio" name="', $field['id'], '" id="', $field['id'], $i, '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label for="', $field['id'], $i, '">', $option['name'], '</label></div>';
+ $i++;
+ }
+ echo '</div>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'radio':
+ if( empty( $meta ) && !empty( $field['std'] ) ) $meta = $field['std'];
+ echo '<ul>';
+ $i = 1;
+ foreach ($field['options'] as $option) {
+ echo '<li><input type="radio" name="', $field['id'], '" id="', $field['id'], $i,'" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' /><label for="', $field['id'], $i, '">', $option['name'].'</label></li>';
+ $i++;
+ }
+ echo '</ul>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'checkbox':
+ echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
+ echo '<span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'multicheck':
+ echo '<ul>';
+ $i = 1;
+ foreach ( $field['options'] as $value => $name ) {
+ // Append `[]` to the name to get multiple values
+ // Use in_array() to check whether the current option should be checked
+ echo '<li><input type="checkbox" name="', $field['id'], '[]" id="', $field['id'], $i, '" value="', $value, '"', in_array( $value, $meta ) ? ' checked="checked"' : '', ' /><label for="', $field['id'], $i, '">', $name, '</label></li>';
+ $i++;
+ }
+ echo '</ul>';
+ echo '<span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'title':
+ echo '<h5 class="cmb_metabox_title">', $field['name'], '</h5>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'wysiwyg':
+ wp_editor( $meta ? $meta : $field['std'], $field['id'], isset( $field['options'] ) ? $field['options'] : array() );
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'taxonomy_select':
+ echo '<select name="', $field['id'], '" id="', $field['id'], '">';
+ $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
+ $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
+ foreach ( $terms as $term ) {
+ if (!is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
+ echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
+ } else {
+ echo '<option value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name . '</option>';
+ }
+ }
+ echo '</select>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'taxonomy_radio':
+ $names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
+ $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
+ echo '<ul>';
+ foreach ( $terms as $term ) {
+ if ( !is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
+ echo '<li><input type="radio" name="', $field['id'], '" value="'. $term->slug . '" checked>' . $term->name . '</li>';
+ } else {
+ echo '<li><input type="radio" name="', $field['id'], '" value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name .'</li>';
+ }
+ }
+ echo '</ul>';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ break;
+ case 'taxonomy_multicheck':
+ echo '<ul>';
+ $names = wp_get_object_terms( $post->ID, $field['taxonomy'] );
+ $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
+ foreach ($terms as $term) {
+ echo '<li><input type="checkbox" name="', $field['id'], '[]" id="', $field['id'], '" value="', $term->name , '"';
+ foreach ($names as $name) {
+ if ( $term->slug == $name->slug ){ echo ' checked="checked" ';};
+ }
+ echo' /><label>', $term->name , '</label></li>';
+ }
+ echo '</ul>';
+ echo '<span class="cmb_metabox_description">', $field['desc'], '</span>';
+ break;
+ case 'file_list':
+ echo '<input class="cmb_upload_file" type="text" size="36" name="', $field['id'], '" value="" />';
+ echo '<input class="cmb_upload_button button" type="button" value="Upload File" />';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ $args = array(
+ 'post_type' => 'attachment',
+ 'numberposts' => null,
+ 'post_status' => null,
+ 'post_parent' => $post->ID
+ );
+ $attachments = get_posts($args);
+ if ($attachments) {
+ echo '<ul class="attach_list">';
+ foreach ($attachments as $attachment) {
+ echo '<li>'.wp_get_attachment_link($attachment->ID, 'thumbnail', 0, 0, 'Download');
+ echo '<span>';
+ echo apply_filters('the_title', '&nbsp;'.$attachment->post_title);
+ echo '</span></li>';
+ }
+ echo '</ul>';
+ }
+ break;
+ case 'file':
+ $input_type_url = "hidden";
+ if ( 'url' == $field['allow'] || ( is_array( $field['allow'] ) && in_array( 'url', $field['allow'] ) ) )
+ $input_type_url="text";
+ echo '<input class="cmb_upload_file" type="' . $input_type_url . '" size="45" id="', $field['id'], '" name="', $field['id'], '" value="', $meta, '" />';
+ echo '<input class="cmb_upload_button button" type="button" value="Upload File" />';
+ echo '<input class="cmb_upload_file_id" type="hidden" id="', $field['id'], '_id" name="', $field['id'], '_id" value="', get_post_meta( $post->ID, $field['id'] . "_id",true), '" />';
+ echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ echo '<div id="', $field['id'], '_status" class="cmb_upload_status">';
+ if ( $meta != '' ) {
+ $check_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $meta );
+ if ( $check_image ) {
+ echo '<div class="img_status">';
+ echo '<img src="', $meta, '" alt="" />';
+ echo '<a href="#" class="cmb_remove_file_button" rel="', $field['id'], '">Remove Image</a>';
+ echo '</div>';
+ } else {
+ $parts = explode( '/', $meta );
+ for( $i = 0; $i < count( $parts ); ++$i ) {
+ $title = $parts[$i];
+ }
+ echo 'File: <strong>', $title, '</strong>&nbsp;&nbsp;&nbsp; (<a href="', $meta, '" target="_blank" rel="external">Download</a> / <a href="#" class="cmb_remove_file_button" rel="', $field['id'], '">Remove</a>)';
+ }
+ }
+ echo '</div>';
+ break;
+ default:
+ do_action('cmb_render_' . $field['type'] , $field, $meta);
+ }
+
+ echo '</td>','</tr>';
+ }
+ echo '</table>';
+ }
+
+ // Save data from metabox
+ function save( $post_id) {
+
+ // verify nonce
+ if ( ! isset( $_POST['wp_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename(__FILE__) ) ) {
+ return $post_id;
+ }
+
+ // check autosave
+ if ( defined('DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
+ return $post_id;
+ }
+
+ // check permissions
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can( 'edit_page', $post_id ) ) {
+ return $post_id;
+ }
+ } elseif ( !current_user_can( 'edit_post', $post_id ) ) {
+ return $post_id;
+ }
+
+ foreach ( $this->_meta_box['fields'] as $field ) {
+ $name = $field['id'];
+
+ if ( ! isset( $field['multiple'] ) )
+ $field['multiple'] = ( 'multicheck' == $field['type'] ) ? true : false;
+
+ $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
+ $new = isset( $_POST[$field['id']] ) ? $_POST[$field['id']] : null;
+
+ if ( in_array( $field['type'], array( 'taxonomy_select', 'taxonomy_radio', 'taxonomy_multicheck' ) ) ) {
+ $new = wp_set_object_terms( $post_id, $new, $field['taxonomy'] );
+ }
+
+ if ( ($field['type'] == 'textarea') || ($field['type'] == 'textarea_small') ) {
+ $new = htmlspecialchars( $new );
+ }
+
+ if ( ($field['type'] == 'textarea_code') ) {
+ $new = htmlspecialchars_decode( $new );
+ }
+
+ if ( $field['type'] == 'text_date_timestamp' ) {
+ $new = strtotime( $new );
+ }
+
+ if ( $field['type'] == 'text_datetime_timestamp' ) {
+ $string = $new['date'] . ' ' . $new['time'];
+ $new = strtotime( $string );
+ }
+
+ $new = apply_filters('cmb_validate_' . $field['type'], $new, $post_id, $field);
+
+ // validate meta value
+ if ( isset( $field['validate_func']) ) {
+ $ok = call_user_func( array( 'cmb_Meta_Box_Validate', $field['validate_func']), $new );
+ if ( $ok === false ) { // pass away when meta value is invalid
+ continue;
+ }
+ } elseif ( $field['multiple'] ) {
+ delete_post_meta( $post_id, $name );
+ if ( !empty( $new ) ) {
+ foreach ( $new as $add_new ) {
+ add_post_meta( $post_id, $name, $add_new, false );
+ }
+ }
+ } elseif ( '' !== $new && $new != $old ) {
+ update_post_meta( $post_id, $name, $new );
+ } elseif ( '' == $new ) {
+ delete_post_meta( $post_id, $name );
+ }
+
+ if ( 'file' == $field['type'] ) {
+ $name = $field['id'] . "_id";
+ $old = get_post_meta( $post_id, $name, !$field['multiple'] /* If multicheck this can be multiple values */ );
+ if ( isset( $field['save_id'] ) && $field['save_id'] ) {
+ $new = isset( $_POST[$name] ) ? $_POST[$name] : null;
+ } else {
+ $new = "";
+ }
+
+ if ( $new && $new != $old ) {
+ update_post_meta( $post_id, $name, $new );
+ } elseif ( '' == $new && $old ) {
+ delete_post_meta( $post_id, $name, $old );
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Adding scripts and styles
+ */
+function cmb_scripts( $hook ) {
+ if ( $hook == 'post.php' || $hook == 'post-new.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
+ wp_register_script( 'cmb-timepicker', CMB_META_BOX_URL . 'js/jquery.timePicker.min.js' );
+ wp_register_script( 'cmb-scripts', CMB_META_BOX_URL . 'js/cmb.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'media-upload', 'thickbox', 'farbtastic' ) );
+ wp_enqueue_script( 'cmb-timepicker' );
+ wp_enqueue_script( 'cmb-scripts' );
+ wp_register_style( 'cmb-styles', CMB_META_BOX_URL . 'style.css', array( 'thickbox', 'farbtastic' ) );
+ wp_enqueue_style( 'cmb-styles' );
+ }
+}
+add_action( 'admin_enqueue_scripts', 'cmb_scripts', 10 );
+
+function cmb_editor_footer_scripts() { ?>
+ <?php
+ if ( isset( $_GET['cmb_force_send'] ) && 'true' == $_GET['cmb_force_send'] ) {
+ $label = $_GET['cmb_send_label'];
+ if ( empty( $label ) ) $label="Select File";
+ ?>
+ <script type="text/javascript">
+ jQuery(function($) {
+ $('td.savesend input').val('<?php echo $label; ?>');
+ });
+ </script>
+ <?php
+ }
+}
+add_action( 'admin_print_footer_scripts', 'cmb_editor_footer_scripts', 99 );
+
+// Force 'Insert into Post' button from Media Library
+add_filter( 'get_media_item_args', 'cmb_force_send' );
+function cmb_force_send( $args ) {
+
+ // if the Gallery tab is opened from a custom meta box field, add Insert Into Post button
+ if ( isset( $_GET['cmb_force_send'] ) && 'true' == $_GET['cmb_force_send'] )
+ $args['send'] = true;
+
+ // if the From Computer tab is opened AT ALL, add Insert Into Post button after an image is uploaded
+ if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
+
+ $args['send'] = true;
+
+ // TO DO: Are there any conditions in which we don't want the Insert Into Post
+ // button added? For example, if a post type supports thumbnails, does not support
+ // the editor, and does not have any cmb file inputs? If so, here's the first
+ // bits of code needed to check all that.
+ // $attachment_ancestors = get_post_ancestors( $_POST["attachment_id"] );
+ // $attachment_parent_post_type = get_post_type( $attachment_ancestors[0] );
+ // $post_type_object = get_post_type_object( $attachment_parent_post_type );
+ }
+
+ // change the label of the button on the From Computer tab
+ if ( isset( $_POST['attachment_id'] ) && '' != $_POST["attachment_id"] ) {
+
+ echo '
+ <script type="text/javascript">
+ function cmbGetParameterByNameInline(name) {
+ name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
+ var regexS = "[\\?&]" + name + "=([^&#]*)";
+ var regex = new RegExp(regexS);
+ var results = regex.exec(window.location.href);
+ if(results == null)
+ return "";
+ else
+ return decodeURIComponent(results[1].replace(/\+/g, " "));
+ }
+
+ jQuery(function($) {
+ if (cmbGetParameterByNameInline("cmb_force_send")=="true") {
+ var cmb_send_label = cmbGetParameterByNameInline("cmb_send_label");
+ $("td.savesend input").val(cmb_send_label);
+ }
+ });
+ </script>
+ ';
+ }
+
+ return $args;
+
+}
+// End. That's it, folks! //
128 metaboxes/js/cmb.js
@@ -0,0 +1,128 @@
+/**
+ * Controls the behaviours of custom metabox fields.
+ *
+ * @author Andrew Norcross
+ * @author Jared Atchison
+ * @author Bill Erickson
+ * @see https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
+ */
+
+/*jslint browser: true, devel: true, indent: 4, maxerr: 50, sub: true */
+/*global jQuery, tb_show, tb_remove */
+
+/**
+ * Custom jQuery for Custom Metaboxes and Fields
+ */
+jQuery(document).ready(function ($) {
+ 'use strict';
+
+ var formfield;
+
+ /**
+ * Initialize timepicker (this will be moved inline in a future release)
+ */
+ $('.cmb_timepicker').each(function () {
+ $('#' + jQuery(this).attr('id')).timePicker({
+ startTime: "07:00",
+ endTime: "22:00",
+ show24Hours: false,
+ separator: ':',
+ step: 30
+ });
+ });
+
+ /**
+ * Initialize jQuery UI datepicker (this will be moved inline in a future release)
+ */
+ $('.cmb_datepicker').each(function () {
+ $('#' + jQuery(this).attr('id')).datepicker();
+ // $('#' + jQuery(this).attr('id')).datepicker({ dateFormat: 'yy-mm-dd' });
+ // For more options see http://jqueryui.com/demos/datepicker/#option-dateFormat
+ });
+ // Wrap date picker in class to narrow the scope of jQuery UI CSS and prevent conflicts
+ $("#ui-datepicker-div").wrap('<div class="cmb_element" />');
+
+ /**
+ * Initialize color picker
+ */
+ $('input:text.cmb_colorpicker').each(function (i) {
+ $(this).after('<div id="picker-' + i + '" style="z-index: 1000; background: #EEE; border: 1px solid #CCC; position: absolute; display: block;"></div>');
+ $('#picker-' + i).hide().farbtastic($(this));
+ })
+ .focus(function() {
+ $(this).next().show();
+ })
+ .blur(function() {
+ $(this).next().hide();
+ });
+
+ /**
+ * File and image upload handling
+ */
+ $('.cmb_upload_file').change(function () {
+ formfield = $(this).attr('name');
+ $('#' + formfield + '_id').val("");
+ });
+
+ $('.cmb_upload_button').live('click', function () {
+ var buttonLabel;
+ formfield = $(this).prev('input').attr('name');
+ buttonLabel = 'Use as ' + $('label[for=' + formfield + ']').text();
+ tb_show('', 'media-upload.php?post_id=' + $('#post_ID').val() + '&type=file&cmb_force_send=true&cmb_send_label=' + buttonLabel + '&TB_iframe=true');
+ return false;
+ });
+
+ $('.cmb_remove_file_button').live('click', function () {
+ formfield = $(this).attr('rel');
+ $('input#' + formfield).val('');
+ $('input#' + formfield + '_id').val('');
+ $(this).parent().remove();
+ return false;
+ });
+
+ window.original_send_to_editor = window.send_to_editor;
+ window.send_to_editor = function (html) {
+ var itemurl, itemclass, itemClassBits, itemid, htmlBits, itemtitle,
+ image, uploadStatus = true;
+
+ if (formfield) {
+
+ if ($(html).html(html).find('img').length > 0) {
+ itemurl = $(html).html(html).find('img').attr('src'); // Use the URL to the size selected.
+ itemclass = $(html).html(html).find('img').attr('class'); // Extract the ID from the returned class name.
+ itemClassBits = itemclass.split(" ");
+ itemid = itemClassBits[itemClassBits.length - 1];
+ itemid = itemid.replace('wp-image-', '');
+ } else {
+ // It's not an image. Get the URL to the file instead.
+ htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method.
+ itemurl = htmlBits[1]; // Use the URL to the file.
+ itemtitle = htmlBits[2];
+ itemtitle = itemtitle.replace('>', '');
+ itemtitle = itemtitle.replace('</a>', '');
+ itemid = ""; // TO DO: Get ID for non-image attachments.
+ }
+
+ image = /(jpe?g|png|gif|ico)$/gi;
+
+ if (itemurl.match(image)) {
+ uploadStatus = '<div class="img_status"><img src="' + itemurl + '" alt="" /><a href="#" class="cmb_remove_file_button" rel="' + formfield + '">Remove Image</a></div>';
+ } else {
+ // No output preview if it's not an image
+ // Standard generic output if it's not an image.
+ html = '<a href="' + itemurl + '" target="_blank" rel="external">View File</a>';
+ uploadStatus = '<div class="no_image"><span class="file_link">' + html + '</span>&nbsp;&nbsp;&nbsp;<a href="#" class="cmb_remove_file_button" rel="' + formfield + '">Remove</a></div>';
+ }
+
+ $('#' + formfield).val(itemurl);
+ $('#' + formfield + '_id').val(itemid);
+ $('#' + formfield).siblings('.cmb_upload_status').slideDown().html(uploadStatus);
+ tb_remove();
+
+ } else {
+ window.original_send_to_editor(html);
+ }
+
+ formfield = '';
+ };
+});
13 metaboxes/js/jquery.timePicker.min.js
@@ -0,0 +1,13 @@
+/**
+ * A time picker for jQuery.
+ *
+ * Dual licensed under the MIT and GPL licenses.
+ * Copyright (c) 2009 Anders Fajerson
+ *
+ * @name timePicker
+ * @author Anders Fajerson (http://perifer.se)
+ * @see http://github.com/perifer/timePicker
+ * @example $("#mytime").timePicker();
+ * @example $("#mytime").timePicker({step:30, startTime:"15:00", endTime:"18:00"});
+ */
+(function(a){function g(a){a.setFullYear(2001),a.setMonth(0),a.setDate(0);return a}function f(a,b){if(a){var c=a.split(b.separator),d=parseFloat(c[0]),e=parseFloat(c[1]);b.show24Hours||(d===12&&a.indexOf("AM")!==-1?d=0:d!==12&&a.indexOf("PM")!==-1&&(d+=12));var f=new Date(0,0,0,d,e,0);return g(f)}return null}function e(a,b){return typeof a=="object"?g(a):f(a,b)}function d(a){return(a<10?"0":"")+a}function c(a,b){var c=a.getHours(),e=b.show24Hours?c:(c+11)%12+1,f=a.getMinutes();return d(e)+b.separator+d(f)+(b.show24Hours?"":c<12?" AM":" PM")}function b(b,c,d,e){b.value=a(c).text(),a(b).change(),a.browser.msie||b.focus(),d.hide()}a.fn.timePicker=function(b){var c=a.extend({},a.fn.timePicker.defaults,b);return this.each(function(){a.timePicker(this,c)})},a.timePicker=function(b,c){var d=a(b)[0];return d.timePicker||(d.timePicker=new jQuery._timePicker(d,c))},a.timePicker.version="0.3",a._timePicker=function(d,h){var i=!1,j=!1,k=e(h.startTime,h),l=e(h.endTime,h),m="selected",n="li."+m;a(d).attr("autocomplete","OFF");var o=[],p=new Date(k);while(p<=l)o[o.length]=c(p,h),p=new Date(p.setMinutes(p.getMinutes()+h.step));var q=a('<div class="time-picker'+(h.show24Hours?"":" time-picker-12hours")+'"></div>'),r=a("<ul></ul>");for(var s=0;s<o.length;s++)r.append("<li>"+o[s]+"</li>");q.append(r),q.appendTo("body").hide(),q.mouseover(function(){i=!0}).mouseout(function(){i=!1}),a("li",r).mouseover(function(){j||(a(n,q).removeClass(m),a(this).addClass(m))}).mousedown(function(){i=!0}).click(function(){b(d,this,q,h),i=!1});var t=function(){if(q.is(":visible"))return!1;a("li",q).removeClass(m);var b=a(d).offset();q.css({top:b.top+d.offsetHeight,left:b.left}),q.show();var e=d.value?f(d.value,h):k,i=k.getHours()*60+k.getMinutes(),j=e.getHours()*60+e.getMinutes()-i,n=Math.round(j/h.step),o=g(new Date(0,0,0,0,n*h.step+i,0));o=k<o&&o<=l?o:k;var p=a("li:contains("+c(o,h)+")",q);p.length&&(p.addClass(m),q[0].scrollTop=p[0].offsetTop);return!0};a(d).focus(t).click(t),a(d).blur(function(){i||q.hide()});var u=a.browser.opera||a.browser.mozilla?"keypress":"keydown";a(d)[u](function(c){var e;j=!0;var f=q[0].scrollTop;switch(c.keyCode){case 38:if(t())return!1;e=a(n,r);var g=e.prev().addClass(m)[0];g?(e.removeClass(m),g.offsetTop<f&&(q[0].scrollTop=f-g.offsetHeight)):(e.removeClass(m),g=a("li:last",r).addClass(m)[0],q[0].scrollTop=g.offsetTop-g.offsetHeight);return!1;case 40:if(t())return!1;e=a(n,r);var i=e.next().addClass(m)[0];i?(e.removeClass(m),i.offsetTop+i.offsetHeight>f+q[0].offsetHeight&&(q[0].scrollTop=f+i.offsetHeight)):(e.removeClass(m),i=a("li:first",r).addClass(m)[0],q[0].scrollTop=0);return!1;case 13:if(q.is(":visible")){var k=a(n,r)[0];b(d,k,q,h)}return!1;case 27:q.hide();return!1}return!0}),a(d).keyup(function(a){j=!1}),this.getTime=function(){return f(d.value,h)},this.setTime=function(b){d.value=c(e(b,h),h),a(d).change()}},a.fn.timePicker.defaults={step:30,startTime:new Date(0,0,0,0,0,0),endTime:new Date(0,0,0,23,30,0),separator:":",show24Hours:!0}})(jQuery)
329 metaboxes/style.css
@@ -0,0 +1,329 @@
+/**
+ * CMB Styling
+ */
+table.cmb_metabox td, table.cmb_metabox th { border-bottom: 1px solid #E9E9E9; }
+table.cmb_metabox th { text-align: right; font-weight:bold;}
+table.cmb_metabox th label { margin-top:5px; display:block;}
+p.cmb_metabox_description { color: #AAA; font-style: italic; margin: 2px 0 !important;}
+span.cmb_metabox_description { color: #AAA; font-style: italic;}
+table.cmb_metabox input, table.cmb_metabox textarea { font-size:12px; padding: 5px; }
+table.cmb_metabox input[type=text], table.cmb_metabox textarea { width: 97%; }
+table.cmb_metabox textarea.cmb_textarea_code { font-family: Consolas,Monaco,monospace; line-height: 16px; }
+table.cmb_metabox input.cmb_text_small { width: 100px; margin-right: 15px;}
+table.cmb_metabox input.cmb_timepicker { width: 100px; margin-right: 15px;}
+table.cmb_metabox input.cmb_text_money { width: 90px; margin-right: 15px;}
+table.cmb_metabox input.cmb_text_medium { width: 230px; margin-right: 15px;}
+table.cmb_metabox input.cmb_upload_file { width: 65%; }
+table.cmb_metabox li { font-size:12px; margin: 1px 0 5px 0; line-height: 16px; }
+table.cmb_metabox ul { padding-top:5px; margin: 0; }
+table.cmb_metabox select { font-size:12px; margin-top: 3px;}
+table.cmb_metabox input:focus, table.cmb_metabox textarea:focus { background: #fffff8;}
+.cmb_metabox_title { margin: 0 0 5px 0; padding: 5px 0 0 0; font: italic 24px/35px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}
+.cmb_radio_inline { padding: 4px 0 0 0;}
+.cmb_radio_inline_option {display: inline; padding-right: 18px;}
+table.cmb_metabox input[type="radio"] { margin: 0 5px 0 0; padding: 0;}
+table.cmb_metabox input[type="checkbox"] { margin: 0 5px 0 0; padding: 0;}
+table.cmb_metabox .mceLayout {border:1px solid #DFDFDF !important;}
+table.cmb_metabox .mceIframeContainer {background:#FFF;}
+table.cmb_metabox .meta_mce {width:97%;}
+table.cmb_metabox .meta_mce textarea {width:100%;}
+table.cmb_metabox .cmb_upload_status { margin: 10px 0 0 0;}
+table.cmb_metabox .cmb_upload_status .img_status { position: relative; }
+table.cmb_metabox .cmb_upload_status .img_status img { border:1px solid #DFDFDF; background: #FAFAFA; max-width:350px; padding: 5px; -moz-border-radius: 2px; border-radius: 2px;}
+table.cmb_metabox .cmb_upload_status .img_status .cmb_remove_file_button { text-indent: -9999px; background: url(images/ico-delete.png); width: 16px; height: 16px; position: absolute; top: -5px; left: -5px;}
+/* Sidebar placement adjustments */
+.inner-sidebar table.cmb_metabox input[type=text], table.cmb_metabox textarea { width: 95%; }
+.inner-sidebar table.cmb_metabox .cmb_upload_status .img_status img { width: 90%; }
+
+/**
+ * Timepicker
+ */
+div.time-picker { position: absolute; height: 191px; width:6em; /* needed for IE */overflow: auto; background: #fff; border: 1px solid #aaa; z-index: 99; margin: 0;}
+div.time-picker-12hours { width:8em; /* needed for IE */}
+div.time-picker ul { list-style-type: none; margin: 0; padding: 0; }
+div.time-picker li { cursor: pointer; height: 10px; font: 12px/1 Helvetica, Arial, sans-serif; padding: 4px 3px; }
+div.time-picker li.selected { background: #0063CE; color: #fff; }
+
+/**
+ * jQuery UI CSS Framework 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+ .cmb_element .ui-helper-hidden { display: none; }
+ .cmb_element .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+ .cmb_element .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+ .cmb_element .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+ .cmb_element .ui-helper-clearfix { display: inline-block; }
+ * html .ui-helper-clearfix { height:1%; }
+ .cmb_element .ui-helper-clearfix { display:block; }
+ .cmb_element .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+ .cmb_element .ui-state-disabled { cursor: default !important; }
+ .cmb_element .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+ .cmb_element .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+ .cmb_element .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+ .cmb_element .ui-widget .ui-widget { font-size: 1em; }
+ .cmb_element .ui-widget input, .cmb_element .ui-widget select, .cmb_element .ui-widget textarea, .cmb_element .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+ .cmb_element .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+ .cmb_element .ui-widget-content a { color: #222222; }
+ .cmb_element .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+ .cmb_element .ui-widget-header a { color: #222222; }
+ .cmb_element .ui-state-default, .cmb_element .ui-widget-content .ui-state-default, .cmb_element .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+ .cmb_element .ui-state-default a, .cmb_element .ui-state-default a:link, .cmb_element .ui-state-default a:visited { color: #555555; text-decoration: none; }
+ .cmb_element .ui-state-hover, .cmb_element .ui-widget-content .ui-state-hover, .cmb_element .ui-widget-header .ui-state-hover, .cmb_element .ui-state-focus, .cmb_element .ui-widget-content .ui-state-focus, .cmb_element .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+ .cmb_element .ui-state-hover a, .cmb_element .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+ .cmb_element .ui-state-active, .cmb_element .ui-widget-content .ui-state-active, .cmb_element .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+ .cmb_element .ui-state-active a, .cmb_element .ui-state-active a:link, .cmb_element .ui-state-active a:visited { color: #212121; text-decoration: none; }
+ .cmb_element .ui-widget :active { outline: none; }
+ .cmb_element .ui-state-highlight, .cmb_element .ui-widget-content .ui-state-highlight, .cmb_element .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+ .cmb_element .ui-state-highlight a, .cmb_element .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+ .cmb_element .ui-state-error, .cmb_element .ui-widget-content .ui-state-error, .cmb_element .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+ .cmb_element .ui-state-error a, .cmb_element .ui-widget-content .ui-state-error a, .cmb_element .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+ .cmb_element .ui-state-error-text, .cmb_element .ui-widget-content .ui-state-error-text, .cmb_element .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+ .cmb_element .ui-priority-primary, .cmb_element .ui-widget-content .ui-priority-primary, .cmb_element .ui-widget-header .ui-priority-primary { font-weight: bold; }
+ .cmb_element .ui-priority-secondary, .cmb_element .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+ .cmb_element .ui-state-disabled, .cmb_element .ui-widget-content .ui-state-disabled, .cmb_element .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+ .cmb_element .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+ .cmb_element .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+ .cmb_element .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+ .cmb_element .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+ .cmb_element .ui-state-hover .ui-icon, .cmb_element .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+ .cmb_element .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+ .cmb_element .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+ .cmb_element .ui-state-error .ui-icon, .cmb_element .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+ .cmb_element .ui-icon-carat-1-n { background-position: 0 0; }
+ .cmb_element .ui-icon-carat-1-ne { background-position: -16px 0; }
+ .cmb_element .ui-icon-carat-1-e { background-position: -32px 0; }
+ .cmb_element .ui-icon-carat-1-se { background-position: -48px 0; }
+ .cmb_element .ui-icon-carat-1-s { background-position: -64px 0; }
+ .cmb_element .ui-icon-carat-1-sw { background-position: -80px 0; }
+ .cmb_element .ui-icon-carat-1-w { background-position: -96px 0; }
+ .cmb_element .ui-icon-carat-1-nw { background-position: -112px 0; }
+ .cmb_element .ui-icon-carat-2-n-s { background-position: -128px 0; }
+ .cmb_element .ui-icon-carat-2-e-w { background-position: -144px 0; }
+ .cmb_element .ui-icon-triangle-1-n { background-position: 0 -16px; }
+ .cmb_element .ui-icon-triangle-1-ne { background-position: -16px -16px; }
+ .cmb_element .ui-icon-triangle-1-e { background-position: -32px -16px; }
+ .cmb_element .ui-icon-triangle-1-se { background-position: -48px -16px; }
+ .cmb_element .ui-icon-triangle-1-s { background-position: -64px -16px; }
+ .cmb_element .ui-icon-triangle-1-sw { background-position: -80px -16px; }
+ .cmb_element .ui-icon-triangle-1-w { background-position: -96px -16px; }
+ .cmb_element .ui-icon-triangle-1-nw { background-position: -112px -16px; }
+ .cmb_element .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+ .cmb_element .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+ .cmb_element .ui-icon-arrow-1-n { background-position: 0 -32px; }
+ .cmb_element .ui-icon-arrow-1-ne { background-position: -16px -32px; }
+ .cmb_element .ui-icon-arrow-1-e { background-position: -32px -32px; }
+ .cmb_element .ui-icon-arrow-1-se { background-position: -48px -32px; }
+ .cmb_element .ui-icon-arrow-1-s { background-position: -64px -32px; }
+ .cmb_element .ui-icon-arrow-1-sw { background-position: -80px -32px; }
+ .cmb_element .ui-icon-arrow-1-w { background-position: -96px -32px; }
+ .cmb_element .ui-icon-arrow-1-nw { background-position: -112px -32px; }
+ .cmb_element .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+ .cmb_element .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+ .cmb_element .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+ .cmb_element .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+ .cmb_element .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+ .cmb_element .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+ .cmb_element .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+ .cmb_element .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+ .cmb_element .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+ .cmb_element .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+ .cmb_element .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+ .cmb_element .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+ .cmb_element .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+ .cmb_element .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+ .cmb_element .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+ .cmb_element .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+ .cmb_element .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+ .cmb_element .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+ .cmb_element .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+ .cmb_element .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+ .cmb_element .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+ .cmb_element .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+ .cmb_element .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+ .cmb_element .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+ .cmb_element .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+ .cmb_element .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+ .cmb_element .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+ .cmb_element .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+ .cmb_element .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+ .cmb_element .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+ .cmb_element .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+ .cmb_element .ui-icon-arrow-4 { background-position: 0 -80px; }
+ .cmb_element .ui-icon-arrow-4-diag { background-position: -16px -80px; }
+ .cmb_element .ui-icon-extlink { background-position: -32px -80px; }
+ .cmb_element .ui-icon-newwin { background-position: -48px -80px; }
+ .cmb_element .ui-icon-refresh { background-position: -64px -80px; }
+ .cmb_element .ui-icon-shuffle { background-position: -80px -80px; }
+ .cmb_element .ui-icon-transfer-e-w { background-position: -96px -80px; }
+ .cmb_element .ui-icon-transferthick-e-w { background-position: -112px -80px; }
+ .cmb_element .ui-icon-folder-collapsed { background-position: 0 -96px; }
+ .cmb_element .ui-icon-folder-open { background-position: -16px -96px; }
+ .cmb_element .ui-icon-document { background-position: -32px -96px; }
+ .cmb_element .ui-icon-document-b { background-position: -48px -96px; }
+ .cmb_element .ui-icon-note { background-position: -64px -96px; }
+ .cmb_element .ui-icon-mail-closed { background-position: -80px -96px; }
+ .cmb_element .ui-icon-mail-open { background-position: -96px -96px; }
+ .cmb_element .ui-icon-suitcase { background-position: -112px -96px; }
+ .cmb_element .ui-icon-comment { background-position: -128px -96px; }
+ .cmb_element .ui-icon-person { background-position: -144px -96px; }
+ .cmb_element .ui-icon-print { background-position: -160px -96px; }
+ .cmb_element .ui-icon-trash { background-position: -176px -96px; }
+ .cmb_element .ui-icon-locked { background-position: -192px -96px; }
+ .cmb_element .ui-icon-unlocked { background-position: -208px -96px; }
+ .cmb_element .ui-icon-bookmark { background-position: -224px -96px; }
+ .cmb_element .ui-icon-tag { background-position: -240px -96px; }
+ .cmb_element .ui-icon-home { background-position: 0 -112px; }
+ .cmb_element .ui-icon-flag { background-position: -16px -112px; }
+ .cmb_element .ui-icon-calendar { background-position: -32px -112px; }
+ .cmb_element .ui-icon-cart { background-position: -48px -112px; }
+ .cmb_element .ui-icon-pencil { background-position: -64px -112px; }
+ .cmb_element .ui-icon-clock { background-position: -80px -112px; }
+ .cmb_element .ui-icon-disk { background-position: -96px -112px; }
+ .cmb_element .ui-icon-calculator { background-position: -112px -112px; }
+ .cmb_element .ui-icon-zoomin { background-position: -128px -112px; }
+ .cmb_element .ui-icon-zoomout { background-position: -144px -112px; }
+ .cmb_element .ui-icon-search { background-position: -160px -112px; }
+ .cmb_element .ui-icon-wrench { background-position: -176px -112px; }
+ .cmb_element .ui-icon-gear { background-position: -192px -112px; }
+ .cmb_element .ui-icon-heart { background-position: -208px -112px; }
+ .cmb_element .ui-icon-star { background-position: -224px -112px; }
+ .cmb_element .ui-icon-link { background-position: -240px -112px; }
+ .cmb_element .ui-icon-cancel { background-position: 0 -128px; }
+ .cmb_element .ui-icon-plus { background-position: -16px -128px; }
+ .cmb_element .ui-icon-plusthick { background-position: -32px -128px; }
+ .cmb_element .ui-icon-minus { background-position: -48px -128px; }
+ .cmb_element .ui-icon-minusthick { background-position: -64px -128px; }
+ .cmb_element .ui-icon-close { background-position: -80px -128px; }
+ .cmb_element .ui-icon-closethick { background-position: -96px -128px; }
+ .cmb_element .ui-icon-key { background-position: -112px -128px; }
+ .cmb_element .ui-icon-lightbulb { background-position: -128px -128px; }
+ .cmb_element .ui-icon-scissors { background-position: -144px -128px; }
+ .cmb_element .ui-icon-clipboard { background-position: -160px -128px; }
+ .cmb_element .ui-icon-copy { background-position: -176px -128px; }
+ .cmb_element .ui-icon-contact { background-position: -192px -128px; }
+ .cmb_element .ui-icon-image { background-position: -208px -128px; }
+ .cmb_element .ui-icon-video { background-position: -224px -128px; }
+ .cmb_element .ui-icon-script { background-position: -240px -128px; }
+ .cmb_element .ui-icon-alert { background-position: 0 -144px; }
+ .cmb_element .ui-icon-info { background-position: -16px -144px; }
+ .cmb_element .ui-icon-notice { background-position: -32px -144px; }
+ .cmb_element .ui-icon-help { background-position: -48px -144px; }
+ .cmb_element .ui-icon-check { background-position: -64px -144px; }
+ .cmb_element .ui-icon-bullet { background-position: -80px -144px; }
+ .cmb_element .ui-icon-radio-off { background-position: -96px -144px; }
+ .cmb_element .ui-icon-radio-on { background-position: -112px -144px; }
+ .cmb_element .ui-icon-pin-w { background-position: -128px -144px; }
+ .cmb_element .ui-icon-pin-s { background-position: -144px -144px; }
+ .cmb_element .ui-icon-play { background-position: 0 -160px; }
+ .cmb_element .ui-icon-pause { background-position: -16px -160px; }
+ .cmb_element .ui-icon-seek-next { background-position: -32px -160px; }
+ .cmb_element .ui-icon-seek-prev { background-position: -48px -160px; }
+ .cmb_element .ui-icon-seek-end { background-position: -64px -160px; }
+ .cmb_element .ui-icon-seek-start { background-position: -80px -160px; }
+ .cmb_element .ui-icon-seek-first { background-position: -80px -160px; }
+ .cmb_element .ui-icon-stop { background-position: -96px -160px; }
+ .cmb_element .ui-icon-eject { background-position: -112px -160px; }
+ .cmb_element .ui-icon-volume-off { background-position: -128px -160px; }
+ .cmb_element .ui-icon-volume-on { background-position: -144px -160px; }
+ .cmb_element .ui-icon-power { background-position: 0 -176px; }
+ .cmb_element .ui-icon-signal-diag { background-position: -16px -176px; }
+ .cmb_element .ui-icon-signal { background-position: -32px -176px; }
+ .cmb_element .ui-icon-battery-0 { background-position: -48px -176px; }
+ .cmb_element .ui-icon-battery-1 { background-position: -64px -176px; }
+ .cmb_element .ui-icon-battery-2 { background-position: -80px -176px; }
+ .cmb_element .ui-icon-battery-3 { background-position: -96px -176px; }
+ .cmb_element .ui-icon-circle-plus { background-position: 0 -192px; }
+ .cmb_element .ui-icon-circle-minus { background-position: -16px -192px; }
+ .cmb_element .ui-icon-circle-close { background-position: -32px -192px; }
+ .cmb_element .ui-icon-circle-triangle-e { background-position: -48px -192px; }
+ .cmb_element .ui-icon-circle-triangle-s { background-position: -64px -192px; }
+ .cmb_element .ui-icon-circle-triangle-w { background-position: -80px -192px; }
+ .cmb_element .ui-icon-circle-triangle-n { background-position: -96px -192px; }
+ .cmb_element .ui-icon-circle-arrow-e { background-position: -112px -192px; }
+ .cmb_element .ui-icon-circle-arrow-s { background-position: -128px -192px; }
+ .cmb_element .ui-icon-circle-arrow-w { background-position: -144px -192px; }
+ .cmb_element .ui-icon-circle-arrow-n { background-position: -160px -192px; }
+ .cmb_element .ui-icon-circle-zoomin { background-position: -176px -192px; }
+ .cmb_element .ui-icon-circle-zoomout { background-position: -192px -192px; }
+ .cmb_element .ui-icon-circle-check { background-position: -208px -192px; }
+ .cmb_element .ui-icon-circlesmall-plus { background-position: 0 -208px; }
+ .cmb_element .ui-icon-circlesmall-minus { background-position: -16px -208px; }
+ .cmb_element .ui-icon-circlesmall-close { background-position: -32px -208px; }
+ .cmb_element .ui-icon-squaresmall-plus { background-position: -48px -208px; }
+ .cmb_element .ui-icon-squaresmall-minus { background-position: -64px -208px; }
+ .cmb_element .ui-icon-squaresmall-close { background-position: -80px -208px; }
+ .cmb_element .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+ .cmb_element .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+ .cmb_element .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+ .cmb_element .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+ .cmb_element .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+ .cmb_element .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+ .cmb_element .ui-corner-all, .cmb_element .ui-corner-top, .cmb_element .ui-corner-left, .cmb_element .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+ .cmb_element .ui-corner-all, .cmb_element .ui-corner-top, .cmb_element .ui-corner-right, .cmb_element .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+ .cmb_element .ui-corner-all, .cmb_element .ui-corner-bottom, .cmb_element .ui-corner-left, .cmb_element .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+ .cmb_element .ui-corner-all, .cmb_element .ui-corner-bottom, .cmb_element .ui-corner-right, .cmb_element .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+ .cmb_element .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+ .cmb_element .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
+ .cmb_element .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+ .cmb_element .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+ .cmb_element .ui-datepicker .ui-datepicker-prev, .cmb_element .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+ .cmb_element .ui-datepicker .ui-datepicker-prev-hover, .cmb_element .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+ .cmb_element .ui-datepicker .ui-datepicker-prev { left:2px; }
+ .cmb_element .ui-datepicker .ui-datepicker-next { right:2px; }
+ .cmb_element .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+ .cmb_element .ui-datepicker .ui-datepicker-next-hover { right:1px; }
+ .cmb_element .ui-datepicker .ui-datepicker-prev span, .cmb_element .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+ .cmb_element .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+ .cmb_element .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+ .cmb_element .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+ .cmb_element .ui-datepicker select.ui-datepicker-month,
+ .cmb_element .ui-datepicker select.ui-datepicker-year { width: 49%;}
+ .cmb_element .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+ .cmb_element .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+ .cmb_element .ui-datepicker td { border: 0; padding: 1px; }
+ .cmb_element .ui-datepicker td span, .cmb_element .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+ .cmb_element .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+ .cmb_element .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+ .cmb_element .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+ .cmb_element .ui-datepicker.ui-datepicker-multi { width:auto; }
+ .cmb_element .ui-datepicker-multi .ui-datepicker-group { float:left; }
+ .cmb_element .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+ .cmb_element .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+ .cmb_element .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+ .cmb_element .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+ .cmb_element .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+ .cmb_element .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+ .cmb_element .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+ .cmb_element .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+ .cmb_element .ui-datepicker-rtl { direction: rtl; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-group { float:right; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+ .cmb_element .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+ .cmb_element .ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+ }

0 comments on commit fe709e4

Please sign in to comment.
Something went wrong with that request. Please try again.