Plugin Directory

Changeset 3117972


Ignore:
Timestamp:
07/15/2024 05:05:04 AM (17 months ago)
Author:
daomapsieucap
Message:

Update to version 3.1.0 from GitHub

Location:
lipsum-dynamo
Files:
15 edited
1 copied

Legend:

Unmodified
Added
Removed
  • lipsum-dynamo/assets/icon.svg

    • Property svn:mime-type set to image/svg+xml
  • lipsum-dynamo/tags/3.1.0/changelog.txt

    r2698796 r3117972  
    11== Changelog ==
     2
     3= 3.1.0 =
     4*Release Date - 15 July 2024*
     5
     6* New: Rename plugin to Dummie.
     7* Fixed: Fix wrong default admin post author.
     8* Changed: Tested up to 6.5.5.
    29
    310= 3.0 =
  • lipsum-dynamo/tags/3.1.0/includes/cleanup.php

    r2698796 r3117972  
    1010class Lipsum_Dynamo_Cleanup{
    1111    public function __construct(){
    12         add_action('admin_enqueue_scripts', array($this, 'lipnamo_cleanup_scripts'));
     12        add_action('admin_enqueue_scripts', [$this, 'lipnamo_cleanup_scripts']);
    1313       
    14         add_action("wp_ajax_lipnamo_cleanup_items", array($this, 'lipnamo_cleanup_items'));
    15         add_action("wp_ajax_nopriv_lipnamo_cleanup_items", array($this, 'lipnamo_cleanup_items'));
     14        add_action("wp_ajax_lipnamo_cleanup_items", [$this, 'lipnamo_cleanup_items']);
     15        add_action("wp_ajax_nopriv_lipnamo_cleanup_items", [$this, 'lipnamo_cleanup_items']);
    1616       
    17         add_action("wp_ajax_lipnamo_total_items", array($this, 'lipnamo_update_total_items'));
    18         add_action("wp_ajax_nopriv_lipnamo_total_items", array($this, 'lipnamo_update_total_items'));
     17        add_action("wp_ajax_lipnamo_total_items", [$this, 'lipnamo_update_total_items']);
     18        add_action("wp_ajax_nopriv_lipnamo_total_items", [$this, 'lipnamo_update_total_items']);
    1919    }
    2020   
    2121    public function lipnamo_cleanup_scripts($hook_suffix){
    2222        if(strpos($hook_suffix, 'lipsum-dynamo') !== false){
    23             wp_enqueue_script('lipnamo-cleanup-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-cleanup-items.js', array('jquery'), LIPNAMO_VERSION, true);
     23            wp_enqueue_script('lipnamo-cleanup-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-cleanup-items.js', ['jquery'], DUMMIE_VERSION, true);
    2424            wp_localize_script('lipnamo-cleanup-items', 'lipnamo_items',
    25                 array(
     25                [
    2626                    'ajax_url'   => admin_url('admin-ajax.php'),
    2727                    'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'),
    28                 )
     28                ]
    2929            );
    3030        }
     
    4949        // Exit if invalid post type
    5050        if($post_type !== 'any'){
    51             $valid_post_types = get_post_types(array('public' => true), 'objects');
     51            $valid_post_types = get_post_types(['public' => true], 'objects');
    5252            if(!in_array($post_type, array_keys($valid_post_types))){
    5353                return;
     
    8585       
    8686        // Store results in an array.
    87         $result = array(
    88             'step' => $post_step
    89         );
     87        $result = [
     88            'step' => $post_step,
     89        ];
    9090       
    9191        if($post_step >= $post_total){
     
    114114        // Exit if invalid post type
    115115        if($post_type !== 'any'){
    116             $valid_post_types = get_post_types(array('public' => true), 'objects');
     116            $valid_post_types = get_post_types(['public' => true], 'objects');
    117117            if(!in_array($post_type, array_keys($valid_post_types))){
    118118                return;
  • lipsum-dynamo/tags/3.1.0/includes/generate-items.php

    r2698796 r3117972  
    1212class Lipsum_Dynamo_Generate{
    1313    public function __construct(){
    14         add_action('admin_enqueue_scripts', array($this, 'lipnamo_generate_scripts'));
     14        add_action('admin_enqueue_scripts', [$this, 'lipnamo_generate_scripts']);
    1515       
    16         add_action("wp_ajax_lipnamo_generate_items", array($this, 'lipnamo_generate_items'));
    17         add_action("wp_ajax_nopriv_lipnamo_generate_items", array($this, 'lipnamo_generate_items'));
     16        add_action("wp_ajax_lipnamo_generate_items", [$this, 'lipnamo_generate_items']);
     17        add_action("wp_ajax_nopriv_lipnamo_generate_items", [$this, 'lipnamo_generate_items']);
    1818    }
    1919   
    2020    public function lipnamo_generate_scripts($hook_suffix){
    2121        if(strpos($hook_suffix, 'lipsum-dynamo') !== false){
    22             wp_enqueue_script('lipnamo-generate-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-generate-items.js', array('jquery'), LIPNAMO_VERSION, true);
     22            wp_enqueue_script('lipnamo-generate-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-generate-items.js', ['jquery'], DUMMIE_VERSION, true);
    2323            wp_localize_script('lipnamo-generate-items', 'lipnamo_items',
    24                 array(
     24                [
    2525                    'ajax_url'   => admin_url('admin-ajax.php'),
    2626                    'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'),
    27                 )
     27                ]
    2828            );
    2929        }
     
    5353       
    5454        // Exit if invalid post type
    55         $valid_post_types = get_post_types(array('public' => true), 'objects');
     55        $valid_post_types = get_post_types(['public' => true], 'objects');
    5656        if(!in_array($post_type, array_keys($valid_post_types))){
    5757            return;
     
    100100           
    101101            // Create post
    102             $new_post = array(
     102            $new_post = [
    103103                'post_type'    => $post_type,
    104104                'post_title'   => wp_strip_all_tags($post_title),
     
    106106                'post_content' => $post_content,
    107107                'post_status'  => $post_status,
    108                 'post_author'  => $post_author
    109             );
     108                'post_author'  => $post_author,
     109            ];
    110110            $post_id  = wp_insert_post($new_post);
    111111            if(!is_wp_error($post_id) && $thumbnail_id){
     
    116116                global $wpdb;
    117117                $table_name = $wpdb->prefix . 'lipnamo';
    118                 $wpdb->insert($table_name, array(
     118                $wpdb->insert($table_name, [
    119119                    'post_id'   => $post_id,
    120                     'post_type' => $post_type
    121                 ));
     120                    'post_type' => $post_type,
     121                ]);
    122122            }
    123123           
     
    130130       
    131131        // Store results in an array.
    132         $result = array(
    133             'step' => $post_step
    134         );
     132        $result = [
     133            'step' => $post_step,
     134        ];
    135135       
    136136        if($post_step >= $post_total){
  • lipsum-dynamo/tags/3.1.0/includes/setting/general.php

    r2698796 r3117972  
    1717            'lipnamo_group',
    1818            'lipsum-dynamo-general',
    19             array($this, 'sanitize_text_field')
     19            [$this, 'sanitize_text_field']
    2020        );
    2121       
     
    2323            'lipnamo_section',
    2424            '',
    25             array($this, 'lipnamo_admin_section_info'),
     25            [$this, 'lipnamo_admin_section_info'],
    2626            'lipsum-dynamo-general'
    2727        );
     
    3030            'lipnamo_post_total', // id
    3131            'Number of items', // title
    32             array($this, 'lipnamo_post_total'), // callback
     32            [$this, 'lipnamo_post_total'], // callback
    3333            'lipsum-dynamo-general', // page
    3434            'lipnamo_section' // section
     
    3838            'post_type', // id
    3939            'Select post type', // title
    40             array($this, 'lipnamo_post_type'), // callback
     40            [$this, 'lipnamo_post_type'], // callback
    4141            'lipsum-dynamo-general', // page
    4242            'lipnamo_section' // section
     
    4646            'post_author', // id
    4747            'Post author', // title
    48             array($this, 'lipnamo_post_author'), // callback
     48            [$this, 'lipnamo_post_author'], // callback
    4949            'lipsum-dynamo-general', // page
    5050            'lipnamo_section' // section
     
    5454            'post_status', // id
    5555            'New Item status', // title
    56             array($this, 'lipnamo_post_status'), // callback
     56            [$this, 'lipnamo_post_status'], // callback
    5757            'lipsum-dynamo-general', // page
    5858            'lipnamo_section' // section
     
    6262            'post_thumbnail', // id
    6363            'New Item Thumbnails', // title
    64             array($this, 'lipnamo_post_thumbnail'), // callback
     64            [$this, 'lipnamo_post_thumbnail'], // callback
    6565            'lipsum-dynamo-general', // page
    6666            'lipnamo_section' // section
     
    7070            'length_control', // id
    7171            'Length Control', // title
    72             array($this, 'lipnamo_length_control'), // callback
     72            [$this, 'lipnamo_length_control'], // callback
    7373            'lipsum-dynamo-general', // page
    7474            'lipnamo_section' // section
     
    9090   
    9191    public function lipnamo_post_type(){
    92         $post_types = get_post_types(array('public' => true), 'objects');
     92        $post_types = get_post_types(['public' => true], 'objects');
    9393        ?>
    9494        <fieldset>
     
    116116   
    117117    public function lipnamo_post_author(){
    118         $users       = get_users(array('role__in' => array('administrator'), 'fields' => array('ID')));
    119         $admin_email = get_option('new_admin_email');
     118        $users       = get_users(['role__in' => ['administrator'], 'fields' => ['ID']]);
     119        $admin_email = get_option('admin_email');
    120120        ?>
    121121        <fieldset>
  • lipsum-dynamo/tags/3.1.0/includes/setting/setting.php

    r2698796 r3117972  
    1111   
    1212    public function __construct(){
    13         add_action('admin_menu', array($this, 'lipnamo_setting'));
    14         add_action('admin_init', array($this, 'lipnamo_setting_init'));
     13        add_action('admin_menu', [$this, 'lipnamo_setting']);
     14        add_action('admin_init', [$this, 'lipnamo_setting_init']);
    1515       
    16         add_action("admin_enqueue_scripts", array($this, 'lipnamo_assets'));
     16        add_action("admin_enqueue_scripts", [$this, 'lipnamo_assets']);
    1717    }
    1818   
    1919    public function lipnamo_assets(){
    20         wp_enqueue_style('lipnamo-admin', LIPNAMO_ASSETS_URL . 'css/lipnamo-admin.css', false, LIPNAMO_VERSION);
     20        wp_enqueue_style('lipnamo-admin', LIPNAMO_ASSETS_URL . 'css/lipnamo-admin.css', false, DUMMIE_VERSION);
    2121       
    2222        // Upload field
     
    2424       
    2525        // Plugin scripts
    26         wp_enqueue_script('lipnamo-admin', LIPNAMO_ASSETS_URL . 'js/lipnamo-admin.js', array('jquery'), LIPNAMO_VERSION);
     26        wp_enqueue_script('lipnamo-admin', LIPNAMO_ASSETS_URL . 'js/lipnamo-admin.js', ['jquery'], DUMMIE_VERSION);
    2727    }
    2828   
     
    4343        add_submenu_page(
    4444            'tools.php',
    45             'Lipsum Dynamo',
    46             'Lipsum Dynamo',
     45            'Dummie',
     46            'Dummie',
    4747            'manage_options',
    4848            'lipsum-dynamo',
    49             array($this, 'lipnamo_setting_html'),
     49            [$this, 'lipnamo_setting_html'],
    5050        );
    5151    }
     
    5757        }
    5858       
    59         $form_action = admin_url("tools.php?page=lipsum-dynamo");
    60         if(isset ($_GET['tab'])){
    61             $form_action = admin_url("tools.php?page=lipsum-dynamo&tab=" . $_GET['tab']);
    62         }
     59        $tab         = esc_attr(lipnamo_array_key_exists('tab', $_GET));
     60        $form_action = $tab ? admin_url("tools.php?page=lipsum-dynamo&tab=" . $tab) : admin_url("tools.php?page=lipsum-dynamo");
     61       
     62        echo '<div class="wrap">';
     63       
     64        echo '<h1>Dummie</h1>';
    6365       
    6466        // nav
    6567        echo '<nav class="nav-tab-wrapper">';
    66         if(isset ($_GET['tab'])){
    67             $this->lipnamo_setting_tab_navs($_GET['tab']);
     68        if($tab){
     69            $this->lipnamo_setting_tab_navs($tab);
    6870        }else{
    6971            $this->lipnamo_setting_tab_navs();
     
    7375        // content
    7476        echo '<div class="tab-content">';
    75         echo '<div class="wrap">';
     77       
    7678        echo '<form class="lipsum-dynamo" method="POST" action="' . $form_action . '">';
    7779       
    7880        wp_nonce_field("lipsum-dynamo");
    7981       
    80         $current_tab = 'general';
    81         if(isset ($_GET['tab'])){
    82             $current_tab = $_GET['tab'];
    83         }
    84        
    85         echo '<h1>' . $this->lipnamo_setting_tabs()[$current_tab] . '</h1>';
    86        
     82        $current_tab = lipnamo_array_key_exists('tab', $_GET) ? : 'general';
    8783        if($current_tab == 'uninstall'){
    8884            echo '<p class="description">' . __("When you uninstall this plugin, what do you want to do with your settings and the generated dummy items? Be careful to use this option. It can't be reverted.", "lipsum-dynamo") . '</p>';
     
    9389        echo '</form>';
    9490        echo '</div>';
    95         echo '</div>';
     91       
     92        echo '</div>'; // wrap
    9693    }
    9794   
    9895    public function lipnamo_setting_tabs(): array{
    99         return array(
     96        $tabs = [
    10097            'general'   => 'General',
    10198            'cleanup'   => 'Cleanup',
    10299            'uninstall' => 'Uninstall',
    103         );
     100        ];
     101       
     102        return $tabs;
    104103    }
    105104   
     
    160159    public function lipnamo_save_options(){
    161160        global $pagenow;
    162         if($pagenow == 'tools.php' && $_GET['page'] == 'lipsum-dynamo'){
     161        if($pagenow == 'tools.php' && esc_attr(lipnamo_array_key_exists('page', $_GET)) == 'lipsum-dynamo'){
    163162            $option_key = 'lipsum-dynamo';
    164163            if(isset($_POST[$option_key])){
     
    168167                }
    169168            }else{
    170                 $new_options = array();
     169                $new_options = [];
    171170            }
    172171           
  • lipsum-dynamo/tags/3.1.0/lipsum-dynamo.php

    r2698796 r3117972  
    11<?php
    22/**
    3  * Plugin Name:       Lipsum Dynamo
     3 * Plugin Name:       Dummie
    44 * Plugin URI:        https://wordpress.org/plugins/lipsum-dynamo/
    55 * Description:       🖨 Generate dummy content for demo purpose
    6  * Version:           3.0
     6 * Version:           3.1.0
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.2
     
    2626 */
    2727
    28 const LIPNAMO_VERSION = '3.0';
     28const DUMMIE_VERSION = '3.1.0';
    2929define("LIPNAMO_DIR", plugin_dir_path(__FILE__));
    3030define("LIPNAMO_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/');
     
    7575        dbDelta($sql);
    7676       
    77         add_option('lipnamo_db_version', LIPNAMO_VERSION);
     77        add_option('lipnamo_db_version', DUMMIE_VERSION);
    7878    }
    7979}
     
    8181add_action('plugins_loaded', 'lipnamo_update_db_check');
    8282function lipnamo_update_db_check(){
    83     if(get_site_option('lipnamo_db_version') != LIPNAMO_VERSION){
     83    if(get_site_option('lipnamo_db_version') != DUMMIE_VERSION){
    8484        lipnamo_install();
    8585    }
  • lipsum-dynamo/tags/3.1.0/readme.txt

    r2698796 r3117972  
    1 === Lipsum Dynamo ===
     1=== Dummie ===
    22Contributors: daomapsieucap
    33Tags: lorem ipsum, dummy text generator, lorem ipsum generator
    44Requires at least: 4.7
    5 Tested up to: 5.9.1
     5Tested up to: 6.5.5
    66Requires PHP: 7.2
    7 Stable tag: 3.0
     7Stable tag: 3.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2929== Changelog ==
    3030
    31 = 3.0 =
    32 *Release Date - 24 March 2022*
     31= 3.1.0 =
     32*Release Date - 15 July 2024*
    3333
    34 * New: Move admin setting menu to Tools.
    35 * New: Upgrade setting UI to tabs.
     34* New: Rename plugin to Dummie.
     35* Fixed: Fix wrong default admin post author.
     36* Changed: Tested up to 6.5.5.
  • lipsum-dynamo/trunk/changelog.txt

    r2698796 r3117972  
    11== Changelog ==
     2
     3= 3.1.0 =
     4*Release Date - 15 July 2024*
     5
     6* New: Rename plugin to Dummie.
     7* Fixed: Fix wrong default admin post author.
     8* Changed: Tested up to 6.5.5.
    29
    310= 3.0 =
  • lipsum-dynamo/trunk/includes/cleanup.php

    r2698796 r3117972  
    1010class Lipsum_Dynamo_Cleanup{
    1111    public function __construct(){
    12         add_action('admin_enqueue_scripts', array($this, 'lipnamo_cleanup_scripts'));
     12        add_action('admin_enqueue_scripts', [$this, 'lipnamo_cleanup_scripts']);
    1313       
    14         add_action("wp_ajax_lipnamo_cleanup_items", array($this, 'lipnamo_cleanup_items'));
    15         add_action("wp_ajax_nopriv_lipnamo_cleanup_items", array($this, 'lipnamo_cleanup_items'));
     14        add_action("wp_ajax_lipnamo_cleanup_items", [$this, 'lipnamo_cleanup_items']);
     15        add_action("wp_ajax_nopriv_lipnamo_cleanup_items", [$this, 'lipnamo_cleanup_items']);
    1616       
    17         add_action("wp_ajax_lipnamo_total_items", array($this, 'lipnamo_update_total_items'));
    18         add_action("wp_ajax_nopriv_lipnamo_total_items", array($this, 'lipnamo_update_total_items'));
     17        add_action("wp_ajax_lipnamo_total_items", [$this, 'lipnamo_update_total_items']);
     18        add_action("wp_ajax_nopriv_lipnamo_total_items", [$this, 'lipnamo_update_total_items']);
    1919    }
    2020   
    2121    public function lipnamo_cleanup_scripts($hook_suffix){
    2222        if(strpos($hook_suffix, 'lipsum-dynamo') !== false){
    23             wp_enqueue_script('lipnamo-cleanup-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-cleanup-items.js', array('jquery'), LIPNAMO_VERSION, true);
     23            wp_enqueue_script('lipnamo-cleanup-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-cleanup-items.js', ['jquery'], DUMMIE_VERSION, true);
    2424            wp_localize_script('lipnamo-cleanup-items', 'lipnamo_items',
    25                 array(
     25                [
    2626                    'ajax_url'   => admin_url('admin-ajax.php'),
    2727                    'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'),
    28                 )
     28                ]
    2929            );
    3030        }
     
    4949        // Exit if invalid post type
    5050        if($post_type !== 'any'){
    51             $valid_post_types = get_post_types(array('public' => true), 'objects');
     51            $valid_post_types = get_post_types(['public' => true], 'objects');
    5252            if(!in_array($post_type, array_keys($valid_post_types))){
    5353                return;
     
    8585       
    8686        // Store results in an array.
    87         $result = array(
    88             'step' => $post_step
    89         );
     87        $result = [
     88            'step' => $post_step,
     89        ];
    9090       
    9191        if($post_step >= $post_total){
     
    114114        // Exit if invalid post type
    115115        if($post_type !== 'any'){
    116             $valid_post_types = get_post_types(array('public' => true), 'objects');
     116            $valid_post_types = get_post_types(['public' => true], 'objects');
    117117            if(!in_array($post_type, array_keys($valid_post_types))){
    118118                return;
  • lipsum-dynamo/trunk/includes/generate-items.php

    r2698796 r3117972  
    1212class Lipsum_Dynamo_Generate{
    1313    public function __construct(){
    14         add_action('admin_enqueue_scripts', array($this, 'lipnamo_generate_scripts'));
     14        add_action('admin_enqueue_scripts', [$this, 'lipnamo_generate_scripts']);
    1515       
    16         add_action("wp_ajax_lipnamo_generate_items", array($this, 'lipnamo_generate_items'));
    17         add_action("wp_ajax_nopriv_lipnamo_generate_items", array($this, 'lipnamo_generate_items'));
     16        add_action("wp_ajax_lipnamo_generate_items", [$this, 'lipnamo_generate_items']);
     17        add_action("wp_ajax_nopriv_lipnamo_generate_items", [$this, 'lipnamo_generate_items']);
    1818    }
    1919   
    2020    public function lipnamo_generate_scripts($hook_suffix){
    2121        if(strpos($hook_suffix, 'lipsum-dynamo') !== false){
    22             wp_enqueue_script('lipnamo-generate-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-generate-items.js', array('jquery'), LIPNAMO_VERSION, true);
     22            wp_enqueue_script('lipnamo-generate-items', LIPNAMO_ASSETS_URL . 'js/lipnamo-generate-items.js', ['jquery'], DUMMIE_VERSION, true);
    2323            wp_localize_script('lipnamo-generate-items', 'lipnamo_items',
    24                 array(
     24                [
    2525                    'ajax_url'   => admin_url('admin-ajax.php'),
    2626                    'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'),
    27                 )
     27                ]
    2828            );
    2929        }
     
    5353       
    5454        // Exit if invalid post type
    55         $valid_post_types = get_post_types(array('public' => true), 'objects');
     55        $valid_post_types = get_post_types(['public' => true], 'objects');
    5656        if(!in_array($post_type, array_keys($valid_post_types))){
    5757            return;
     
    100100           
    101101            // Create post
    102             $new_post = array(
     102            $new_post = [
    103103                'post_type'    => $post_type,
    104104                'post_title'   => wp_strip_all_tags($post_title),
     
    106106                'post_content' => $post_content,
    107107                'post_status'  => $post_status,
    108                 'post_author'  => $post_author
    109             );
     108                'post_author'  => $post_author,
     109            ];
    110110            $post_id  = wp_insert_post($new_post);
    111111            if(!is_wp_error($post_id) && $thumbnail_id){
     
    116116                global $wpdb;
    117117                $table_name = $wpdb->prefix . 'lipnamo';
    118                 $wpdb->insert($table_name, array(
     118                $wpdb->insert($table_name, [
    119119                    'post_id'   => $post_id,
    120                     'post_type' => $post_type
    121                 ));
     120                    'post_type' => $post_type,
     121                ]);
    122122            }
    123123           
     
    130130       
    131131        // Store results in an array.
    132         $result = array(
    133             'step' => $post_step
    134         );
     132        $result = [
     133            'step' => $post_step,
     134        ];
    135135       
    136136        if($post_step >= $post_total){
  • lipsum-dynamo/trunk/includes/setting/general.php

    r2698796 r3117972  
    1717            'lipnamo_group',
    1818            'lipsum-dynamo-general',
    19             array($this, 'sanitize_text_field')
     19            [$this, 'sanitize_text_field']
    2020        );
    2121       
     
    2323            'lipnamo_section',
    2424            '',
    25             array($this, 'lipnamo_admin_section_info'),
     25            [$this, 'lipnamo_admin_section_info'],
    2626            'lipsum-dynamo-general'
    2727        );
     
    3030            'lipnamo_post_total', // id
    3131            'Number of items', // title
    32             array($this, 'lipnamo_post_total'), // callback
     32            [$this, 'lipnamo_post_total'], // callback
    3333            'lipsum-dynamo-general', // page
    3434            'lipnamo_section' // section
     
    3838            'post_type', // id
    3939            'Select post type', // title
    40             array($this, 'lipnamo_post_type'), // callback
     40            [$this, 'lipnamo_post_type'], // callback
    4141            'lipsum-dynamo-general', // page
    4242            'lipnamo_section' // section
     
    4646            'post_author', // id
    4747            'Post author', // title
    48             array($this, 'lipnamo_post_author'), // callback
     48            [$this, 'lipnamo_post_author'], // callback
    4949            'lipsum-dynamo-general', // page
    5050            'lipnamo_section' // section
     
    5454            'post_status', // id
    5555            'New Item status', // title
    56             array($this, 'lipnamo_post_status'), // callback
     56            [$this, 'lipnamo_post_status'], // callback
    5757            'lipsum-dynamo-general', // page
    5858            'lipnamo_section' // section
     
    6262            'post_thumbnail', // id
    6363            'New Item Thumbnails', // title
    64             array($this, 'lipnamo_post_thumbnail'), // callback
     64            [$this, 'lipnamo_post_thumbnail'], // callback
    6565            'lipsum-dynamo-general', // page
    6666            'lipnamo_section' // section
     
    7070            'length_control', // id
    7171            'Length Control', // title
    72             array($this, 'lipnamo_length_control'), // callback
     72            [$this, 'lipnamo_length_control'], // callback
    7373            'lipsum-dynamo-general', // page
    7474            'lipnamo_section' // section
     
    9090   
    9191    public function lipnamo_post_type(){
    92         $post_types = get_post_types(array('public' => true), 'objects');
     92        $post_types = get_post_types(['public' => true], 'objects');
    9393        ?>
    9494        <fieldset>
     
    116116   
    117117    public function lipnamo_post_author(){
    118         $users       = get_users(array('role__in' => array('administrator'), 'fields' => array('ID')));
    119         $admin_email = get_option('new_admin_email');
     118        $users       = get_users(['role__in' => ['administrator'], 'fields' => ['ID']]);
     119        $admin_email = get_option('admin_email');
    120120        ?>
    121121        <fieldset>
  • lipsum-dynamo/trunk/includes/setting/setting.php

    r2698796 r3117972  
    1111   
    1212    public function __construct(){
    13         add_action('admin_menu', array($this, 'lipnamo_setting'));
    14         add_action('admin_init', array($this, 'lipnamo_setting_init'));
     13        add_action('admin_menu', [$this, 'lipnamo_setting']);
     14        add_action('admin_init', [$this, 'lipnamo_setting_init']);
    1515       
    16         add_action("admin_enqueue_scripts", array($this, 'lipnamo_assets'));
     16        add_action("admin_enqueue_scripts", [$this, 'lipnamo_assets']);
    1717    }
    1818   
    1919    public function lipnamo_assets(){
    20         wp_enqueue_style('lipnamo-admin', LIPNAMO_ASSETS_URL . 'css/lipnamo-admin.css', false, LIPNAMO_VERSION);
     20        wp_enqueue_style('lipnamo-admin', LIPNAMO_ASSETS_URL . 'css/lipnamo-admin.css', false, DUMMIE_VERSION);
    2121       
    2222        // Upload field
     
    2424       
    2525        // Plugin scripts
    26         wp_enqueue_script('lipnamo-admin', LIPNAMO_ASSETS_URL . 'js/lipnamo-admin.js', array('jquery'), LIPNAMO_VERSION);
     26        wp_enqueue_script('lipnamo-admin', LIPNAMO_ASSETS_URL . 'js/lipnamo-admin.js', ['jquery'], DUMMIE_VERSION);
    2727    }
    2828   
     
    4343        add_submenu_page(
    4444            'tools.php',
    45             'Lipsum Dynamo',
    46             'Lipsum Dynamo',
     45            'Dummie',
     46            'Dummie',
    4747            'manage_options',
    4848            'lipsum-dynamo',
    49             array($this, 'lipnamo_setting_html'),
     49            [$this, 'lipnamo_setting_html'],
    5050        );
    5151    }
     
    5757        }
    5858       
    59         $form_action = admin_url("tools.php?page=lipsum-dynamo");
    60         if(isset ($_GET['tab'])){
    61             $form_action = admin_url("tools.php?page=lipsum-dynamo&tab=" . $_GET['tab']);
    62         }
     59        $tab         = esc_attr(lipnamo_array_key_exists('tab', $_GET));
     60        $form_action = $tab ? admin_url("tools.php?page=lipsum-dynamo&tab=" . $tab) : admin_url("tools.php?page=lipsum-dynamo");
     61       
     62        echo '<div class="wrap">';
     63       
     64        echo '<h1>Dummie</h1>';
    6365       
    6466        // nav
    6567        echo '<nav class="nav-tab-wrapper">';
    66         if(isset ($_GET['tab'])){
    67             $this->lipnamo_setting_tab_navs($_GET['tab']);
     68        if($tab){
     69            $this->lipnamo_setting_tab_navs($tab);
    6870        }else{
    6971            $this->lipnamo_setting_tab_navs();
     
    7375        // content
    7476        echo '<div class="tab-content">';
    75         echo '<div class="wrap">';
     77       
    7678        echo '<form class="lipsum-dynamo" method="POST" action="' . $form_action . '">';
    7779       
    7880        wp_nonce_field("lipsum-dynamo");
    7981       
    80         $current_tab = 'general';
    81         if(isset ($_GET['tab'])){
    82             $current_tab = $_GET['tab'];
    83         }
    84        
    85         echo '<h1>' . $this->lipnamo_setting_tabs()[$current_tab] . '</h1>';
    86        
     82        $current_tab = lipnamo_array_key_exists('tab', $_GET) ? : 'general';
    8783        if($current_tab == 'uninstall'){
    8884            echo '<p class="description">' . __("When you uninstall this plugin, what do you want to do with your settings and the generated dummy items? Be careful to use this option. It can't be reverted.", "lipsum-dynamo") . '</p>';
     
    9389        echo '</form>';
    9490        echo '</div>';
    95         echo '</div>';
     91       
     92        echo '</div>'; // wrap
    9693    }
    9794   
    9895    public function lipnamo_setting_tabs(): array{
    99         return array(
     96        $tabs = [
    10097            'general'   => 'General',
    10198            'cleanup'   => 'Cleanup',
    10299            'uninstall' => 'Uninstall',
    103         );
     100        ];
     101       
     102        return $tabs;
    104103    }
    105104   
     
    160159    public function lipnamo_save_options(){
    161160        global $pagenow;
    162         if($pagenow == 'tools.php' && $_GET['page'] == 'lipsum-dynamo'){
     161        if($pagenow == 'tools.php' && esc_attr(lipnamo_array_key_exists('page', $_GET)) == 'lipsum-dynamo'){
    163162            $option_key = 'lipsum-dynamo';
    164163            if(isset($_POST[$option_key])){
     
    168167                }
    169168            }else{
    170                 $new_options = array();
     169                $new_options = [];
    171170            }
    172171           
  • lipsum-dynamo/trunk/lipsum-dynamo.php

    r2698796 r3117972  
    11<?php
    22/**
    3  * Plugin Name:       Lipsum Dynamo
     3 * Plugin Name:       Dummie
    44 * Plugin URI:        https://wordpress.org/plugins/lipsum-dynamo/
    55 * Description:       🖨 Generate dummy content for demo purpose
    6  * Version:           3.0
     6 * Version:           3.1.0
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.2
     
    2626 */
    2727
    28 const LIPNAMO_VERSION = '3.0';
     28const DUMMIE_VERSION = '3.1.0';
    2929define("LIPNAMO_DIR", plugin_dir_path(__FILE__));
    3030define("LIPNAMO_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/');
     
    7575        dbDelta($sql);
    7676       
    77         add_option('lipnamo_db_version', LIPNAMO_VERSION);
     77        add_option('lipnamo_db_version', DUMMIE_VERSION);
    7878    }
    7979}
     
    8181add_action('plugins_loaded', 'lipnamo_update_db_check');
    8282function lipnamo_update_db_check(){
    83     if(get_site_option('lipnamo_db_version') != LIPNAMO_VERSION){
     83    if(get_site_option('lipnamo_db_version') != DUMMIE_VERSION){
    8484        lipnamo_install();
    8585    }
  • lipsum-dynamo/trunk/readme.txt

    r2698796 r3117972  
    1 === Lipsum Dynamo ===
     1=== Dummie ===
    22Contributors: daomapsieucap
    33Tags: lorem ipsum, dummy text generator, lorem ipsum generator
    44Requires at least: 4.7
    5 Tested up to: 5.9.1
     5Tested up to: 6.5.5
    66Requires PHP: 7.2
    7 Stable tag: 3.0
     7Stable tag: 3.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2929== Changelog ==
    3030
    31 = 3.0 =
    32 *Release Date - 24 March 2022*
     31= 3.1.0 =
     32*Release Date - 15 July 2024*
    3333
    34 * New: Move admin setting menu to Tools.
    35 * New: Upgrade setting UI to tabs.
     34* New: Rename plugin to Dummie.
     35* Fixed: Fix wrong default admin post author.
     36* Changed: Tested up to 6.5.5.
Note: See TracChangeset for help on using the changeset viewer.