Changeset 3117972
- Timestamp:
- 07/15/2024 05:05:04 AM (17 months ago)
- Location:
- lipsum-dynamo
- Files:
-
- 15 edited
- 1 copied
-
assets/icon.svg (modified) (1 prop)
-
tags/3.1.0 (copied) (copied from lipsum-dynamo/trunk)
-
tags/3.1.0/changelog.txt (modified) (1 diff)
-
tags/3.1.0/includes/cleanup.php (modified) (4 diffs)
-
tags/3.1.0/includes/generate-items.php (modified) (6 diffs)
-
tags/3.1.0/includes/setting/general.php (modified) (10 diffs)
-
tags/3.1.0/includes/setting/setting.php (modified) (8 diffs)
-
tags/3.1.0/lipsum-dynamo.php (modified) (4 diffs)
-
tags/3.1.0/readme.txt (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/cleanup.php (modified) (4 diffs)
-
trunk/includes/generate-items.php (modified) (6 diffs)
-
trunk/includes/setting/general.php (modified) (10 diffs)
-
trunk/includes/setting/setting.php (modified) (8 diffs)
-
trunk/lipsum-dynamo.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lipsum-dynamo/assets/icon.svg
-
Property
svn:mime-type
set to
image/svg+xml
-
Property
svn:mime-type
set to
-
lipsum-dynamo/tags/3.1.0/changelog.txt
r2698796 r3117972 1 1 == 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. 2 9 3 10 = 3.0 = -
lipsum-dynamo/tags/3.1.0/includes/cleanup.php
r2698796 r3117972 10 10 class Lipsum_Dynamo_Cleanup{ 11 11 public function __construct(){ 12 add_action('admin_enqueue_scripts', array($this, 'lipnamo_cleanup_scripts'));12 add_action('admin_enqueue_scripts', [$this, 'lipnamo_cleanup_scripts']); 13 13 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']); 16 16 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']); 19 19 } 20 20 21 21 public function lipnamo_cleanup_scripts($hook_suffix){ 22 22 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); 24 24 wp_localize_script('lipnamo-cleanup-items', 'lipnamo_items', 25 array(25 [ 26 26 'ajax_url' => admin_url('admin-ajax.php'), 27 27 'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'), 28 )28 ] 29 29 ); 30 30 } … … 49 49 // Exit if invalid post type 50 50 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'); 52 52 if(!in_array($post_type, array_keys($valid_post_types))){ 53 53 return; … … 85 85 86 86 // Store results in an array. 87 $result = array(88 'step' => $post_step 89 );87 $result = [ 88 'step' => $post_step, 89 ]; 90 90 91 91 if($post_step >= $post_total){ … … 114 114 // Exit if invalid post type 115 115 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'); 117 117 if(!in_array($post_type, array_keys($valid_post_types))){ 118 118 return; -
lipsum-dynamo/tags/3.1.0/includes/generate-items.php
r2698796 r3117972 12 12 class Lipsum_Dynamo_Generate{ 13 13 public function __construct(){ 14 add_action('admin_enqueue_scripts', array($this, 'lipnamo_generate_scripts'));14 add_action('admin_enqueue_scripts', [$this, 'lipnamo_generate_scripts']); 15 15 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']); 18 18 } 19 19 20 20 public function lipnamo_generate_scripts($hook_suffix){ 21 21 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); 23 23 wp_localize_script('lipnamo-generate-items', 'lipnamo_items', 24 array(24 [ 25 25 'ajax_url' => admin_url('admin-ajax.php'), 26 26 'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'), 27 )27 ] 28 28 ); 29 29 } … … 53 53 54 54 // 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'); 56 56 if(!in_array($post_type, array_keys($valid_post_types))){ 57 57 return; … … 100 100 101 101 // Create post 102 $new_post = array(102 $new_post = [ 103 103 'post_type' => $post_type, 104 104 'post_title' => wp_strip_all_tags($post_title), … … 106 106 'post_content' => $post_content, 107 107 'post_status' => $post_status, 108 'post_author' => $post_author 109 );108 'post_author' => $post_author, 109 ]; 110 110 $post_id = wp_insert_post($new_post); 111 111 if(!is_wp_error($post_id) && $thumbnail_id){ … … 116 116 global $wpdb; 117 117 $table_name = $wpdb->prefix . 'lipnamo'; 118 $wpdb->insert($table_name, array(118 $wpdb->insert($table_name, [ 119 119 'post_id' => $post_id, 120 'post_type' => $post_type 121 ));120 'post_type' => $post_type, 121 ]); 122 122 } 123 123 … … 130 130 131 131 // Store results in an array. 132 $result = array(133 'step' => $post_step 134 );132 $result = [ 133 'step' => $post_step, 134 ]; 135 135 136 136 if($post_step >= $post_total){ -
lipsum-dynamo/tags/3.1.0/includes/setting/general.php
r2698796 r3117972 17 17 'lipnamo_group', 18 18 'lipsum-dynamo-general', 19 array($this, 'sanitize_text_field')19 [$this, 'sanitize_text_field'] 20 20 ); 21 21 … … 23 23 'lipnamo_section', 24 24 '', 25 array($this, 'lipnamo_admin_section_info'),25 [$this, 'lipnamo_admin_section_info'], 26 26 'lipsum-dynamo-general' 27 27 ); … … 30 30 'lipnamo_post_total', // id 31 31 'Number of items', // title 32 array($this, 'lipnamo_post_total'), // callback32 [$this, 'lipnamo_post_total'], // callback 33 33 'lipsum-dynamo-general', // page 34 34 'lipnamo_section' // section … … 38 38 'post_type', // id 39 39 'Select post type', // title 40 array($this, 'lipnamo_post_type'), // callback40 [$this, 'lipnamo_post_type'], // callback 41 41 'lipsum-dynamo-general', // page 42 42 'lipnamo_section' // section … … 46 46 'post_author', // id 47 47 'Post author', // title 48 array($this, 'lipnamo_post_author'), // callback48 [$this, 'lipnamo_post_author'], // callback 49 49 'lipsum-dynamo-general', // page 50 50 'lipnamo_section' // section … … 54 54 'post_status', // id 55 55 'New Item status', // title 56 array($this, 'lipnamo_post_status'), // callback56 [$this, 'lipnamo_post_status'], // callback 57 57 'lipsum-dynamo-general', // page 58 58 'lipnamo_section' // section … … 62 62 'post_thumbnail', // id 63 63 'New Item Thumbnails', // title 64 array($this, 'lipnamo_post_thumbnail'), // callback64 [$this, 'lipnamo_post_thumbnail'], // callback 65 65 'lipsum-dynamo-general', // page 66 66 'lipnamo_section' // section … … 70 70 'length_control', // id 71 71 'Length Control', // title 72 array($this, 'lipnamo_length_control'), // callback72 [$this, 'lipnamo_length_control'], // callback 73 73 'lipsum-dynamo-general', // page 74 74 'lipnamo_section' // section … … 90 90 91 91 public function lipnamo_post_type(){ 92 $post_types = get_post_types( array('public' => true), 'objects');92 $post_types = get_post_types(['public' => true], 'objects'); 93 93 ?> 94 94 <fieldset> … … 116 116 117 117 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'); 120 120 ?> 121 121 <fieldset> -
lipsum-dynamo/tags/3.1.0/includes/setting/setting.php
r2698796 r3117972 11 11 12 12 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']); 15 15 16 add_action("admin_enqueue_scripts", array($this, 'lipnamo_assets'));16 add_action("admin_enqueue_scripts", [$this, 'lipnamo_assets']); 17 17 } 18 18 19 19 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); 21 21 22 22 // Upload field … … 24 24 25 25 // 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); 27 27 } 28 28 … … 43 43 add_submenu_page( 44 44 'tools.php', 45 ' Lipsum Dynamo',46 ' Lipsum Dynamo',45 'Dummie', 46 'Dummie', 47 47 'manage_options', 48 48 'lipsum-dynamo', 49 array($this, 'lipnamo_setting_html'),49 [$this, 'lipnamo_setting_html'], 50 50 ); 51 51 } … … 57 57 } 58 58 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>'; 63 65 64 66 // nav 65 67 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); 68 70 }else{ 69 71 $this->lipnamo_setting_tab_navs(); … … 73 75 // content 74 76 echo '<div class="tab-content">'; 75 echo '<div class="wrap">';77 76 78 echo '<form class="lipsum-dynamo" method="POST" action="' . $form_action . '">'; 77 79 78 80 wp_nonce_field("lipsum-dynamo"); 79 81 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'; 87 83 if($current_tab == 'uninstall'){ 88 84 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>'; … … 93 89 echo '</form>'; 94 90 echo '</div>'; 95 echo '</div>'; 91 92 echo '</div>'; // wrap 96 93 } 97 94 98 95 public function lipnamo_setting_tabs(): array{ 99 return array(96 $tabs = [ 100 97 'general' => 'General', 101 98 'cleanup' => 'Cleanup', 102 99 'uninstall' => 'Uninstall', 103 ); 100 ]; 101 102 return $tabs; 104 103 } 105 104 … … 160 159 public function lipnamo_save_options(){ 161 160 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'){ 163 162 $option_key = 'lipsum-dynamo'; 164 163 if(isset($_POST[$option_key])){ … … 168 167 } 169 168 }else{ 170 $new_options = array();169 $new_options = []; 171 170 } 172 171 -
lipsum-dynamo/tags/3.1.0/lipsum-dynamo.php
r2698796 r3117972 1 1 <?php 2 2 /** 3 * Plugin Name: Lipsum Dynamo3 * Plugin Name: Dummie 4 4 * Plugin URI: https://wordpress.org/plugins/lipsum-dynamo/ 5 5 * Description: 🖨 Generate dummy content for demo purpose 6 * Version: 3. 06 * Version: 3.1.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 26 26 */ 27 27 28 const LIPNAMO_VERSION = '3.0';28 const DUMMIE_VERSION = '3.1.0'; 29 29 define("LIPNAMO_DIR", plugin_dir_path(__FILE__)); 30 30 define("LIPNAMO_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/'); … … 75 75 dbDelta($sql); 76 76 77 add_option('lipnamo_db_version', LIPNAMO_VERSION);77 add_option('lipnamo_db_version', DUMMIE_VERSION); 78 78 } 79 79 } … … 81 81 add_action('plugins_loaded', 'lipnamo_update_db_check'); 82 82 function lipnamo_update_db_check(){ 83 if(get_site_option('lipnamo_db_version') != LIPNAMO_VERSION){83 if(get_site_option('lipnamo_db_version') != DUMMIE_VERSION){ 84 84 lipnamo_install(); 85 85 } -
lipsum-dynamo/tags/3.1.0/readme.txt
r2698796 r3117972 1 === Lipsum Dynamo===1 === Dummie === 2 2 Contributors: daomapsieucap 3 3 Tags: lorem ipsum, dummy text generator, lorem ipsum generator 4 4 Requires at least: 4.7 5 Tested up to: 5.9.15 Tested up to: 6.5.5 6 6 Requires PHP: 7.2 7 Stable tag: 3. 07 Stable tag: 3.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 29 29 == Changelog == 30 30 31 = 3. 0 =32 *Release Date - 24 March 2022*31 = 3.1.0 = 32 *Release Date - 15 July 2024* 33 33 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 1 1 == 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. 2 9 3 10 = 3.0 = -
lipsum-dynamo/trunk/includes/cleanup.php
r2698796 r3117972 10 10 class Lipsum_Dynamo_Cleanup{ 11 11 public function __construct(){ 12 add_action('admin_enqueue_scripts', array($this, 'lipnamo_cleanup_scripts'));12 add_action('admin_enqueue_scripts', [$this, 'lipnamo_cleanup_scripts']); 13 13 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']); 16 16 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']); 19 19 } 20 20 21 21 public function lipnamo_cleanup_scripts($hook_suffix){ 22 22 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); 24 24 wp_localize_script('lipnamo-cleanup-items', 'lipnamo_items', 25 array(25 [ 26 26 'ajax_url' => admin_url('admin-ajax.php'), 27 27 'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'), 28 )28 ] 29 29 ); 30 30 } … … 49 49 // Exit if invalid post type 50 50 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'); 52 52 if(!in_array($post_type, array_keys($valid_post_types))){ 53 53 return; … … 85 85 86 86 // Store results in an array. 87 $result = array(88 'step' => $post_step 89 );87 $result = [ 88 'step' => $post_step, 89 ]; 90 90 91 91 if($post_step >= $post_total){ … … 114 114 // Exit if invalid post type 115 115 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'); 117 117 if(!in_array($post_type, array_keys($valid_post_types))){ 118 118 return; -
lipsum-dynamo/trunk/includes/generate-items.php
r2698796 r3117972 12 12 class Lipsum_Dynamo_Generate{ 13 13 public function __construct(){ 14 add_action('admin_enqueue_scripts', array($this, 'lipnamo_generate_scripts'));14 add_action('admin_enqueue_scripts', [$this, 'lipnamo_generate_scripts']); 15 15 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']); 18 18 } 19 19 20 20 public function lipnamo_generate_scripts($hook_suffix){ 21 21 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); 23 23 wp_localize_script('lipnamo-generate-items', 'lipnamo_items', 24 array(24 [ 25 25 'ajax_url' => admin_url('admin-ajax.php'), 26 26 'ajax_nonce' => wp_create_nonce('lipnamo_ajax_nonce'), 27 )27 ] 28 28 ); 29 29 } … … 53 53 54 54 // 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'); 56 56 if(!in_array($post_type, array_keys($valid_post_types))){ 57 57 return; … … 100 100 101 101 // Create post 102 $new_post = array(102 $new_post = [ 103 103 'post_type' => $post_type, 104 104 'post_title' => wp_strip_all_tags($post_title), … … 106 106 'post_content' => $post_content, 107 107 'post_status' => $post_status, 108 'post_author' => $post_author 109 );108 'post_author' => $post_author, 109 ]; 110 110 $post_id = wp_insert_post($new_post); 111 111 if(!is_wp_error($post_id) && $thumbnail_id){ … … 116 116 global $wpdb; 117 117 $table_name = $wpdb->prefix . 'lipnamo'; 118 $wpdb->insert($table_name, array(118 $wpdb->insert($table_name, [ 119 119 'post_id' => $post_id, 120 'post_type' => $post_type 121 ));120 'post_type' => $post_type, 121 ]); 122 122 } 123 123 … … 130 130 131 131 // Store results in an array. 132 $result = array(133 'step' => $post_step 134 );132 $result = [ 133 'step' => $post_step, 134 ]; 135 135 136 136 if($post_step >= $post_total){ -
lipsum-dynamo/trunk/includes/setting/general.php
r2698796 r3117972 17 17 'lipnamo_group', 18 18 'lipsum-dynamo-general', 19 array($this, 'sanitize_text_field')19 [$this, 'sanitize_text_field'] 20 20 ); 21 21 … … 23 23 'lipnamo_section', 24 24 '', 25 array($this, 'lipnamo_admin_section_info'),25 [$this, 'lipnamo_admin_section_info'], 26 26 'lipsum-dynamo-general' 27 27 ); … … 30 30 'lipnamo_post_total', // id 31 31 'Number of items', // title 32 array($this, 'lipnamo_post_total'), // callback32 [$this, 'lipnamo_post_total'], // callback 33 33 'lipsum-dynamo-general', // page 34 34 'lipnamo_section' // section … … 38 38 'post_type', // id 39 39 'Select post type', // title 40 array($this, 'lipnamo_post_type'), // callback40 [$this, 'lipnamo_post_type'], // callback 41 41 'lipsum-dynamo-general', // page 42 42 'lipnamo_section' // section … … 46 46 'post_author', // id 47 47 'Post author', // title 48 array($this, 'lipnamo_post_author'), // callback48 [$this, 'lipnamo_post_author'], // callback 49 49 'lipsum-dynamo-general', // page 50 50 'lipnamo_section' // section … … 54 54 'post_status', // id 55 55 'New Item status', // title 56 array($this, 'lipnamo_post_status'), // callback56 [$this, 'lipnamo_post_status'], // callback 57 57 'lipsum-dynamo-general', // page 58 58 'lipnamo_section' // section … … 62 62 'post_thumbnail', // id 63 63 'New Item Thumbnails', // title 64 array($this, 'lipnamo_post_thumbnail'), // callback64 [$this, 'lipnamo_post_thumbnail'], // callback 65 65 'lipsum-dynamo-general', // page 66 66 'lipnamo_section' // section … … 70 70 'length_control', // id 71 71 'Length Control', // title 72 array($this, 'lipnamo_length_control'), // callback72 [$this, 'lipnamo_length_control'], // callback 73 73 'lipsum-dynamo-general', // page 74 74 'lipnamo_section' // section … … 90 90 91 91 public function lipnamo_post_type(){ 92 $post_types = get_post_types( array('public' => true), 'objects');92 $post_types = get_post_types(['public' => true], 'objects'); 93 93 ?> 94 94 <fieldset> … … 116 116 117 117 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'); 120 120 ?> 121 121 <fieldset> -
lipsum-dynamo/trunk/includes/setting/setting.php
r2698796 r3117972 11 11 12 12 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']); 15 15 16 add_action("admin_enqueue_scripts", array($this, 'lipnamo_assets'));16 add_action("admin_enqueue_scripts", [$this, 'lipnamo_assets']); 17 17 } 18 18 19 19 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); 21 21 22 22 // Upload field … … 24 24 25 25 // 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); 27 27 } 28 28 … … 43 43 add_submenu_page( 44 44 'tools.php', 45 ' Lipsum Dynamo',46 ' Lipsum Dynamo',45 'Dummie', 46 'Dummie', 47 47 'manage_options', 48 48 'lipsum-dynamo', 49 array($this, 'lipnamo_setting_html'),49 [$this, 'lipnamo_setting_html'], 50 50 ); 51 51 } … … 57 57 } 58 58 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>'; 63 65 64 66 // nav 65 67 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); 68 70 }else{ 69 71 $this->lipnamo_setting_tab_navs(); … … 73 75 // content 74 76 echo '<div class="tab-content">'; 75 echo '<div class="wrap">';77 76 78 echo '<form class="lipsum-dynamo" method="POST" action="' . $form_action . '">'; 77 79 78 80 wp_nonce_field("lipsum-dynamo"); 79 81 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'; 87 83 if($current_tab == 'uninstall'){ 88 84 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>'; … … 93 89 echo '</form>'; 94 90 echo '</div>'; 95 echo '</div>'; 91 92 echo '</div>'; // wrap 96 93 } 97 94 98 95 public function lipnamo_setting_tabs(): array{ 99 return array(96 $tabs = [ 100 97 'general' => 'General', 101 98 'cleanup' => 'Cleanup', 102 99 'uninstall' => 'Uninstall', 103 ); 100 ]; 101 102 return $tabs; 104 103 } 105 104 … … 160 159 public function lipnamo_save_options(){ 161 160 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'){ 163 162 $option_key = 'lipsum-dynamo'; 164 163 if(isset($_POST[$option_key])){ … … 168 167 } 169 168 }else{ 170 $new_options = array();169 $new_options = []; 171 170 } 172 171 -
lipsum-dynamo/trunk/lipsum-dynamo.php
r2698796 r3117972 1 1 <?php 2 2 /** 3 * Plugin Name: Lipsum Dynamo3 * Plugin Name: Dummie 4 4 * Plugin URI: https://wordpress.org/plugins/lipsum-dynamo/ 5 5 * Description: 🖨 Generate dummy content for demo purpose 6 * Version: 3. 06 * Version: 3.1.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 26 26 */ 27 27 28 const LIPNAMO_VERSION = '3.0';28 const DUMMIE_VERSION = '3.1.0'; 29 29 define("LIPNAMO_DIR", plugin_dir_path(__FILE__)); 30 30 define("LIPNAMO_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/'); … … 75 75 dbDelta($sql); 76 76 77 add_option('lipnamo_db_version', LIPNAMO_VERSION);77 add_option('lipnamo_db_version', DUMMIE_VERSION); 78 78 } 79 79 } … … 81 81 add_action('plugins_loaded', 'lipnamo_update_db_check'); 82 82 function lipnamo_update_db_check(){ 83 if(get_site_option('lipnamo_db_version') != LIPNAMO_VERSION){83 if(get_site_option('lipnamo_db_version') != DUMMIE_VERSION){ 84 84 lipnamo_install(); 85 85 } -
lipsum-dynamo/trunk/readme.txt
r2698796 r3117972 1 === Lipsum Dynamo===1 === Dummie === 2 2 Contributors: daomapsieucap 3 3 Tags: lorem ipsum, dummy text generator, lorem ipsum generator 4 4 Requires at least: 4.7 5 Tested up to: 5.9.15 Tested up to: 6.5.5 6 6 Requires PHP: 7.2 7 Stable tag: 3. 07 Stable tag: 3.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 29 29 == Changelog == 30 30 31 = 3. 0 =32 *Release Date - 24 March 2022*31 = 3.1.0 = 32 *Release Date - 15 July 2024* 33 33 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.