prefix . "alm"; //If alm 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_results("SELECT COLUMN_NAME FROM $table_name.COLUMNS WHERE column_name = '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 $row2 = $wpdb->get_results("SELECT COLUMN_NAME FROM $table_name.COLUMNS WHERE column_name = 'test'"); if(empty($row2)){ $wpdb->query("ALTER TABLE $table_name ADD test TEXT NOT NULL"); $wpdb->update($table_name , array('test' => 'test value'), array('id' => 1)); } // 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 } } } /* * alm_admin_vars * Create admin variables and ajax nonce * * @since 2.0.0 */ function alm_admin_vars() { ?>

A simple solution for lazy loading WordPress posts and pages

 
'; include( ALM_PATH. 'admin/includes/cta/extend.php'); echo '
'; } ?>
prefix . "alm"; if($n === 'default'){ $data_update = array('repeaterDefault' => "$c", 'pluginVersion' => ALM_VERSION); $data_where = array('name' => "default"); }else{ $data_update = array('repeaterDefault' => "$c", 'pluginVersion' => ALM_REPEATER_VERSION); $data_where = array('name' => $n); } $wpdb->update($table_name , $data_update, $data_where); //Our results if($w){ echo 'File saved'; } else { echo 'Error saving file'; } } /* * alm_shortcode_builder_page * Shortcode Builder * * @since 2.0.0 */ function alm_shortcode_builder_page(){ ?>

shortcode by adjusting the values below', ALM_NAME); ?>

five additional repeaters and allow you to select unique repeaters for different content types throughout your theme.

It\'s easy! Just build each repeater and then choose from the list of repeaters while building your shortcode.

Read/Write Access is required!

', ALM_NAME); ?>
Installed '; }else{ echo ' Purchase & Install'; } ?>
'; echo ''; echo ''; } function alm_adminFooter() { echo ''; echo ''; } /* * admin_init * Initiate the plugin, create our setting variables. * * @since 2.0.0 */ add_action( 'admin_init', 'alm_admin_init'); function alm_admin_init(){ register_setting( 'alm-setting-group', 'alm_settings', 'alm_sanitize_settings' ); add_settings_section( 'alm_general_settings', 'General Settings', 'alm_general_settings_callback', 'ajax-load-more' ); add_settings_field( '_alm_disable_css', __('Disable CSS', ALM_NAME ), 'alm_disable_css_callback', 'ajax-load-more', 'alm_general_settings' ); add_settings_field( '_alm_html5', __('HTML5 Elements', ALM_NAME ), 'alm_html5_callback', 'ajax-load-more', 'alm_general_settings' ); add_settings_field( '_alm_container_type', __('Container Type', ALM_NAME ), 'alm_container_type_callback', 'ajax-load-more', 'alm_general_settings' ); add_settings_field( '_alm_classname', __('Container Class', ALM_NAME ), 'alm_class_callback', 'ajax-load-more', 'alm_general_settings' ); add_settings_field( '_alm_btn_color', __('Button Color', ALM_NAME ), 'alm_btn_color_callback', 'ajax-load-more', 'alm_general_settings' ); } /* * alm_general_settings_callback * Some general settings text * * @since 2.0.0 */ function alm_general_settings_callback() { echo '

' . __('Customize your version of Ajax Load More by updating the fields below.

All changes will be applied globally accross 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_html5_callback * Enable HTML5 elements within AjaxLoadMore. * * @since 2.0.0 */ function alm_html5_callback(){ $options = get_option( 'alm_settings' ); if(!isset($options['_alm_html5'])) $options['_alm_html5'] = '1'; echo ' '; } /* * alm_class_callback * Enable HTML5 elements within AjaxLoadMore. * * @since 2.0.0 */ function alm_class_callback(){ $options = get_option( 'alm_settings' ); echo '
'; } /* * alm_container_type_callback * The type of container ul or div * * @since 2.0.0 */ function alm_container_type_callback() { $options = get_option( 'alm_settings' ); if(!isset($options['_alm_container_type'])) $options['_alm_container_type'] = '1'; $html = ''; $html .= '
'; $html .= ''; $html .= ''; echo $html; } /* * alm_btn_color_callback * Get button color * * @since 2.0.0 */ function alm_btn_color_callback() { $options = get_option( 'alm_settings' ); $color = $options['_alm_btn_color']; if(!isset($color)) $options['_alm_btn_color'] = '0'; $selected0 = ''; if($color == 'default') $selected0 = 'selected="selected"'; $selected1 = ''; if($color == 'blue') $selected1 = 'selected="selected"'; $selected2 = ''; if($color == 'green') $selected2 = 'selected="selected"'; $selected3 = ''; if($color == 'red') $selected3 = 'selected="selected"'; $selected4 = ''; if($color == 'purple') $selected4 = 'selected="selected"'; $selected5 = ''; if($color == 'grey') $selected5 = 'selected="selected"'; $html = ''; echo $html; }