Plugin Directory

Changeset 2389074


Ignore:
Timestamp:
09/27/2020 08:38:18 AM (6 years ago)
Author:
A5hleyRich
Message:

Preparing for 0.4.1 release

Location:
replybox/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • replybox/trunk/readme.txt

    r2332070 r2389074  
    33Tags: comment, comments
    44Requires at least: 4.7
    5 Tested up to: 5.4.2
     5Tested up to: 5.5.1
    66Requires PHP: 5.4
    7 Stable tag: 0.4
     7Stable tag: 0.4.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2929== Changelog ==
    3030
     31= 0.4.1 =
     32* Don't show the ReplyBox embed on WooCommerce product pages.
     33* Fix "PHP Notice: register_rest_route was called incorrectly".
     34
    3135= 0.4 =
    3236* Enable linking to individual comments.
     
    4044= 0.1 =
    4145* Initial release.
     46
     47
     48
  • replybox/trunk/replybox.php

    r2023912 r2389074  
    33 * Plugin Name: ReplyBox
    44 * Description: A simple, honest comment system which works everywhere. No ads, no dodgy affiliate links, no fluff.
    5  * Version: 0.4
     5 * Version: 0.4.1
    66 * Author: ReplyBox
    77 * Author URI: https://getreplybox.com
     
    8888     *
    8989     * @param string $key
    90      * @param mixed  $default
     90     * @param mixed $default
    9191     *
    9292     * @return mixed
     
    180180    public function register_api_endpoints() {
    181181        register_rest_route( 'replybox/v1', '/comments', array(
    182             'methods'  => 'GET',
    183             'callback' => array( $this, 'get_comments_endpoint' ),
    184             'args'     => array(
     182            'methods'             => 'GET',
     183            'callback'            => array( $this, 'get_comments_endpoint' ),
     184            'permission_callback' => '__return_true',
     185            'args'                => array(
    185186                'page'     => array(
    186187                    'default'           => 1,
     
    203204
    204205        register_rest_route( 'replybox/v1', '/comments', array(
    205             'methods'  => 'POST',
    206             'callback' => array( $this, 'post_comments_endpoint' ),
    207             'args'     => array(
     206            'methods'             => 'POST',
     207            'callback'            => array( $this, 'post_comments_endpoint' ),
     208            'permission_callback' => '__return_true',
     209            'args'                => array(
    208210                'token' => array(
    209211                    'required' => true,
     
    214216
    215217        register_rest_route( 'replybox/v1', '/comments', array(
    216             'methods'  => 'PATCH',
    217             'callback' => array( $this, 'patch_comments_endpoint' ),
    218             'args'     => array(
     218            'methods'             => 'PATCH',
     219            'callback'            => array( $this, 'patch_comments_endpoint' ),
     220            'permission_callback' => '__return_true',
     221            'args'                => array(
    219222                'token' => array(
    220223                    'required' => true,
     
    225228
    226229        register_rest_route( 'replybox/v1', '/comments', array(
    227             'methods'  => 'DELETE',
    228             'callback' => array( $this, 'delete_comments_endpoint' ),
    229             'args'     => array(
     230            'methods'             => 'DELETE',
     231            'callback'            => array( $this, 'delete_comments_endpoint' ),
     232            'permission_callback' => '__return_true',
     233            'args'                => array(
    230234                'token' => array(
    231235                    'required' => true,
     
    314318     *
    315319     * @return array|WP_Error
    316      */ 
     320     */
    317321    public function patch_comments_endpoint( $request ) {
    318322        if ( $this->get_option( 'secure_token' ) !== $request['token'] ) {
     
    344348     *
    345349     * @return array|WP_Error
    346      */ 
     350     */
    347351    public function delete_comments_endpoint( $request ) {
    348352        if ( $this->get_option( 'secure_token' ) !== $request['token'] ) {
     
    392396     * Replace the default WordPress comments.
    393397     *
     398     * @param string $file
     399     *
    394400     * @return string
    395401     */
    396     public function comments_template() {
     402    public function comments_template( $file ) {
    397403        global $post;
     404
     405        if ( ! $this->should_show_comment_embed( $post ) ) {
     406            return $file;
     407        }
    398408
    399409        wp_enqueue_script( 'replybox-js', $this->get_embed_url(), array(), null, true );
     
    407417
    408418    /**
     419     * Should we show the comment embed?
     420     *
     421     * @param WP_Post $post
     422     *
     423     * @return bool
     424     */
     425    protected function should_show_comment_embed( $post ) {
     426        $show_embed = is_singular() && post_type_supports( $post->post_type, 'comments' );
     427
     428        if ( function_exists( 'is_product' ) && is_product() ) {
     429            $show_embed = false;
     430        }
     431
     432        return apply_filters( 'replybox_show_embed', $show_embed, $post );
     433    }
     434
     435    /**
    409436     * Filter a single comment link.
    410437     *
    411438     * @param string $link
     439     *
    412440     * @return string
    413441     */
     
    416444        $id   = get_comment_meta( $comment->comment_ID, 'replybox_id', true );
    417445
    418         if ($id) {
     446        if ( $id ) {
    419447            $hash = '#comment-' . $id;
    420448        }
     
    427455     *
    428456     * @param string $link
     457     *
    429458     * @return string
    430459     */
     
    459488     *
    460489     * @param array $stats
    461      * @param int   $post_id
     490     * @param int $post_id
    462491     *
    463492     * @return bool|mixed|object
Note: See TracChangeset for help on using the changeset viewer.