';
}
/**
* Generate options
*/
public function generate_options( $options ) {
$plugin_options = get_option( 'aws_settings' );
if ( empty( $options ) ) {
return;
}
foreach ( $options as $k => $value ) {
switch ( $value['type'] ) {
case 'text': ?>
$label ) { ?>
>
$label ) { ?>
>
0 ) {
foreach ($inactive_buttons as $button) {
echo '
' . $button . '
';
}
}
?>
0 ) {
foreach ($active_buttons as $button) {
if ( ! $button ) continue;
echo '
' . $button . '
';
}
}
?>
';
echo '
Reindex table
';
echo '
';
echo '
';
echo 'Update all data in plugins index table. Index table - table with products data where plugin is searching all typed terms. Use this button if you think that plugin not shows last actual data in its search results. CAUTION: this can take large amount of time.';
echo '
';
echo '
';
}
/*
* Options array that generate settings page
*/
public function options_array() {
require_once AWS_DIR .'/includes/options.php';
return $options;
}
/*
* Register plugin settings
*/
public function register_settings() {
register_setting( 'aws_settings', 'aws_settings' );
}
/*
* Get plugin settings
*/
public function get_settings() {
$plugin_options = get_option( 'aws_settings' );
return $plugin_options;
}
/**
* Initialize settings to their default values
*/
public function initialize_settings() {
$options = $this->options_array();
$default_settings = array();
foreach ( $options as $section ) {
foreach ($section as $values) {
if ( $values['type'] === 'heading' ) {
continue;
}
$default_settings[$values['id']] = $values['value'];
if (isset( $values['sub_option'])) {
$default_settings[$values['sub_option']['id']] = $values['sub_option']['value'];
}
}
}
update_option( 'aws_settings', $default_settings );
}
/*
* Enqueue admin scripts and styles
*/
public function admin_enqueue_scripts() {
if ( isset( $_GET['page'] ) && $_GET['page'] == 'aws-options' ) {
wp_enqueue_style( 'plugin-admin-style', AWS_URL . '/assets/css/admin.css', array(), AWS_VERSION );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'plugin-admin-scripts', AWS_URL . '/assets/js/admin.js', array('jquery'), AWS_VERSION );
wp_localize_script( 'plugin-admin-scripts', 'aws_vars', array( 'ajaxurl' => admin_url('admin-ajax.php' ) ) );
}
}
}
endif;
new AWS_Admin();