prefix . "alm";
//If alm table is present
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
$version = $wpdb->get_var("SELECT pluginVersion FROM $table_name WHERE id = 1");
if($version != ALM_VERSION){
//Write to repeater file
$defaultRepeater = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE id = 1");
$f = ALM_PATH. '/core/repeater/default.php'; // File
$o = fopen($f, 'w+'); //Open file
$w = fwrite($o, $defaultRepeater); //Save the file
$r = fread($o, 100000); //Read it
fclose($o); //now close it
}
}
}
/**
* alm_admin_menu
* Create Admin Menu
*
* @since 2.0.0
*/
add_action( 'admin_menu', 'alm_admin_menu' );
function alm_admin_menu() {
$icon = 'dashicons-plus-alt';
$icon = ALM_ADMIN_URL . "/img/alm-logo-16x16.png";
add_menu_page( 'Ajax Load More', 'Ajax Load More', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page', $icon, 81 );
add_submenu_page( 'ajax-load-more', 'Settings', 'Settings', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page');
add_submenu_page( 'ajax-load-more', 'Repeaters', 'Repeaters', 'edit_theme_options', 'ajax-load-more-repeaters', 'alm_repeater_page');
add_submenu_page( 'ajax-load-more', 'Shortcode Builder', 'Shortcode Builder', 'edit_theme_options', 'ajax-load-more-shortcode-builder', 'alm_shortcode_builder_page');
add_submenu_page( 'ajax-load-more', 'Examples', 'Examples', 'edit_theme_options', 'ajax-load-more-examples', 'alm_example_page');
add_submenu_page( 'ajax-load-more', 'Add-ons', 'Add-ons', 'edit_theme_options', 'ajax-load-more-add-ons', 'alm_add_ons_page');
}
/*
* alm_settings_page
* Settings page
*
* @since 2.0.0
*/
function alm_settings_page(){ ?>
';
include( ALM_PATH. 'admin/includes/cta/extend.php');
echo '
';
}
?>
prefix . "alm";
$data_update = array('repeaterDefault' => "$c", 'pluginVersion' => ALM_VERSION);
$data_where = array('id' => "1");
$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(){ ?>
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;
}