Plugin Directory

Changeset 3042247


Ignore:
Timestamp:
02/28/2024 12:19:33 AM (2 years ago)
Author:
brandondove
Message:

Updated to version 1.4

Location:
conversation-starter
Files:
17 added
9 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • conversation-starter/trunk/pj-convo.php

    r2020793 r3042247  
    11<?php
    2 /*
    3 Plugin Name: Conversation Starter
    4 Plugin URI: http://www.pixeljar.net/491/conversation-manager/
    5 Description: This plugin prompts readers to answer a question in your comments.
    6 Author: brandondove, jeffreyzinn, STDestiny, vegasgeek, drewstrojny
    7 Version: 1.3
    8 Author URI: http://www.pixeljar.net
    9 Text Domain: pj-convo
     2/**
     3 * Plugin Name: Conversation Starter
     4 * Plugin URI: https://www.pixeljar.com/wordpress-plugin-development/conversation-manager/
     5 * Description: This plugin prompts readers to answer a question in your comments.
     6 * Version: 1.4
     7 * Requires at least: 6.0
     8 * Requires PHP: 7.4
     9 * Author: Pixel Jar
     10 * Author URI: https://www.pixeljar.com
     11 * License: GPLv2
     12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     13 * Text Domain: pj-convo
     14 * Domain Path: /languages
    1015
    11 This program is free software; you can redistribute it and/or modify
    12 it under the terms of the GNU General Public License as published by
    13 the Free Software Foundation; either version 2 of the License, or
    14 (at your option) any later version.
     16 * This program is free software; you can redistribute it and/or modify
     17 * it under the terms of the GNU General Public License as published by
     18 * the Free Software Foundation; either version 2 of the License, or
     19 * (at your option) any later version.
    1520
    16 This program is distributed in the hope that it will be useful,
    17 but WITHOUT ANY WARRANTY; without even the implied warranty of
    18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19 GNU General Public License for more details.
     21 * This program is distributed in the hope that it will be useful,
     22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     24 * GNU General Public License for more details.
    2025
    21 You should have received a copy of the GNU General Public License
    22 along with this program; if not, write to the Free Software
    23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    24 */
     26 * You should have received a copy of the GNU General Public License
     27 * along with this program; if not, write to the Free Software
     28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     29 *
     30 * @package PJ_Conversation_Starter
     31 */
    2532
    26 if ( ! defined( 'WP_CONTENT_URL' ) )
    27       define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
    28 if ( ! defined( 'WP_CONTENT_DIR' ) )
    29       define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    30 if ( ! defined( 'WP_PLUGIN_URL' ) )
    31       define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
    32 if ( ! defined( 'WP_PLUGIN_DIR' ) )
    33       define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
    34 if ( ! defined( 'CONVO_URL' ) )
    35       define( 'CONVO_URL', WP_PLUGIN_URL. '/conversation-starter' );
    36 if ( ! defined( 'CONVO_DIR' ) )
    37     define( 'CONVO_DIR', WP_PLUGIN_DIR . '/conversation-starter' );
     33namespace PJ_Conversation_Starter;
    3834
    39 define( 'CONVO_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
    40 define( 'CONVO_LIB', plugin_dir_path( __FILE__ ) . 'lib/' );
    41 define( 'CONVO_VERSION', '1.3' );
     35define( 'PJ_CONVO_URL', plugin_dir_url( __FILE__ ) ); // Includes ending slash.
     36define( 'PJ_CONVO_PATH', plugin_dir_path( __FILE__ ) ); // Includes ending slash.
     37define( 'PJ_CONVO_ASSETS', PJ_CONVO_URL . 'assets/' );
     38define( 'PJ_CONVO_LIB', PJ_CONVO_PATH . 'lib/' );
     39define( 'PJ_CONVO_VERSION', '1.4' );
    4240
    43 if ( ! class_exists( 'PJ_Convo_Changelog' ) ) {
    44     require_once CONVO_LIB . 'changelog.php';
     41/**
     42 * Load translations.
     43 *
     44 * @return void
     45 */
     46function pj_convo_load_textdomain() {
     47
     48    load_plugin_textdomain( 'pj-convo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
     49
    4550}
     51add_action( 'init', '\PJ_Conversation_Starter\pj_convo_load_textdomain' );
    4652
    47     function pj_convo_starter_add_model_meta()
    48     {
    49         add_meta_box( 'pj_convo_starter_metabox', __('Conversation Starter'), 'pj_convo_starter_metabox', 'post', 'normal', 'high' );
    50     }
    51    
    52     function pj_convo_starter_metabox()
    53     {
    54         global $post;
    55        
    56         $promptext = get_post_meta($post->ID, 'prompt', true);
    57        
    58         if (empty($promptext)) {
    59             global $convo_starter;
    60             $promptext = $convo_starter->defaultPromptText(); // "What do you think about this post?";
    61         }
    62          
    63         ?>
    64         <label for="promptext"><?php echo __("Use this text to prompt the readers:" ); ?></label><br />
    65         <textarea rows="5" cols="35" name="promptext" id="promptext"><?php echo $promptext; ?></textarea><br />
    66        
    67         <?php
    68     }
    69    
    70     function pj_convo_starter_save_model_meta($post_id, $post)
    71     {
    72         // Is the user allowed to edit the post or page?
    73         if ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) {
    74             if ( !current_user_can( 'edit_page', $post->ID ))
    75             return $post->ID;
    76         } else {
    77             if ( !current_user_can( 'edit_post', $post->ID ))
    78             return $post->ID;
    79         }
    80 
    81         $mydata['prompt'] = '';
    82         if ( isset( $_POST['promptext'] ) ) {
    83             $mydata['prompt'] = $_POST['promptext'];
    84         }
    85        
    86         foreach ($mydata as $key => $value) { //Let's cycle through the $mydata array!
    87             if( $post->post_type == 'revision' ) return; //don't store custom data twice
    88             $value = implode(',', (array)$value); //if $value is an array, make it a CSV (unlikely)
    89             if(get_post_meta($post->ID, $key, FALSE)) { //if the custom field already has a value
    90                 update_post_meta($post->ID, $key, $value);
    91             } else { //if the custom field doesn't have a value
    92                 add_post_meta($post->ID, $key, $value);
    93             }
    94             if(!$value) delete_post_meta($post->ID, $key); //delete if blank
    95         }
    96     }
    97    
    98     /* Use the admin_menu action to define the custom boxes */
    99     add_action('admin_menu', 'pj_convo_starter_add_model_meta');
    100     add_action('save_post',  'pj_convo_starter_save_model_meta', 1, 2);
    101     add_action('activate_conversation-starter/pj-convo.php', array(&$convo_starter, 'activateMe'));
    102     add_action('wp_head', 'pj_convo_starter_head_intercept');
    103     add_action('wp_footer', 'pj_convo_starter_foot_intercept');
    104     function pj_convo_starter_head_intercept()
    105     {
    106         echo '<meta name="generator" content="Think-Press, Conversation Starter v1.1" />';
    107     }
    108     function pj_convo_starter_foot_intercept ()
    109     {
    110         global $post;
    111         echo '<script language="javascript" src="'.get_option('home').'/index.php?conversation-starter=frontend_js&convo-id='.$post->ID.'"></script>'; 
    112     }
    113    
    114    
    115     /*----------------------------
    116     FRONTEND CSS & JS files
    117     */
    118     function pj_convo_parse_request($wp) {
    119         // only process requests with "my-plugin=ajax-handler"
    120         if (array_key_exists('conversation-starter', $wp->query_vars)
    121                 && $wp->query_vars['conversation-starter'] == 'frontend_css') {
    122             include(CONVO_DIR.'/stylesheets/frontend.php');
    123             die();
    124         } else if (array_key_exists('conversation-starter', $wp->query_vars)
    125                 && $wp->query_vars['conversation-starter'] == 'frontend_js') {
    126             include(CONVO_DIR.'/javascripts/frontend.php');
    127             die();
    128         }
    129     }
    130     add_action('wp', 'pj_convo_parse_request');
    131    
    132     function pj_convo_query_vars($vars) {
    133         $vars[] = 'conversation-starter';
    134         $vars[] = 'convo-id';
    135         return $vars;
    136     }
    137     add_filter('query_vars', 'pj_convo_query_vars');
    138 
    139 
    140 
    141     /*----------------------------
    142     ADMIN Page functionality
    143     */
    144     require ('PluginCore/extend.php');
    145 
    146 ?>
     53require_once PJ_CONVO_LIB . 'class-helpers.php';
     54require_once PJ_CONVO_LIB . 'class-admin.php';
     55require_once PJ_CONVO_LIB . 'class-meta-box.php';
     56require_once PJ_CONVO_LIB . 'class-frontend.php';
     57require_once PJ_CONVO_LIB . 'class-changelog.php';
  • conversation-starter/trunk/readme.txt

    r2020793 r3042247  
    11=== Conversation Starter ===
    2 Contributors: brandondove, jeffreyzinn, STDestiny, vegasgeek, drewstrojny, nateconley
     2Contributors: brandondove, jeffreyzinn, STDestiny, vegasgeek, drewstrojny
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9525411
    4 Tags: conversation, comments
    5 Requires at least: 4.8
    6 Tested up to: 5.0.3
    7 Stable tag: 1.3
     4Tags: conversation, blog, comments
     5Requires at least: 6.0
     6Tested up to: 6.5
     7Stable tag: 1.4
     8Requires PHP: 7.4
     9License: GPLv2 or later
     10License URI: https://www.gnu.org/licenses/gpl-2.0.html
    811
    912== Description ==
     
    2427= I installed the plugin, but nothing happened. =
    2528
    26 We didn't want to assume you wanted to prompt your users to say anything on every post, so we only put the prompts on posts where you've specifically entered a prompt. GO into the post edit screen and add prompts for users as you see fit.
     29We didn't want to assume you wanted to prompt your users to say anything on every post, so we only put the prompts on posts where you've specifically entered a prompt. Go into the post edit screen and add prompts for users as you see fit.
    2730
    2831== Screenshots ==
  • conversation-starter/trunk/views/changelog.php

    r2020793 r3042247  
     1<?php
     2/**
     3 * Changelog view.
     4 *
     5 * @package Conversation_Starter
     6 */
     7
     8?>
     9
    110<div class="wrap">
    2     <h1><?php esc_html_e( 'Conversation Starter Changelog', 'pj-convo' ); ?></h1>
     11    <h1>Conversation Starter - Changelog</h1>
     12
     13    <h3>1.4</h3>
     14    <ul>
     15        <li>This version represents a major modernization of the codebase</li>
     16        <li>Updated to work with WordPress 6.5</li>
     17        <li>Updated to work with PHP 8</li>
     18        <li>This version implements standard security practices</li>
     19    </ul>
    320
    421    <h3>1.3</h3>
     
    1027    <h3>1.2</h3>
    1128    <ul>
    12         <li><?php esc_html_e( 'Fixed cases when incorrect prompt would show up above the comment form.', 'pj-convo' ); ?></li>
    13         <li><?php esc_html_e( 'Fixed several escaping functions that led to data being placed in incorrect places.', 'pj-convo' ); ?></li>
     29        <li>Fixed cases when incorrect prompt would show up above the comment form.</li>
     30        <li>Fixed several escaping functions that led to data being placed in incorrect places.</li>
    1431    </ul>
    1532
    1633    <h3>1.1.1</h3>
    1734    <ul>
    18         <li><?php esc_html_e( 'Stopped the box from showing up when no message was defined for a post (posts written before the plugin was installed)', 'pj-convo' ); ?></li>
     35        <li>Stopped the box from showing up when no message was defined for a post (posts written before the plugin was installed)</li>
    1936    </ul>
    2037
    2138    <h3>1.1</h3>
    2239    <ul>
    23         <li><?php esc_html_e( 'The security holes have been patched up.', 'pj-convo' ); ?></li>
    24         <li><?php esc_html_e( 'Reworked how the prompt was attached to the comment form to allow for greater compatibility with more themes.', 'pj-convo' ); ?></li>
     40        <li>The security holes have been patched up.</li>
     41        <li>Reworked how the prompt was attached to the comment form to allow for greater compatibility with more themes.</li>
    2542    </ul>
    2643
    2744    <h3>1.0</h3>
    2845    <ul>
    29         <li><?php esc_html_e( 'It\'s version 1 baby, what you see is what you get.', 'pj-convo' ); ?></li>
     46        <li>It's version 1 baby, what you see is what you get.</li>
    3047    </ul>
    3148
    3249    <div class="pixel-jar-ads">
    33         <h3><?php esc_html_e( 'More from Pixel Jar', 'pj-convo' ); ?></h3>
     50        <h3>More from Pixel Jar</h3>
    3451
    3552        <div class="ad-flex-container">
     
    3754                <a href="https://www.pixeljar.com/" target="_blank">
    3855                    <img
    39                         src="<?php echo CONVO_ASSETS . 'images/pixel-jar.svg' ?>"
    40                         alt="<?php esc_attr_e( 'Pixel Jar logo', 'pj-convo' ); ?>"
     56                        src="<?php echo esc_url( PJ_CONVO_ASSETS . 'images/pixel-jar.svg' ); ?>"
     57                        alt="Pixel Jar logo"
    4158                    />
    4259                </a>
    43                 <p><?php
    44                     printf(
    45                         wp_kses(
    46                             __( 'Conversation Starter is proudly powered by %1$s. We’re a small web development agency that focuses on %2$s as a development platform for websites. %1$s started in 2004. It grew out of the desire to be free to choose projects that challenge us and work with clients that inspire us. Read more about us <a href="%3$s" target="_blank">here</a>.', 'pj-convo' ),
    47                             array( 'a' => array(
    48                                 'href'   => array(),
    49                                 'target' => array(),
    50                             ) )
    51                         ),
    52                         'Pixel Jar',
    53                         'WordPress',
    54                         esc_url( 'https://www.pixeljar.com' )
    55                     );
    56                 ?></p>
     60                <p>Conversation Starter is proudly powered by Pixel Jar. We're a small web development agency that focuses on WordPress as a development platform for websites. Pixel Jar started in 2004. It grew out of the desire to be free to choose projects that challenge us and work with clients that inspire us. Read more about us <a href="https://pixeljar.com" target="_blank">here</a></p>
    5761            </div>
    5862
     
    6064                <a href="https://adsanityplugin.com/" target="_blank">
    6165                    <img
    62                         src="<?php echo CONVO_ASSETS . 'images/adsanity.svg' ?>"
    63                         alt="<?php esc_attr_e( 'AdSanity logo', 'pj-convo' ); ?>"
     66                        src="<?php echo esc_url( PJ_CONVO_ASSETS . 'images/adsanity.svg' ); ?>"
     67                        alt="AdSanity logo"
    6468                    />
    6569                </a>
    66                 <p><?php
    67                     printf(
    68                         wp_kses(
    69                             __( '%1$s also makes %2$s, a light ad rotator plugin for %3$s. It allows the user to create and manage ads shown on a website as well as keep statistics on views and clicks through a robust set of features. You can read all about it on the <a href="%4$s" target="_blank">%2$s site</a>.', 'pj-convo' ),
    70                             array( 'a' => array(
    71                                 'href'   => array(),
    72                                 'target' => array(),
    73                             ) )
    74                         ),
    75                         'Pixel Jar',
    76                         'AdSanity',
    77                         'WordPress',
    78                         esc_url( 'https://adsanityplugin.com/' )
    79                     );
    80                 ?></p>
    81             </div>
    82 
    83             <div class="ad">
    84                 <a href="https://www.clickrangerpro.com/" target="_blank">
    85                     <img
    86                         src="<?php echo CONVO_ASSETS . 'images/click-ranger-pro.svg' ?>"
    87                         alt="<?php esc_attr_e( 'Click Ranger Pro logo', 'pj-convo' ); ?>"
    88                     />
    89                 </a>
    90                 <p><?php
    91                     printf(
    92                         wp_kses(
    93                             __( '%1$s helps you easily track user clicks, downloads, and events of your %2$s website to %3$s. Get the data you need without the fuss of JavaScript or PHP. You can read all about it on the <a href="%4$s" target="_blank">%1$s site</a>.', 'pj-convo' ),
    94                             array( 'a' => array(
    95                                 'href'   => array(),
    96                                 'target' => array(),
    97                             ) )
    98                         ),
    99                         'Click Ranger Pro',
    100                         'WordPress',
    101                         'Google Analytics',
    102                         esc_url( 'https://www.clickrangerpro.com/' )
    103                     );
    104                 ?></p>
     70                <p>Pixel Jar also makes AdSanity, a light ad rotator plugin for WordPress. It allows the user to create and manage ads shown on a website as well as keep statistics on views and clicks through a robust set of features. You can read all about it on the <a href="https://adsanityplugin.com" target="_blank">AdSanity site</a>.</p>
    10571            </div>
    10672        </div>
Note: See TracChangeset for help on using the changeset viewer.