Navigation Menu

Skip to content

Commit

Permalink
Hotfix 2.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
valendesigns committed Apr 22, 2015
2 parents 065f290 + bd37ad7 commit 11a66f8
Show file tree
Hide file tree
Showing 9 changed files with 770 additions and 345 deletions.
2 changes: 1 addition & 1 deletion assets/js/ot-admin.js
Expand Up @@ -587,7 +587,7 @@
});
},
bind_select_wrapper: function() {
$('.option-tree-ui-select').on('change', function () {
$(document).on('change', '.option-tree-ui-select', function () {
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
});
},
Expand Down
18 changes: 8 additions & 10 deletions includes/ot-cleanup-api.php
Expand Up @@ -62,14 +62,12 @@ function styles() {
* @since 2.4.6
*/
public function maybe_cleanup() {
global $wpdb, $table_prefix, $ot_maybe_cleanup_posts, $ot_maybe_cleanup_table;

$posts = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'option-tree' LIMIT 2" );
$table = $wpdb->get_results( "SHOW TABLES LIKE '{$table_prefix}option_tree'" );

$ot_maybe_cleanup_posts = count( $posts ) > 1;
$ot_maybe_cleanup_table = count( $table ) == 1;
global $wpdb, $ot_maybe_cleanup_posts, $ot_maybe_cleanup_table;

$table_name = $wpdb->prefix . 'option_tree';
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
$ot_maybe_cleanup_posts = count( $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'option-tree' LIMIT 2" ) ) > 1;
$ot_maybe_cleanup_table = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_name ) ) == $table_name;

if ( ! $ot_maybe_cleanup_posts && ! $ot_maybe_cleanup_table && $page == 'ot-cleanup' ) {
wp_redirect( apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ) . '?page=' . apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ) );
Expand Down Expand Up @@ -113,7 +111,7 @@ public function cleanup_notice() {
* @since 2.4.6
*/
public function options_page() {
global $wpdb, $table_prefix, $ot_maybe_cleanup_posts, $ot_maybe_cleanup_table;
global $wpdb, $ot_maybe_cleanup_posts, $ot_maybe_cleanup_table;

// Option ID
$option_id = 'ot_media_post_ID';
Expand Down Expand Up @@ -225,7 +223,7 @@ function ot_script_reload() {

if ( $ot_maybe_cleanup_table ) {

$table_name = $table_prefix . 'option_tree';
$table_name = $wpdb->prefix . 'option_tree';

echo $ot_maybe_cleanup_posts ? '<hr />' : '';

Expand All @@ -241,7 +239,7 @@ function ot_script_reload() {

$wpdb->query( "DROP TABLE IF EXISTS $table_name" );

if ( count( $wpdb->get_results( "SHOW TABLES LIKE '{$table_prefix}option_tree'" ) ) == 0 ) {
if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_name ) ) != $table_name ) {

echo '<p>' . sprintf( __( 'The %s table has been successfully deleted. The page will now reload...', 'option-tree' ), '<tt>' . $table_name . '</tt>' ) . '</p>';

Expand Down

0 comments on commit 11a66f8

Please sign in to comment.