Plugin Directory

Changeset 1334958


Ignore:
Timestamp:
01/24/2016 01:31:21 PM (10 years ago)
Author:
wassereimer
Message:

new version

Location:
easy-code-placement/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • easy-code-placement/trunk/easy-code-placement.php

    r1256969 r1334958  
    22/*
    33Plugin Name: Easy Code Placement
    4 Version: 3.0
     4Version: 3.1
    55Plugin URI: http://www.randnotizen.org/easy-code-placement/
    66Author: Jens Herdy
     
    1313ob_start();
    1414define('ECP_FILE',__FILE__);
    15 define('ECP_VERSION','3.0');
     15define('ECP_VERSION','3.1');
    1616
    1717// load functions, classes
     
    4141
    4242// add options menu
    43 add_action( 'admin_menu', 'ecp_add_page' );
     43add_action( 'admin_menu', 'ecp_add_page');
    4444
    4545?>
  • easy-code-placement/trunk/inc/functions.php

    r1256966 r1334958  
    22
    33// error reporting for dev
    4 // error_reporting(E_ALL);
    5 // define( 'DIEONDBERROR', true ); // multisite
    6 // $wpdb->show_errors(); // single site
     4error_reporting(E_ALL);
     5define( 'DIEONDBERROR', true ); // multisite
     6$wpdb->show_errors(); // single site
     7
     8// check if role >= option
     9function 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}
    718
    819// generate options menu
    920function 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    }
    1124}
    1225
     
    8598}
    8699
    87 // updates from 2.6.x to 2.7
     100// update to 3.1
    88101function ecp_update(){
    89102    // multiside update
     
    94107        foreach ($blogids as $blogid) {
    95108            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' ));
    98113        }
    99114    switch_to_blog($blog);
     
    101116    // single update
    102117    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' ));
    105122    }
    106123}
     
    112129    if (! is_admin()) {
    113130        return;
    114     } elseif ($ecp_options_version === '3.0') {
     131    } elseif ($ecp_options_version === '3.1') {
    115132        return;
    116133    } else {
  • easy-code-placement/trunk/inc/install.php

    r1227126 r1334958  
    1919        `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
    2020        `option_name` varchar(10) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
    21         `option_value` varchar(10) COLLATE utf8_unicode_ci NOT NULL
     21        `option_value` varchar(20) COLLATE utf8_unicode_ci NOT NULL
    2222        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1";
    2323    $wpdb->query($ecp_options);
    2424    // 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'));
    2728}
    2829
  • easy-code-placement/trunk/inc/page.php

    r1256966 r1334958  
    4242    <tr>
    4343        <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">
    4545            <input type="hidden" name="cmd" value="_s-xclick">
    4646            <input type="hidden" name="hosted_button_id" value="2X2EH5MYGPLL4">
  • easy-code-placement/trunk/inc/settings.php

    r1256966 r1334958  
    99    $_POST = stripslashes_deep ($_POST);
    1010    $t_ecp_perpage = $_POST['perpage'];
     11    $t_ecp_role = $_POST['role'];
    1112
    1213    if ($t_ecp_perpage == "") {
     
    2728   
    2829    $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'));
    2931
    3032    // when added to database goto options page
     
    5557    <tbody>
    5658    <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>
    5774            <td><?php _e('Codes per Page','ecp'); ?></td>
    5875            <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                ?>
    6080                <input type="text" name="perpage" value="<?php echo $per_page; ?>" size="10" maxlength="2">
    6181            </td>
  • easy-code-placement/trunk/inc/system.php

    r1256966 r1334958  
    2727                    } else if (function_exists('mysql_get_server_info')) {
    2828            echo mysql_get_server_info();
     29                    } else {
     30                        _e('Error','ecp');
    2931                    }
    3032        ?>
     
    6365            </td>
    6466    </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>
    6580    </tbody>
    6681</table>
     
    8196    <tr>
    8297            <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>
    84105    </tr>
    85106    <tr>
    86107            <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>
    88115    </tr>
    89116    <tr>
  • easy-code-placement/trunk/readme.txt

    r1256966 r1334958  
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2X2EH5MYGPLL4
    44Tags: 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.1
    6 Tested up to: 4.3.1
    7 Stable tag: 3.0
     5Requires at least: 3.0
     6Tested up to: 4.4.1
     7Stable tag: 3.1
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3434* Place a Code with a Shortcode
    3535* Place a Code with the standard WordPress Text-Widget
     36* Choose who can manage the Plugin (Admin/Editor/Author/Contributor)
    3637* Ready for translations
    3738* Multisite/Network compatible
     
    7980
    8081== 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
    8192
    8293= 3.0 =
Note: See TracChangeset for help on using the changeset viewer.