| 1 |
<?php |
| 2 |
|
| 3 |
$loader_iamge = "<span class='display_none ays_chart_loader_box'><img src=". CHART_BUILDER_ADMIN_URL ."/images/loaders/loading.gif></span>"; |
| 4 |
|
| 5 |
if( isset( $_REQUEST['ays_submit'] ) ){ |
| 6 |
$this->settings_obj->store_data(); |
| 7 |
} |
| 8 |
|
| 9 |
$ays_tab = isset($_GET['ays_tab']) && esc_attr(stripslashes(sanitize_text_field($_GET['ays_tab']))) !== '' |
| 10 |
? esc_attr(stripslashes(sanitize_text_field($_GET['ays_tab']))) |
| 11 |
: 'tab1'; |
| 12 |
|
| 13 |
if ($ays_tab !== 'tab1' && $ays_tab !== 'tab2') { |
| 14 |
$url = remove_query_arg( array('ays_tab') ); |
| 15 |
wp_redirect( $url ); |
| 16 |
} |
| 17 |
|
| 18 |
$db_data = $this->settings_obj->get_all_data(); |
| 19 |
$options = ($this->settings_obj->get_setting('options') === false) ? array() : json_decode($this->settings_obj->get_setting('options'), true); |
| 20 |
|
| 21 |
global $wp_roles; |
| 22 |
$ays_users_roles = $wp_roles->role_names; |
| 23 |
$user_roles = $this->settings_obj->get_setting('user_roles'); |
| 24 |
if( $user_roles === null || $user_roles === false ){ |
| 25 |
$user_roles = array(); |
| 26 |
}else{ |
| 27 |
$user_roles = json_decode( $user_roles ); |
| 28 |
} |
| 29 |
|
| 30 |
// User roles to change plugin |
| 31 |
$user_roles_to_change_plugin = (isset($options['user_roles_to_change']) && !empty( $options['user_roles_to_change'] ) ) ? $options['user_roles_to_change'] : array('administrator'); |
| 32 |
|
| 33 |
$chart_title_length = (isset($options['title_length']) && $options['title_length'] != '') ? intval($options['title_length']) : 5; |
| 34 |
?> |
| 35 |
<div class="wrap" style="position:relative;"> |
| 36 |
<div class="container-fluid"> |
| 37 |
<div class="ays-chart-heading-box"> |
| 38 |
<div class="ays-chart-wordpress-user-manual-box"> |
| 39 |
<a href="https://ays-pro.com/wordpress-chart-builder-plugin-user-manual" target="_blank" style="text-decoration: none;font-size: 13px;"> |
| 40 |
<i class="ays_fa ays_fa_file_text" ></i> |
| 41 |
<span style="margin-left: 3px;text-decoration: underline;">View Documentation</span> |
| 42 |
</a> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
<form method="post" id="ays-settings-form"> |
| 46 |
<input type="hidden" name="ays_tab" value="<?php echo esc_attr($ays_tab); ?>"> |
| 47 |
<h1 class="wp-heading-inline"> |
| 48 |
<?php |
| 49 |
echo esc_html__('General Settings','chart-builder'); |
| 50 |
?> |
| 51 |
</h1> |
| 52 |
<hr /> |
| 53 |
<div class="ays-settings-wrapper ays-chart-general-settings"> |
| 54 |
<div> |
| 55 |
<div class="nav-tab-wrapper" style="position:sticky; top:35px;"> |
| 56 |
<a href="#tab1" data-tab="tab1" class="nav-tab <?php echo ($ays_tab == 'tab1') ? 'nav-tab-active' : ''; ?>"> |
| 57 |
<?php echo esc_html__("General", 'chart-builder');?> |
| 58 |
</a> |
| 59 |
<a href="#tab2" data-tab="tab2" class="nav-tab <?php echo ($ays_tab == 'tab2') ? 'nav-tab-active' : ''; ?>"> |
| 60 |
<?php echo esc_html__("Integrations", 'chart-builder');?> |
| 61 |
</a> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
<div class="ays-chart-tabs-wrapper"> |
| 65 |
<div id="tab1" class="ays-chart-tab-content ays-tab-content <?php echo ($ays_tab == 'tab1') ? 'ays-tab-content-active' : ''; ?>"> |
| 66 |
<p class="ays-subtitle"><?php echo esc_html__('General Settings','chart-builder')?></p> |
| 67 |
<hr /> |
| 68 |
<fieldset> |
| 69 |
<legend> |
| 70 |
<strong style="font-size:30px;"><i class="ays_fa ays_fa_globe"></i></strong> |
| 71 |
<h5><?php echo esc_html__('Who will have permission to Chart Builder','chart-builder')?></h5> |
| 72 |
</legend> |
| 73 |
<div class="form-group row" style="margin:0px;"> |
| 74 |
<div class="ays-pro-features-v2-main-box"> |
| 75 |
<div class="ays-pro-features-v2-small-buttons-box"> |
| 76 |
<div class="ays-pro-features-v2-video-button"></div> |
| 77 |
<a href="https://ays-pro.com/wordpress/chart-builder" target="_blank" class="ays-pro-features-v2-upgrade-button"> |
| 78 |
<div class="ays-pro-features-v2-upgrade-icon" style="background-image: url('<?php echo esc_attr(CHART_BUILDER_ADMIN_URL); ?>/images/icons/pro-features-icons/Locked_24x24.svg');" data-img-src="<?php echo esc_attr(CHART_BUILDER_ADMIN_URL); ?>/images/icons/pro-features-icons/Locked_24x24.svg"></div> |
| 79 |
<div class="ays-pro-features-v2-upgrade-text"> |
| 80 |
<?php echo esc_html__("Upgrade" , "chart-builder"); ?> |
| 81 |
</div> |
| 82 |
</a> |
| 83 |
</div> |
| 84 |
<div class="form-group row"> |
| 85 |
<div class="form-group row"> |
| 86 |
<div class="col-sm-4"> |
| 87 |
<label for="ays_user_roles"> |
| 88 |
<?php echo esc_html__( "Select user role for giving access to Chart Builder menu", 'chart-builder' ); ?> |
| 89 |
<a class="ays_help" data-bs-toggle="tooltip" title="<?php echo esc_attr(__("Give access to the Chart Builder plugin to only the selected user role(s) on your WP dashboard. Each selected user will see only his/her created charts.",'chart-builder'))?>"> |
| 90 |
<i class="ays_fa ays_fa_info_circle"></i> |
| 91 |
</a> |
| 92 |
</label> |
| 93 |
</div> |
| 94 |
<div class="col-sm-8"> |
| 95 |
<select name="ays_user_roles[]" id="ays_user_roles" multiple> |
| 96 |
<?php |
| 97 |
foreach($ays_users_roles as $role => $role_name){ |
| 98 |
$selected = in_array($role, $user_roles) ? 'selected' : ''; |
| 99 |
echo "<option ". esc_html($selected) ." value='".esc_attr($role)."'>".esc_attr($role_name)."</option>"; |
| 100 |
} |
| 101 |
?> |
| 102 |
</select> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
<hr style="opacity:.25;margin:1rem 0;"> |
| 106 |
<div class="form-group row"> |
| 107 |
<div class="col-sm-4"> |
| 108 |
<label for="ays_user_roles_to_change_plugin"> |
| 109 |
<?php echo esc_html__( "Select user role for giving access to change all chart data", 'chart-builder' ); ?> |
| 110 |
<a class="ays_help" data-bs-toggle="tooltip" title="<?php echo esc_attr(__('Give permissions to manage all charts and submissions to these user roles. Please add the given user roles to the above field as well.','chart-builder'))?>"> |
| 111 |
<i class="ays_fa ays_fa_info_circle"></i> |
| 112 |
</a> |
| 113 |
</label> |
| 114 |
</div> |
| 115 |
<div class="col-sm-8 ays-chart-user-roles"> |
| 116 |
<select name="ays_user_roles_to_change_plugin[]" id="ays_user_roles_to_change_plugin" multiple> |
| 117 |
<?php |
| 118 |
foreach($ays_users_roles as $role => $role_name){ |
| 119 |
$selected = in_array($role, $user_roles_to_change_plugin) ? 'selected' : ''; |
| 120 |
echo "<option ". esc_html($selected) ." value='".esc_attr($role)."'>".esc_attr($role_name)."</option>"; |
| 121 |
} |
| 122 |
?> |
| 123 |
</select> |
| 124 |
</div> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
<br> |
| 128 |
<blockquote> |
| 129 |
<?php echo esc_html__( "Control the access of the plugin from the dashboard and manage the capabilities of those user roles.", 'chart-builder' ); ?> |
| 130 |
<br> |
| 131 |
<?php echo esc_html__( "If you want to give a full control to the given user role, please add the role in both fields.", 'chart-builder'); ?> |
| 132 |
</blockquote> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
</fieldset> |
| 136 |
<hr> |
| 137 |
<fieldset> |
| 138 |
<legend> |
| 139 |
<strong style="font-size:30px;"><i class="ays_fa ays_fa_text"></i></strong> |
| 140 |
<h5><?php echo esc_html__('Except words count in list table','chart-builder')?></h5> |
| 141 |
</legend> |
| 142 |
<div class="form-group row"> |
| 143 |
<div class="col-sm-4"> |
| 144 |
<label for="ays_chart_title_length"> |
| 145 |
<?php echo esc_html__( "Charts list table", 'chart-builder' ); ?> |
| 146 |
<a class="ays_help" data-bs-toggle="tooltip" title="<?php echo esc_attr(__('Determine the length of the questions to be shown in the Charts List Table by putting your preferred count of words in the following field. (For example: if you put 10, you will see the first 10 words of each question in the Charts page of your dashboard.', 'chart-builder')); ?>"> |
| 147 |
<i class="ays_fa ays_fa_info_circle"></i> |
| 148 |
</a> |
| 149 |
</label> |
| 150 |
</div> |
| 151 |
<div class="col-sm-8"> |
| 152 |
<input type="number" name="ays_chart_title_length" id="ays_chart_title_length" class="ays-text-input" value="<?php echo esc_attr($chart_title_length); ?>"> |
| 153 |
</div> |
| 154 |
</div> |
| 155 |
</fieldset> <!-- Excerpt words count in list table --> |
| 156 |
</div> |
| 157 |
<div id="tab2" class="ays-chart-tab-content ays-tab-content <?php echo ($ays_tab == 'tab2') ? 'ays-tab-content-active' : ''; ?>"> |
| 158 |
<p class="ays-subtitle"><?php echo esc_html__('Integrations','chart-builder')?></p> |
| 159 |
<hr /> |
| 160 |
<?php |
| 161 |
do_action( 'ays_cb_settings_page_integrations' ); |
| 162 |
?> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
</div> |
| 166 |
<hr /> |
| 167 |
<div style="position:sticky;padding:15px 0px;bottom:0;"> |
| 168 |
<?php |
| 169 |
wp_nonce_field('settings_action', 'settings_action'); |
| 170 |
$other_attributes = array(); |
| 171 |
submit_button(esc_html__('Save changes', 'chart-builder'), 'primary ays-chart-loader-banner ays-chart-gen-settings-save', 'ays_submit', true, $other_attributes); |
| 172 |
$loader_sanitize_properties = Chart_Builder_Admin::get_allowed_tags_for_loader(); |
| 173 |
$sanitized_loader_iamge = wp_kses($loader_iamge, $loader_sanitize_properties); |
| 174 |
echo wp_kses_post($sanitized_loader_iamge); |
| 175 |
?> |
| 176 |
</div> |
| 177 |
</form> |
| 178 |
</div> |
| 179 |
</div> |
| 180 |
|