Changeset 2931908
- Timestamp:
- 06/28/2023 03:16:09 PM (2 years ago)
- Location:
- fiber-admin
- Files:
-
- 2 added
- 18 edited
- 1 copied
-
tags/3.0.0 (copied) (copied from fiber-admin/trunk)
-
tags/3.0.0/assets/js/fiber-admin.min.js (modified) (1 diff)
-
tags/3.0.0/assets/js/fiber-svg.min.js (modified) (1 diff)
-
tags/3.0.0/changelog.txt (modified) (1 diff)
-
tags/3.0.0/fiberadmin.php (modified) (2 diffs)
-
tags/3.0.0/includes/attachment.php (added)
-
tags/3.0.0/includes/content.php (modified) (4 diffs)
-
tags/3.0.0/includes/helper.php (modified) (1 diff)
-
tags/3.0.0/includes/image.php (modified) (3 diffs)
-
tags/3.0.0/includes/settings/miscellaneous.php (modified) (10 diffs)
-
tags/3.0.0/readme.txt (modified) (2 diffs)
-
trunk/assets/js/fiber-admin.min.js (modified) (1 diff)
-
trunk/assets/js/fiber-svg.min.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/fiberadmin.php (modified) (2 diffs)
-
trunk/includes/attachment.php (added)
-
trunk/includes/content.php (modified) (4 diffs)
-
trunk/includes/helper.php (modified) (1 diff)
-
trunk/includes/image.php (modified) (3 diffs)
-
trunk/includes/settings/miscellaneous.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fiber-admin/tags/3.0.0/assets/js/fiber-admin.min.js
r2610034 r2931908 1 jQuery(document).ready(function(n){n('.fiber-admin-input__img input[type="text"]').on("change",function(){ let t=n(this).closest("fieldset").find("img"),e=n(this).closest("fieldset").find("input");n(this).val()?(t.attr("src")||t.attr("src",e.val()),t.show()):t.hide()}),n(".fiber-admin-upload").each(function(){const t=n(this),e=t.closest("fieldset").find("input"),i=t.closest("fieldset").find("img");let s;i.attr("src")||i.hide(),t.click(function(t){t.preventDefault(),s||(s=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1}),s.on("select",function(){var t=s.state().get("selection").first().toJSON();e.val(t.url),i.attr("src",t.url).show()})),s.open()})}),n(".fiber-color-field").wpColorPicker()});1 jQuery(document).ready(function(n){n('.fiber-admin-input__img input[type="text"]').on("change",function(){var t=n(this).closest("fieldset").find("img"),e=n(this).closest("fieldset").find("input");n(this).val()?(t.attr("src")||t.attr("src",e.val()),t.show()):t.hide()}),n(".fiber-admin-upload").each(function(){const t=n(this),e=t.closest("fieldset").find("input"),i=t.closest("fieldset").find("img");let s;i.attr("src")||i.hide(),t.click(function(t){t.preventDefault(),s||(s=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1})).on("select",function(){var t=s.state().get("selection").first().toJSON();e.val(t.url),i.attr("src",t.url).show()}),s.open()})}),n(".fiber-color-field").wpColorPicker()}); -
fiber-admin/tags/3.0.0/assets/js/fiber-svg.min.js
r2627852 r2931908 1 jQuery(document).ready(function( l){const t=new MutationObserver(function(a){for(let n=0;n<a.length;n++)for(let e=0;e<a[n].addedNodes.length;e++){const s=l(a[n].addedNodes[e]);let t=!1;if(!s.hasClass("attachment-details")&&0===s.find(".attachment-details").length||(t=!0),!0===t){const i=s.find('span[data-setting="url"]');var d;0!==i.length&&(d=i.find("input").val(),s.find(".details-image").attr("src",d),s.find(".details-image").removeClass("icon"))}}});t.observe(document.body,{childList:!0,subtree:!0})});1 jQuery(document).ready(function(s){new MutationObserver(function(d){for(let a=0;a<d.length;a++)for(let t=0;t<d[a].addedNodes.length;t++){var n,i=s(d[a].addedNodes[t]);let e=!1;!0===(e=!i.hasClass("attachment-details")&&0===i.find(".attachment-details").length?e:!0)&&0!==(n=i.find('span[data-setting="url"]')).length&&(n=n.find("input").val(),i.find(".details-image").attr("src",n),i.find(".details-image").removeClass("icon"))}}).observe(document.body,{childList:!0,subtree:!0})}); -
fiber-admin/tags/3.0.0/changelog.txt
r2912732 r2931908 1 1 == Changelog == 2 3 = 3.0.0 = 4 *Release Date - 28 June 2023* 5 6 * Fixed: Fix wrong email regex pattern. 7 * Added: Improve content protection scripts. 8 * Added: Sanitizing filename to a server-friendly version. 9 * Added: Improve feature auto set attachment title with sanitized filename. 2 10 3 11 = 2.0.16 = -
fiber-admin/tags/3.0.0/fiberadmin.php
r2912732 r2931908 4 4 * Plugin URI: https://wordpress.org/plugins/fiber-admin/ 5 5 * Description: 💈 Bring multiple customization features to make your own WordPress admin. 6 * Version: 2.0.166 * Version: 3.0.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.0 … … 64 64 include_once(FIBERADMIN_DIR . 'includes/duplicate.php'); 65 65 include_once(FIBERADMIN_DIR . 'includes/db-error.php'); 66 include_once(FIBERADMIN_DIR . 'includes/attachment.php'); 66 67 } 67 68 -
fiber-admin/tags/3.0.0/includes/content.php
r2857421 r2931908 12 12 // Convert email text to link 13 13 if(!fiad_get_miscellaneous_option('disable_email_converter')){ 14 add_filter('the_content', array($this, 'fiad_auto_convert_email_address')); 15 16 // Divi theme 17 add_filter('et_builder_render_layout', array($this, 'fiad_auto_convert_email_address')); 14 add_filter('the_content', [$this, 'fiad_auto_convert_email_address']); 18 15 } 19 16 20 17 // Content protection 21 18 if(!fiad_get_miscellaneous_option('disable_content_protection') && !fiad_is_admin_user_role()){ 22 add_action('wp_footer', array($this, 'fiad_content_protection_scripts'));19 add_action('wp_footer', [$this, 'fiad_content_protection_scripts']); 23 20 } 24 21 25 22 // Revisions 26 $revision_number = fiad_get_miscellaneous_option('revision_number'); 27 if(empty($revision_number)){ 28 $revision_number = 5; 29 } 23 $revision_number = fiad_get_miscellaneous_option('revision_number') ? : 5; 30 24 $revision_number = intval($revision_number); 31 25 if($revision_number > 0){ 32 add_filter('wp_revisions_to_keep', array($this, 'fiad_limit_wp_revisions'), 10, 2);26 add_filter('wp_revisions_to_keep', [$this, 'fiad_limit_wp_revisions'], 10, 2); 33 27 } 34 28 … … 36 30 if(!fiad_get_miscellaneous_option('enable_comments')){ 37 31 // Remove from admin menu 38 add_action('admin_menu', array($this, 'fiad_remove_comment_admin_menus'));32 add_action('admin_menu', [$this, 'fiad_remove_comment_admin_menus']); 39 33 40 34 // Remove from post types 41 add_action('init', array($this, 'fiad_remove_comment_support'), 100);35 add_action('init', [$this, 'fiad_remove_comment_support'], 100); 42 36 43 37 // Remove from admin bar 44 add_action('wp_before_admin_bar_render', array($this, 'fiad_remove_comment_admin_bar'));38 add_action('wp_before_admin_bar_render', [$this, 'fiad_remove_comment_admin_bar']); 45 39 } 46 40 } … … 67 61 68 62 // Detect and create email link 69 $search = array('/([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})/');70 $replace = array('<a href="mailto:$1" title="$1">$1</a>');63 $search = ['/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,})/']; 64 $replace = ['<a href="mailto:$1" title="$1">$1</a>']; 71 65 72 66 return preg_replace($search, $replace, $content); … … 74 68 75 69 public function fiad_content_protection_scripts(){ 76 echo ' 77 <script type="text/javascript"> 70 if(FIBERADMIN_DEV_MODE){ 71 echo ' 72 <script> 73 // text 74 const disable_keys = ["s","a","c","x","C","J","U","I"]; 78 75 document.addEventListener("keydown", function(e){ 79 if((navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ 80 if(e.key === "s" || e.key === "a" || e.key === "c" || e.key === "x" || (e.shiftKey && e.key === "I")){ 81 e.preventDefault(); 76 if(((navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) && disable_keys.includes(e.key)) || e.key === "F12"){ 77 e.preventDefault(); 78 } 79 }, false); 80 81 ["cut", "copy"].forEach(even => { 82 document.querySelector("body").addEventListener(even, e => { 83 e.preventDefault(); 84 }); 85 }); 86 87 // image 88 setTimeout(function(){ 89 const currentURL = window.location.hostname, 90 images = document.getElementsByTagName("img"); 91 92 let imageURL = ""; 93 for(let i = 0; i < images.length; i++){ 94 imageURL = images[i].src; 95 if(imageURL.includes(currentURL)){ 96 images[i].addEventListener("contextmenu", event => event.preventDefault()); 97 images[i].setAttribute("draggable", false); 82 98 } 83 99 } 84 }, false);100 }, 1000); 85 101 </script> 86 102 '; 103 }else{ 104 echo '<script>const disable_keys=["s","a","c","x","C","J","U","I"];document.addEventListener("keydown",function(e){((navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&disable_keys.includes(e.key)||"F12"===e.key)&&e.preventDefault()},!1),["cut","copy"].forEach(e=>{document.querySelector("body").addEventListener(e,e=>{e.preventDefault()})}),setTimeout(function(){let e=window.location.hostname,t=document.getElementsByTagName("img"),n="";for(let a=0;a<t.length;a++)(n=t[a].src).includes(e)&&(t[a].addEventListener("contextmenu",e=>e.preventDefault()),t[a].setAttribute("draggable",!1))},1e3);</script>'; 105 } 87 106 } 88 107 89 108 public function fiad_limit_wp_revisions($num, $post): int{ 90 $revision_number = fiad_get_miscellaneous_option('revision_number'); 91 if(empty($revision_number)){ 92 $revision_number = 5; 93 } 109 $revision_number = fiad_get_miscellaneous_option('revision_number') ? : 5; 94 110 95 111 return intval($revision_number); -
fiber-admin/tags/3.0.0/includes/helper.php
r2912732 r2931908 99 99 } 100 100 101 if(!function_exists('fiad_get_maintenance_mode_option')){ 102 function fiad_get_maintenance_mode_option($key){ 103 return fiad_get_option($key, get_option('fiad_maintenance_mode')); 104 } 105 } 106 101 107 if(!function_exists('fiad_array_key_exists')){ 102 108 function fiad_array_key_exists($key, $array, $default = ''){ -
fiber-admin/tags/3.0.0/includes/image.php
r2834904 r2931908 28 28 class Fiber_Admin_Image{ 29 29 public function __construct(){ 30 // Set image meta on upload31 if(fiad_get_miscellaneous_option('auto_img_meta')){32 add_action('add_attachment', array($this, 'fiad_set_image_meta_on_image_upload'));33 }34 35 // Disable right click and drag on image v1.2.036 if(!fiad_get_miscellaneous_option('disable_image_protection') && !fiad_is_admin_user_role()){37 add_action('wp_footer', array($this, 'fiad_image_protection_scripts'));38 }39 40 30 // Enable SVG 41 31 if(fiad_get_miscellaneous_option('enable_svg')){ 42 add_filter('upload_mimes', array($this, 'fiad_svg_mime_types'));43 add_action('admin_head', array($this, 'fiad_fix_svg_display'));32 add_filter('upload_mimes', [$this, 'fiad_svg_mime_types']); 33 add_action('admin_head', [$this, 'fiad_fix_svg_display']); 44 34 45 add_action("admin_enqueue_scripts", array($this, 'fiad_svg_enqueue_scripts'));46 add_filter('wp_handle_upload_prefilter', array($this, 'fiad_check_for_svg'));35 add_action("admin_enqueue_scripts", [$this, 'fiad_svg_enqueue_scripts']); 36 add_filter('wp_handle_upload_prefilter', [$this, 'fiad_check_for_svg']); 47 37 48 38 // SVG metadata 49 add_filter('wp_get_attachment_metadata', array($this, 'fiad_svg_attachment_metadata'), 10, 2);50 add_filter('wp_generate_attachment_metadata', array($this, 'fiad_svg_attachment_metadata'), 10, 2);39 add_filter('wp_get_attachment_metadata', [$this, 'fiad_svg_attachment_metadata'], 10, 2); 40 add_filter('wp_generate_attachment_metadata', [$this, 'fiad_svg_attachment_metadata'], 10, 2); 51 41 } 52 42 } … … 56 46 if($screen->id == 'upload'){ 57 47 $suffix = !FIBERADMIN_DEV_MODE ? '.min' : ''; 58 wp_enqueue_script('fiber-admin-svg', FIBERADMIN_ASSETS_URL . 'js/fiber-svg' . $suffix . '.js', array('jquery'), FIBERADMIN_VERSION);48 wp_enqueue_script('fiber-admin-svg', FIBERADMIN_ASSETS_URL . 'js/fiber-svg' . $suffix . '.js', ['jquery'], FIBERADMIN_VERSION); 59 49 wp_localize_script('fiber-admin-svg', 'script_vars', 60 array(61 'ajaxurl' => admin_url('admin-ajax.php') 62 )50 [ 51 'ajaxurl' => admin_url('admin-ajax.php'), 52 ] 63 53 ); 64 54 } 65 }66 67 public function fiad_set_image_meta_on_image_upload($post_id){68 if(wp_attachment_is_image($post_id)){69 $fiber_image_title = get_post($post_id)->post_title;70 71 $fiber_image_title = preg_replace('%\s*[-_\s]+\s*%', ' ', $fiber_image_title);72 $fiber_image_title = ucwords(strtolower($fiber_image_title));73 74 $fiber_image_meta = array(75 'ID' => $post_id,76 'post_title' => $fiber_image_title,77 );78 79 update_post_meta($post_id, '_wp_attachment_image_alt', $fiber_image_title);80 wp_update_post($fiber_image_meta);81 }82 }83 84 public function fiad_image_protection_scripts(){85 echo "86 <script type='text/javascript'>87 setTimeout(function(){88 const currentURL = window.location.hostname,89 images = document.getElementsByTagName('img');90 91 let imageURL = '';92 for(let i = 0; i < images.length; i++){93 imageURL = images[i].src;94 if(imageURL.includes(currentURL)){95 images[i].addEventListener('contextmenu', event => event.preventDefault());96 images[i].setAttribute('draggable', false);97 }98 }99 }, 1000);100 </script>101 ";102 55 } 103 56 … … 161 114 } 162 115 163 return array(116 return [ 164 117 'width' => ceil($width), 165 118 'height' => ceil($height), 166 'orientation' => ($width > $height) ? 'landscape' : 'portrait' 167 );119 'orientation' => ($width > $height) ? 'landscape' : 'portrait', 120 ]; 168 121 } 169 122 -
fiber-admin/tags/3.0.0/includes/settings/miscellaneous.php
r2696536 r2931908 16 16 'fiad_miscellaneous_group', 17 17 'fiad_miscellaneous', 18 array($this, 'sanitize_text_field')18 [$this, 'sanitize_text_field'] 19 19 ); 20 20 … … 22 22 'fiad_miscellaneous_section', 23 23 '<span class="dashicons dashicons-admin-generic"></span> General', 24 array($this, 'fiad_section_info'),24 [$this, 'fiad_section_info'], 25 25 'fiber-admin-miscellaneous' 26 26 ); … … 29 29 'enable_auto_update', // id 30 30 'Enable auto update', // title 31 array($this, 'fiad_enable_auto_update'), // callback31 [$this, 'fiad_enable_auto_update'], // callback 32 32 'fiber-admin-miscellaneous', // page 33 33 'fiad_miscellaneous_section' // section … … 35 35 36 36 add_settings_section( 37 'fiad_image_section',38 '<span class="dashicons dashicons-format-image"></span> Image',39 array($this, 'fiad_section_info'),40 'fiber-admin-miscellaneous'41 );42 43 add_settings_field(44 'auto_img_meta', // id45 'Auto Set Image Meta', // title46 array($this, 'fiad_auto_image_meta'), // callback47 'fiber-admin-miscellaneous', // page48 'fiad_image_section' // section49 );50 51 add_settings_field(52 'disable_image_protection', // id53 'Disable Image Protection ', // title54 array($this, 'fiad_disable_image_protection'), // callback55 'fiber-admin-miscellaneous', // page56 'fiad_image_section' // section57 );58 59 add_settings_section(60 37 'fiad_content_section', 61 38 '<span class="dashicons dashicons-editor-table"></span> Content', 62 array($this, 'fiad_section_info'),39 [$this, 'fiad_section_info'], 63 40 'fiber-admin-miscellaneous' 64 41 ); … … 67 44 'revision_number', // id 68 45 'Limit number of revisions', // title 69 array($this, 'fiad_revision_number'), // callback46 [$this, 'fiad_revision_number'], // callback 70 47 'fiber-admin-miscellaneous', // page 71 48 'fiad_content_section' // section … … 75 52 'disable_email_converter', // id 76 53 'Disable Convert Email Text to Link', // title 77 array($this, 'fiad_disable_email_converter'), // callback54 [$this, 'fiad_disable_email_converter'], // callback 78 55 'fiber-admin-miscellaneous', // page 79 56 'fiad_content_section' // section … … 83 60 'enable_svg', // id 84 61 'Enable SVG', // title 85 array($this, 'fiad_enable_svg'), // callback62 [$this, 'fiad_enable_svg'], // callback 86 63 'fiber-admin-miscellaneous', // page 87 64 'fiad_content_section' // section … … 91 68 'disable_content_protection', // id 92 69 'Disable Content Protection', // title 93 array($this, 'fiad_disable_content_protection'), // callback70 [$this, 'fiad_disable_content_protection'], // callback 94 71 'fiber-admin-miscellaneous', // page 95 72 'fiad_content_section' // section … … 99 76 'enable_comments', // id 100 77 'Enable Comments', // title 101 array($this, 'fiad_enable_comments'), // callback78 [$this, 'fiad_enable_comments'], // callback 102 79 'fiber-admin-miscellaneous', // page 103 80 'fiad_content_section' // section … … 114 91 <input type="checkbox" name="fiad_miscellaneous[enable_auto_update]" id="enable_auto_update" 115 92 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('enable_auto_update')), 'yes'); ?> /> 116 <span class="slider round"></span>117 </label>118 </fieldset>119 <?php120 }121 122 public function fiad_auto_image_meta(){123 ?>124 <fieldset>125 <label for="auto_img_meta" class="fiber-admin-toggle">126 <input type="checkbox" name="fiad_miscellaneous[auto_img_meta]" id="auto_img_meta"127 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('auto_img_meta')), 'yes'); ?> />128 <span class="slider round"></span>129 </label>130 </fieldset>131 <?php132 }133 134 public function fiad_disable_image_protection(){135 ?>136 <fieldset>137 <label for="disable_image_protection" class="fiber-admin-toggle">138 <input type="checkbox" name="fiad_miscellaneous[disable_image_protection]"139 id="disable_image_protection"140 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('disable_image_protection')), 'yes'); ?> />141 93 <span class="slider round"></span> 142 94 </label> -
fiber-admin/tags/3.0.0/readme.txt
r2912732 r2931908 3 3 Tags: white label, admin tool, duplicate post, content protection 4 4 Requires at least: 4.7 5 Tested up to: 6. 0.15 Tested up to: 6.2.2 6 6 Requires PHP: 7.0 7 Stable tag: 2.0.167 Stable tag: 3.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 47 47 == Changelog == 48 48 49 = 2.0.16=50 *Release Date - 16 May2023*49 = 3.0.0 = 50 *Release Date - 28 June 2023* 51 51 52 * Fixed: Use admin bar default when the option enable admin toolbar is disabled. 52 * Fixed: Fix wrong email regex pattern. 53 * Added: Improve content protection scripts. 54 * Added: Sanitizing filename to a server-friendly version. 55 * Added: Improve feature auto set attachment title with sanitized filename. -
fiber-admin/trunk/assets/js/fiber-admin.min.js
r2610034 r2931908 1 jQuery(document).ready(function(n){n('.fiber-admin-input__img input[type="text"]').on("change",function(){ let t=n(this).closest("fieldset").find("img"),e=n(this).closest("fieldset").find("input");n(this).val()?(t.attr("src")||t.attr("src",e.val()),t.show()):t.hide()}),n(".fiber-admin-upload").each(function(){const t=n(this),e=t.closest("fieldset").find("input"),i=t.closest("fieldset").find("img");let s;i.attr("src")||i.hide(),t.click(function(t){t.preventDefault(),s||(s=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1}),s.on("select",function(){var t=s.state().get("selection").first().toJSON();e.val(t.url),i.attr("src",t.url).show()})),s.open()})}),n(".fiber-color-field").wpColorPicker()});1 jQuery(document).ready(function(n){n('.fiber-admin-input__img input[type="text"]').on("change",function(){var t=n(this).closest("fieldset").find("img"),e=n(this).closest("fieldset").find("input");n(this).val()?(t.attr("src")||t.attr("src",e.val()),t.show()):t.hide()}),n(".fiber-admin-upload").each(function(){const t=n(this),e=t.closest("fieldset").find("input"),i=t.closest("fieldset").find("img");let s;i.attr("src")||i.hide(),t.click(function(t){t.preventDefault(),s||(s=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1})).on("select",function(){var t=s.state().get("selection").first().toJSON();e.val(t.url),i.attr("src",t.url).show()}),s.open()})}),n(".fiber-color-field").wpColorPicker()}); -
fiber-admin/trunk/assets/js/fiber-svg.min.js
r2627852 r2931908 1 jQuery(document).ready(function( l){const t=new MutationObserver(function(a){for(let n=0;n<a.length;n++)for(let e=0;e<a[n].addedNodes.length;e++){const s=l(a[n].addedNodes[e]);let t=!1;if(!s.hasClass("attachment-details")&&0===s.find(".attachment-details").length||(t=!0),!0===t){const i=s.find('span[data-setting="url"]');var d;0!==i.length&&(d=i.find("input").val(),s.find(".details-image").attr("src",d),s.find(".details-image").removeClass("icon"))}}});t.observe(document.body,{childList:!0,subtree:!0})});1 jQuery(document).ready(function(s){new MutationObserver(function(d){for(let a=0;a<d.length;a++)for(let t=0;t<d[a].addedNodes.length;t++){var n,i=s(d[a].addedNodes[t]);let e=!1;!0===(e=!i.hasClass("attachment-details")&&0===i.find(".attachment-details").length?e:!0)&&0!==(n=i.find('span[data-setting="url"]')).length&&(n=n.find("input").val(),i.find(".details-image").attr("src",n),i.find(".details-image").removeClass("icon"))}}).observe(document.body,{childList:!0,subtree:!0})}); -
fiber-admin/trunk/changelog.txt
r2912732 r2931908 1 1 == Changelog == 2 3 = 3.0.0 = 4 *Release Date - 28 June 2023* 5 6 * Fixed: Fix wrong email regex pattern. 7 * Added: Improve content protection scripts. 8 * Added: Sanitizing filename to a server-friendly version. 9 * Added: Improve feature auto set attachment title with sanitized filename. 2 10 3 11 = 2.0.16 = -
fiber-admin/trunk/fiberadmin.php
r2912732 r2931908 4 4 * Plugin URI: https://wordpress.org/plugins/fiber-admin/ 5 5 * Description: 💈 Bring multiple customization features to make your own WordPress admin. 6 * Version: 2.0.166 * Version: 3.0.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.0 … … 64 64 include_once(FIBERADMIN_DIR . 'includes/duplicate.php'); 65 65 include_once(FIBERADMIN_DIR . 'includes/db-error.php'); 66 include_once(FIBERADMIN_DIR . 'includes/attachment.php'); 66 67 } 67 68 -
fiber-admin/trunk/includes/content.php
r2857421 r2931908 12 12 // Convert email text to link 13 13 if(!fiad_get_miscellaneous_option('disable_email_converter')){ 14 add_filter('the_content', array($this, 'fiad_auto_convert_email_address')); 15 16 // Divi theme 17 add_filter('et_builder_render_layout', array($this, 'fiad_auto_convert_email_address')); 14 add_filter('the_content', [$this, 'fiad_auto_convert_email_address']); 18 15 } 19 16 20 17 // Content protection 21 18 if(!fiad_get_miscellaneous_option('disable_content_protection') && !fiad_is_admin_user_role()){ 22 add_action('wp_footer', array($this, 'fiad_content_protection_scripts'));19 add_action('wp_footer', [$this, 'fiad_content_protection_scripts']); 23 20 } 24 21 25 22 // Revisions 26 $revision_number = fiad_get_miscellaneous_option('revision_number'); 27 if(empty($revision_number)){ 28 $revision_number = 5; 29 } 23 $revision_number = fiad_get_miscellaneous_option('revision_number') ? : 5; 30 24 $revision_number = intval($revision_number); 31 25 if($revision_number > 0){ 32 add_filter('wp_revisions_to_keep', array($this, 'fiad_limit_wp_revisions'), 10, 2);26 add_filter('wp_revisions_to_keep', [$this, 'fiad_limit_wp_revisions'], 10, 2); 33 27 } 34 28 … … 36 30 if(!fiad_get_miscellaneous_option('enable_comments')){ 37 31 // Remove from admin menu 38 add_action('admin_menu', array($this, 'fiad_remove_comment_admin_menus'));32 add_action('admin_menu', [$this, 'fiad_remove_comment_admin_menus']); 39 33 40 34 // Remove from post types 41 add_action('init', array($this, 'fiad_remove_comment_support'), 100);35 add_action('init', [$this, 'fiad_remove_comment_support'], 100); 42 36 43 37 // Remove from admin bar 44 add_action('wp_before_admin_bar_render', array($this, 'fiad_remove_comment_admin_bar'));38 add_action('wp_before_admin_bar_render', [$this, 'fiad_remove_comment_admin_bar']); 45 39 } 46 40 } … … 67 61 68 62 // Detect and create email link 69 $search = array('/([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})/');70 $replace = array('<a href="mailto:$1" title="$1">$1</a>');63 $search = ['/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,})/']; 64 $replace = ['<a href="mailto:$1" title="$1">$1</a>']; 71 65 72 66 return preg_replace($search, $replace, $content); … … 74 68 75 69 public function fiad_content_protection_scripts(){ 76 echo ' 77 <script type="text/javascript"> 70 if(FIBERADMIN_DEV_MODE){ 71 echo ' 72 <script> 73 // text 74 const disable_keys = ["s","a","c","x","C","J","U","I"]; 78 75 document.addEventListener("keydown", function(e){ 79 if((navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ 80 if(e.key === "s" || e.key === "a" || e.key === "c" || e.key === "x" || (e.shiftKey && e.key === "I")){ 81 e.preventDefault(); 76 if(((navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) && disable_keys.includes(e.key)) || e.key === "F12"){ 77 e.preventDefault(); 78 } 79 }, false); 80 81 ["cut", "copy"].forEach(even => { 82 document.querySelector("body").addEventListener(even, e => { 83 e.preventDefault(); 84 }); 85 }); 86 87 // image 88 setTimeout(function(){ 89 const currentURL = window.location.hostname, 90 images = document.getElementsByTagName("img"); 91 92 let imageURL = ""; 93 for(let i = 0; i < images.length; i++){ 94 imageURL = images[i].src; 95 if(imageURL.includes(currentURL)){ 96 images[i].addEventListener("contextmenu", event => event.preventDefault()); 97 images[i].setAttribute("draggable", false); 82 98 } 83 99 } 84 }, false);100 }, 1000); 85 101 </script> 86 102 '; 103 }else{ 104 echo '<script>const disable_keys=["s","a","c","x","C","J","U","I"];document.addEventListener("keydown",function(e){((navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&disable_keys.includes(e.key)||"F12"===e.key)&&e.preventDefault()},!1),["cut","copy"].forEach(e=>{document.querySelector("body").addEventListener(e,e=>{e.preventDefault()})}),setTimeout(function(){let e=window.location.hostname,t=document.getElementsByTagName("img"),n="";for(let a=0;a<t.length;a++)(n=t[a].src).includes(e)&&(t[a].addEventListener("contextmenu",e=>e.preventDefault()),t[a].setAttribute("draggable",!1))},1e3);</script>'; 105 } 87 106 } 88 107 89 108 public function fiad_limit_wp_revisions($num, $post): int{ 90 $revision_number = fiad_get_miscellaneous_option('revision_number'); 91 if(empty($revision_number)){ 92 $revision_number = 5; 93 } 109 $revision_number = fiad_get_miscellaneous_option('revision_number') ? : 5; 94 110 95 111 return intval($revision_number); -
fiber-admin/trunk/includes/helper.php
r2912732 r2931908 99 99 } 100 100 101 if(!function_exists('fiad_get_maintenance_mode_option')){ 102 function fiad_get_maintenance_mode_option($key){ 103 return fiad_get_option($key, get_option('fiad_maintenance_mode')); 104 } 105 } 106 101 107 if(!function_exists('fiad_array_key_exists')){ 102 108 function fiad_array_key_exists($key, $array, $default = ''){ -
fiber-admin/trunk/includes/image.php
r2834904 r2931908 28 28 class Fiber_Admin_Image{ 29 29 public function __construct(){ 30 // Set image meta on upload31 if(fiad_get_miscellaneous_option('auto_img_meta')){32 add_action('add_attachment', array($this, 'fiad_set_image_meta_on_image_upload'));33 }34 35 // Disable right click and drag on image v1.2.036 if(!fiad_get_miscellaneous_option('disable_image_protection') && !fiad_is_admin_user_role()){37 add_action('wp_footer', array($this, 'fiad_image_protection_scripts'));38 }39 40 30 // Enable SVG 41 31 if(fiad_get_miscellaneous_option('enable_svg')){ 42 add_filter('upload_mimes', array($this, 'fiad_svg_mime_types'));43 add_action('admin_head', array($this, 'fiad_fix_svg_display'));32 add_filter('upload_mimes', [$this, 'fiad_svg_mime_types']); 33 add_action('admin_head', [$this, 'fiad_fix_svg_display']); 44 34 45 add_action("admin_enqueue_scripts", array($this, 'fiad_svg_enqueue_scripts'));46 add_filter('wp_handle_upload_prefilter', array($this, 'fiad_check_for_svg'));35 add_action("admin_enqueue_scripts", [$this, 'fiad_svg_enqueue_scripts']); 36 add_filter('wp_handle_upload_prefilter', [$this, 'fiad_check_for_svg']); 47 37 48 38 // SVG metadata 49 add_filter('wp_get_attachment_metadata', array($this, 'fiad_svg_attachment_metadata'), 10, 2);50 add_filter('wp_generate_attachment_metadata', array($this, 'fiad_svg_attachment_metadata'), 10, 2);39 add_filter('wp_get_attachment_metadata', [$this, 'fiad_svg_attachment_metadata'], 10, 2); 40 add_filter('wp_generate_attachment_metadata', [$this, 'fiad_svg_attachment_metadata'], 10, 2); 51 41 } 52 42 } … … 56 46 if($screen->id == 'upload'){ 57 47 $suffix = !FIBERADMIN_DEV_MODE ? '.min' : ''; 58 wp_enqueue_script('fiber-admin-svg', FIBERADMIN_ASSETS_URL . 'js/fiber-svg' . $suffix . '.js', array('jquery'), FIBERADMIN_VERSION);48 wp_enqueue_script('fiber-admin-svg', FIBERADMIN_ASSETS_URL . 'js/fiber-svg' . $suffix . '.js', ['jquery'], FIBERADMIN_VERSION); 59 49 wp_localize_script('fiber-admin-svg', 'script_vars', 60 array(61 'ajaxurl' => admin_url('admin-ajax.php') 62 )50 [ 51 'ajaxurl' => admin_url('admin-ajax.php'), 52 ] 63 53 ); 64 54 } 65 }66 67 public function fiad_set_image_meta_on_image_upload($post_id){68 if(wp_attachment_is_image($post_id)){69 $fiber_image_title = get_post($post_id)->post_title;70 71 $fiber_image_title = preg_replace('%\s*[-_\s]+\s*%', ' ', $fiber_image_title);72 $fiber_image_title = ucwords(strtolower($fiber_image_title));73 74 $fiber_image_meta = array(75 'ID' => $post_id,76 'post_title' => $fiber_image_title,77 );78 79 update_post_meta($post_id, '_wp_attachment_image_alt', $fiber_image_title);80 wp_update_post($fiber_image_meta);81 }82 }83 84 public function fiad_image_protection_scripts(){85 echo "86 <script type='text/javascript'>87 setTimeout(function(){88 const currentURL = window.location.hostname,89 images = document.getElementsByTagName('img');90 91 let imageURL = '';92 for(let i = 0; i < images.length; i++){93 imageURL = images[i].src;94 if(imageURL.includes(currentURL)){95 images[i].addEventListener('contextmenu', event => event.preventDefault());96 images[i].setAttribute('draggable', false);97 }98 }99 }, 1000);100 </script>101 ";102 55 } 103 56 … … 161 114 } 162 115 163 return array(116 return [ 164 117 'width' => ceil($width), 165 118 'height' => ceil($height), 166 'orientation' => ($width > $height) ? 'landscape' : 'portrait' 167 );119 'orientation' => ($width > $height) ? 'landscape' : 'portrait', 120 ]; 168 121 } 169 122 -
fiber-admin/trunk/includes/settings/miscellaneous.php
r2696536 r2931908 16 16 'fiad_miscellaneous_group', 17 17 'fiad_miscellaneous', 18 array($this, 'sanitize_text_field')18 [$this, 'sanitize_text_field'] 19 19 ); 20 20 … … 22 22 'fiad_miscellaneous_section', 23 23 '<span class="dashicons dashicons-admin-generic"></span> General', 24 array($this, 'fiad_section_info'),24 [$this, 'fiad_section_info'], 25 25 'fiber-admin-miscellaneous' 26 26 ); … … 29 29 'enable_auto_update', // id 30 30 'Enable auto update', // title 31 array($this, 'fiad_enable_auto_update'), // callback31 [$this, 'fiad_enable_auto_update'], // callback 32 32 'fiber-admin-miscellaneous', // page 33 33 'fiad_miscellaneous_section' // section … … 35 35 36 36 add_settings_section( 37 'fiad_image_section',38 '<span class="dashicons dashicons-format-image"></span> Image',39 array($this, 'fiad_section_info'),40 'fiber-admin-miscellaneous'41 );42 43 add_settings_field(44 'auto_img_meta', // id45 'Auto Set Image Meta', // title46 array($this, 'fiad_auto_image_meta'), // callback47 'fiber-admin-miscellaneous', // page48 'fiad_image_section' // section49 );50 51 add_settings_field(52 'disable_image_protection', // id53 'Disable Image Protection ', // title54 array($this, 'fiad_disable_image_protection'), // callback55 'fiber-admin-miscellaneous', // page56 'fiad_image_section' // section57 );58 59 add_settings_section(60 37 'fiad_content_section', 61 38 '<span class="dashicons dashicons-editor-table"></span> Content', 62 array($this, 'fiad_section_info'),39 [$this, 'fiad_section_info'], 63 40 'fiber-admin-miscellaneous' 64 41 ); … … 67 44 'revision_number', // id 68 45 'Limit number of revisions', // title 69 array($this, 'fiad_revision_number'), // callback46 [$this, 'fiad_revision_number'], // callback 70 47 'fiber-admin-miscellaneous', // page 71 48 'fiad_content_section' // section … … 75 52 'disable_email_converter', // id 76 53 'Disable Convert Email Text to Link', // title 77 array($this, 'fiad_disable_email_converter'), // callback54 [$this, 'fiad_disable_email_converter'], // callback 78 55 'fiber-admin-miscellaneous', // page 79 56 'fiad_content_section' // section … … 83 60 'enable_svg', // id 84 61 'Enable SVG', // title 85 array($this, 'fiad_enable_svg'), // callback62 [$this, 'fiad_enable_svg'], // callback 86 63 'fiber-admin-miscellaneous', // page 87 64 'fiad_content_section' // section … … 91 68 'disable_content_protection', // id 92 69 'Disable Content Protection', // title 93 array($this, 'fiad_disable_content_protection'), // callback70 [$this, 'fiad_disable_content_protection'], // callback 94 71 'fiber-admin-miscellaneous', // page 95 72 'fiad_content_section' // section … … 99 76 'enable_comments', // id 100 77 'Enable Comments', // title 101 array($this, 'fiad_enable_comments'), // callback78 [$this, 'fiad_enable_comments'], // callback 102 79 'fiber-admin-miscellaneous', // page 103 80 'fiad_content_section' // section … … 114 91 <input type="checkbox" name="fiad_miscellaneous[enable_auto_update]" id="enable_auto_update" 115 92 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('enable_auto_update')), 'yes'); ?> /> 116 <span class="slider round"></span>117 </label>118 </fieldset>119 <?php120 }121 122 public function fiad_auto_image_meta(){123 ?>124 <fieldset>125 <label for="auto_img_meta" class="fiber-admin-toggle">126 <input type="checkbox" name="fiad_miscellaneous[auto_img_meta]" id="auto_img_meta"127 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('auto_img_meta')), 'yes'); ?> />128 <span class="slider round"></span>129 </label>130 </fieldset>131 <?php132 }133 134 public function fiad_disable_image_protection(){135 ?>136 <fieldset>137 <label for="disable_image_protection" class="fiber-admin-toggle">138 <input type="checkbox" name="fiad_miscellaneous[disable_image_protection]"139 id="disable_image_protection"140 value="yes" <?php checked(esc_attr(fiad_get_miscellaneous_option('disable_image_protection')), 'yes'); ?> />141 93 <span class="slider round"></span> 142 94 </label> -
fiber-admin/trunk/readme.txt
r2912732 r2931908 3 3 Tags: white label, admin tool, duplicate post, content protection 4 4 Requires at least: 4.7 5 Tested up to: 6. 0.15 Tested up to: 6.2.2 6 6 Requires PHP: 7.0 7 Stable tag: 2.0.167 Stable tag: 3.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 47 47 == Changelog == 48 48 49 = 2.0.16=50 *Release Date - 16 May2023*49 = 3.0.0 = 50 *Release Date - 28 June 2023* 51 51 52 * Fixed: Use admin bar default when the option enable admin toolbar is disabled. 52 * Fixed: Fix wrong email regex pattern. 53 * Added: Improve content protection scripts. 54 * Added: Sanitizing filename to a server-friendly version. 55 * Added: Improve feature auto set attachment title with sanitized filename.
Note: See TracChangeset
for help on using the changeset viewer.