Plugin Directory

Changeset 2929010


Ignore:
Timestamp:
06/21/2023 08:08:22 AM (3 years ago)
Author:
siteimprove
Message:

Version 2.0.2

Location:
siteimprove
Files:
28 added
4 edited

Legend:

Unmodified
Added
Removed
  • siteimprove/trunk/admin/class-siteimprove-admin.php

    r2919146 r2929010  
    9191        $prepublish_enabled = intval( get_option( 'siteimprove_prepublish_enabled', 0 ) );
    9292
    93         if ( $wp_query->is_preview() && 1 === $prepublish_allowed && 1 === $prepublish_enabled ) {
     93        if ( ( $wp_query->is_preview() || $wp_query->is_singular() ) && 1 === $prepublish_allowed && 1 === $prepublish_enabled ) {
    9494            wp_enqueue_style( 'siteimprove_preview_css', plugin_dir_url( __FILE__ ) . 'css/siteimprove-preview.css', array(), $this->version, 'all' );
    9595        }
     
    191191        }
    192192
    193         $preview = is_preview();
     193        $is_content_page = is_preview() || is_singular();
    194194
    195195        $si_js_args = array(
     
    198198            'url'   => $url,
    199199            'version' => $disabled_new_version,
    200             'preview' => $preview,
     200            'is_content_page' => $is_content_page,
    201201        );
    202202
     
    397397        $prepublish_enabled = intval( get_option( 'siteimprove_prepublish_enabled', 0 ) );
    398398
    399         if ( is_preview() && 1 === $prepublish_allowed && 1 === $prepublish_enabled ) {
     399        if ( ( is_preview() || is_singular() ) && 1 === $prepublish_allowed && 1 === $prepublish_enabled ) {
    400400            $prepublish_button = '<svg xmlns="http://www.w3.org/2000/svg" height="28px" width="28px" viewBox="0 0 24 24" focusable="false" aria-hidden="true" fill="currentColor"><path fill="#141155" d="M12.015625.113281C5.433594.113281.113281 5.433594.113281 12.015625c0 6.578125 5.320313 11.886719 11.902344 11.886719 6.578125 0 11.886719-5.324219 11.886719-11.886719 0-6.566406-5.324219-11.902344-11.886719-11.902344Zm0 0"></path><path fill="#fff" d="m6.097656 14.796875 1.695313-1.003906c.367187.945312 1.074219 1.539062 2.328125 1.539062 1.257812 0 1.625-.507812 1.625-1.074219 0-.746093-.679688-1.042968-2.1875-1.480468-1.539063-.4375-3.050782-1.074219-3.050782-3.007813 0-1.933593 1.609376-2.992187 3.332032-2.992187s2.9375.847656 3.613281 2.257812l-1.664063.960938c-.367187-.777344-.917968-1.300782-1.949218-1.300782-.832032 0-1.328125.4375-1.328125 1.019532 0 .621094.382812.945312 1.921875 1.410156 1.609375.523438 3.316406 1.058594 3.316406 3.121094 0 1.890625-1.523438 3.046875-3.671875 3.046875-2.058594.015625-3.441406-.972657-3.980469-2.496094m8.667969-6.917969c0-.621094.507813-1.160156 1.144531-1.160156.636719 0 1.15625.539062 1.15625 1.160156 0 .621094-.507812 1.140625-1.15625 1.140625-.648437 0-1.144531-.519531-1.144531-1.140625m.214844 1.988282h1.863281v7.230468h-1.863281Zm0 0"></path></svg>';
    401401            $admin_bar->add_menu(
  • siteimprove/trunk/admin/js/siteimprove.js

    r2919146 r2929010  
    3232
    3333  var siteimprove = {
    34     input: function (url, token, version, preview) {
     34    input: function (url, token, version, is_content_page) {
    3535      this.url = url;
    3636      this.token = token;
    3737      this.method = "input";
    3838      this.version = version;
    39       this.preview = preview;
     39      this.is_content_page = is_content_page;
    4040      this.common(url);
    4141    },
     
    4545      this.method = "domain";
    4646      this.common(url);
     47    },
     48    clear: function (callback, token) {
     49      this.callback = callback;
     50      this.token = token;
     51      this.method = "clear";
     52      this.common();
    4753    },
    4854    recheck: function (url, token) {
     
    121127      // 0 = overlay-v1.js
    122128      // 1 = overlay-latest.js
    123       if(this.version == 1 && this.preview) {
     129      if (this.version == 1 && this.is_content_page) {
    124130        _si.push(['registerPrepublishCallback', getDomCallback, this.token]);
    125131      }
    126132      _si.push([this.method, this.url, this.token]);
    127133
    128       //Calling the "clear" method to avoid smallbox showing a "Page not found" message when inside wp-admin panel
     134      // Calling the "clear" method to avoid smallbox showing a "Page not found" message when inside wp-admin panel
    129135      // Do not do this for domain, so we can still see site-view of the plugin
    130       if(this.method !== "domain") {
     136      if (this.version == 0 && this.method !== "domain") {
    131137        const pattern = /(?:\/wp-admin\/{1})[\D-\d]+.php/;
    132         if (this.url.match(pattern)) {
     138        if (this.url && this.url.match(pattern)) {
    133139          setTimeout(() => {
    134             _si.push(['clear']);
     140            _si.push(['clear', null, this.token]);
    135141          }, 500);
    136142        }
     
    180186    // If exist siteimprove_input, call input Siteimprove method.
    181187    if (typeof siteimprove_input !== "undefined") {
    182       siteimprove.input(siteimprove_input.url, siteimprove_input.token, siteimprove_input.version, siteimprove_input.preview);
     188      siteimprove.input(siteimprove_input.url, siteimprove_input.token, siteimprove_input.version, siteimprove_input.is_content_page);
    183189    }
    184190
     
    188194      if( "0" === siteimprove_domain.version ){
    189195        siteimprove.domain(siteimprove_domain.url, siteimprove_domain.token);
     196      } else {
     197        siteimprove.clear(null, siteimprove_domain.token);
    190198      }
    191199    }
  • siteimprove/trunk/readme.txt

    r2919182 r2929010  
    8787== Changelog ==
    8888
     89= 2.0.2 =
     90* Added - Calling "clear" on non-content pages in WordPress
     91* Added - Prepublish can now be started from a published page
     92
    8993= 2.0.1 =
    9094* Bugfix - Fixed checkbox for "Use latest experience" was not properly checked on by default
  • siteimprove/trunk/siteimprove.php

    r2919182 r2929010  
    1010 * Plugin URI:          https://www.siteimprove.com/integrations/cms-plugin/wordpress/
    1111 * Description:         Integration with Siteimprove.
    12  * Version:             2.0.1
     12 * Version:             2.0.2
    1313 * Author:              Siteimprove
    1414 * Author URI:          http://www.siteimprove.com/
Note: See TracChangeset for help on using the changeset viewer.