Changeset 3444155
- Timestamp:
- 01/21/2026 02:14:37 PM (2 months ago)
- Location:
- qrmemo/trunk
- Files:
-
- 3 edited
-
admin-settings.php (modified) (1 diff)
-
qrmemo.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qrmemo/trunk/admin-settings.php
r3170933 r3444155 1 1 <?php 2 if (!defined('ABSPATH')) { 3 exit; // Exit if accessed directly 2 if ( !defined( 'ABSPATH' ) ) { 3 exit; 4 // Exit if accessed directly 4 5 } 5 6 6 7 // Callback della pagina delle impostazioni 8 7 9 function qrmemo_settings_page() { 8 10 // Ottieni i tipi di post pubblici, escludendo 'attachment' 9 $post_types = get_post_types(['public' => true], 'objects'); 10 11 // Rimuovi il tipo di post 'attachment' (Media) 12 unset($post_types['attachment']); 11 $post_types = get_post_types( ['public' => true], 'objects' ); 13 12 14 $selected_post_types = get_option('qrmemo_post_types', []); 15 ?> 16 <div class="wrap"> 17 <h1><?php esc_html_e('QRMemo Settings', 'qrmemo'); ?></h1> 18 <form method="post" action="options.php"> 19 <?php 20 settings_fields('qrmemo_settings_group'); 21 do_settings_sections('qrmemo'); 22 ?> 23 <table class="form-table"> 24 <tr valign="top"> 25 <th scope="row"><?php esc_html_e('Enable QR Code for the following post types', 'qrmemo'); ?>:</th> 26 <td> 27 <ul> 28 <?php foreach ($post_types as $post_type) : ?> 29 <li> 30 <label> 31 <input type="checkbox" name="qrmemo_post_types[]" value="<?php echo esc_attr($post_type->name); ?>" 32 <?php echo in_array($post_type->name, $selected_post_types) ? 'checked' : ''; ?> /> 33 <?php echo esc_html($post_type->label); ?> 34 </label> 35 </li> 36 <?php endforeach; ?> 37 </ul> 38 </td> 39 </tr> 40 </table> 41 <p> 42 <?php esc_html_e('To add a QR Code via shortcode, use the following syntax', 'qrmemo'); ?>: 43 </p> 44 <p style="margin-left: 20px;"> 45 [qrmemo text="<i><?php esc_html_e('text to encode', 'qrmemo'); ?></i>" size="<i><?php esc_html_e('size in pixel', 'qrmemo'); ?></i>" margin="<i><?php esc_html_e('margin in pixel', 'qrmemo'); ?></i>" align="<i><?php esc_html_e('left|center|right', 'qrmemo'); ?></i>"] 46 </p> 47 <?php submit_button(); ?> 48 </form> 13 // Rimuovi il tipo di post 'attachment' ( Media ) 14 unset( $post_types['attachment'] ); 15 16 $selected_post_types = get_option( 'qrmemo_post_types', [] ); 17 ?> 18 <div class = "wrap"> 19 <h1><?php esc_html_e( 'QRMemo Settings', 'qrmemo' ); 20 ?></h1> 21 <form method = "post" action = "options.php"> 22 <?php 23 settings_fields( 'qrmemo_settings_group' ); 24 do_settings_sections( 'qrmemo' ); 25 ?> 26 <table class = "form-table"> 27 <tr valign = "top"> 28 <th scope = "row"><?php esc_html_e( 'Enable QR Code for the following post types', 'qrmemo' ); 29 ?>:</th> 30 <td> 31 <ul> 32 <?php foreach ( $post_types as $post_type ) : ?> 33 <li> 34 <label> 35 <input type = "checkbox" name = "qrmemo_post_types[]" value = "<?php echo esc_attr($post_type->name); ?>" 36 <?php echo in_array( $post_type->name, $selected_post_types ) ? 'checked' : ''; 37 ?> /> 38 <?php echo esc_html( $post_type->label ); 39 ?> 40 </label> 41 </li> 42 <?php endforeach; 43 ?> 44 </ul> 45 </td> 46 </tr> 47 </table> 48 <p> 49 <?php esc_html_e( 'To add a QR Code via shortcode, use the following syntax', 'qrmemo' ); 50 ?>: 51 </p> 52 <p style = "margin-left: 20px;"> 53 [qrmemo text = "<i><?php esc_html_e('text to encode', 'qrmemo'); ?></i>" size = "<i><?php esc_html_e('size in pixel', 'qrmemo'); ?></i>" margin = "<i><?php esc_html_e('margin in pixel', 'qrmemo'); ?></i>" align = "<i><?php esc_html_e('left|center|right', 'qrmemo'); ?></i>"] 54 </p> 55 <?php submit_button(); 56 ?> 57 </form> 49 58 </div> 50 <?php59 <?php 51 60 } 52 61 53 62 // Registra e definisci le impostazioni 63 54 64 function qrmemo_register_settings() { 55 register_setting('qrmemo_settings_group', 'qrmemo_post_types'); 65 register_setting( 66 'qrmemo_settings_group', 67 'qrmemo_post_types', 68 [ 69 'sanitize_callback' => function ( $value ) { 70 if ( ! is_array( $value ) ) { 71 return []; 72 } 56 73 74 return array_values( 75 array_filter( 76 array_map( 'sanitize_key', $value ) 77 ) 78 ); 79 } 80 , 81 'default' => [], 82 ] 83 ); 57 84 add_settings_section( 58 85 'qrmemo_settings_section', 59 __( 'Main Settings', 'qrmemo'),86 __( 'Main Settings', 'qrmemo' ), 60 87 'qrmemo_settings_section_callback', 61 88 'qrmemo' 62 89 ); 63 90 } 64 add_action( 'admin_init', 'qrmemo_register_settings');91 add_action( 'admin_init', 'qrmemo_register_settings' ); 65 92 66 93 // Callback della sezione delle impostazioni 94 67 95 function qrmemo_settings_section_callback() { 68 echo '<p>' . esc_html_e( 'Configure the settings for QRMemo', 'qrmemo') . '</p>';96 echo '<p>' . esc_html_e( 'Configure the settings for QRMemo', 'qrmemo' ) . '</p>'; 69 97 } -
qrmemo/trunk/qrmemo.php
r3444102 r3444155 4 4 Plugin URI: 5 5 Description: Adds a QR code at the end of each page and post with the current page URL. Also supports generating QR codes via shortcode. 6 Version: 1.0. 06 Version: 1.0.1 7 7 Author: mrpro64 8 8 Author URI: https://paolobertinetti.it/web … … 22 22 use Endroid\QrCode\Writer\PngWriter; 23 23 use Endroid\QrCode\Encoding\Encoding; 24 25 // Carica il textdomain per le traduzioni26 function qrmemo_load_textdomain() {27 load_plugin_textdomain('qrmemo', false, dirname(plugin_basename(__FILE__)) . '/languages');28 }29 add_action('plugins_loaded', 'qrmemo_load_textdomain');30 24 31 25 // Genera il QR code come immagine PNG codificata in base64 -
qrmemo/trunk/readme.txt
r3444102 r3444155 5 5 Requires at least: 5.0 6 6 Tested up to: 6.9 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 52 52 == Changelog == 53 53 54 = 1.0.1 = 55 * Fixed Plugin Check compliance issues. 56 * Improved settings sanitization. 57 * Improved translation handling. 58 * Tested up to WordPress 6.9. 59 54 60 = 1.0 = 55 61 * Initial stable release with support for adding QR codes to selected post types and shortcode generation.
Note: See TracChangeset
for help on using the changeset viewer.