| 1 |
<?php |
| 2 |
/** |
| 3 |
* UsersWP import export Settings |
| 4 |
* |
| 5 |
* @author AyeCode |
| 6 |
* @category Admin |
| 7 |
* @package userswp/Admin |
| 8 |
* @version 1.0.24 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
if ( ! class_exists( 'UsersWP_Settings_Addons', false ) ) : |
| 16 |
|
| 17 |
/** |
| 18 |
* UsersWP_Settings_Email. |
| 19 |
*/ |
| 20 |
class UsersWP_Settings_Addons extends UsersWP_Settings_Page { |
| 21 |
|
| 22 |
public function __construct() { |
| 23 |
|
| 24 |
$this->id = 'uwp-addons'; |
| 25 |
$this->label = __( 'Addons', 'userswp' ); |
| 26 |
|
| 27 |
add_filter( 'uwp_settings_tabs_array', array( $this, 'add_settings_page' ), 99 ); |
| 28 |
add_action( 'uwp_settings_' . $this->id, array( $this, 'output' ) ); |
| 29 |
add_action( 'uwp_sections_' . $this->id, array( $this, 'output_toggle_advanced' ) ); |
| 30 |
add_action( 'uwp_settings_save_' . $this->id, array( $this, 'save' ) ); |
| 31 |
add_action( 'uwp_sections_' . $this->id, array( $this, 'output_sections' ) ); |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Output the settings. |
| 37 |
*/ |
| 38 |
public function output() { |
| 39 |
global $current_section; |
| 40 |
|
| 41 |
$settings = $this->get_settings( $current_section ); |
| 42 |
|
| 43 |
UsersWP_Admin_Settings::output_fields( $settings ); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Save settings. |
| 48 |
*/ |
| 49 |
public function save() { |
| 50 |
global $current_section; |
| 51 |
|
| 52 |
$settings = $this->get_settings( $current_section ); |
| 53 |
UsersWP_Admin_Settings::save_fields( $settings ); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Get sections. |
| 58 |
* |
| 59 |
* @return array |
| 60 |
*/ |
| 61 |
public function get_sections() |
| 62 |
{ |
| 63 |
|
| 64 |
$sections = array( |
| 65 |
'' => __('Addons', 'userswp'), |
| 66 |
); |
| 67 |
|
| 68 |
return apply_filters('uwp_get_sections_' . $this->id, $sections); |
| 69 |
} |
| 70 |
|
| 71 |
public function get_settings($current_section = '') |
| 72 |
{ |
| 73 |
$settings = array(); |
| 74 |
|
| 75 |
if ('' == $current_section) { |
| 76 |
|
| 77 |
global $uwp_hide_save_button; |
| 78 |
$uwp_hide_save_button = true; |
| 79 |
|
| 80 |
$settings = array( |
| 81 |
array( |
| 82 |
'title' => __('UsersWP Addons', 'userswp'), |
| 83 |
'type' => 'title', |
| 84 |
'desc' => sprintf(__('Please select an addon to view its settings. Check our list of addons available for UsersWP %s here %s','userswp'), '<a href="https://userswp.io/downloads/category/addons/" target="_blank">', '</a>'), |
| 85 |
'id' => 'addons_general_settings_options', |
| 86 |
'desc_tip' => false, |
| 87 |
), |
| 88 |
array('type' => 'sectionend', 'id' => 'addons_general_settings_options'), |
| 89 |
); |
| 90 |
|
| 91 |
} |
| 92 |
|
| 93 |
return apply_filters('uwp_get_settings_' . $this->id, $settings, $current_section); |
| 94 |
} |
| 95 |
|
| 96 |
} |
| 97 |
|
| 98 |
endif; |
| 99 |
|
| 100 |
|
| 101 |
return new UsersWP_Settings_Addons(); |