Plugin Directory

Changeset 2616475


Ignore:
Timestamp:
10/19/2021 12:20:53 PM (4 years ago)
Author:
silktide
Message:

Fix for some 404 pages, updated docs URL

Location:
silktide/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • silktide/trunk/class-silktide.php

    r2223463 r2616475  
    11<?php
    22
    3 /**
    4  * Class Silktide
    5  *
    6  * @package Silktide
    7  */
    83class Silktide {
    94
    105    /**
    11      * Default notification URL.
     6     * Default notification URL
    127     */
    138    const DEFAULT_NOTIFY_URL = 'https://api.silktide.com/cms/update';
     9   
    1410    /**
    1511     * Our minimum WordPress version
     
    2925    private $plugin_version;
    3026
    31     /**
    32      * Silktide constructor.
    33      */
    3427    public function __construct() {
    3528        $this->silktide_notify_url = self::DEFAULT_NOTIFY_URL;
     
    5548        add_action( 'silktide_header', array( $this, 'action_hook_header' ) );
    5649        add_action( 'wp_head', array( $this, 'action_hook_header' ) );
    57 
    5850    }
    5951
     
    6254     *
    6355     * @param array $links
    64      *
    6556     * @return array
    6657     */
     
    7667
    7768    /**
    78      * Add our Silktide header.
    79      *
    80      * Adds the meta header to the post.
    81      *
    82      * @return void
     69     * Add our Silktide meta header.
     70     * This tells Silktide what it needs to edit the page later on.
    8371     */
    8472    public function action_hook_header() {
     
    8977         */
    9078        global $post;
     79       
     80        /**
     81         * 404 pages don't define a $post; we can't edit these, so we ignore them
     82         */
     83        if (!isset($post) || !$post) {
     84            return;
     85        }
     86               
    9187        $key = get_option( 'silktide_api_key', '' );
    9288        if ( 32 !== strlen( $key ) ) {
     
    105101
    106102        $ivlen = openssl_cipher_iv_length( 'AES-256-CBC' );
     103       
    107104        /**
    108105         * We don't check the cryptographically strong flag as it's not vitally important.
     
    112109            return;
    113110        }
     111       
    114112        $ciphertext_raw = openssl_encrypt(
    115113            wp_json_encode( array( 'editorUrl' => $edit_link ) ),
     
    120118        $hmac           = hash_hmac( 'sha256', $ciphertext_raw, $key, true );
    121119        $ciphertext     = base64_encode( $iv . $hmac . $ciphertext_raw );
     120       
    122121        echo '<meta name="silktide-cms" content="' . esc_attr( $ciphertext ) . '" />' . PHP_EOL;
    123122    }
    124123
    125124    /**
    126      * Fire a callback .
     125     * Fire a callback.
    127126     *
    128127     * @param string $new_status New post status.
     
    275274     *
    276275     * @param string $input The api key as entered.
    277      *
    278276     * @return string
    279277     */
     
    322320                    )
    323321                ),
    324                 esc_url( 'https://monitor.support.silktide.com/guides/cms-integrations/how-to-integrate-silktide-with-wordpress/' ),
     322                esc_url( 'https://support.silktide.com/guides/cms-integrations/how-to-integrate-silktide-with-wordpress/' ),
    325323                esc_url( 'https://silktide.com/' )
    326324            );
     
    458456        }
    459457    }
    460 
    461 
    462458}
  • silktide/trunk/readme.txt

    r2564217 r2616475  
    33Tags: silktide, site validation, site verification
    44Requires at least: 4.9.8
    5 Tested up to: 5.7.2
     5Tested up to: 5.8.1
    66Stable tag: 1.0.8
    77Requires PHP: 5.3
     
    24241) Install the plugin
    25252) Go to the Settings -> Silktide section of the WordPress dashboard
    26 3) Provide [your Silktide API key](https://monitor.support.silktide.com/guides/cms-integrations/how-to-integrate-silktide-with-wordpress/)
     263) Provide [your Silktide API key](https://support.silktide.com/guides/cms-integrations/how-to-integrate-silktide-with-wordpress/)
    2727
    2828== Changelog ==
    2929
     301.0.8 - Oct 2021 - Fix for 404 pages without $post; updated documentation URL
    30311.0.7 - Jan 2020 - Updated documentation and text.
    31321.0.6 - Feb 2019 - Update documentation link.
Note: See TracChangeset for help on using the changeset viewer.