Plugin Directory

Changeset 2256704


Ignore:
Timestamp:
03/08/2020 09:33:15 AM (6 years ago)
Author:
hyvor
Message:

custom identifier added

Location:
hyvor-talk/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • hyvor-talk/trunk/hyvor-talk.php

    r2251819 r2256704  
    77Plugin URI: https://talk.hyvor.com
    88Description: The official WordPress plugin for Hyvor Talk, The Best Commenting Platform For Your Website
    9 Version: 1.2.0
     9Version: 1.2.1
    1010Author: Hyvor
    1111Author URI: https://hyvor.com
     
    7373
    7474
    75 
    76 /* add_action( 'plugins_loaded', function() {
    77     $user = wp_get_current_user();
    78     var_dump($user);
    79     die;
    80 }); */
    81 
    82 
    83 
    8475/**
    8576 * Used Options
  • hyvor-talk/trunk/inc/class-hyvor-talk-webpage.php

    r2251818 r2256704  
    216216        global $post;
    217217
    218         // a trick to make it really unique
    219         return $post -> ID . ':' . $post -> guid;
     218        $type = defined('HYVOR_TALK_ID_TYPE') ? HYVOR_TALK_ID_TYPE : 'default';
     219
     220        /**
     221         * After importing from other third party,
     222         * HYVOR_TALK_ID_TYPE should be set to URL
     223         * Then, the permalink is used
     224         */
     225        switch ($type) {
     226            case 'url':
     227                $id = get_permalink($post);
     228                break;
     229            default:
     230                // a trick to make it really unique
     231                $id = $post -> ID . ':' . $post -> guid;
     232                break;
     233        }
     234
     235
     236        return $id;
    220237    }
    221238
  • hyvor-talk/trunk/inc/class-hyvor-talk.php

    r2251818 r2256704  
    169169
    170170    // Updates the website ID
    171     public static function setWebsiteId(int $websiteId) {
     171    public static function setWebsiteId($websiteId) {
    172172        update_option( self::WEBSITE_ID_OPTION_NAME, $websiteId );
    173173    }
    174174    // Updates the loading mode
    175     public static function setLoadingMode(string $mode) {
     175    public static function setLoadingMode($mode) {
    176176        update_option( self::LOADING_MODE_OPTION_NAME, $mode );
    177177    }
    178178    // updates the sso ID
    179     public static function setSSOId(int $ssoId) {
     179    public static function setSSOId($ssoId) {
    180180        update_option( self::SSO_ID_OPTION_NAME, $ssoId );
    181181    }
    182182    // updates the SSO Private Key
    183     public static function setSSOPrivateKey(string $key) {
     183    public static function setSSOPrivateKey($key) {
    184184        update_option( self::SSO_PRIVATE_KEY_OPTION_NAME, $key );
    185185    }
  • hyvor-talk/trunk/readme.txt

    r2251818 r2256704  
    55Requires at least: 4.6
    66Tested up to: 5.3.2
    7 Stable tag: 1.2.0
     7Stable tag: 1.2.1
    88Requires PHP: 5.4
    99License: GPLv2
     
    174174== Change Log ==
    175175
     176= 1.2.1 =
     177* Custom identifiers added (To support third-party importing)
     178
    176179= 1.2.0 =
    177180* SSO support added
  • hyvor-talk/trunk/static/admin.js

    r2251818 r2256704  
    2828        // sso
    2929        var ssoId = $.trim($("#talk-sso-id-input").val());
    30         if (ssoId)
    31             data.ssoId = ssoId;
     30        data.ssoId = ssoId;
    3231        var ssoPrivateKey = $.trim($("#talk-sso-private-key-input").val());
    33         if (ssoPrivateKey)
    34             data.ssoPrivateKey = ssoPrivateKey;
     32        data.ssoPrivateKey = ssoPrivateKey;
    3533
    3634        // nothing to update
Note: See TracChangeset for help on using the changeset viewer.