Plugin Directory

Changeset 1993424


Ignore:
Timestamp:
12/13/2018 08:40:02 AM (7 years ago)
Author:
deformator
Message:

Added support for new code format

Location:
replain
Files:
26 added
2 edited

Legend:

Unmodified
Added
Removed
  • replain/trunk/readme.txt

    r1957493 r1993424  
    1 === Replain ===
     1=== Replain ===
    22Tags: live chat, support, telegram chat
    33Requires at least: 4.6
    44Tested up to: 4.9.4
    55Requires PHP: 5.2.4
    6 Stable tag: 1.6
     6Stable tag: 1.7
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6363= 1.6 =
    6464* Polish language added.
     65
     66= 1.7 =
     67* Added support for new code format.
  • replain/trunk/replain.php

    r1957493 r1993424  
    55Plugin URI: http://wordpress.org/plugins/replain/
    66Description: The simplest live chat in the world. The first live chat in your messenger. Messages from the site come directly to your Telegram. Re:plain For those who need customers, not data.
    7 Version: 1.6
     7Version: 1.7
    88Author: Re:plain
    99Author URI: http://replain.cc
     
    130130
    131131                if ( isset( $_POST[$code_name] ) ) {
    132                     preg_match( '/REPLAIN_\s*=\s*\W(.*?)\W;/', stripslashes( $_POST[$code_name] ), $matches );
     132                    preg_match( '/REPLAIN_\s*=\s*\W(.*?)\W;/', stripslashes( $_POST[$code_name] ), $matches );
    133133
    134134                    if ( !empty( $matches ) && isset( $matches[1] ) ) {
    135135                        $token = sanitize_text_field( $matches[1] );
    136136                    } else {
    137                         $token = '';
     137                        preg_match( '/id\s*:\s*\W(.*?)\W{2}/', stripslashes( $_POST[$code_name] ), $matches );
     138
     139                        if ( !empty( $matches ) && isset( $matches[1] ) ) {
     140                            $token = sanitize_text_field( $matches[1] );
     141                        } else {
     142                            $token = '';
     143                        }
    138144                    }
    139145
     
    212218    }
    213219
    214     $jsCode = '<script type="text/javascript" charset="utf-8">var __REPLAIN_ = \''.$code.'\';(function(u){var s=document.createElement(\'script\');s.type=\'text/javascript\';s.async=true;s.src=u;var x=document.getElementsByTagName(\'script\')[0];x.parentNode.insertBefore(s,x);})(\'https://widget.replain.cc/dist/client.js\');</script>';
     220    $jsCode = '<script>window.replainSettings = { id: \''.$code.'\'};(function(u){var s=document.createElement(\'script\');s.type=\'text/javascript\';s.async=true;s.src=u;var x=document.getElementsByTagName(\'script\')[0];x.parentNode.insertBefore(s,x);})(\'https://widget.replain.cc/dist/client.js\');</script>';
    215221    $jsCode = stripslashes( $jsCode );
    216222    return $jsCode;
Note: See TracChangeset for help on using the changeset viewer.