Plugin Directory


Ignore:
Timestamp:
10/22/2013 06:26:26 PM (12 years ago)
Author:
Otto42
Message:

Move screenshots to assets folder, i18n fixes, rm donate link, general cleanup, bump to 2.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • php-code-widget/trunk/execphp.php

    r204607 r791939  
    11<?php
    22/*
    3 Plugin Name: Executable PHP widget
    4 Plugin URI: http://wordpress.org/extend/plugins/php-code-widget/
     3Plugin Name: PHP Code Widget
     4Plugin URI: http://ottopress.com/wordpress-plugins/php-code-widget/
    55Description: Like the Text widget, but it will take PHP code as well. Heavily derived from the Text widget code in WordPress.
    66Author: Otto
    7 Version: 2.1
     7Version: 2.2
     8Text Domain: php-code-widget
    89Author URI: http://ottodestruct.com
    9 License: GPL2
    10 
    11     Copyright 2009  Samuel Wood  (email : otto@ottodestruct.com)
    12 
    13     This program is free software; you can redistribute it and/or modify
    14     it under the terms of the GNU General Public License version 2,
    15     as published by the Free Software Foundation.
    16    
    17     You may NOT assume that you can use any other version of the GPL.
    18 
    19     This program is distributed in the hope that it will be useful,
    20     but WITHOUT ANY WARRANTY; without even the implied warranty of
    21     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22     GNU General Public License for more details.
    23    
    24     The license for this software can likely be found here:
    25     http://www.gnu.org/licenses/gpl-2.0.html
    26    
    2710*/
    2811
    2912class PHP_Code_Widget extends WP_Widget {
    30 
    3113    function PHP_Code_Widget() {
    32         $widget_ops = array('classname' => 'widget_execphp', 'description' => __('Arbitrary text, HTML, or PHP Code'));
     14        $widget_ops = array('classname' => 'widget_execphp', 'description' => __('Arbitrary text, HTML, or PHP Code', 'php-code-widget'));
    3315        $control_ops = array('width' => 400, 'height' => 350);
    34         $this->WP_Widget('execphp', __('PHP Code'), $widget_ops, $control_ops);
     16        $this->WP_Widget('execphp', __('PHP Code', 'php-code-widget'), $widget_ops, $control_ops);
    3517    }
    3618
     
    4022        $text = apply_filters( 'widget_execphp', $instance['text'], $instance );
    4123        echo $before_widget;
    42         if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } 
     24        if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
    4325            ob_start();
    4426            eval('?>'.$text);
    4527            $text = ob_get_contents();
    4628            ob_end_clean();
    47             ?>         
     29            ?>
    4830            <div class="execphpwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
    4931        <?php
     
    6749        $text = format_to_edit($instance['text']);
    6850?>
    69         <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
     51        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'php-code-widget'); ?></label>
    7052        <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
    7153
    7254        <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
    7355
    74         <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
     56        <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.', 'php-code-widget'); ?></label></p>
    7557<?php
    7658    }
     
    7860
    7961add_action('widgets_init', create_function('', 'return register_widget("PHP_Code_Widget");'));
    80 
    81 // donate link on manage plugin page
    82 add_filter('plugin_row_meta', 'execphp_donate_link', 10, 2);
    83 function execphp_donate_link($links, $file) {
    84     if ($file == plugin_basename(__FILE__)) {
    85         $donate_link = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=otto%40ottodestruct%2ecom">Donate</a>';
    86         $links[] = $donate_link;
    87     }
    88     return $links;
    89 }
Note: See TracChangeset for help on using the changeset viewer.