prefix . "alm"; // ********************************************** // If table exists // ********************************************** if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) { // Updated 2.0.5 // Check column 'name' exists in $wpdb - this is an upgrade checker. $row = $wpdb->get_col("Show columns from $table_name like 'name'"); if(empty($row)){ $wpdb->query("ALTER TABLE $table_name ADD name TEXT NOT NULL"); $wpdb->update($table_name , array('name' => 'default'), array('id' => 1)); } // ******** // @TO-DO - Upgrade test, will remove in future versions // REMOVED - 2.1.3 // ******** $test = $wpdb->get_col("Show columns from $table_name like 'test'"); if(!empty($test)){ $wpdb->query("ALTER TABLE $table_name DROP test"); } //Add column for repeater template alias $alias = $wpdb->get_col("Show columns from $table_name like 'alias'"); if(empty($alias)){ $wpdb->query("ALTER TABLE $table_name ADD alias TEXT NOT NULL"); } // Compare versions of repeaters, if template versions do not match, update the repeater with value from DB $version = $wpdb->get_var("SELECT pluginVersion FROM $table_name WHERE name = 'default'"); if($version != ALM_VERSION){ // First, make sure versions do not match. //Write to repeater file $data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'"); $f = ALM_PATH. 'core/repeater/default.php'; // File $o = fopen($f, 'w+'); //Open file $w = fwrite($o, $data); //Save the file $r = fread($o, 100000); //Read it fclose($o); //now close it } } // ********************************************** // If table DOES NOT exist, create it. // ********************************************** if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { $createRepeater = '
No terms exist within this taxonomy
"; die(); } } /* * alm_example_page * Examples Page * * @since 2.0.0 */ function alm_example_page(){ ?>All changes will be applied globally throughout your theme.', ALM_NAME) . '
'; } /* * alm_sanitize_settings * Sanitize our form fields * * @since 2.0.0 */ function alm_sanitize_settings( $input ) { return $input; } /* * alm_disable_css_callback * Diabale Ajax Load More CSS. * * @since 2.0.0 */ function alm_disable_css_callback(){ $options = get_option( 'alm_settings' ); if(!isset($options['_alm_disable_css'])) $options['_alm_disable_css'] = '0'; echo ' '; echo ''.__('View Ajax Load More CSS', ALM_NAME).'
'; ?> '; } /* * alm_class_callback * Add classes to the Ajax Load More wrapper * * @since 2.0.0 */ function alm_class_callback(){ $options = get_option( 'alm_settings' ); echo '