Changeset 1334958
- Timestamp:
- 01/24/2016 01:31:21 PM (10 years ago)
- Location:
- easy-code-placement/trunk
- Files:
-
- 9 edited
-
easy-code-placement.php (modified) (3 diffs)
-
inc/functions.php (modified) (5 diffs)
-
inc/install.php (modified) (1 diff)
-
inc/page.php (modified) (1 diff)
-
inc/settings.php (modified) (3 diffs)
-
inc/system.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
-
screenshot-5.png (modified) (previous)
-
screenshot-6.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
easy-code-placement/trunk/easy-code-placement.php
r1256969 r1334958 2 2 /* 3 3 Plugin Name: Easy Code Placement 4 Version: 3. 04 Version: 3.1 5 5 Plugin URI: http://www.randnotizen.org/easy-code-placement/ 6 6 Author: Jens Herdy … … 13 13 ob_start(); 14 14 define('ECP_FILE',__FILE__); 15 define('ECP_VERSION','3. 0');15 define('ECP_VERSION','3.1'); 16 16 17 17 // load functions, classes … … 41 41 42 42 // add options menu 43 add_action( 'admin_menu', 'ecp_add_page' );43 add_action( 'admin_menu', 'ecp_add_page'); 44 44 45 45 ?> -
easy-code-placement/trunk/inc/functions.php
r1256966 r1334958 2 2 3 3 // error reporting for dev 4 // error_reporting(E_ALL); 5 // define( 'DIEONDBERROR', true ); // multisite 6 // $wpdb->show_errors(); // single site 4 error_reporting(E_ALL); 5 define( 'DIEONDBERROR', true ); // multisite 6 $wpdb->show_errors(); // single site 7 8 // check if role >= option 9 function check_role() { 10 global $wpdb; 11 $ecp_role = $wpdb->get_var("SELECT option_value FROM ".$wpdb->prefix."ecp_options WHERE option_name = 'role'" ); 12 if (current_user_can($ecp_role)) { 13 return '1'; 14 } else { 15 return '0'; 16 } 17 } 7 18 8 19 // generate options menu 9 20 function ecp_add_page() { 10 add_options_page( 'Easy Code Placement', 'Easy Code Placement', 'manage_options', 'ecp', 'ecp' ); 21 if (check_role() === '1') { 22 add_options_page( 'Easy Code Placement', 'Easy Code Placement', 'edit_posts', 'ecp', 'ecp' ); 23 } 11 24 } 12 25 … … 85 98 } 86 99 87 // update s from 2.6.x to 2.7100 // update to 3.1 88 101 function ecp_update(){ 89 102 // multiside update … … 94 107 foreach ($blogids as $blogid) { 95 108 switch_to_blog($blogid); 96 $wpdb->query("UPDATE ".$wpdb->prefix."ecp_data SET version='3.0'"); 97 $wpdb->update($wpdb->prefix.'ecp_options', array( 'option_value'=>'3.0' ), array( 'option_name'=>'version' )); 109 $wpdb->query("ALTER TABLE ".$wpdb->prefix."ecp_options MODIFY COLUMN option_value varchar(20)"); 110 $wpdb->query("UPDATE ".$wpdb->prefix."ecp_data SET version='3.1'"); 111 $wpdb->insert($wpdb->prefix.'ecp_options', array( 'option_name' => 'role','option_value' => 'manage_options')); 112 $wpdb->update($wpdb->prefix.'ecp_options', array( 'option_value' => '3.1' ), array( 'option_name' => 'version' )); 98 113 } 99 114 switch_to_blog($blog); … … 101 116 // single update 102 117 global $wpdb; 103 $wpdb->query("UPDATE ".$wpdb->prefix."ecp_data SET version='3.0'"); 104 $wpdb->update($wpdb->prefix.'ecp_options', array( 'option_value'=>'3.0' ), array( 'option_name'=>'version' )); 118 $wpdb->query("ALTER TABLE ".$wpdb->prefix."ecp_options MODIFY COLUMN option_value varchar(20)"); 119 $wpdb->query("UPDATE ".$wpdb->prefix."ecp_data SET version='3.1'"); 120 $wpdb->insert($wpdb->prefix.'ecp_options', array( 'option_name' => 'role','option_value' => 'manage_options')); 121 $wpdb->update($wpdb->prefix.'ecp_options', array( 'option_value' => '3.1' ), array( 'option_name' => 'version' )); 105 122 } 106 123 } … … 112 129 if (! is_admin()) { 113 130 return; 114 } elseif ($ecp_options_version === '3. 0') {131 } elseif ($ecp_options_version === '3.1') { 115 132 return; 116 133 } else { -
easy-code-placement/trunk/inc/install.php
r1227126 r1334958 19 19 `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, 20 20 `option_name` varchar(10) COLLATE utf8_unicode_ci NOT NULL UNIQUE, 21 `option_value` varchar( 10) COLLATE utf8_unicode_ci NOT NULL21 `option_value` varchar(20) COLLATE utf8_unicode_ci NOT NULL 22 22 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1"; 23 23 $wpdb->query($ecp_options); 24 24 // insert data 25 $wpdb->insert($wpdb->prefix.'ecp_options', array('option_name' => 'version','option_value' => ECP_VERSION)); 26 $wpdb->insert($wpdb->prefix.'ecp_options', array('option_name' => 'perpage','option_value' => '10')); 25 $wpdb->insert($wpdb->prefix.'ecp_options', array( 'option_name' => 'version','option_value' => ECP_VERSION)); 26 $wpdb->insert($wpdb->prefix.'ecp_options', array( 'option_name' => 'perpage','option_value' => '10')); 27 $wpdb->insert($wpdb->prefix.'ecp_options', array( 'option_name' => 'role','option_value' => 'manage_options')); 27 28 } 28 29 -
easy-code-placement/trunk/inc/page.php
r1256966 r1334958 42 42 <tr> 43 43 <td width="600px" align="left"><?php _e('If you want to thank the developer for this free Plugin, you are welcome to make a donation via PayPal (you don\'t need a PayPal account to make the donation).','ecp'); ?></td> 44 <td><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_ top">44 <td><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> 45 45 <input type="hidden" name="cmd" value="_s-xclick"> 46 46 <input type="hidden" name="hosted_button_id" value="2X2EH5MYGPLL4"> -
easy-code-placement/trunk/inc/settings.php
r1256966 r1334958 9 9 $_POST = stripslashes_deep ($_POST); 10 10 $t_ecp_perpage = $_POST['perpage']; 11 $t_ecp_role = $_POST['role']; 11 12 12 13 if ($t_ecp_perpage == "") { … … 27 28 28 29 $wpdb->update($wpdb->prefix.'ecp_options', array('option_value'=>$t_ecp_perpage), array('option_name'=>'perpage')); 30 $wpdb->update($wpdb->prefix.'ecp_options', array('option_value'=>$t_ecp_role), array('option_name'=>'role')); 29 31 30 32 // when added to database goto options page … … 55 57 <tbody> 56 58 <tr> 59 <td><?php _e('Who can manage this Plugin?','ecp'); ?></td> 60 <td> 61 <?php 62 global $wpdb; 63 $ecp_role = $wpdb->get_var("SELECT option_value FROM ".$wpdb->prefix."ecp_options WHERE option_name = 'role'"); 64 ?> 65 <select name="role"> 66 <option <?php if ($ecp_role === 'manage_options') {echo 'selected';}; ?> value="manage_options"><?php _e('Adminstrators and higher','ecp'); ?></option> 67 <option <?php if ($ecp_role === 'manage_categories') {echo 'selected';}; ?> value="manage_categories"><?php _e('Editors and higher','ecp'); ?></option> 68 <option <?php if ($ecp_role === 'publish_posts') {echo 'selected';}; ?> value="publish_posts"><?php _e('Authors and higher','ecp'); ?></option> 69 <option <?php if ($ecp_role === 'edit_posts') {echo 'selected';}; ?> value="edit_posts"><?php _e('Contributors and higher','ecp'); ?></option> 70 </select> 71 </td> 72 </tr> 73 <tr> 57 74 <td><?php _e('Codes per Page','ecp'); ?></td> 58 75 <td> 59 <?php global $wpdb; $per_page = $wpdb->get_var("SELECT option_value FROM ".$wpdb->prefix."ecp_options WHERE option_name = 'perpage'"); ?> 76 <?php 77 global $wpdb; 78 $per_page = $wpdb->get_var("SELECT option_value FROM ".$wpdb->prefix."ecp_options WHERE option_name = 'perpage'"); 79 ?> 60 80 <input type="text" name="perpage" value="<?php echo $per_page; ?>" size="10" maxlength="2"> 61 81 </td> -
easy-code-placement/trunk/inc/system.php
r1256966 r1334958 27 27 } else if (function_exists('mysql_get_server_info')) { 28 28 echo mysql_get_server_info(); 29 } else { 30 _e('Error','ecp'); 29 31 } 30 32 ?> … … 63 65 </td> 64 66 </tr> 67 <tr> 68 <td><?php _e('Role','ecp'); ?></td> 69 <td><?php 70 global $wpdb; 71 $ecp_options_role = $wpdb->get_var("SELECT option_value FROM ".$wpdb->prefix."ecp_options WHERE option_name = 'role'"); 72 if ($ecp_options_role === '') { 73 _e('Error','ecp'); 74 } else { 75 echo $ecp_options_role; 76 } 77 ?> 78 </td> 79 </tr> 65 80 </tbody> 66 81 </table> … … 81 96 <tr> 82 97 <td><?php _e('PHP max. execution time','ecp'); ?></td> 83 <td><?php if (function_exists('ini_get')) echo ini_get('max_execution_time'); ?>s</td> 98 <td><?php 99 if (function_exists('ini_get')) { 100 echo ini_get('max_execution_time').'s'; 101 } else { 102 _e('Error','ecp'); 103 } ?> 104 </td> 84 105 </tr> 85 106 <tr> 86 107 <td><?php _e('PHP memory limit','ecp'); ?></td> 87 <td><?php if (function_exists('ini_get')) echo ini_get('memory_limit').'B'; ?></td> 108 <td><?php 109 if (function_exists('ini_get')) { 110 echo ini_get('memory_limit').'B'; 111 } else { 112 _e('Error','ecp'); 113 } ?> 114 </td> 88 115 </tr> 89 116 <tr> -
easy-code-placement/trunk/readme.txt
r1256966 r1334958 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2X2EH5MYGPLL4 4 4 Tags: ad, addthis, ads, adsense, adsense plugin, advertising, affilimatch, affilinet, align, alignment, amazon associates, audio, clicksor, code, codes, css, flash, google, google adsense, html, infolinks, insert, java, javascript, multisite, network, offline, online, page, pages, php, place, plugin, post, posts, shortcode, shortcodes, snippet, snippets, text, video, widget 5 Requires at least: 3.0 .16 Tested up to: 4. 3.17 Stable tag: 3. 05 Requires at least: 3.0 6 Tested up to: 4.4.1 7 Stable tag: 3.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 34 34 * Place a Code with a Shortcode 35 35 * Place a Code with the standard WordPress Text-Widget 36 * Choose who can manage the Plugin (Admin/Editor/Author/Contributor) 36 37 * Ready for translations 37 38 * Multisite/Network compatible … … 79 80 80 81 == Changelog == 82 83 = 3.1 = 84 * 24.01.2016 85 * Compatibility check for WordPress Version 4.4.1 86 * Added an Option to choose who can manage the Plugin 87 * Added the Information who can manage the Plugin to the System Informationens site 88 * Donation-Page opens now in a new Tab 89 * Updated the German translation 90 * Secured the Output from the System Informations Site to prevent Errors 91 * Updated the existing Screenshots 5 and 6 81 92 82 93 = 3.0 =
Note: See TracChangeset
for help on using the changeset viewer.