Changeset 3207904
- Timestamp:
- 12/14/2024 10:15:15 AM (4 months ago)
- Location:
- html-tag-and-class-replace
- Files:
-
- 25 added
- 3 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
html-tag-and-class-replace/trunk/html-tag-and-class-replace.php
r3190687 r3207904 4 4 * Plugin URI: https://wordpress.org/plugins/html-tag-and-class-replace/ 5 5 * Description: Allows you to Replace any HTML Tag and Class of your WordPress WebSite. 6 * Version: 1. 0.86 * Version: 1.1.0 7 7 * Requires at least: 4.7 8 8 * Tested up to: 6.7 … … 20 20 class HTMLtagreplace { 21 21 22 public function __construct() {22 public function __construct() { 23 23 24 $file_data = get_file_data( __FILE__, array( 'Version' => 'Version' ) ); 24 $file_data = get_file_data( __FILE__, array( 'Version' => 'Version' ) ); 25 $this->plugin = new stdClass; 26 $this->plugin->name = 'html-tag-and-class-replace'; 27 $this->plugin->displayName = 'Tag and Class Replace'; 28 $this->plugin->folder = plugin_dir_path( __FILE__ ); 29 $this->plugin->url = plugin_dir_url( __FILE__ ); 30 define( 'HTMLTagReplace_VERSION', '1.1.0' ); 31 define( 'HTMLTagReplace_URL', plugin_dir_url( __FILE__ ) ); 25 32 26 $this->plugin = new stdClass; 27 $this->plugin->name = 'html-tag-and-class-replace'; 28 $this->plugin->displayName = 'Tag and Class Replace'; 29 $this->plugin->version = $file_data['Version']; 30 $this->plugin->folder = plugin_dir_path( __FILE__ ); 31 $this->plugin->url = plugin_dir_url( __FILE__ ); 33 /** 34 * Hooks 35 */ 32 36 33 /** 34 * Hooks 35 */ 37 add_action('admin_menu', array($this,'html_tag_replace_admin_add_page')); 38 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this,'html_tag_replace_page_settings')); 39 $this->html_tag_and_class_replace_function(); 36 40 37 add_action('admin_menu', array($this,'html_tag_replace_admin_add_page')); 38 add_action('admin_enqueue_scripts', array($this,'html_tag_and_class_replace_scripts')); 39 add_action('wp_enqueue_scripts', array($this,'html_tag_replace_front_custom_scripts'), 100); 40 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this,'html_tag_replace_page_settings')); 41 } 41 42 42 $this->appsero_init_tracker_html_tag_and_class_replace(); 43 /** 44 * Admin Menu 45 */ 43 46 44 } 47 function html_tag_replace_admin_add_page() { 48 add_submenu_page( 'options-general.php', $this->plugin->displayName, $this->plugin->displayName, 'manage_options', $this->plugin->name, array( &$this, 'settingsPanel' ) ); 49 } 45 50 46 /**47 * Admin Menu 48 */51 /** 52 * Deshboard file and data insert 53 */ 49 54 50 function html_tag_replace_admin_add_page() { 51 add_submenu_page( 'options-general.php', $this->plugin->displayName, $this->plugin->displayName, 'manage_options', $this->plugin->name, array( &$this, 'settingsPanel' ) ); 52 } 55 function settingsPanel() { 53 56 54 /** 55 * Deshboard file and data insert 56 */ 57 $this->html_tag_replace_info = array( 58 'html_class_replace' => get_option( 'html_class_replace' ), 59 'html_tag_replace' => get_option( 'html_tag_replace' ) 60 ); 61 include_once $this->plugin->folder.'/view/deshboard.php'; 57 62 58 function settingsPanel() { 63 } 59 64 60 if ( ! current_user_can( 'manage_options' ) ) { 61 wp_die( __( 'Sorry, you are not allowed to access this page.', 'html-tag-and-class-replace' ) );62 } 65 /** 66 * Activated Plugin Setting 67 */ 63 68 64 if(isset($_REQUEST['but_submit'])){ 65 if ( ! current_user_can( 'unfiltered_html' ) ) { 66 wp_die( __( 'Sorry, you are not allowed to access this page.', 'html-tag-and-class-replace' ) ); 67 } elseif ( !isset( $_REQUEST[ $this->plugin->name . '_nonce' ] ) ) { 68 $this->errorMessage = __( 'nonce field is missing. Settings NOT saved.', 'html-tag-and-class-replace' ); 69 }else{ 70 update_option( 'html_old_tag', sanitize_text_field($_REQUEST['html_old_tag']) ); 71 update_option( 'html_new_tag', sanitize_text_field($_REQUEST['html_new_tag'],'') ); 72 update_option( 'html_old_class', sanitize_text_field($_REQUEST['html_old_class']) ); 73 update_option( 'html_new_class', isset( $_REQUEST['html_new_class'] ) ? sanitize_text_field($_REQUEST['html_new_class']) : '' ); 74 $this->message = __( 'Settings Saved.', 'html-tag-and-class-replace' ); 69 function html_tag_replace_activated( $plugin ) { 70 if ( plugin_basename( __FILE__ ) == $plugin ) { 71 wp_redirect( admin_url( 'options-general.php?page='.$this->plugin->name ) ); 72 die(); 75 73 } 76 74 } 77 $this->html_tag_replace_info = array(78 'html_old_tag' => esc_html( wp_unslash( get_option( 'html_old_tag' ) ) ),79 'html_new_tag' => esc_html( wp_unslash( get_option( 'html_new_tag' ) ) ),80 'html_old_class' => esc_html( wp_unslash( get_option( 'html_old_class' ) ) ),81 'html_new_class' => esc_html( wp_unslash( get_option( 'html_new_class' ) ) ),82 );83 include_once $this->plugin->folder.'/view/deshboard.php';84 75 85 } 76 /** 77 * Plugin Setting Page Linked 78 */ 86 79 87 /** 88 * Activated Plugin Setting 89 */ 80 function html_tag_replace_page_settings( $links ) { 81 $link = sprintf( "<a href='%s' style='color:#2271b1;'>%s</a>", admin_url( 'options-general.php?page='.$this->plugin->name ), __( 'Settings', 'html-tag-and-class-replace' ) ); 82 array_push( $links, $link ); 83 return $links; 84 } 90 85 91 function html_tag_replace_activated( $plugin ) { 92 if ( plugin_basename( __FILE__ ) == $plugin ) { 93 wp_redirect( admin_url( 'options-general.php?page='.$this->plugin->name ) ); 94 die(); 86 /** 87 * Load Function 88 * 89 * @return void 90 */ 91 function html_tag_and_class_replace_function(){ 92 require_once __DIR__ . '/inc/functions.php'; 95 93 } 96 }97 98 99 /**100 * Plugin Setting Page Linked101 */102 103 function html_tag_replace_page_settings( $links ) {104 $link = sprintf( "<a href='%s' style='color:#2271b1;'>%s</a>", admin_url( 'options-general.php?page='.$this->plugin->name ), __( 'Settings', 'html-tag-and-class-replace' ) );105 array_push( $links, $link );106 107 return $links;108 }109 110 /**111 * Admin Include CSS112 */113 114 function html_tag_and_class_replace_scripts(){115 wp_enqueue_style( 'html_tag_and_class_replace_css', plugins_url('/assets/css/style.css', __FILE__), false, $this->plugin->version);116 }117 118 119 /**120 * Front-End Include JS121 */122 123 function html_tag_replace_front_custom_scripts(){124 125 wp_enqueue_script( 'my_replace_js', plugins_url('/assets/js/replace.js', __FILE__), array('jquery'), '', true );126 127 $jh_html_old_tag = wp_unslash(get_option( 'html_old_tag' ));128 $jh_html_new_tag = wp_unslash(get_option( 'html_new_tag' ));129 $jh_html_old_class = wp_unslash(get_option( 'html_old_class' ));130 $jh_html_new_class = wp_unslash(get_option( 'html_new_class' ));131 $jh_data_pass = array(132 'oldtag' => $jh_html_old_tag,133 'newtag' => $jh_html_new_tag,134 'oldclass' => $jh_html_old_class,135 'newclass' => $jh_html_new_class136 );137 wp_localize_script( 'my_replace_js', 'htc_data', $jh_data_pass );138 139 }140 141 142 /**143 * Initialize the plugin tracker144 *145 * @return void146 */147 function appsero_init_tracker_html_tag_and_class_replace() {148 149 if ( ! class_exists( 'Appsero\Client' ) ) {150 require_once __DIR__ . '/inc/app/src/Client.php';151 }152 153 $client = new Appsero\Client( '48566830-079d-44e7-87ae-212216263283', 'HTML Tag and Class Replace', __FILE__ );154 155 // Active insights156 $client->insights()->init();157 158 }159 160 94 161 95 } -
html-tag-and-class-replace/trunk/readme.txt
r3190687 r3207904 4 4 Requires at least: 4.7 5 5 Tested up to: 6.7 6 Stable tag: 1. 0.86 Stable tag: 1.1.0 7 7 Requires PHP: 5.3 8 8 License: GPLv2 or later … … 13 13 == Description == 14 14 15 HTML Tag and Class Replace is a very simple plugin that lets you to replace your html tag and class. it's a very useful for SEO.15 HTML Tag and Class Replace is a lightweight and user-friendly WordPress plugin designed to let you easily replace HTML tags and classes across your website. Whether you're optimizing for SEO, improving design consistency, or customizing your theme, this plugin simplifies the process with just a few clicks. 16 16 17 <strong>Features:</strong> 17 18 18 A few notes about the sections above: 19 * Effortlessly replace any HTML tag for better semantic structure and SEO optimization. 20 * Modify or replace HTML classes to enhance your website’s styling and consistency. 21 * Perfect for bloggers, developers, and website owners aiming for more control over their site's HTML output. 19 22 20 * Very simple to replace any html tag 21 * Replace html Class in your blog 23 <strong>Injection Locations:</strong> 22 24 23 = INJECTION LOCATIONS = 24 25 1. Head Section 25 1. Header Section 26 26 2. Body Section 27 27 3. Footer Section 28 28 29 <strong>Why Choose HTML Tag and Class Replace?</strong> 29 30 30 31 <strong>Privacy Policy : </strong> 32 33 HTML Tag and Class Replace uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements. 34 35 Appsero SDK does not gather any data by default. The SDK only starts gathering basic telemetry data when a user allows it via the admin notice. We collect the data to ensure a great user experience for all our users. 36 37 Integrating Appsero SDK DOES NOT IMMEDIATELY start gathering data, without confirmation from users in any case. 31 It’s a quick and powerful solution that helps you make critical HTML updates without diving deep into your website’s codebase. 38 32 39 33 … … 66 60 67 61 == Changelog == 62 63 = 1.1.0 = 64 65 * Added: Unlimited Tags & Class Replace 66 * Improvement: Settings 68 67 69 68 = 1.0.8 = -
html-tag-and-class-replace/trunk/view/deshboard.php
r2620301 r3207904 1 1 <div class="wrap"> 2 2 <h2 class="best-header-title"><?php echo esc_html($this->plugin->displayName); ?> » <?php esc_html_e( 'Settings','html-tag-and-class-replace'); ?> </h2> 3 <?php 4 if ( isset( $this->message ) ) { 5 ?> 6 <div class="updated fade"> 7 <p><?php echo esc_html($this->message); ?></p> 8 </div> 9 <?php 10 } 11 if ( isset( $this->errorMessage ) ) { 12 ?> 13 <div class="error fade"><p><?php echo esc_html($this->errorMessage); ?></p></div> 14 <?php 15 } 16 ?> 3 17 4 <?php 18 5 $hfcm_form_action = admin_url('options-general.php?page=html-tag-and-class-replace'); 19 20 ?> 21 <div class="html_tag_replace_notes"> 22 <h3><?php esc_html_e("Note: Replace Tag","html-tag-and-class-replace"); ?></h3> 23 <ul> 24 <li><?php esc_html_e("Old Tag","html-tag-and-class-replace"); ?> <code><?php esc_html_e("h1.....h6, p, a, span, .class-name h1.....h6, .class-name p, .class-name a","html-tag-and-class-replace"); ?></code> <b><?php esc_html_e("You can add multiple tag using comma ( , )","html-tag-and-class-replace"); ?></b></li> 25 <li><?php esc_html_e("New Tag just type","html-tag-and-class-replace"); ?> <code><?php esc_html_e(" h1.......h6, p, span","html-tag-and-class-replace"); ?></code> <b><?php esc_html_e("You can only add one tag", "html-tag-and-class-replace"); ?></b></li> 26 </ul> 27 </div> 6 ?> 28 7 <div class="replace-tag-box"> 29 8 <form method='post' action='<?php echo esc_html($hfcm_form_action); ?>'> 30 <p> 31 <label for="html-old-tag"><?php esc_html_e("Old Tag","html-tag-and-class-replace"); ?> <small><?php esc_html_e("(Tag Name)", "html-tag-and-class-replace"); ?></small></label> 32 <input type="text" name="html_old_tag" id="html-old-tag" placeholder="Example: .class-name a, p, h1..... h6, span" value="<?php if(!empty($this->html_tag_replace_info['html_old_tag'])){ echo esc_html($this->html_tag_replace_info['html_old_tag']); } ?>" <?php echo ( ! current_user_can( 'unfiltered_html' ) ) ? ' disabled="disabled" ' : ''; ?> /> 33 </p> 34 <p> 35 <label for="html-new-tag"><?php esc_html_e("New Tag","html-tag-and-class-replace"); ?> <small><?php esc_html_e("(Tag Name)", "html-tag-and-class-replace"); ?></small></label> 36 <input type="text" name="html_new_tag" id="html-new-tag" placeholder="Example: h1.....h6, p, span" value="<?php if(!empty($this->html_tag_replace_info['html_new_tag'])){ echo esc_html($this->html_tag_replace_info['html_new_tag']); } ?>" <?php echo ( ! current_user_can( 'unfiltered_html' ) ) ? ' disabled="disabled" ' : ''; ?> /> 37 </p> 38 <p> 39 <label for="html-old-class"><?php esc_html_e("Old Class Name","html-tag-and-class-replace"); ?> <small><?php esc_html_e("(Class Name)", "html-tag-and-class-replace"); ?></small></label> 40 <input type="text" name="html_old_class" id="html-old-class" placeholder="class-name" value="<?php if(!empty($this->html_tag_replace_info['html_old_class'])){ echo esc_html($this->html_tag_replace_info['html_old_class']); } ?>" <?php echo ( ! current_user_can( 'unfiltered_html' ) ) ? ' disabled="disabled" ' : ''; ?> /> 41 </p> 42 <p> 43 <label for="html-new-class"><?php esc_html_e("New Class Name","html-tag-and-class-replace"); ?> <small><?php esc_html_e("(Class Name)", "html-tag-and-class-replace"); ?></small></label> 44 <input type="text" name="html_new_class" id="html-new-class" placeholder="class-name" value="<?php if(!empty($this->html_tag_replace_info['html_new_class'])){ echo esc_html($this->html_tag_replace_info['html_new_class']); } ?>" <?php echo ( ! current_user_can( 'unfiltered_html' ) ) ? ' disabled="disabled" ' : ''; ?> /> 45 </p> 46 <?php if ( current_user_can( 'unfiltered_html' ) ) { ?> 9 10 <!-- Tag Replace Start --> 11 <h3><?php esc_html_e("Replace Tag", "html-tag-and-class-replace"); ?></h3> 12 <div class="repeater-box"> 13 <div id="tag-repeater-container" class="repeater-container"> 14 <?php 15 $tag_repeater_data = !empty($this->html_tag_replace_info['html_tag_replace']) ? $this->html_tag_replace_info['html_tag_replace'] : []; 16 if (empty($tag_repeater_data)) { 17 $tag_repeater_data[] = ['html_old_tag' => '', 'html_new_tag' => '']; 18 } else { 19 $tag_repeater_data = $tag_repeater_data["repeater_data"]; 20 } 21 foreach ($tag_repeater_data as $index => $row) { 22 ?> 23 <div class="repeater-row"> 24 <div class="repeater-field"> 25 <p> 26 <label><?php esc_html_e("Old Tag", "html-tag-and-class-replace"); ?></label> 27 <input type="text" name="tag_repeater_data[<?php echo $index; ?>][html_old_tag]" placeholder="Ex: .class-name a/h6/span" value="<?php echo esc_attr($row['html_old_tag']); ?>"> 28 </p> 29 <p> 30 <label><?php esc_html_e("New Tag", "html-tag-and-class-replace"); ?></label> 31 <input type="text" name="tag_repeater_data[<?php echo $index; ?>][html_new_tag]" placeholder="Ex: h5" value="<?php echo esc_attr($row['html_new_tag']); ?>"> 32 </p> 33 </div> 34 <div class="repeater-controller"> 35 <span class="remove-row"><p>×</p></span> 36 </div> 37 </div> 38 <?php } ?> 39 </div> 40 <div class="add-new-row"> 41 <button type="button" class="button button-primary" id="add-tag-row"><?php esc_html_e("Add Row", "html-tag-and-class-replace"); ?></button> 42 </div> 43 </div> 44 <!-- Tag Replace End --> 45 46 <!-- Class Replace Start --> 47 <h3><?php esc_html_e("Replace Class", "html-tag-and-class-replace"); ?></h3> 48 <div class="repeater-box"> 49 <div id="class-repeater-container" class="repeater-container"> 50 <?php 51 $class_repeater_data = !empty($this->html_tag_replace_info['html_class_replace']) ? $this->html_tag_replace_info['html_class_replace'] : []; 52 if (empty($class_repeater_data)) { 53 $class_repeater_data[] = ['html_old_class' => '', 'html_new_class' => '']; 54 } else { 55 $class_repeater_data = $class_repeater_data["repeater_data"]; 56 } 57 foreach ($class_repeater_data as $index => $row) { 58 ?> 59 <div class="repeater-row"> 60 <div class="repeater-field"> 61 <p> 62 <label><?php esc_html_e("Old Class", "html-tag-and-class-replace"); ?></label> 63 <input type="text" name="repeater_data[<?php echo $index; ?>][html_old_class]" placeholder="class-name" value="<?php echo esc_attr($row['html_old_class']); ?>"> 64 </p> 65 <p> 66 <label><?php esc_html_e("New Class", "html-tag-and-class-replace"); ?></label> 67 <input type="text" name="repeater_data[<?php echo $index; ?>][html_new_class]" placeholder="class-name" value="<?php echo esc_attr($row['html_new_class']); ?>"> 68 </p> 69 </div> 70 <div class="repeater-controller"> 71 <span class="remove-row"><p>×</p></span> 72 </div> 73 </div> 74 <?php } ?> 75 </div> 76 <div class="add-new-row"> 77 <button type="button" class="button button-primary" id="add-class-row"><?php esc_html_e("Add Row", "html-tag-and-class-replace"); ?></button> 78 </div> 79 </div> 80 <!-- Class Replace End --> 81 <div class="html-tag-and-class-replace-response"> 82 83 </div> 47 84 <?php wp_nonce_field( $this->plugin->name, $this->plugin->name . '_nonce' ); ?> 48 85 <p> 49 <input type='submit' name='but_submit' value='<?php esc_attr_e("Submit","html-tag-and-class-replace"); ?>'> 86 <button type='submit' class="html-tag-and-class-submit"> 87 <?php esc_attr_e("Save Settings","html-tag-and-class-replace"); ?> 88 </button> 50 89 </p> 51 <?php } ?> 90 52 91 </form> 53 92 </div>
Note: See TracChangeset
for help on using the changeset viewer.