Permalink
Browse files

plethora of updates

  • Loading branch information...
1 parent ec90107 commit 8bb5722445c9094ec445fe5399082385113629e5 jaredatch committed Dec 14, 2011
View
@@ -1,19 +1,25 @@
-=== Custom Metaboxes and Fields for WordPress===
+# Custom Metaboxes and Fields for WordPress
-Contributors:
- Andrew Norcross (@norcross / andrewnorcross.com)
- Jared Atchison (@jaredatch / jaredatchison.com)
- Bill Erickson (@billerickson / billerickson.net)
-Version: 0.8
-Requires at least: 3.3
-Tested up to: 3.3
-License: GPLv2
+**Contributors**:
-== Description ==
+* Andrew Norcross ( [@norcorss](http://twitter.com/norcross ) / [andrewnorcross.com](http://andrewnorcross.com/) )
+* Jared Atchison ( [@jaredatch](http://twitter.com/jaredatch ) / [jaredatchison.com](http://jaredatchison.com/) )
+* Bill Erickson ( [@norcorss](http://twitter.com/billerickson ) / [billerickson.net](http://billerickson.net/) )
+
+**Version**: 0.8 trunk
+**Requires at least**: 3.3
+**Tested up to**: 3.3
+**License**: GPLv2
+
+## Description
Custom Metaboxes and Fields (CMB for short) will create metaboxes with custom fields that will blow your mind.
-Field Types:
+##### Links
+* [Github project page](github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress)
+* [Documentation (GitHub wiki)](https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress/wiki)
+
+##### Field Types:
* text
* text small
* text medium
@@ -34,8 +40,9 @@ Field Types:
* WYSIWYG/TinyMCE
* Image/file upload
+[More on field types (GitHub wiki)](github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types)
-== Installation ==
+## Installation
This script is easy to install. If you can't figure it out you probably shouldn't be using it.
@@ -44,47 +51,54 @@ This script is easy to install. If you can't figure it out you probably shouldn'
3. See `example-functions.php` for further guidance.
4. Profit.
-== Known Issues ==
+## Known Issues
* Problem inserting file url inside field for image with caption (issue #50)
* Multicheck saves new values incorrectly (issue #48)
* `CMB_META_BOX_URL` does not define properly in WAMP/XAMP (Windows) (issue #31)
-* datepicker triggers extra space below footer with Firefox (issue #14)
* Metabox container WYSIWYG editor cannot be moved
-== To-do ==
+## To-do
* Fix known issues (above)
-* Ditch packaged datepicker, use jquery UI with 3.3
-* clean up enqueued scripts
* improve inline documentation
-== Changelog ==
+## Changelog
+
+### ?.?
+* ** Note: This release requires WordPress 3.3+ **
+* Use jQuery UI datepicker packaged with 3.3 core, props @jaredatch
+* Fixed bug where datepicker triggers extra space after footer in Firefox (issue #14), props @jaredatch
+* Tweaked CSS, removed inline styles, now all in style.css, props @jaredatch
+* Clean up scripts being queued. props @jaredatch
+* Added ability to filter the money type with text_money, props @jaredatch
+* Added readme.md markdown file, props @jaredatch
+* Multicheck fixes and tweaks, props @randyhoyt
-= 0.8 =
+### 0.8
* Added jQuery timepicker, props @norcross
* Added 'raw' textarea to convert special HTML entities back to characters, props @norcross
* Added missing examples on example-functions.php, props @norcross
-= 0.7 =
+### 0.7
* Added the new wp_editor() function for the WYSIWYG dialog box, props @jcpry
* Created 'cmb_show_on' filter to define your own Show On Filters, props @billerickson
* Added page template show_on filter, props @billerickson
* Improvements to the 'file' field type, props @randyhoyt
* Allow for default values on 'radio' and 'radio_inline' field types, props @billerickson
-= 0.6.1 =
+### 0.6.1
* Enabled the ability to define your own custom field types (issue #28). props @randyhoyt
-= 0.6 =
+### 0.6
* Added the ability to limit metaboxes to certain posts by id. props @billerickson
-= 0.5 =
+### 0.5
* Fixed define to prevent notices. props @destos
* Added text_date_timestap option. props @andrewyno
* Fixed WYSIWYG paragraph breaking/spacing bug. props @wpsmith
* Added taxonomy_radio and taxonomies_select options. props @c3mdigital
* Fixed script causing the dashboard widgets to not be collapsible.
* Fixed various spacing and whitespace inconsistencies
-= 0.4 =
-* Think we have a release that is mostly working. We'll say the initial release :)
+### 0.4
+* Think we have a release that is mostly working. We'll say the initial release :)
@@ -7,7 +7,7 @@ function be_sample_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'test_metabox',
'title' => 'Test Metabox',
- 'pages' => array('page'), // post type
+ 'pages' => array( 'page' ), // post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
@@ -163,7 +163,7 @@ function be_sample_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'about_page_metabox',
'title' => 'About Page Metabox',
- 'pages' => array('page'), // post type
+ 'pages' => array( 'page' ), // post type
'show_on' => array( 'key' => 'id', 'value' => array( 2 ) ), // specific post ids to display this metabox
'context' => 'normal',
'priority' => 'high',
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -217,7 +217,7 @@ function show() {
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>';
+ echo apply_filters('cmb_money_type', '$') . ' <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 'textarea':
echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="10" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>','<p class="cmb_metabox_description">', $field['desc'], '</p>';
@@ -271,16 +271,8 @@ function show() {
echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
break;
case 'wysiwyg':
- /* Make sure that the new wp_editor() function is available.
- * Otherwise, use the "old" version of the WYSIWYG editor */
- if( function_exists( 'wp_editor' ) ) {
- wp_editor( $meta ? $meta : $field['std'], $field['id'], isset( $field['options'] ) ? $field['options'] : array() );
- } else {
- echo '<div id="poststuff" class="meta_mce">';
- echo '<div class="customEditor"><textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="7" style="width:97%">', $meta ? wpautop($meta, true) : '', '</textarea></div>';
- echo '</div>';
- }
- echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
+ 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'], '">';
@@ -443,7 +435,7 @@ function save( $post_id) {
$aNewToAdd = array_diff( $new, $old );
$aOldToDelete = array_diff( $old, $new );
foreach ( $aNewToAdd as $newToAdd ) {
- if ($newToAdd!="") add_post_meta( $post_id, $name, $newToAdd, false );
+ if ( $newToAdd != "" ) add_post_meta( $post_id, $name, $newToAdd, false );
}
foreach ( $aOldToDelete as $oldToDelete ) {
delete_post_meta( $post_id, $name, $oldToDelete );
@@ -478,99 +470,31 @@ function save( $post_id) {
*/
function cmb_scripts( $hook ) {
- if ( $hook == 'post.php' OR $hook == 'post-new.php' OR $hook == 'page-new.php' OR $hook == 'page.php' ) {
- wp_register_script( 'cmb-scripts', CMB_META_BOX_URL.'jquery.cmbScripts.js', array( 'jquery','media-upload','thickbox' ) );
- wp_enqueue_script( 'jquery' );
- wp_enqueue_script( 'jquery-ui-core' ); // Make sure and use elements form the 1.7.3 UI - not 1.8.9
- wp_enqueue_script( 'media-upload' );
- wp_enqueue_script( 'thickbox' );
+ if ( $hook == 'post.php' || $hook == 'post-new.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
+ wp_register_script( 'cmb-scripts', CMB_META_BOX_URL . 'jquery.cmbScripts.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'media-upload', 'thickbox' ) );
wp_enqueue_script( 'cmb-scripts' );
- wp_enqueue_style( 'thickbox' );
- wp_enqueue_style( 'jquery-custom-ui' );
- add_action( 'admin_head', 'cmb_styles_inline' );
+ wp_register_style( 'cmb-styles', CMB_META_BOX_URL . 'style.css' );
+ wp_enqueue_style( 'cmb-styles' );
}
}
-add_action( 'admin_enqueue_scripts', 'cmb_scripts', 10, 1 );
-
-function editor_admin_init( $hook ) {
- if ( $hook == 'post.php' OR $hook == 'post-new.php' OR $hook == 'page-new.php' OR $hook == 'page.php' ) {
- wp_enqueue_script( 'word-count' );
- wp_enqueue_script( 'post' );
- wp_enqueue_script( 'editor' );
- }
-}
-
-function editor_admin_head( $hook ) {
- if ( $hook == 'post.php' OR $hook == 'post-new.php' OR $hook == 'page-new.php' OR $hook == 'page.php' ) {
- wp_tiny_mce();
- }
-}
-
-add_action( 'admin_init', 'editor_admin_init' );
-add_action( 'admin_head', 'editor_admin_head' );
+add_action( 'admin_enqueue_scripts', 'cmb_scripts', 10 );
function cmb_editor_footer_scripts() { ?>
- <script type="text/javascript">
- /* <![CDATA[ */
- jQuery(function($) {
- var i=1;
- $('.customEditor textarea').each(function(e) {
- var id = $(this).attr('id');
- if (!id) {
- id = 'customEditor-' + i++;
- $(this).attr('id',id);
- }
- tinyMCE.execCommand('mceAddControl', false, id);
- });
- });
- /* ]]> */
- </script>
- <?php if ( isset( $_GET['cmb_force_send'] ) && 'true' == $_GET['cmb_force_send'] ) {
+ <?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">
+ if ( empty( $label ) ) $label="Select File";
+ ?>
+ <script type="text/javascript">
jQuery(function($) {
$('td.savesend input').val('<?php echo $label; ?>');
});
- </script>
- <?php } ?>
-<?php }
+ </script>
+ <?php
+ }
+}
add_action( 'admin_print_footer_scripts', 'cmb_editor_footer_scripts', 99 );
-function cmb_styles_inline() {
- echo '<link rel="stylesheet" type="text/css" href="' . CMB_META_BOX_URL.'style.css" />';
- ?>
- <style type="text/css">
- 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:6px; display:block;}
- p.cmb_metabox_description { color: #AAA; font-style: italic; margin: 2px 0 !important;}
- span.cmb_metabox_description { color: #AAA; font-style: italic;}
- input.cmb_text_small { width: 100px; margin-right: 15px;}
- input.cmb_text_time { width: 40px; margin-right: 15px;}
- input.cmb_text_money { width: 90px; margin-right: 15px;}
- input.cmb_text_medium { width: 230px; margin-right: 15px;}
- table.cmb_metabox input, table.cmb_metabox textarea { font-size:11px; padding: 5px;}
- table.cmb_metabox li { font-size:11px; }
- table.cmb_metabox ul { padding-top:5px; }
- table.cmb_metabox select { font-size:11px;}
- 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-right:3px;}
- table.cmb_metabox input[type="checkbox"] { margin-right:6px;}
- 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 .remove_file_button { text-indent: -9999px; background: url(<?php echo CMB_META_BOX_URL ?>images/ico-delete.png); width: 16px; height: 16px; position: absolute; top: -5px; left: -5px;}
- </style>
- <?php
-}
// Force 'Insert into Post' button from Media Library
add_filter( 'get_media_item_args', 'cmb_force_send' );
View
Oops, something went wrong.
View
@@ -6,8 +6,8 @@
* Jared Atchison ( [@jaredatch](http://twitter.com/jaredatch ) / [jaredatchison.com](http://jaredatchison.com/) )
* Bill Erickson ( [@norcorss](http://twitter.com/billerickson ) / [billerickson.net](http://billerickson.net/) )
@GaryJones
GaryJones Dec 14, 2011 Contributor

Typo for BE's Twitter name.

-**Version**: 0.8
-**Requires at least**: 3.0
+**Version**: 0.8 trunk
+**Requires at least**: 3.3
**Tested up to**: 3.3
**License**: GPLv2
@@ -56,31 +56,38 @@ This script is easy to install. If you can't figure it out you probably shouldn'
* Problem inserting file url inside field for image with caption (issue #50)
* Multicheck saves new values incorrectly (issue #48)
* `CMB_META_BOX_URL` does not define properly in WAMP/XAMP (Windows) (issue #31)
-* datepicker triggers extra space below footer with Firefox (issue #14)
* Metabox container WYSIWYG editor cannot be moved
## To-do
* Fix known issues (above)
-* Ditch packaged datepicker, use jquery UI with 3.3
-* clean up enqueued scripts
* improve inline documentation
+* clean up code
+* support for multipile configurable timepickers
## Changelog
+### ?.?
+* ** Note: This release requires WordPress 3.3+ **
+* Use jQuery UI datepicker packaged with 3.3 core, props @jaredatch
+* Fixed bug where datepicker triggers extra space after footer in Firefox (issue #14), props @jaredatch
+* Tweaked CSS, removed inline styles, now all in style.css, props @jaredatch
+* Clean up scripts being queued. props @jaredatch
+* Added ability to filter the money type with text_money, props @jaredatch
+* Added readme.md markdown file, props @jaredatch
+* Multicheck fixes and tweaks, props @randyhoyt
+
### 0.8
* Added jQuery timepicker, props @norcross
* Added 'raw' textarea to convert special HTML entities back to characters, props @norcross
* Added missing examples on example-functions.php, props @norcross
-
### 0.7
* Added the new wp_editor() function for the WYSIWYG dialog box, props @jcpry
* Created 'cmb_show_on' filter to define your own Show On Filters, props @billerickson
* Added page template show_on filter, props @billerickson
* Improvements to the 'file' field type, props @randyhoyt
* Allow for default values on 'radio' and 'radio_inline' field types, props @billerickson
-
### 0.6.1
* Enabled the ability to define your own custom field types (issue #28). props @randyhoyt
Oops, something went wrong.

0 comments on commit 8bb5722

Please sign in to comment.