PluginProbe
WP Docs / 2.3.2
WP Docs v2.3.2
2.3.4 2.3.3 2.3.2 trunk 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1
← All changes | inc/functions.php +580 -292 2.2.32.3.2 View file →
@@ -1,6 +1,18 @@
1 1 <?php
2 -
2 + if(!function_exists('wpdocs_secure_url')){
3 + function wpdocs_secure_url($file_id=''){
4 +
5 + $ret = add_query_arg(
6 + array(
7 + 'wpdocs_dl' => $file_id,
8 + 'wpdocs_nonce' => wp_create_nonce('wpdocs_dl_'.$file_id),
9 + ),
10 + home_url('/')
11 + );
12 + return $ret;
13 + }
14 + }
3 15 if(!function_exists('wp_docs_get_memphis_dir_option_id')){
4 16 function wp_docs_get_option_id($option_name){
5 17 global $wpdb;
6 18 $option_name = esc_sql( $option_name );
@@ -44,8 +56,10 @@
44 56 function wpdocs_admin_enqueue_script()
45 57 {
46 58 if (isset($_GET['page']) && $_GET['page'] == 'wpdocs') {
47 59
60 + //pree(get_option('mdocs-list'));exit;
61 +
48 62 global $wpdocs_pro, $wpdocs_options;
49 63
50 64 wp_enqueue_script('wpdocs_boostrap', plugin_dir_url(dirname(__FILE__)) . 'js/bootstrap.min.js', array('jquery'));
51 65 wp_enqueue_style('wpdocs-boostrap', plugins_url('css/bootstrap.min.css', dirname(__FILE__)));
@@ -65,8 +79,9 @@
65 79 wp_enqueue_style('wpdocs-common', plugins_url('css/common-styles.css', dirname(__FILE__)), array(), date('Ymdhi'));
66 80 wp_enqueue_style('wpdocs-admin', plugins_url('css/admin-styles.css', dirname(__FILE__)), array(), date('Ymdhi'));
67 81
68 82 wp_enqueue_script('wpdocs_admin_scripts', plugin_dir_url(dirname(__FILE__)) . 'js/admin-scripts.js', array('jquery', 'jquery-ui-dialog'), time());
83 + wp_enqueue_script('wpdocs_verify_scripts', plugin_dir_url(dirname(__FILE__)) . 'js/verify-scripts.js', array('jquery', 'jquery-ui-dialog'), time());
69 84
70 85 if($wpdocs_pro){
71 86 wp_enqueue_script('wpdocs_pro_scripts', plugin_dir_url(dirname(__FILE__)) . 'pro/wp-docs-admin.js?t='.time(), array('jquery'));
72 87 }
@@ -83,8 +98,9 @@
83 98 'wpdocs_admin_scripts',
84 99 'wpdocs_ajax_object',
85 100 array(
86 101 'ajax_url' => admin_url('admin-ajax.php'),
102 + 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'),
87 103 'url' => admin_url('options-general.php?page=wpdocs'),
88 104 'wpdocs_pro' => $wpdocs_pro,
89 105 'wpdocs_delete_msg' => __('Do you want to delete this directory and data as well?', 'wp-docs'),
90 106 'wpdocs_delete_shortcut_msg' => __('Do you want to delete this shortcut?', 'wp-docs'),
@@ -100,16 +116,64 @@
100 116 'undo_import_confirm' => __('Do you want to rollback the import?', 'wp-docs'),
101 117 'select_role_str' => __('Select roles to allow upload', 'wp-docs'),
102 118 'rename_confirm' => __('Do you want to rename this directory?', 'wp-docs'),
103 119 'reset_confirm' => __('Do you want to reset all settings and clear directories?', 'wp-docs'),
104 - 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'),
120 +
105 121 'empty_settings' => empty($wpdocs_options),
106 122 'wc_os_pg' => (isset($_GET['pg'])?esc_attr($_GET['pg']):'0'),
107 123 'wc_os_tab' => (isset($_GET['t'])?esc_attr($_GET['t']):'0'),
108 - 'all_dirs' => $dir_id_to_titles
124 + 'all_dirs' => $dir_id_to_titles,
125 + 'rename_confirm' => __('Please enter new folder name:', 'wp-docs'),
109 126
110 127 )
111 128 );
129 +
130 + wp_localize_script(
131 + 'wpdocs_verify_scripts',
132 + 'wpdocs_vars',
133 + array(
134 + 'ajax_url' => admin_url('admin-ajax.php'),
135 + 'url' => admin_url('options-general.php?page=wpdocs'),
136 + 'nonce' => wp_create_nonce('wpdocs_verify_nonce'),
137 + 'preparing_queue' => __('Preparing verification queue...', 'wp-docs'),
138 + 'unable_to_start' => __('Unable to start verification.', 'wp-docs'),
139 + 'ajax_error' => __('AJAX error.', 'wp-docs'),
140 + 'verification_failed' => __('Verification failed.', 'wp-docs'),
141 + 'verification_completed' => __('Verification completed.', 'wp-docs'),
142 + 'verification_interrupted' => __('Verification interrupted.', 'wp-docs'),
143 + 'checking_folder' => __('Checking Folder:', 'wp-docs'),
144 + 'checking_file' => __('Checking File:', 'wp-docs'),
145 + 'unknown_file' => __('Unknown File', 'wp-docs'),
146 + 'items_processed' => __('items processed', 'wp-docs'),
147 + 'total_folders' => __('Total Folders', 'wp-docs'),
148 + 'verified_folders' => __('Verified Folders', 'wp-docs'),
149 + 'missing_folders' => __('Missing Folders', 'wp-docs'),
150 + 'total_files' => __('Total Files', 'wp-docs'),
151 + 'verified_files' => __('Verified Files', 'wp-docs'),
152 + 'missing_files' => __('Missing Files', 'wp-docs'),
153 + 'missing_folder' => __('MISSING FOLDER', 'wp-docs'),
154 + 'missing_file' => __('MISSING FILE', 'wp-docs'),
155 + 'no_items_display' => __('No items to display.', 'wp-docs'),
156 + 'import_in_progress' => __('Import is already in progress. Please wait.', 'wp-docs'),
157 + 'import_missing_confirm' => __('This will import only missing folders and files. Do you want to continue?', 'wp-docs'),
158 + 'initializing' => __('Initializing...', 'wp-docs'),
159 + 'preparing_import_queue' => __('Preparing import queue...', 'wp-docs'),
160 + 'unable_to_start_import' => __('Unable to start import.', 'wp-docs'),
161 + 'import_failed' => __('Import failed.', 'wp-docs'),
162 + 'import_completed' => __('Import completed!', 'wp-docs'),
163 + 'refreshing_results' => __('Refreshing verification results...', 'wp-docs'),
164 + 'import_interrupted' => __('Import interrupted. Please try again.', 'wp-docs'),
165 + 'creating_folder' => __('Creating Folder:', 'wp-docs'),
166 + 'importing_file' => __('Importing File:', 'wp-docs'),
167 + 'path' => __('Path:', 'wp-docs'),
168 + 'target' => __('Target:', 'wp-docs'),
169 + 'folders_imported' => __('Folders imported:', 'wp-docs'),
170 + 'files_imported' => __('Files imported:', 'wp-docs'),
171 + 'failed' => __('Failed:', 'wp-docs'),
172 + 'please_wait' => __('Please wait...', 'wp-docs'),
173 + 'import_missing_items' => __('Import Missing Items Only', 'wp-docs'),
174 + )
175 + );
112 176 }
113 177 }
114 178
115 179 add_filter( 'ajax_query_attachments_args', 'wpdocs_filter_media');
@@ -419,8 +483,10 @@
419 483 $dir_id = (!$dir_id && array_key_exists('dir', $_GET)?sanitize_wpdocs_data($_GET['dir']):0);
420 484
421 485 $params_array = array(
422 486 'dir_id' => $dir_id,
487 +
488 + 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'),
423 489 'parent_dir' => get_permalink($post->ID).'/?dir=',
424 490 'wpdocs_pro' => $wpdocs_pro,
425 491 'details_view_sorting' => $details_view_sorting,
426 492 'ajax_based_deep_search' => $ajax_based_deep_search,
@@ -436,9 +502,8 @@
436 502 'block_ui' => __('Please wait...', 'wp-docs'),
437 503 'is_ajax' => $is_ajax,
438 504 'is_ajax_url' => $is_ajax_url,
439 505 'del_from_front' => array_key_exists('del_from_front', $wpdocs_options),
440 - 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'),
441 506 'restriction_load' => isset($_GET['wpdocs_restriction']),
442 507 'restriction_id' => isset($_GET['wpdocs_restriction']) ? $_GET['wpdocs_restriction'] : '',
443 508 'restriction_container' => isset($_GET['wpdocs_container']) ? $_GET['wpdocs_container'] : '',
444 509 'current_user_id' => get_current_user_id(),
@@ -624,8 +689,13 @@
624 689 add_action('wp_ajax_wpdocs_create_folder', 'wpdocs_create_folder');
625 690
626 691 function wpdocs_create_folder()
627 692 {
693 + if ( ! current_user_can( 'manage_options' ) ) {
694 + wp_send_json_error( __("Unauthorized user", 'wp-docs') );
695 + wp_die();
696 + }
697 +
628 698 $nonce = sanitize_wpdocs_data(wp_unslash($_POST['nonce']));
629 699
630 700 if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) )
631 701 die (__("Sorry, your nonce did not verify.", 'wp-docs'));
@@ -639,9 +709,29 @@
639 709 $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid);
640 710
641 711 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
642 712
643 - echo '<li class="ab-dir ab-new" data-id="'.$dir_id.'" data-resource='.base64_encode($dir_id).'" data-linked="'.$list['content'].'" data-guid="'.($is_shortcut?$list['guid']:'').'"><a class="folder fa fa-folder"></a><a class="dtitle" title="'.__('Click here to rename', 'wp-docs').'">'.__('New Folder', 'wp-docs').'</a><span class="wpd_action_span"><a class="wpd-edit" title="'.__('Click here to edit', 'wp-docs').'"></a><span class="wpd_action_span_inner"><a class="wpd-copy" title="'.__('Click here to copy', 'wp-docs').'"></a><a class="wpd-move" title="'.__('Click here to move', 'wp-docs').'"></a></span><a class="wpd-trash" title="'.__('Click here to delete', 'wp-docs').'"></a></span></li>';
713 + echo '<li class="ab-dir ab-new"
714 + data-id="' . esc_attr($dir_id) . '"
715 + data-resource="' . esc_attr(base64_encode($dir_id)) . '"
716 + data-linked="' . esc_attr($list['content']) . '"
717 + data-guid="' . ($is_shortcut ? esc_attr($list['guid']) : '') . '">
718 +
719 + <a class="folder fa fa-folder"></a>
720 +
721 + <a class="dtitle" title="' . esc_attr(__('Click here to rename', 'wp-docs')) . '">
722 + ' . esc_html__('New Folder', 'wp-docs') . '
723 + </a>
724 +
725 + <span class="wpd_action_span">
726 + <a class="wpd-edit" title="' . esc_attr(__('Click here to edit', 'wp-docs')) . '"></a>
727 + <span class="wpd_action_span_inner">
728 + <a class="wpd-copy" title="' . esc_attr(__('Click here to copy', 'wp-docs')) . '"></a>
729 + <a class="wpd-move" title="' . esc_attr(__('Click here to move', 'wp-docs')) . '"></a>
730 + </span>
731 + <a class="wpd-trash" title="' . esc_attr(__('Click here to delete', 'wp-docs')) . '"></a>
732 + </span>
733 + </li>';
644 734
645 735 exit;
646 736 }
647 737
@@ -718,16 +808,15 @@
718 808 }
719 809
720 810
721 811
722 -
723 812 return array(
724 -
725 - 'file_url' => $file_url,
726 - 'ext' => $ext,
727 - 'filename' => $filename,
728 - 'title' => $filename,
729 - 'icon_url' => $icon_url
813 + 'file_id' => $item,
814 + 'file_url' => esc_url($file_url),
815 + 'ext' => esc_attr($ext),
816 + 'filename' => esc_attr($filename),
817 + 'title' => esc_html($filename),
818 + 'icon_url' => esc_url($icon_url)
730 819 );
731 820
732 821
733 822 }
@@ -766,9 +855,9 @@
766 855 }
767 856 function wpdocs_list_added_items($dir)
768 857 {
769 858
770 - global $wpdocs_options;
859 + global $wpdocs_options, $icon_sub_path, $wpdocs_url;
771 860
772 861 $wp_get_upload_dir = wp_get_upload_dir();
773 862 $wp_uploads_path = $wp_get_upload_dir['basedir'];
774 863 $wp_uploads_url = $wp_get_upload_dir['baseurl'];
@@ -787,12 +876,12 @@
787 876
788 877 $item_data = wpd_get_item_type_icon_url($item);
789 878 extract($item_data);
790 879
791 - //pree($item_data);
880 + //pree($item_data);exit;
792 881 //pree($wp_uploads_path);exit;
793 882
794 - $icon_str = '<img src="'.$icon_url.'" style="">';
883 + $icon_str = '<img src="' . esc_url($icon_url) . '" style="" alt="' . esc_attr($title) . '">';
795 884
796 885 switch ($ext) {
797 886 case 'png':
798 887 case 'jpg':
@@ -817,18 +906,30 @@
817 906
818 907 $file_url_thumb = str_replace('.pdf', '.png', strtolower($item_data['file_url']));
819 908 $file_url_thumb_path = str_replace($wp_uploads_url, $wp_uploads_path, $file_url_thumb);
820 909
821 - if(!file_exists($file_url_thumb_path)){
910 + if(!file_exists($file_url_thumb_path) && class_exists('imagick')){
822 911
823 - $im = new imagick($item_data['file_url']);
824 - $im->setIteratorIndex(0);
825 - $im->setImageFormat('png');
826 - $im->writeImage($file_url_thumb_path);
912 + try {
913 + $im = new imagick($item_data['file_url']);
914 + $im->setIteratorIndex(0);
915 + $im->setImageFormat('png');
916 + $im->writeImage($file_url_thumb_path);
917 + } catch (ImagickException $e) {
918 +
919 + if(defined('WP_DEBUG') && WP_DEBUG && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG){
920 + error_log("Imagick error: " . $e->getMessage());
921 + error_log('file_url: '.$item_data['file_url']);
922 + error_log('file_url_thumb_path: '.$file_url_thumb_path);
923 + }
924 +
925 + $file_url_thumb = $wpdocs_url.$icon_sub_path.$ext.'.png';
926 + }
827 927
928 +
828 929 }
829 930
830 - $icon_str = '<img src="'.$file_url_thumb.'" style="">';
931 + $icon_str = '<img src="' . esc_url( $file_url_thumb ) . '" style="" alt="' . esc_attr( $title ) . '">';
831 932
832 933 }
833 934
834 935 }
@@ -839,21 +940,24 @@
839 940 //$class .= 'fa-file';
840 941 break;
841 942 }
842 943 $class = '';
843 - $files_list[$title] = '<li data-id="' . $item . '" data-dir="'.$dir. '" title="'.esc_attr($filename).'">
844 - <a href="' . $file_url . '" target="_blank" class="file ' . $class . '"> '.$icon_str.' </a>
845 - <a class="ftitle" title="' . $title . '">' . $title . '</a>
846 - <span class="wpd_action_span">
847 - <a href="upload.php?item='.$item.'" target="_blank" class="wpd-edit" title="'.__('Click here to edit', 'wp-docs').'"></a>
848 - <span class="wpd_action_span_inner">
849 - <a class="wpd-copy" title="'.__('Click here to copy', 'wp-docs').'"></a>
850 - <a class="wpd-move" title="'.__('Click here to move', 'wp-docs').'"></a>
851 - </span>
852 -
853 - <a href="upload.php?search='.esc_attr($filename).'" target="_blank" class="wpd-trash" title="'.__('Click here to delete', 'wp-docs').'"></a>
854 - </span>
855 - </li>';
944 +
945 +
946 + $secured_file_url = wpdocs_secure_url($file_id);
947 +
948 + $files_list[ $title ] = '<li data-id="' . esc_attr( $item ) . '" data-dir="' . esc_attr( $dir ) . '" title="' . esc_attr( $filename ) . '">
949 + <a href="' . esc_url( $secured_file_url ) . '" target="_blank" class="file ' . esc_attr( $class ) . '"> ' . $icon_str . ' </a>
950 + <a class="ftitle" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</a>
951 + <span class="wpd_action_span">
952 + <a href="' . esc_url( 'upload.php?item=' . $item ) . '" target="_blank" class="wpd-edit" title="' . esc_attr__( 'Click here to edit', 'wp-docs' ) . '"></a>
953 + <span class="wpd_action_span_inner">
954 + <a class="wpd-copy" title="' . esc_attr__( 'Click here to copy', 'wp-docs' ) . '"></a>
955 + <a class="wpd-move" title="' . esc_attr__( 'Click here to move', 'wp-docs' ) . '"></a>
956 + </span>
957 + <a href="' . esc_url( 'upload.php?search=' . rawurlencode( $filename ) ) . '" target="_blank" class="wpd-trash" title="' . esc_attr__( 'Click here to delete', 'wp-docs' ) . '"></a>
958 + </span>
959 +</li>';
856 960 }
857 961 }
858 962
859 963 ksort($files_list);
@@ -911,13 +1015,9 @@
911 1015 {
912 1016
913 1017 if (
914 1018 !empty($_POST) && !wp_doing_ajax() &&
915 - (
916 - ! isset( $_POST['wpdocs_front_list_nonce'] )
917 -
918 - ||
919 -
1019 + (
920 1020 (isset( $_POST['wpdocs_front_list_nonce'] ) && ! wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['wpdocs_front_list_nonce_field'])), 'wpdocs_front_list_nonce' ) )
921 1021 )
922 1022 ) {
923 1023
@@ -932,9 +1032,9 @@
932 1032
933 1033
934 1034 //pree($atts);
935 1035 ob_start();
936 - global $wpdocs_url, $wpdocs_options, $wpdocs_pro, $wpdocs_post_types, $pdf_thumb_selected;
1036 + global $wpdocs_url, $wpdocs_options, $wpdocs_pro, $wpdocs_post_types, $pdf_thumb_selected, $icon_sub_path;
937 1037
938 1038 $pdf_thumb_selected = (array_key_exists('pdf_thumb', $wpdocs_options)?$wpdocs_options['pdf_thumb']:'default');
939 1039
940 1040 $wpdocs_view = get_option('wpdocs_view', array());
@@ -1126,12 +1226,19 @@
1126 1226
1127 1227 ?>
1128 1228
1129 1229
1130 - <div class="container-fluid wpdoc_container" data-dir_restrictions = "<?php echo wpdocs_get_dir_restrictions($dir, 'base64'); ?>" data-del_from_front="<?php echo $is_del_from_front; ?>" data-dir="<?php echo $dir; ?>" data-home="<?php echo $home_id; ?>">
1131 - <?php wp_nonce_field( 'wpdocs_front_list_nonce', 'wpdocs_front_list_nonce_field' ); ?>
1132 - <input type="hidden" class="wpd_home_id" value="<?php echo esc_html($home_id); ?>" />
1133 - <input type="hidden" class="wpd_del_file_id" value="" />
1230 +<div class="container-fluid wpdoc_container"
1231 + data-dir_restrictions="<?php echo esc_attr( wpdocs_get_dir_restrictions( $dir, 'base64' ) ); ?>"
1232 + data-del_from_front="<?php echo esc_attr( $is_del_from_front ); ?>"
1233 + data-dir="<?php echo esc_attr( $dir ); ?>"
1234 + data-home="<?php echo esc_attr( $home_id ); ?>">
1235 +
1236 + <?php wp_nonce_field( 'wpdocs_front_list_nonce', 'wpdocs_front_list_nonce_field' ); ?>
1237 +
1238 + <input type="hidden" class="wpd_home_id" value="<?php echo esc_attr( $home_id ); ?>" />
1239 + <input type="hidden" class="wpd_del_file_id" value="" />
1240 +
1134 1241 <?php
1135 1242
1136 1243 $wpdocs_view = array_key_exists($home_id, $wpdocs_view) ? $wpdocs_view[$home_id] : trim($default_view);
1137 1244
@@ -1143,9 +1250,13 @@
1143 1250 <ol class="breadcrumb bg-light" style="border-bottom:1px solid #dee2e6;border-radius: 0; min-height: 40px;">
1144 1251
1145 1252 <?php if (!empty($breadcrumb_array)) { ?>
1146 1253
1147 - <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo $get_permalink ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li>
1254 + <li class="breadcrumb-item bread_home_url">
1255 + <a class="wpd_bread_item" href="<?php echo esc_url($get_permalink); ?>" data-id="0">
1256 + <?php echo esc_html__('Home', 'wp-docs'); ?>
1257 + </a>
1258 +</li>
1148 1259 <?php
1149 1260
1150 1261 foreach (array_reverse($breadcrumb_array) as $bread_key => $bread_value) {
1151 1262 $active = '';
@@ -1151,9 +1262,9 @@
1151 1262 $active = '';
1152 1263 $page = '';
1153 1264 $permalink = stripos($get_permalink, '?');
1154 1265 $permalink_c = ($permalink!='' && is_numeric($permalink) && $permalink>=0);
1155 - $link = '<a class="wpd_bread_item" href="' . $get_permalink . ($permalink_c?'&':'?').'dir=' . $bread_value . '" data-id="'.$bread_value.'" >' . get_the_title($bread_value) . '</a>';
1266 + $link = '<a class="wpd_bread_item" href="' . esc_url($get_permalink . ($permalink_c ? '&' : '?') . 'dir=' . $bread_value) . '" data-id="' . esc_attr($bread_value) . '">' . (get_the_title($bread_value)) . '</a>';
1156 1267 if ($bread_value == 0) {
1157 1268 continue;
1158 1269 }
1159 1270 if ($bread_value == $dir) {
@@ -1163,9 +1274,11 @@
1163 1274 }
1164 1275
1165 1276
1166 1277 ?>
1167 - <li class="breadcrumb-item <?php echo $active ?>" aria-current="<?php echo $page; ?>"><?php echo $link; ?></li>
1278 + <li class="breadcrumb-item <?php echo esc_attr($active); ?>" aria-current="<?php echo esc_attr($page); ?>">
1279 + <?php echo wp_kses_post($link); ?>
1280 +</li>
1168 1281
1169 1282 <?php } ?>
1170 1283 <?php
1171 1284 }
@@ -1174,16 +1287,21 @@
1174 1287
1175 1288 </ol>
1176 1289
1177 1290 <?php if($is_del_from_front):?>
1291 +<i style="opacity: 0.5;"
1292 + class="fa fa-trash fa-1x position-absolute wp_docs_del_file <?php echo esc_attr(is_user_logged_in() ? 'logged_in' : 'logged_out'); ?>"
1293 + title="<?php echo esc_attr__('Click here to delete selected files', 'wp-docs'); ?>">
1294 +</i>
1178 1295
1179 - <i style="opacity: 0.5;" class="fa fa-trash fa-1x position-absolute wp_docs_del_file <?php echo (is_user_logged_in()?'logged_in':'logged_out'); ?>" title="<?php _e('Click here to delete selected files', 'wp-docs'); ?>"></i>
1180 -
1181 1296 <?php endif; ?>
1182 1297
1183 1298 <?php if($wpdocs_pro && $dir != 0 && wpdocs_can_current_user_upload_file($dir) && $is_file):?>
1184 1299
1185 - <i class="fa fa-upload fa-1x wpdocs-front-add-media position-absolute" id="wpdocs_front_file_add_<?php echo $dir; ?>" title="<?php _e('Click here to add files', 'wp-docs'); ?>"></i>
1300 +<i class="fa fa-upload fa-1x wpdocs-front-add-media position-absolute"
1301 + id="wpdocs_front_file_add_<?php echo esc_attr( $dir ); ?>"
1302 + title="<?php echo esc_attr__( 'Click here to add files', 'wp-docs' ); ?>">
1303 +</i>
1186 1304
1187 1305 <?php endif; ?>
1188 1306 </nav>
1189 1307 <?php
@@ -1216,10 +1334,9 @@
1216 1334 pree($posts_array);
1217 1335 */
1218 1336 ?>
1219 1337
1220 - <?php echo $warning_msg?'<div class="card-body">'.$warning_msg.'</div>':''; ?>
1221 -
1338 + <?php echo $warning_msg ? '<div class="card-body">' . wp_kses_post( $warning_msg ) . '</div>' : ''; ?>
1222 1339 <?php if($is_searchbox || $ajax_based_deep_search): ?>
1223 1340 <div class="wpdocs-searchbox">
1224 1341 <input type="text" placeholder="<?php echo ($ajax_based_deep_search?__('Type here to search...', 'wp-docs'):__('Type here to filter...', 'wp-docs')); ?>" />
1225 1342 </div>
@@ -1241,14 +1358,22 @@
1241 1358 //$wpdocs_child_files_list = wpdocs_added_items($list['id']);
1242 1359 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1243 1360 ?>
1244 1361
1245 - <div class="col-4 col-md-3 file_wrapper is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>">
1246 - <figure class="figure file_view p-0">
1247 - <span class="fa fa-folder text-warning" style="<?php echo $customize_icon_size; ?>"></span>
1248 - <figcaption class="figure-caption text-center" style="<?php echo $customize_font_size; ?>"><?php echo $list['title']; ?></figcaption>
1249 - </figure>
1250 - </div>
1362 +<div class="col-4 col-md-3 file_wrapper is_dir" style="cursor: pointer;"
1363 + data-id="<?php echo esc_attr($list['id']); ?>"
1364 + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>"
1365 + data-linked="<?php echo esc_attr($list['content']); ?>"
1366 + data-guid="<?php echo esc_attr($is_shortcut ? $list['link'] : ''); ?>">
1367 +
1368 + <figure class="figure file_view p-0">
1369 + <span class="fa fa-folder text-warning" style="<?php echo esc_attr($customize_icon_size); ?>"></span>
1370 + <figcaption class="figure-caption text-center" style="<?php echo esc_attr($customize_font_size); ?>">
1371 + <?php echo esc_html($list['title']); ?>
1372 + </figcaption>
1373 + </figure>
1374 +
1375 +</div>
1251 1376 <?php
1252 1377 }
1253 1378 } else {
1254 1379 $no_dir_found = true;
@@ -1265,14 +1390,23 @@
1265 1390 $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid);
1266 1391 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1267 1392
1268 1393 ?>
1269 - <div class="col-4 col-md-3 file_wrapper is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>">
1270 - <figure class="figure file_view p-0">
1271 - <span class="fa fa-folder text-warning" style="<?php echo $customize_icon_size; ?>"></span>
1272 - <figcaption class="figure-caption text-center" style="<?php echo $customize_font_size; ?>"><?php echo $list['title']; ?></figcaption>
1273 - </figure>
1274 - </div>
1394 +<div class="col-4 col-md-3 file_wrapper is_dir is_deep" style="cursor: pointer;"
1395 + data-id="<?php echo esc_attr($list['id']); ?>"
1396 + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>"
1397 + data-linked="<?php echo esc_attr($list['content']); ?>"
1398 + data-guid="<?php echo esc_attr($is_shortcut ? $list['guid'] : ''); ?>">
1399 +
1400 + <figure class="figure file_view p-0">
1401 + <span class="fa fa-folder text-warning" style="<?php echo esc_attr($customize_icon_size); ?>"></span>
1402 +
1403 + <figcaption class="figure-caption text-center" style="<?php echo esc_attr($customize_font_size); ?>">
1404 + <?php echo esc_html($list['title']); ?>
1405 + </figcaption>
1406 + </figure>
1407 +
1408 +</div>
1275 1409 <?php
1276 1410 }
1277 1411 }
1278 1412 }
@@ -1315,17 +1449,30 @@
1315 1449
1316 1450 $file_url_thumb = str_replace('.pdf', '.png', strtolower($file_data['file_url']));
1317 1451 $file_url_thumb_path = str_replace($wp_uploads_url, $wp_uploads_path, $file_url_thumb);
1318 1452
1319 - if(!file_exists($file_url_thumb_path)){
1320 -
1321 - $im = new imagick($file_data['file_url']);
1322 - $im->setIteratorIndex(0);
1323 - $im->setImageFormat('png');
1324 - $im->writeImage($file_url_thumb_path);
1453 + if(!file_exists($file_url_thumb_path) && class_exists('imagick')){
1454 +
1455 + try {
1456 + $im = new imagick($item_data['file_url']);
1457 + $im->setIteratorIndex(0);
1458 + $im->setImageFormat('png');
1459 + $im->writeImage($file_url_thumb_path);
1460 + } catch (ImagickException $e) {
1461 +
1462 + if(defined('WP_DEBUG') && WP_DEBUG && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG){
1463 + error_log("Imagick error: " . $e->getMessage());
1464 + error_log('file_url: '.$item_data['file_url']);
1465 + error_log('file_url_thumb_path: '.$file_url_thumb_path);
1466 + }
1467 +
1468 + $file_url_thumb = $wpdocs_url.$icon_sub_path.$ext.'.png';
1469 + }
1325 1470
1471 +
1326 1472 }
1327 1473
1474 +
1328 1475 $icon_url = $file_url_thumb;
1329 1476
1330 1477 }
1331 1478
@@ -1336,21 +1483,23 @@
1336 1483 default:
1337 1484 //$class .= 'fa-file';
1338 1485 break;
1339 1486 }
1487 +
1488 + $secured_file_url = wpdocs_secure_url($file_id);
1340 1489
1341 1490 $file_list_row = '
1342 -
1343 -
1344 - <div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_shallow" style="cursor: pointer;" data-id="'.$file.'">
1345 - <figure class="figure file_view p-1">
1346 - <a href="'.$file_url.'" target="_blank" class="file" ><img class="my-3" src="'.$icon_url.'" /></a>
1347 - <figcaption class="figure-caption text-center">'.$title.'</figcaption>
1348 - </figure>
1349 - </div>
1350 -
1351 -
1352 - ';
1491 +
1492 +<div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_shallow" style="cursor: pointer;" data-id="'.esc_attr($file).'">
1493 + <figure class="figure file_view p-1">
1494 + <a href="'.esc_url($secured_file_url).'" target="_blank" class="file">
1495 + <img class="my-3" src="'.esc_url($icon_url).'" />
1496 + </a>
1497 + <figcaption class="figure-caption text-center">'.esc_html($title).'</figcaption>
1498 + </figure>
1499 +</div>
1500 +
1501 +';
1353 1502 $list = wpdocs_list_population($list, $file_data, $file_list_row, $default_orderby);
1354 1503
1355 1504 }
1356 1505
@@ -1421,21 +1570,23 @@
1421 1570 default:
1422 1571 //$class .= 'fa-file';
1423 1572 break;
1424 1573 }
1574 +
1575 + $secured_file_url = wpdocs_secure_url($file_id);
1425 1576
1426 1577 $file_list_row = '
1427 -
1428 -
1429 - <div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_deep" style="cursor: pointer;" data-id="'.$file.'">
1430 - <figure class="figure file_view p-1">
1431 - <a href="'.$file_url.'" target="_blank" class="file" ><img class="my-3" src="'.$icon_url.'" /></a>
1432 - <figcaption class="figure-caption text-center">'.$title.'</figcaption>
1433 - </figure>
1434 - </div>
1435 -
1436 -
1437 - ';
1578 +
1579 +<div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_deep" style="cursor: pointer;" data-id="'.esc_attr($file).'">
1580 + <figure class="figure file_view p-1">
1581 + <a href="'.esc_url($secured_file_url).'" target="_blank" class="file">
1582 + <img class="my-3" src="'.esc_url($icon_url).'" />
1583 + </a>
1584 + <figcaption class="figure-caption text-center">'.esc_html($title).'</figcaption>
1585 + </figure>
1586 +</div>
1587 +
1588 +';
1438 1589 $list = wpdocs_list_population($list, $file_data, $file_list_row, $default_orderby);
1439 1590
1440 1591 }
1441 1592
@@ -1470,12 +1621,16 @@
1470 1621 foreach ($wpdocs_list as $list) {
1471 1622 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1472 1623 ?>
1473 1624
1474 - <div class="col-12 file_wrapper is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>">
1625 +<div class="col-12 file_wrapper is_dir" style="cursor: pointer;"
1626 + data-id="<?php echo esc_attr($list['id']); ?>"
1627 + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>"
1628 + data-linked="<?php echo esc_attr($list['content']); ?>"
1629 + data-guid="<?php echo esc_attr($is_shortcut ? $list['link'] : ''); ?>">
1475 1630 <figure class="figure file_view p-2">
1476 1631 <span class="fa fa-folder text-warning" style="font-size:25px"></span>
1477 - <small class="text-center"><?php echo $list['title']; ?></small>
1632 + <small class="text-center"><?php echo esc_html($list['title']); ?></small>
1478 1633 </figure>
1479 1634 </div>
1480 1635 <?php
1481 1636 }
@@ -1492,12 +1647,16 @@
1492 1647 $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid);
1493 1648 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1494 1649
1495 1650 ?>
1496 - <div class="col-12 file_wrapper is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>">
1651 + <div class="col-12 file_wrapper is_dir is_deep" style="cursor: pointer;"
1652 + data-id="<?php echo esc_attr($list['id']); ?>"
1653 + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>"
1654 + data-linked="<?php echo esc_attr($list['content']); ?>"
1655 + data-guid="<?php echo esc_attr($is_shortcut ? $list['guid'] : ''); ?>">
1497 1656 <figure class="figure file_view p-2">
1498 1657 <span class="fa fa-folder text-warning" style="font-size:25px"></span>
1499 - <small class="text-center"><?php echo $list['title']; ?></small>
1658 + <small class="text-center"><?php echo esc_html($list['title']); ?></small>
1500 1659 </figure>
1501 1660 </div>
1502 1661 <?php
1503 1662 }
@@ -1513,13 +1672,15 @@
1513 1672 extract($file_data);
1514 1673
1515 1674
1516 1675 if(trim($file_url)){
1676 +
1677 + $secured_file_url = wpdocs_secure_url($file_id);
1517 1678
1518 1679 $file_list_row = '
1519 1680 <div title="'.esc_attr($filename).'" class="col-12 file_wrapper is_file" style="cursor: pointer;" data-id="'.$file.'">
1520 1681 <figure class="figure file_view p-3">
1521 - <a href="'.$file_url.'" target="_blank" class="file" ><img class="mb-2" src="'.$icon_url.'" style="width: 25px; height: 25px"></a>
1682 + <a href="'.$secured_file_url.'" target="_blank" class="file" ><img class="mb-2" src="'.$icon_url.'" style="width: 25px; height: 25px"></a>
1522 1683 <small class="text-center">'.$title.'</small>
1523 1684 </figure>
1524 1685 </div>';
1525 1686
@@ -1593,14 +1754,27 @@
1593 1754 <div class="table-responsive" style="zoom:70%">
1594 1755 <table class="table">
1595 1756 <thead class="thead">
1596 1757 <tr>
1597 - <th><?php _e('Name', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th>
1598 - <?php if($details_date_created): ?> <th><?php _e('Created Date', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?>
1599 - <?php if($details_date): ?> <th><?php _e('Modified Date', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?>
1600 - <?php if($details_type): ?> <th><?php _e('Type', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?>
1601 - <?php if($details_size): ?> <th><?php _e('Size', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?>
1602 - </tr>
1758 + <th><?php esc_html_e('Name', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th>
1759 +
1760 +<?php if ( $details_date_created ) : ?>
1761 + <th><?php esc_html_e('Created Date', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th>
1762 +<?php endif; ?>
1763 +
1764 +<?php if ( $details_date ) : ?>
1765 + <th><?php esc_html_e('Modified Date', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th>
1766 +<?php endif; ?>
1767 +
1768 +<?php if ( $details_type ) : ?>
1769 + <th><?php esc_html_e('Type', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th>
1770 +<?php endif; ?>
1771 +
1772 +<?php if ( $details_size ) : ?>
1773 + <th><?php esc_html_e('Size', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th>
1774 +<?php endif; ?>
1775 +
1776 +</tr>
1603 1777 </thead>
1604 1778 <?php
1605 1779 $no_dir_found = false;
1606 1780 $no_file_found = false;
@@ -1607,13 +1781,13 @@
1607 1781 if (!empty($wpdocs_list)) {
1608 1782 foreach ($wpdocs_list as $list) {
1609 1783 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1610 1784 ?>
1611 - <tr title="<?php echo $list['id']; ?>" class="file_wrapper file_view is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>">
1785 + <tr title="<?php echo esc_attr($list['id']); ?>" class="file_wrapper file_view is_dir" style="cursor: pointer;" data-id="<?php echo esc_attr($list['id']); ?>" data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" data-linked="<?php echo esc_attr($list['content']); ?>" data-guid="<?php echo $is_shortcut?esc_url($list['link']):''; ?>">
1612 1786 <td>
1613 1787 <figure class="figure ">
1614 1788 <span class="fa fa-folder text-warning" style="font-size:25px"></span>
1615 - <small class="text-center mb-1"><?php echo $list['title']; ?></small>
1789 + <small class="text-center mb-1"><?php echo esc_html($list['title']); ?></small>
1616 1790 </figure>
1617 1791 </td>
1618 1792
1619 1793 <?php if($details_date_created): ?> <td data-time="<?php get_post_time('U', false, $list['id']) ?>"><small><?php echo get_the_date(get_option( 'date_format' ), $list['id']) . ' ' . get_the_time(get_option( 'time_format' ), $list['id']) ?></small></td><?php endif; ?>
@@ -1651,13 +1825,13 @@
1651 1825 $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid);
1652 1826 $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']);
1653 1827
1654 1828 ?>
1655 - <tr title="<?php echo $list['id']; ?>" class="file_wrapper file_view is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>">
1829 + <tr title="<?php echo esc_attr($list['id']); ?>" class="file_wrapper file_view is_dir is_deep" style="cursor: pointer;" data-id="<?php echo esc_attr($list['id']); ?>" data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" data-linked="<?php echo esc_attr($list['content']); ?>" data-guid="<?php echo $is_shortcut?esc_attr($list['guid']):''; ?>">
1656 1830 <td>
1657 1831 <figure class="figure ">
1658 1832 <span class="fa fa-folder text-warning" style="font-size:25px"></span>
1659 - <small class="text-center mb-1"><?php echo $list['title']; ?></small>
1833 + <small class="text-center mb-1"><?php echo esc_html($list['title']); ?></small>
1660 1834 </figure>
1661 1835 </td>
1662 1836
1663 1837 <?php if($details_date_created): ?> <td data-time="<?php get_post_time('U', false, $list['id']) ?>"><small><?php echo get_the_date(get_option( 'date_format' ), $list['id']) . ' ' . get_the_time(get_option( 'time_format' ), $list['id']) ?></small></td><?php endif; ?>
@@ -1697,11 +1871,11 @@
1697 1871 extract($file_data);
1698 1872 //pree($ts);
1699 1873
1700 1874 if(trim($icon_url)){
1701 -
1875 + $secured_file_url = wpdocs_secure_url($file_id);
1702 1876 $files_list_row = '
1703 - <tr title="'.esc_attr($filename).'" data-url="'.$file_url.'" class="file_view file_link is_file" style="cursor: pointer;" data-id="'.$file.'">
1877 + <tr title="'.esc_attr($filename).'" data-url="'.$secured_file_url.'" class="file_view file_link is_file" style="cursor: pointer;" data-id="'.$file.'">
1704 1878
1705 1879 <td>
1706 1880
1707 1881 <figure class="figure file_view">
@@ -1754,11 +1928,13 @@
1754 1928 extract($file_data);
1755 1929 //pree($ts);
1756 1930
1757 1931 if(trim($icon_url)){
1932 +
1933 + $secured_file_url = wpdocs_secure_url($file_id);
1758 1934
1759 1935 $files_list_row = '
1760 - <tr title="'.esc_attr($filename).'" data-url="'.$file_url.'" class="file_view file_link is_file is_deep" style="cursor: pointer;" data-id="'.$file.'">
1936 + <tr title="'.esc_attr($filename).'" data-url="'.$secured_file_url.'" class="file_view file_link is_file is_deep" style="cursor: pointer;" data-id="'.$file.'">
1761 1937
1762 1938 <td>
1763 1939
1764 1940 <figure class="figure file_view">
@@ -1824,9 +2000,9 @@
1824 2000 </div>
1825 2001 <?php if($is_bootstrap): ?>
1826 2002 <div class="wpdocs_loader wpd_modal d-none">
1827 2003 <div class="modal_content">
1828 - <img src="<?php echo $wpdocs_url.'img/loader.gif' ?>" width="50px" height="50px">
2004 + <img src="<?php echo esc_url($wpdocs_url.'img/loader.gif'); ?>" width="50px" height="50px">
1829 2005 </div>
1830 2006 </div>
1831 2007 <?php endif; ?>
1832 2008
@@ -1939,56 +2115,71 @@
1939 2115
1940 2116
1941 2117
1942 2118 add_action('wp_ajax_wpdocs_update_folder', 'wpdocs_update_folder');
1943 - function wpdocs_update_folder()
1944 - {
1945 -
1946 - $nonce = sanitize_wpdocs_data(wp_unslash($_POST['nonce']));
2119 +
2120 + function wpdocs_update_folder() {
2121 +
1947 2122
1948 - if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) )
1949 - die (__("Sorry, your nonce did not verify.", 'wp-docs'));
1950 -
1951 - $dir_id = sanitize_wpdocs_data($_POST['dir_id']);
1952 - $dir_id_compare = base64_decode(sanitize_wpdocs_data($_POST['resource_id']));
1953 - //pree($dir_id_compare.'=='.$dir_id.' - '.wpdocs_folder_exists($dir_id));exit;
2123 + if ( ! current_user_can('edit_posts') ) {
2124 + wp_send_json_error(['msg' => __('Unauthorized access.', 'wp-docs')]);
2125 + }
2126 +
2127 +
2128 + if (
2129 + empty($_POST['nonce']) ||
2130 + ! wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'wpdocs_update_options_nonce')
2131 + ) {
2132 + wp_send_json_error(['msg' => __('Sorry, your nonce did not verify.', 'wp-docs')]);
2133 + }
2134 +
1954 2135
1955 - $ret = array('msg'=>'');
1956 -
1957 - if ($dir_id>0 && $dir_id_compare==$dir_id && wpdocs_folder_exists($dir_id)) {
1958 -
2136 + $dir_id = absint($_POST['dir_id'] ?? 0);
2137 + $resource_id = base64_decode(sanitize_text_field($_POST['resource_id'] ?? ''));
2138 + $new_name = sanitize_text_field($_POST['new_name'] ?? '');
2139 +
2140 + $ret = ['msg' => ''];
2141 +
2142 + if ( $dir_id > 0 && $resource_id == $dir_id && wpdocs_folder_exists($dir_id) ) {
2143 +
1959 2144 global $wpdb, $wpdocs_post_types, $wpdocs_post_status;
1960 -
1961 - $my_post = array(
1962 - 'post_title' => htmlspecialchars_decode(sanitize_wpdocs_data($_POST['new_name'])),
1963 - 'ID' => $dir_id,
2145 +
2146 + $updated = $wpdb->query(
2147 + $wpdb->prepare(
2148 + "UPDATE $wpdb->posts
2149 + SET post_title = %s
2150 + WHERE ID = %d
2151 + AND post_type IN ('" . implode("','", array_map('esc_sql', $wpdocs_post_types)) . "')
2152 + AND post_status = %s",
2153 + htmlspecialchars_decode($new_name),
2154 + $dir_id,
2155 + $wpdocs_post_status
2156 + )
1964 2157 );
1965 - //pree($my_post);exit;
1966 - //wp_update_post($my_post);
1967 - $rename_query = $wpdb->prepare("UPDATE $wpdb->posts SET post_title=%s WHERE ID=%d AND post_type IN ('".implode("','", $wpdocs_post_types)."') AND post_status=%s",
1968 - $my_post['post_title'],
1969 - $dir_id,
1970 - $wpdocs_post_status
1971 - );
1972 - //pree($rename_query);exit;
1973 - $updated = $wpdb->query($rename_query);
1974 -
1975 -
1976 - if($updated){
1977 - $ret['msg'] = __("Successfully updated.", 'wp-docs');
1978 - }else{
1979 - $ret['msg'] = __("No changes are made, input seems the same as before.", 'wp-docs');
2158 +
2159 + if ( $updated ) {
2160 + $ret['msg'] = __('Successfully updated.', 'wp-docs');
2161 + } else {
2162 + $ret['msg'] = __('No changes were made. Input seems the same as before.', 'wp-docs');
1980 2163 }
2164 + } else {
2165 + $ret['msg'] = __('Invalid folder ID or resource mismatch.', 'wp-docs');
1981 2166 }
2167 +
2168 + wp_send_json_success($ret);
2169 + }
1982 2170
1983 - echo wp_json_encode($ret);
1984 - exit;
1985 - }
1986 2171
1987 2172 add_action('wp_ajax_wpdocs_delete_folder', 'wpdocs_delete_folder');
1988 2173
1989 2174 function wpdocs_delete_folder()
1990 2175 {
2176 +
2177 + if ( ! current_user_can( 'manage_options' ) ) {
2178 + wp_send_json_error( __( 'Unauthorized user', 'wp-docs' ) );
2179 + wp_die();
2180 + }
2181 +
1991 2182 $nonce = sanitize_wpdocs_data(wp_unslash($_POST['nonce']));
1992 2183
1993 2184 if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) )
1994 2185 die (__("Sorry, your nonce did not verify.", 'wp-docs'));
@@ -2128,152 +2319,157 @@
2128 2319 add_action('wp_ajax_wpdocs_update_option', 'wpdocs_update_option');
2129 2320
2130 2321 if(!function_exists('wpdocs_update_option')){
2131 2322 function wpdocs_update_option(){
2323 +
2324 + if ( ! current_user_can('manage_options') ) {
2325 + wp_send_json_error('Insufficient permissions.');
2326 + }
2132 2327
2328 + if (
2329 + ! isset($_POST['wpdocs_update_option_nonce']) ||
2330 + ! wp_verify_nonce($_POST['wpdocs_update_option_nonce'], 'wpdocs_update_options_nonce')
2331 + ) {
2332 + wp_send_json_error('Invalid nonce '.$_POST['wpdocs_update_option_nonce']);
2333 + } else {
2334 + //wp_send_json_success('Nonce valid!');
2335 + }
2133 2336
2337 + $return = array(
2134 2338
2135 - if(isset($_POST['wpdocs_update_option_nonce'])){
2339 + 'option_update' => false,
2340 + 'dir_move' => false,
2341 + );
2136 2342
2137 - $nonce = sanitize_wpdocs_data(wp_unslash($_POST['wpdocs_update_option_nonce']));
2343 +
2138 2344
2139 - $return = array(
2345 + if(isset($_POST['wpdocs_options'])){
2140 2346
2141 - 'option_update' => false,
2142 - 'dir_move' => false,
2143 - );
2347 + $wpdocs_options = isset($_POST['wpdocs_options']) ? sanitize_wpdocs_data($_POST['wpdocs_options']) : array();
2144 2348
2145 - if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) )
2146 - die (__("Sorry, your nonce did not verify.", 'wp-docs'));
2349 + $wpdocs_dir_id = isset($_POST['wpdocs_dir_id']) ? sanitize_wpdocs_data($_POST['wpdocs_dir_id']) : 0;
2147 2350
2148 - if(isset($_POST['wpdocs_options'])){
2149 2351
2150 - $wpdocs_options = isset($_POST['wpdocs_options']) ? sanitize_wpdocs_data($_POST['wpdocs_options']) : array();
2352 + $sanitized_option = sanitize_wpdocs_data($wpdocs_options);
2353 + $sanitized_option['allowed_role'] = $sanitized_option['allowed_role'] !== 'empty' ? $sanitized_option['allowed_role'] : array();
2151 2354
2152 - $wpdocs_dir_id = isset($_POST['wpdocs_dir_id']) ? sanitize_wpdocs_data($_POST['wpdocs_dir_id']) : 0;
2153 2355
2356 + if($wpdocs_dir_id == 0){
2154 2357
2155 - $sanitized_option = sanitize_wpdocs_data($wpdocs_options);
2156 - $sanitized_option['allowed_role'] = $sanitized_option['allowed_role'] !== 'empty' ? $sanitized_option['allowed_role'] : array();
2358 + $update = update_option('wpdocs_options', $sanitized_option);
2157 2359
2360 + }else{
2158 2361
2159 - if($wpdocs_dir_id == 0){
2362 + $update = update_post_meta($wpdocs_dir_id, '_wpdocs_dir_options', $sanitized_option);
2363 + $child_dir_list = wpdoc_get_dir_children($wpdocs_dir_id);
2364 + if(!empty($child_dir_list)){
2365 + foreach ($child_dir_list as $child_dir) {
2160 2366
2161 - $update = update_option('wpdocs_options', $sanitized_option);
2367 + $update = update_post_meta($child_dir, '_wpdocs_dir_options', $sanitized_option);
2162 2368
2163 - }else{
2164 -
2165 - $update = update_post_meta($wpdocs_dir_id, '_wpdocs_dir_options', $sanitized_option);
2166 - $child_dir_list = wpdoc_get_dir_children($wpdocs_dir_id);
2167 - if(!empty($child_dir_list)){
2168 - foreach ($child_dir_list as $child_dir) {
2169 -
2170 - $update = update_post_meta($child_dir, '_wpdocs_dir_options', $sanitized_option);
2171 -
2172 - # code...
2173 - }
2369 + # code...
2174 2370 }
2371 + }
2175 2372
2176 -
2373 +
2177 2374
2178 - }
2179 - }
2375 + }
2376 + }
2180 2377
2181 2378
2182 2379
2183 - if(isset($_POST['wpdocs_move_selected_dir'])){
2380 + if(isset($_POST['wpdocs_move_selected_dir'])){
2184 2381
2185 - $wpdocs_move_selected_dir = sanitize_wpdocs_data($_POST['wpdocs_move_selected_dir']);
2186 - $action_type = $wpdocs_move_selected_dir['action_type'];
2187 -
2382 + $wpdocs_move_selected_dir = sanitize_wpdocs_data($_POST['wpdocs_move_selected_dir']);
2383 + $action_type = $wpdocs_move_selected_dir['action_type'];
2384 +
2188 2385
2189 - $is_file = array_key_exists('is_file', $wpdocs_move_selected_dir) ? $wpdocs_move_selected_dir['is_file']: false;
2190 - $is_file = $is_file == 'false' ? false: true;
2386 + $is_file = array_key_exists('is_file', $wpdocs_move_selected_dir) ? $wpdocs_move_selected_dir['is_file']: false;
2387 + $is_file = $is_file == 'false' ? false: true;
2191 2388
2192 2389
2193 - if(!$is_file && array_key_exists('dir_selected', $wpdocs_move_selected_dir) &&
2194 - array_key_exists('dir_id', $wpdocs_move_selected_dir)){
2390 + if(!$is_file && array_key_exists('dir_selected', $wpdocs_move_selected_dir) &&
2391 + array_key_exists('dir_id', $wpdocs_move_selected_dir)){
2392 +
2393 + switch($action_type){
2394 + default:
2395 + case 'move':
2396 +
2397 +
2398 + $update = wp_update_post(
2399 + array(
2400 + 'ID' => $wpdocs_move_selected_dir['dir_selected'],
2401 + 'post_parent' => $wpdocs_move_selected_dir['dir_id']
2402 + )
2403 + );
2195 2404
2196 - switch($action_type){
2197 - default:
2198 - case 'move':
2405 + if($update == $wpdocs_move_selected_dir['dir_selected']){
2406 + $return['dir_move'] = true;
2407 + }
2199 2408
2200 -
2201 - $update = wp_update_post(
2202 - array(
2203 - 'ID' => $wpdocs_move_selected_dir['dir_selected'],
2204 - 'post_parent' => $wpdocs_move_selected_dir['dir_id']
2205 - )
2206 - );
2409 + break;
2410 +
2411 + case 'copy':
2412 + $existing_dir = get_post($wpdocs_move_selected_dir['dir_selected']);
2413 + $existing_dir = (is_object($existing_dir)?(array)$existing_dir:array());
2414 + if(!empty($existing_dir) && array_key_exists('ID', $existing_dir) && function_exists('wpdocs_recursive_copy_folder')){
2207 2415
2208 - if($update == $wpdocs_move_selected_dir['dir_selected']){
2209 - $return['dir_move'] = true;
2210 - }
2416 + wpdocs_recursive_copy_folder($wpdocs_move_selected_dir['dir_id'], $existing_dir);
2211 2417
2212 - break;
2418 + $return['dir_move'] = true;
2419 +
2420 + }
2213 2421
2214 - case 'copy':
2215 - $existing_dir = get_post($wpdocs_move_selected_dir['dir_selected']);
2216 - $existing_dir = (is_object($existing_dir)?(array)$existing_dir:array());
2217 - if(!empty($existing_dir) && array_key_exists('ID', $existing_dir) && function_exists('wpdocs_recursive_copy_folder')){
2218 -
2219 - wpdocs_recursive_copy_folder($wpdocs_move_selected_dir['dir_id'], $existing_dir);
2220 -
2221 - $return['dir_move'] = true;
2222 -
2223 - }
2224 -
2225 -
2226 - break;
2227 - }
2228 -
2229 -
2230 -
2231 - }
2232 - //exit;
2422 +
2423 + break;
2424 + }
2425 +
2426 +
2427 +
2428 + }
2429 + //exit;
2233 2430
2234 - if($is_file){
2431 + if($is_file){
2235 2432
2236 - $file_id = $wpdocs_move_selected_dir['files'];
2237 -
2238 - $current_dir = $wpdocs_move_selected_dir['file_dir'];
2433 + $file_id = $wpdocs_move_selected_dir['files'];
2434 +
2435 + $current_dir = $wpdocs_move_selected_dir['file_dir'];
2436 +
2437 + $new_dir = $wpdocs_move_selected_dir['dir_id'];
2438 +
2439 + $files = wpdocs_added_items($current_dir);
2440 +
2441 + $file_id = is_array($file_id) ? $file_id : array($file_id);
2442 + $files = array_diff($files, $file_id);
2443 +
2444 +
2445 + switch($action_type){
2446 + default:
2447 + case 'move':
2448 +
2449 + update_post_meta($current_dir, 'wpdocs_items', $files);
2450 +
2451 + break;
2239 2452
2240 - $new_dir = $wpdocs_move_selected_dir['dir_id'];
2241 -
2242 - $files = wpdocs_added_items($current_dir);
2243 -
2244 - $file_id = is_array($file_id) ? $file_id : array($file_id);
2245 - $files = array_diff($files, $file_id);
2246 -
2247 -
2248 - switch($action_type){
2249 - default:
2250 - case 'move':
2251 -
2252 - update_post_meta($current_dir, 'wpdocs_items', $files);
2253 -
2254 - break;
2453 + case 'copy':
2255 2454
2256 - case 'copy':
2257 -
2258 - break;
2259 -
2260 - }
2455 + break;
2456 +
2457 + }
2261 2458
2262 - $update = wpdocs_update_files_meta($new_dir, $file_id);
2263 -
2264 - if($update === true){
2265 - $return['dir_move'] = true;
2266 - }
2459 + $update = wpdocs_update_files_meta($new_dir, $file_id);
2460 +
2461 + if($update === true){
2462 + $return['dir_move'] = true;
2463 + }
2267 2464
2268 - }
2269 - }
2465 + }
2466 + }
2270 2467
2271 - echo wp_json_encode($return);
2468 + echo wp_json_encode($return);
2272 2469
2273 - }
2274 2470
2275 - wp_die();
2471 + wp_die();
2276 2472
2277 2473 }
2278 2474 }
2279 2475
@@ -2330,9 +2526,9 @@
2330 2526
2331 2527 if(!array_key_exists('id', $wp_dir)) continue;
2332 2528 $wpdocs_list_child = wpdocs_list($wp_dir['id']);
2333 2529
2334 - $option .= '<option value="'.$wp_dir['id'].'" data-parent="'.$dir.'">'.str_repeat(str_replace(' ', '&nbsp;', $str), $level).$wp_dir['title'].'</option>';
2530 + $option .= '<option value="'.esc_attr($wp_dir['id']).'" data-parent="'.esc_attr($dir).'">'.str_repeat(str_replace(' ', '&nbsp;', $str), $level).esc_html($wp_dir['title']).'</option>';
2335 2531
2336 2532
2337 2533 if(!empty($wpdocs_list_child)){
2338 2534
@@ -2366,9 +2562,9 @@
2366 2562
2367 2563 <nav aria-label="breadcrumb" class="wpdocs-nav">
2368 2564 <ol class="breadcrumb bg-light" style="border-bottom:1px solid #dee2e6;border-radius: 0;">
2369 2565
2370 - <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo $get_permalink ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li>
2566 + <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo esc_url($get_permalink); ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li>
2371 2567 <?php
2372 2568
2373 2569 foreach (array_reverse($breadcrumb_array) as $bread_key => $bread_value) {
2374 2570 $active = '';
@@ -2385,9 +2581,9 @@
2385 2581 }
2386 2582
2387 2583
2388 2584 ?>
2389 - <li class="breadcrumb-item <?php echo $active ?>" aria-current="<?php echo $page; ?>"><?php echo $link ?></li>
2585 + <li class="breadcrumb-item <?php echo esc_attr($active); ?>" aria-current="<?php echo esc_attr($page); ?>"><?php echo ($link); ?></li>
2390 2586
2391 2587 <?php
2392 2588 }
2393 2589
@@ -2623,13 +2819,91 @@
2623 2819 return $ret;
2624 2820
2625 2821 }
2626 2822 }
2823 + if(!function_exists('wpdocs_file_download')){
2824 + function wpdocs_file_download(){
2825 +
2826 + if(empty($_GET['wpdocs_dl'])){
2827 + return;
2828 + }
2829 +
2830 + $file_id = absint(
2831 + wp_unslash($_GET['wpdocs_dl'])
2832 + );
2833 +
2834 + if(!$file_id){
2835 + status_header(404);
2836 + exit;
2837 + }
2838 +
2839 + $nonce = isset($_GET['wpdocs_nonce'])
2840 + ? sanitize_text_field(
2841 + wp_unslash($_GET['wpdocs_nonce'])
2842 + )
2843 + : '';
2844 +
2845 + if(
2846 + !wp_verify_nonce(
2847 + $nonce,
2848 + 'wpdocs_dl_' . $file_id
2849 + )
2850 + ){
2851 + status_header(403);
2852 + exit;
2853 + }
2854 +
2855 + // Adjust this according to where you store the file
2856 + $file = get_attached_file($file_id);
2857 +
2858 + if(
2859 + !$file ||
2860 + !file_exists($file)
2861 + ){
2862 + status_header(404);
2863 + exit;
2864 + }
2865 +
2866 + $uploads = wp_get_upload_dir();
2867 + $base_real = realpath($uploads['basedir']);
2868 + $file_real = realpath($file);
2869 +
2870 + if(
2871 + !$base_real ||
2872 + !$file_real ||
2873 + strpos(
2874 + $file_real,
2875 + $base_real . DIRECTORY_SEPARATOR
2876 + ) !== 0
2877 + ){
2878 + status_header(403);
2879 + exit;
2880 + }
2881 +
2882 + $mime = wp_check_filetype($file_real);
2883 + $mime = !empty($mime['type'])
2884 + ? $mime['type']
2885 + : 'application/octet-stream';
2886 +
2887 + header('Content-Type: ' . $mime);
2888 + header('Content-Length: ' . filesize($file_real));
2889 + header(
2890 + 'Content-Disposition: inline; filename="' .
2891 + basename($file_real) .
2892 + '"'
2893 + );
2894 +
2895 + readfile($file_real);
2896 + exit;
2897 + }
2898 + }
2627 2899
2628 2900 add_action('init', 'wpdocs_dir_actions');
2629 2901 if(!function_exists('wpdocs_dir_actions')){
2630 2902 function wpdocs_dir_actions(){
2631 2903
2904 + wpdocs_file_download();
2905 +
2632 2906 if(is_admin() && get_option('wpdocs_memphis_uninstall')){
2633 2907 if(wp_docs_memphis_folder_preserve('mdocs_2', 'mdocs')){
2634 2908 update_option('wpdocs_memphis_uninstall', false);
2635 2909 }
@@ -2836,30 +3110,34 @@
2836 3110 $result_array = array(
2837 3111 'status' => false,
2838 3112 );
2839 3113
2840 - if (!isset($_POST['wp_docs_nonce']) || !wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['wp_docs_nonce'])), 'wpdocs_update_options_nonce' ) ){
3114 + if(!empty($_POST) && isset($_POST['wp_docs_nonce'])){
2841 3115
2842 - wp_die(__("Sorry, your nonce did not verify.", 'wp-docs'));
2843 -
2844 - }else{
2845 -
2846 - $dir_progress = wp_docs_import_memphis_directories();
2847 - $file_progress = wp_docs_memphis_import_files();
2848 -
2849 - $result_array['status'] = ($dir_progress || $file_progress);
2850 -
2851 - if($result_array['status']){
2852 - wp_docs_whiteflag_memphis_htaccess();
2853 - }
2854 -
2855 - if(!$dir_progress && !$file_progress){
3116 + if (!wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['wp_docs_nonce'])), 'wpdocs_update_options_nonce' ) ){
2856 3117
2857 - $result_array['remarks'] = __('No directories and files found.', 'wp-docs');
3118 + wp_die(__("Sorry, your nonce did not verify.", 'wp-docs'));
3119 +
3120 + }else{
3121 +
3122 + $dir_progress = wp_docs_import_memphis_directories();
3123 + $file_progress = wp_docs_memphis_import_files();
3124 +
3125 + $result_array['status'] = ($dir_progress || $file_progress);
3126 +
3127 + if($result_array['status']){
3128 + wp_docs_whiteflag_memphis_htaccess();
3129 + }
3130 +
3131 + if(!$dir_progress && !$file_progress){
3132 +
3133 + $result_array['remarks'] = __('No directories and files found.', 'wp-docs');
3134 + }
3135 +
2858 3136 }
2859 3137
2860 3138 }
2861 -
3139 +
2862 3140 wp_send_json($result_array);
2863 3141 }
2864 3142 }
2865 3143
@@ -2871,16 +3149,20 @@
2871 3149 $result_array = array(
2872 3150 'status' => false,
2873 3151 );
2874 3152
2875 - if (!isset($_POST['wp_docs_nonce']) || !wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['wp_docs_nonce'])), 'wpdocs_update_options_nonce' ) ){
3153 + if(!empty($_POST) && isset($_POST['wp_docs_nonce'])){
2876 3154
2877 - wp_die(__("Sorry, your nonce did not verify.", 'wp-docs'));
2878 -
2879 - }else{
2880 -
2881 - wp_docs_rollback_memphis_import();
2882 - $result_array['status'] = true;
3155 + if (!wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['wp_docs_nonce'])), 'wpdocs_update_options_nonce' ) ){
3156 +
3157 + wp_die(__("Sorry, your nonce did not verify.", 'wp-docs'));
3158 +
3159 + }else{
3160 +
3161 + wp_docs_rollback_memphis_import();
3162 + $result_array['status'] = true;
3163 + }
3164 +
2883 3165 }
2884 3166
2885 3167 wp_send_json($result_array);
2886 3168 }
@@ -3072,31 +3354,34 @@
3072 3354
3073 3355 }
3074 3356 }
3075 3357
3358 +
3076 3359 if(!function_exists('wp_docs_relocate_memphis_meta')){
3077 3360 function wp_docs_relocate_memphis_meta($dir_id){
3078 3361 global $wpdocs_imported_files, $wpdocs_imported_folder;
3362 +
3363 + // Ensure arrays are initialized properly before using them
3364 + $wpdocs_imported_files = (is_array($wpdocs_imported_files) ? $wpdocs_imported_files : array());
3365 + $wpdocs_imported_folder = (is_array($wpdocs_imported_folder) ? $wpdocs_imported_folder : array());
3366 +
3079 3367 $wpdocs_items = get_post_meta($dir_id, 'wpdocs_items', true);
3080 3368 $wpdocs_items = (is_array($wpdocs_items) ? $wpdocs_items : array());
3081 3369 $dir_slug = get_post_meta($dir_id, '_wpdocs_memphis_slug', true);
3082 -
3083 - $wpdocs_imported_files = (is_array($wpdocs_imported_files)?$wpdocs_imported_files:array());
3084 -
3370 +
3085 3371 if(!empty($wpdocs_items)){
3086 -
3087 3372 $wpdocs_imported_files = array_diff($wpdocs_imported_files, $wpdocs_items);
3088 3373 }
3089 -
3374 +
3090 3375 if($dir_slug){
3091 3376 $wpdocs_imported_folder = array_diff($wpdocs_imported_folder, array($dir_slug));
3092 3377 }
3093 -
3378 +
3094 3379 update_option('wpdocs_imported_folder', $wpdocs_imported_folder);
3095 3380 update_option('wpdocs_imported_files', $wpdocs_imported_files);
3381 + }
3382 + }
3096 3383
3097 - };
3098 - }
3099 3384
3100 3385 if(!function_exists('wp_docs_memphis_import_files')){
3101 3386 function wp_docs_memphis_import_files(){
3102 3387 global $memphis_folders_id, $memphis_files_array, $wpdocs_imported_files, $wpdocs_memphis_list, $wpdocs_post_types;
@@ -3132,8 +3417,10 @@
3132 3417
3133 3418 if(!empty($dir_list)){
3134 3419 foreach($dir_list as $dir_id){
3135 3420 update_post_meta($attachment_id, '_wpdocs_memphis_media_file', true);
3421 + update_post_meta($attachment_id, '_wpdocs_memphis_file_id', $file_data['id']);
3422 +
3136 3423 $wpdocs_imported_files[] = $attachment_id;
3137 3424 wpdocs_update_files_meta($dir_id, $files);
3138 3425 }
3139 3426 unset($memphis_files_array[$file_index]);
@@ -3314,15 +3601,15 @@
3314 3601 $default_ext = '';
3315 3602
3316 3603 $breadcrumb = get_the_title($dir);
3317 3604 ?>
3318 - <small class="alert alert-success d-block"><i class="fas fa-chevron-right"></i> <?php echo $breadcrumb; ?></small>
3605 + <small class="alert alert-success d-block"><i class="fas fa-chevron-right"></i> <?php echo esc_html($breadcrumb); ?></small>
3319 3606 <?php
3320 3607
3321 3608 }
3322 3609 ?>
3323 3610 <label for="wpdocs_options_file">
3324 - <input <?php checked($is_file); ?> type="checkbox" class="<?php echo $dir_option_class; ?>" name="wpdocs_options[file_upload]" value="file_upload" id="wpdocs_options_file" />
3611 + <input <?php checked($is_file); ?> type="checkbox" class="<?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[file_upload]" value="file_upload" id="wpdocs_options_file" />
3325 3612 <?php echo __('File Upload Front-end', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small> <i title="<?php echo __('This icon will appear on front-end for users', 'wp-docs'); ?>" class="fa fa-upload" style="color:#ffc107"></i>
3326 3613 <a href="https://www.youtube.com/embed/flFmqpJCwYk" target="_blank"><?php echo __('Video Tutorial', 'wp-docs'); ?></a>
3327 3614 </label>
3328 3615
@@ -3330,9 +3617,9 @@
3330 3617
3331 3618 <ul class="ml-4 <?php echo $is_file ? '' : 'd-none'?>">
3332 3619 <li>
3333 3620 <label for="wpdocs_options_current_user_files">
3334 - <input class="<?php echo $dir_option_class; ?>" <?php checked($is_file && $is_current_user_files); ?> type="checkbox" name="wpdocs_options[current_user_files]" value="current_user_files" id="wpdocs_options_current_user_files" />
3621 + <input class="<?php echo esc_attr($dir_option_class); ?>" <?php checked($is_file && $is_current_user_files); ?> type="checkbox" name="wpdocs_options[current_user_files]" value="current_user_files" id="wpdocs_options_current_user_files" />
3335 3622 <?php echo __('Do not make files public uploaded by users', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small>
3336 3623 </label>
3337 3624 </li>
3338 3625
@@ -3337,9 +3624,9 @@
3337 3624 </li>
3338 3625
3339 3626 <li>
3340 3627 <label for="wpdocs_options_del_from_front">
3341 - <input class="<?php echo $dir_option_class; ?>" <?php checked($is_file && $is_del_from_front); ?> type="checkbox" name="wpdocs_options[del_from_front]" value="del_from_front" id="wpdocs_options_del_from_front" />
3628 + <input class="<?php echo esc_attr($dir_option_class); ?>" <?php checked($is_file && $is_del_from_front); ?> type="checkbox" name="wpdocs_options[del_from_front]" value="del_from_front" id="wpdocs_options_del_from_front" />
3342 3629 <?php echo __('User can delete the files from front-end?', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small> <i class="fas fa-trash-alt" style="color:#ffc107"></i>
3343 3630 </label>
3344 3631 </li>
3345 3632
@@ -3349,9 +3636,9 @@
3349 3636 </label>
3350 3637
3351 3638
3352 3639
3353 - <select class="wpdocs_options_allowed_role <?php echo $dir_option_class; ?>" name="wpdocs_options[allowed_role]" data-name="allowed_role" id="wpdocs_options_allowed_role" multiple placeholder="<?php echo __('Select roles to allow upload', 'wp-docs'); ?>">
3640 + <select class="wpdocs_options_allowed_role <?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[allowed_role]" data-name="allowed_role" id="wpdocs_options_allowed_role" multiple placeholder="<?php echo __('Select roles to allow upload', 'wp-docs'); ?>">
3354 3641
3355 3642 <?php echo wpdocs_get_user_roles_options($allowed_role) ?>
3356 3643
3357 3644 </select>
@@ -3362,9 +3649,9 @@
3362 3649 <li>
3363 3650 <label for="wpdocs_options_allowed_ext">
3364 3651 <?php echo __('Allowed File Types', 'wp-docs'); ?> <?php echo ($wpdocs_pro?'':'<small>'.__('(Premium)', 'wp-docs').'</small> '); ?> <i class="fas fa-photo-video" style="color:#ffc107"></i>
3365 3652 </label>
3366 - <input type="text" class="form-control <?php echo $dir_option_class; ?>" name="wpdocs_options[allowed_ext]" data-name="allowed_ext" value="<?php echo $allowed_ext; ?>" id="wpdocs_options_allowed_ext" title="<?php _e('Leave blank if you want to allow all type of files', 'wp-docs'); ?>" placeholder="<?php echo $default_ext; ?>" />
3653 + <input type="text" class="form-control <?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[allowed_ext]" data-name="allowed_ext" value="<?php echo esc_attr($allowed_ext); ?>" id="wpdocs_options_allowed_ext" title="<?php _e('Leave blank if you want to allow all type of files', 'wp-docs'); ?>" placeholder="<?php echo esc_attr($default_ext); ?>" />
3367 3654
3368 3655 </li>
3369 3656
3370 3657 </ul>
@@ -3529,4 +3816,5 @@
3529 3816 function wpdoc_humanize($str){
3530 3817 return ucwords(str_replace(array('-', '_'), ' ', $str));
3531 3818 }
3532 3819 }
3820 + include_once('functions-verify.php');