Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Working on more syntax and SASS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bamadesigner committed Sep 14, 2016
1 parent 37f5d35 commit 4849aee
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 259 deletions.
6 changes: 3 additions & 3 deletions admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ private function get_conflicting_taxonomy_terms_count( $post_type ) {
}

// First check both the taxonomy and terms tables together
$terms_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} term_tax INNER JOIN {$wpdb->terms} terms ON terms.term_id = term_tax.term_id WHERE term_tax.taxonomy = '{$post_type}' GROUP BY term_tax.term_id" );
$terms_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} term_tax INNER JOIN {$wpdb->terms} terms ON terms.term_id = term_tax.term_id WHERE term_tax.taxonomy = %s GROUP BY term_tax.term_id", $post_type ) );
if ( $terms_count > 0 ) {
return $terms_count;
}

// Then check just the taxonomy table
$terms_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} WHERE taxonomy = '{$post_type}'" );
$terms_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} WHERE taxonomy = %s", $post_type ) );
if ( $terms_count > 0 ) {
return $terms_count;
}
Expand Down Expand Up @@ -2888,7 +2888,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
$edit = $_REQUEST[ 'edit' ];
$delete_url = esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'delete' => $edit, '_wpnonce' => wp_create_nonce( 'delete-cpt-' . $edit ) ), $this->admin_url ), 'delete-cpt-' . $edit );
?>
<p><?php printf( __( 'Deleting your custom post type %1$2DOES NOT%2$s delete the actual posts. They\'ll be waiting for you if you decide to register this post type again. Just make sure you use the same name.', 'cpt-onomies' ), '<strong>', '</strong>' ); ?></p>
<p><?php printf( __( 'Deleting your custom post type %1$sDOES NOT%2$s delete the actual posts. They\'ll be waiting for you if you decide to register this post type again. Just make sure you use the same name.', 'cpt-onomies' ), '<strong>', '</strong>' ); ?></p>
<p><strong><?php _e( 'However, there is no "undo" and, once you click "Delete", all of your settings will be gone.', 'cpt-onomies' ); ?></p>
<a class="delete_cpt_onomy_custom_post_type button" href="<?php echo $delete_url; ?>" title="<?php esc_attr_e( 'Delete this custom post type', 'cpt-onomies' ); ?>"><?php _e( 'Delete this custom post type', 'cpt-onomies' ); ?></a><?php
break;
Expand Down
54 changes: 27 additions & 27 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,56 +33,56 @@ public function __construct() {
if ( is_admin() ) {

// If the user visits edit-tags.php to manage the terms, we set them straight
add_action( 'admin_init', array( &$this, 'deny_edit_tags' ) );
add_action( 'admin_init', array( $this, 'deny_edit_tags' ) );

// Register all of the admin scripts
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_register_styles_and_scripts' ), 10 );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_register_styles_and_scripts' ), 10 );

// Returns wp_object_terms()
add_action( 'wp_ajax_custom_post_type_onomy_get_wp_object_terms', array( &$this, 'ajax_get_wp_object_terms' ) );
add_action( 'wp_ajax_custom_post_type_onomy_get_wp_object_terms', array( $this, 'ajax_get_wp_object_terms' ) );

// Checks to see if term exists
add_action( 'wp_ajax_custom_post_type_onomy_check_if_term_exists', array( &$this, 'ajax_check_if_term_exists' ) );
add_action( 'wp_ajax_custom_post_type_onomy_check_if_term_exists', array( $this, 'ajax_check_if_term_exists' ) );

// Add CPT-onomy "edit" meta boxes
add_action( 'add_meta_boxes', array( &$this, 'add_cpt_onomy_meta_boxes' ), 10, 2 );
add_action( 'add_meta_boxes', array( $this, 'add_cpt_onomy_meta_boxes' ), 10, 2 );

// Takes care of autocomplete meta boxes
add_action( 'wp_ajax_custom_post_type_onomy_meta_box_autocomplete_callback', array( &$this, 'ajax_meta_box_autocomplete_callback' ) );
add_action( 'wp_ajax_custom_post_type_onomy_meta_box_autocomplete_callback', array( $this, 'ajax_meta_box_autocomplete_callback' ) );

// Runs when any post is saved
add_action( 'save_post', array( &$this, 'save_post' ), 10, 2 );
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );

// Runs when any post is deleted
add_action( 'delete_post', array( &$this, 'delete_post' ) );
add_action( 'delete_post', array( $this, 'delete_post' ) );

// Bulk/quick edit
add_action( 'bulk_edit_custom_box', array( &$this, 'bulk_quick_edit_custom_box' ), 100, 2 );
add_action( 'quick_edit_custom_box', array( &$this, 'bulk_quick_edit_custom_box' ), 100, 2 );
add_action( 'wp_ajax_custom_post_type_onomy_get_cpt_onomy_terms_include_term_ids', array( &$this, 'ajax_get_cpt_onomy_terms_include_term_ids' ) );
add_action( 'wp_ajax_custom_post_type_onomy_get_cpt_onomy_terms_exclude_term_ids', array( &$this, 'ajax_get_cpt_onomy_terms_exclude_term_ids' ) );
add_action( 'wp_ajax_custom_post_type_onomy_populate_bulk_quick_edit', array( &$this, 'ajax_get_wp_object_terms' ) );
add_action( 'wp_ajax_custom_post_type_onomy_save_bulk_edit', array( &$this, 'ajax_save_bulk_edit' ) );
add_action( 'wp_ajax_custom_post_type_onomy_quick_edit_populate_custom_columns', array( &$this, 'ajax_quick_edit_populate_custom_columns' ) );
add_action( 'bulk_edit_custom_box', array( $this, 'bulk_quick_edit_custom_box' ), 100, 2 );
add_action( 'quick_edit_custom_box', array( $this, 'bulk_quick_edit_custom_box' ), 100, 2 );
add_action( 'wp_ajax_custom_post_type_onomy_get_cpt_onomy_terms_include_term_ids', array( $this, 'ajax_get_cpt_onomy_terms_include_term_ids' ) );
add_action( 'wp_ajax_custom_post_type_onomy_get_cpt_onomy_terms_exclude_term_ids', array( $this, 'ajax_get_cpt_onomy_terms_exclude_term_ids' ) );
add_action( 'wp_ajax_custom_post_type_onomy_populate_bulk_quick_edit', array( $this, 'ajax_get_wp_object_terms' ) );
add_action( 'wp_ajax_custom_post_type_onomy_save_bulk_edit', array( $this, 'ajax_save_bulk_edit' ) );
add_action( 'wp_ajax_custom_post_type_onomy_quick_edit_populate_custom_columns', array( $this, 'ajax_quick_edit_populate_custom_columns' ) );

// Add column filters
add_action( 'restrict_manage_posts', array( &$this, 'restrict_manage_posts' ) );
add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );

/**
* Add custom admin columns.
*
* >= 3.5 - it allows you to remove "show_admin_column" column via filter
* < 3.5 - backwards compatibility for a little while - adds column
*/
add_filter( 'manage_pages_columns', array( &$this, 'add_cpt_onomy_admin_column' ), 100, 1 );
add_filter( 'manage_posts_columns', array( &$this, 'add_cpt_onomy_admin_column' ), 100, 2 );
add_filter( 'manage_pages_columns', array( $this, 'add_cpt_onomy_admin_column' ), 100, 1 );
add_filter( 'manage_posts_columns', array( $this, 'add_cpt_onomy_admin_column' ), 100, 2 );

// Define sortable columns
add_action( 'load-edit.php', array( &$this, 'add_cpt_onomy_admin_sortable_columns_filter' ) );
add_action( 'load-edit.php', array( $this, 'add_cpt_onomy_admin_sortable_columns_filter' ) );

// Edit custom admin columns for version < 3.5 - backwards compatibility for a little while
add_action( 'manage_pages_custom_column', array( &$this, 'edit_cpt_onomy_admin_column' ), 10, 2 );
add_action( 'manage_posts_custom_column', array( &$this, 'edit_cpt_onomy_admin_column' ), 10, 2 );
add_action( 'manage_pages_custom_column', array( $this, 'edit_cpt_onomy_admin_column' ), 10, 2 );
add_action( 'manage_posts_custom_column', array( $this, 'edit_cpt_onomy_admin_column' ), 10, 2 );

}

Expand Down Expand Up @@ -567,7 +567,7 @@ public function add_cpt_onomy_meta_boxes( $post_type, $post ) {
$meta_box_title = isset( $tax->meta_box_title ) && ! empty( $tax->meta_box_title ) ? $tax->meta_box_title : $tax->label;

// Add the meta box
add_meta_box( 'custom-post-type-onomies-' . $taxonomy, apply_filters( 'custom_post_type_onomies_meta_box_title', $meta_box_title, $taxonomy, $post_type ), array( &$this, 'print_cpt_onomy_meta_box' ), $post_type, 'side', 'core', array( 'taxonomy' => $taxonomy ) );
add_meta_box( 'custom-post-type-onomies-' . $taxonomy, apply_filters( 'custom_post_type_onomies_meta_box_title', $meta_box_title, $taxonomy, $post_type ), array( $this, 'print_cpt_onomy_meta_box' ), $post_type, 'side', 'core', array( 'taxonomy' => $taxonomy ) );

}

Expand Down Expand Up @@ -1241,7 +1241,7 @@ public function add_cpt_onomy_admin_column( $columns, $post_type='page' ) {
public function add_cpt_onomy_admin_sortable_columns_filter() {
global $current_screen;
if ( $current_screen && isset( $current_screen->id ) )
add_filter( "manage_{$current_screen->id}_sortable_columns", array( &$this, 'add_cpt_onomy_admin_sortable_columns' ) );
add_filter( "manage_{$current_screen->id}_sortable_columns", array( $this, 'add_cpt_onomy_admin_sortable_columns' ) );
}

/**
Expand Down Expand Up @@ -1393,7 +1393,7 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $
}

$cb_args = array_merge( array( &$output, $element, $depth ), $args );
call_user_func_array( array( &$this, 'start_el' ), $cb_args );
call_user_func_array( array( $this, 'start_el' ), $cb_args );

$id = $element->$id_field;

Expand All @@ -1407,7 +1407,7 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $

// Start the child delimiter
$cb_args = array_merge( array( &$output, $depth ), $args );
call_user_func_array( array( &$this, 'start_lvl' ), $cb_args );
call_user_func_array( array( $this, 'start_lvl' ), $cb_args );

}

Expand All @@ -1421,13 +1421,13 @@ function display_element( $element, &$children_elements, $max_depth, $depth=0, $

// End the child delimiter
$cb_args = array_merge( array( &$output, $depth ), $args );
call_user_func_array( array( &$this, 'end_lvl' ), $cb_args );
call_user_func_array( array( $this, 'end_lvl' ), $cb_args );

}

// End this element
$cb_args = array_merge( array( &$output, $element, $depth ), $args );
call_user_func_array( array( &$this, 'end_el' ), $cb_args );
call_user_func_array( array( $this, 'end_el' ), $cb_args );

}
}
Expand Down
Loading

0 comments on commit 4849aee

Please sign in to comment.