asset-manager
5 years ago
dashboard-widgets
6 months ago
metaboxes
1 week ago
settings
4 months ago
stats
1 week ago
templates
1 week ago
addons-list.php
1 week ago
admin-footer.php
2 months ago
admin-head.php
2 years ago
edit-store-profile.php
5 years ago
iconfinder.php
2 years ago
page-header.php
6 months ago
settings.php
6 months ago
stats.php
6 months ago
welcome.php
6 months ago
settings.php
263 lines
| 1 | <?php |
| 2 | |
| 3 | use WPDM\Admin\Menu\Settings; |
| 4 | |
| 5 | if ( ! defined( "ABSPATH" ) ) { |
| 6 | die( "Shit happens!" ); |
| 7 | } |
| 8 | ?> |
| 9 | <style> |
| 10 | #wpfooter { |
| 11 | display: none; |
| 12 | } |
| 13 | </style> |
| 14 | <div class="wrap w3eden <?php echo (int)get_option('__wpdm_left_aligned', 0) === 0 ? 'wpdms-body-centered': '' ?>"> |
| 15 | <form method="post" id="wdm_settings_form"> |
| 16 | <?php |
| 17 | |
| 18 | $actions = [ |
| 19 | [ |
| 20 | 'type' => "submit", |
| 21 | "class" => "primary btn-full-height", |
| 22 | "name" => '<i class="sinc far fa-hdd"></i> ' . __( "Save Settings", "download-manager" ) |
| 23 | ] |
| 24 | ]; |
| 25 | |
| 26 | //WPDM()->admin->pageHeader(esc_attr__('Settings', WPDM_TEXT_DOMAIN), 'cog sinc color-purple', [], $actions, ['class' => 'pr-0']); |
| 27 | |
| 28 | ?> |
| 29 | |
| 30 | |
| 31 | |
| 32 | <?php |
| 33 | wp_nonce_field( WPDMSET_NONCE_KEY, '__wpdms_nonce' ); |
| 34 | ?> |
| 35 | <div class="panel panel-default" id="wpdm-wrapper-panel"> |
| 36 | |
| 37 | <div id="wpdm-admin-page-container"> |
| 38 | <div id="wpdm-admin-page-sidebar" data-simplebar> |
| 39 | <div id="sidebarlogo" class="panel panel-default"> |
| 40 | <a href="https://www.wpdownloadmanager.com/" target="_blank"> |
| 41 | <svg style="width: 160px;" xmlns="http://www.w3.org/2000/svg" |
| 42 | xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 327.3 327.3"> |
| 43 | <g id="Layer_2" data-name="Layer 2"> |
| 44 | <g id="download-manager-logo"> |
| 45 | <g id="wpdm_logo_v3" data-name="WordPress Download Manage Pro"> |
| 46 | <path id="arrow" fill="#3c80e4" |
| 47 | d="M149.87,180.29l-91.41-91A20,20,0,0,1,58.39,61L64,55.36a20,20,0,0,1,28.29-.07l71.52,71.18,71-71.7a20,20,0,0,1,28.29-.13l5.68,5.62a20,20,0,0,1,.14,28.29l-90.75,91.64A20,20,0,0,1,149.87,180.29Z"></path> |
| 48 | <path id="circle" |
| 49 | d="M186.66,202.9a32,32,0,0,1-45.29.16L97.58,159.48a78,78,0,1,0,132.49-.41Z" |
| 50 | style="fill: #094168;"></path> |
| 51 | </g> |
| 52 | </g> |
| 53 | </g> |
| 54 | </svg> |
| 55 | </a> |
| 56 | </div> |
| 57 | <div> |
| 58 | <ul id="tabs" class="nav nav-pills nav-stacked settings-tabs"> |
| 59 | <?php Settings::renderMenu( $tab = wpdm_query_var( 'tab', [ |
| 60 | 'validate' => 'txt', |
| 61 | 'default' => 'basic' |
| 62 | ] ) ); ?> |
| 63 | </ul> |
| 64 | </div> |
| 65 | <div class="panel panel-default sidebar-button"> |
| 66 | <div class="panel-body"> |
| 67 | <button type="submit" style="min-width:200px" class="btn btn-admin btn-block btn-lg"> |
| 68 | <i class="sinc far fa-hdd"></i> |
| 69 | <?php _e( "Save Settings", "download-manager" ); ?> |
| 70 | </button> |
| 71 | </div> |
| 72 | </div> |
| 73 | </div> |
| 74 | <div id="wpdm-admin-page-body"> |
| 75 | <div class="tab-content"> |
| 76 | <div class="panel panel-default" id="setting-head"> |
| 77 | <div class="panel-body" style="padding: 20px 0 !important;"> |
| 78 | <div class="media"> |
| 79 | <div class="pull-right"> |
| 80 | <div id="wpdm_notify" |
| 81 | style="position: fixed; cursor: pointer;right: 20px;bottom: 20px"></div> |
| 82 | <button type="submit" style="min-width:200px" |
| 83 | class="btn btn-admin btn-block btn-lg"> |
| 84 | <i class="sinc far fa-hdd"></i> |
| 85 | <?php _e( "Save Settings", "download-manager" ); ?> |
| 86 | </button> |
| 87 | </div> |
| 88 | <div class="media-body"> |
| 89 | <h2 class="m-0" id="stitle" style="font-size: 14pt;line-height: 42px"> |
| 90 | <div class="pull-left text-primary" style="width: 28px"> |
| 91 | <svg id="leftal" style="width: 24px;margin-top: 11px;margin-right: 6px;" |
| 92 | xmlns="http://www.w3.org/2000/svg" |
| 93 | xmlns:xlink="http://www.w3.org/1999/xlink" |
| 94 | viewBox="0 0 327.3 327.3"> |
| 95 | <title>wpdm logo v3</title> |
| 96 | <g id="Layer_2" data-name="Layer 2"> |
| 97 | <g id="download-manager-logo"> |
| 98 | <g id="wpdm_logo_v3" data-name="wpdm logo v3"> |
| 99 | <path id="arrow" fill="#3c80e4" |
| 100 | d="M149.87,180.29l-91.41-91A20,20,0,0,1,58.39,61L64,55.36a20,20,0,0,1,28.29-.07l71.52,71.18,71-71.7a20,20,0,0,1,28.29-.13l5.68,5.62a20,20,0,0,1,.14,28.29l-90.75,91.64A20,20,0,0,1,149.87,180.29Z"/> |
| 101 | <path id="circle" |
| 102 | d="M186.66,202.9a32,32,0,0,1-45.29.16L97.58,159.48a78,78,0,1,0,132.49-.41Z" |
| 103 | style="fill: #094168;"/> |
| 104 | </g> |
| 105 | </g> |
| 106 | </g> |
| 107 | </svg> |
| 108 | <i :class="icon" id="centeral"></i> |
| 109 | </div> |
| 110 | <?= __( 'Settings', WPDM_TEXT_DOMAIN ) ?> <i |
| 111 | class="fa fa-angle-double-right"></i> <span>{{stitle}}</span> |
| 112 | </h2> |
| 113 | </div> |
| 114 | </div> |
| 115 | </div> |
| 116 | </div> |
| 117 | <div style="height: 55px"></div> |
| 118 | <div class="alert alert-success" |
| 119 | style="max-width: 300px !important;display: none;position: fixed; right: 15px;top: 80px;background: #ffffff !important;cursor: pointer" |
| 120 | id="wpdm_message"></div> |
| 121 | |
| 122 | <input type="hidden" name="task" id="task" value="wdm_save_settings"/> |
| 123 | <input type="hidden" name="action" id="action" value="wpdm_settings"/> |
| 124 | <input type="hidden" name="section" id="section" value="<?php echo $tab; ?>"/> |
| 125 | <div id="fm_settings"> |
| 126 | <?php |
| 127 | global $stabs; |
| 128 | if ( isset( $stabs[ $tab ], $stabs[ $tab ]['callback'] ) ) { |
| 129 | call_user_func( $stabs[ $tab ]['callback'] ); |
| 130 | } else { |
| 131 | echo "<div class='panel panel-danger'><div class='panel-body color-red'><i class='fa fa-exclamation-triangle'></i> " . __( "Something is wrong!", "download-manager" ) . "</div></div>"; |
| 132 | } |
| 133 | ?> |
| 134 | </div> |
| 135 | |
| 136 | |
| 137 | </div> |
| 138 | </div> |
| 139 | |
| 140 | </div> |
| 141 | |
| 142 | |
| 143 | </div> |
| 144 | |
| 145 | </form> |
| 146 | <link rel="stylesheet" href="<?php echo WPDM_BASE_URL ?>assets/simplebar/simplebar.css"/> |
| 147 | <script src="<?php echo WPDM_BASE_URL ?>assets/simplebar/simplebar.min.js"></script> |
| 148 | <script> |
| 149 | |
| 150 | const { createApp } = Vue; |
| 151 | |
| 152 | var stitle = createApp({ |
| 153 | data() { |
| 154 | return { |
| 155 | stitle: '<?= __( 'General', WPDM_TEXT_DOMAIN ); ?>', |
| 156 | icon: 'fa-solid fa-sliders' |
| 157 | }; |
| 158 | } |
| 159 | }).mount('#stitle'); |
| 160 | |
| 161 | jQuery(function ($) { |
| 162 | var $body = $('body'), section; |
| 163 | $body.on('click', '#wpdm_message.alert-success', function () { |
| 164 | $(this).fadeOut(); |
| 165 | }); |
| 166 | |
| 167 | stitle.stitle = $('#tabs li.active a').text(); |
| 168 | stitle.icon = $('#tabs li.active a').data('icon'); |
| 169 | |
| 170 | $('select:not(.system-ui)').select2({minimumResultsForSearch: 6}); |
| 171 | $("ul#tabs li").click(function () { |
| 172 | |
| 173 | }); |
| 174 | $('#wpdm_message').removeClass('hide').hide(); |
| 175 | $("ul#tabs li a").click(function () { |
| 176 | stitle.stitle = $(this).text(); |
| 177 | stitle.icon = $(this).data('icon'); |
| 178 | ///jQuert("ul#tabs li").removeClass('active') |
| 179 | $("ul#tabs li").removeClass("active"); |
| 180 | $(this).parent('li').addClass('active'); |
| 181 | WPDM.blockUI('#fm_settings'); |
| 182 | section = this.id; |
| 183 | $.post(ajaxurl, {action: 'wpdm_settings', section: this.id}, function (res) { |
| 184 | $('#fm_settings').html(res); |
| 185 | $('#section').val(section) |
| 186 | $('select:not(.system-ui)').select2({minimumResultsForSearch: 6}); |
| 187 | window.history.pushState({ |
| 188 | "html": res, |
| 189 | "pageTitle": "response.pageTitle" |
| 190 | }, "", "edit.php?post_type=wpdmpro&page=wpdm-settings&tab=" + section); |
| 191 | $('#wpdm-lsp').fadeOut(function () { |
| 192 | $(this).remove(); |
| 193 | }); |
| 194 | WPDM.unblockUI('#fm_settings'); |
| 195 | $('#ttip').tooltip({placement: 'bottom'}); |
| 196 | }); |
| 197 | return false; |
| 198 | }); |
| 199 | |
| 200 | window.onpopstate = function (e) { |
| 201 | if (e.state) { |
| 202 | $("#fm_settings").html(e.state.html); |
| 203 | //document.title = e.state.pageTitle; |
| 204 | } |
| 205 | }; |
| 206 | |
| 207 | |
| 208 | $('#wdm_settings_form').submit(function () { |
| 209 | |
| 210 | $('.sinc').removeClass('far fa-hdd').addClass('fas fa-sun fa-spin'); |
| 211 | |
| 212 | $(this).ajaxSubmit({ |
| 213 | url: ajaxurl, |
| 214 | beforeSubmit: function (formData, jqForm, options) { |
| 215 | $('.wpdm-ssb').addClass('wpdm-spin'); |
| 216 | $('#wdms_loading').addClass('wpdm-spin'); |
| 217 | }, |
| 218 | success: function (response) { |
| 219 | var section = $('input#section').val(); |
| 220 | if (typeof response === 'string') |
| 221 | WPDM.notify("<div style='margin-bottom: 5px;text-transform: uppercase'><strong>" + $('#' + section).html() + "</strong></div>" + response, 'success', '#wpdm_notify', 10000); |
| 222 | else { |
| 223 | if (response.success === true) |
| 224 | WPDM.notify("<div style='margin-bottom: 5px;text-transform: uppercase'><strong>" + $('#' + section).html() + ":</strong></div>" + response.msg, 'success', '#wpdm_notify', 10000); |
| 225 | if (response.success === false) |
| 226 | WPDM.notify("<div style='margin-bottom: 5px;text-transform: uppercase'><strong>" + $('#' + section).html() + ":</strong></div>" + response.msg, 'danger', '#wpdm_notify', 10000); |
| 227 | if (response.reload === true) { |
| 228 | $('#' + section).trigger('click'); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | WPDM.doAction("wpdm_save_settings", $('#section').val(), response) |
| 233 | |
| 234 | $('.wpdm-ssb').removeClass('wpdm-spin'); |
| 235 | $('.sinc').removeClass('fas fa-sun fa-spin').addClass('far fa-hdd'); |
| 236 | $('#wdms_loading').removeClass('wpdm-spin'); |
| 237 | } |
| 238 | }); |
| 239 | |
| 240 | return false; |
| 241 | }); |
| 242 | |
| 243 | $('body').on("click", '.nav-tabs a', function (e) { |
| 244 | e.preventDefault(); |
| 245 | $(this).tab('show'); |
| 246 | }); |
| 247 | |
| 248 | function adjustSidebarHeight() { |
| 249 | var abh = $('#wpadminbar').height(); |
| 250 | $('#wpdm-admin-page-sidebar').css('height', (window.innerHeight - abh) + 'px'); |
| 251 | } |
| 252 | |
| 253 | adjustSidebarHeight(); |
| 254 | $(window).on('resize', function () { |
| 255 | adjustSidebarHeight(); |
| 256 | }); |
| 257 | |
| 258 | |
| 259 | }); |
| 260 | |
| 261 | </script> |
| 262 | |
| 263 |