Plugin Directory

Changeset 2984583


Ignore:
Timestamp:
10/26/2023 06:43:09 PM (2 years ago)
Author:
happyprime
Message:

Update to version 1.3.0 from GitHub

Location:
turn-comments-off
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • turn-comments-off/assets/banner-1544x500.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • turn-comments-off/assets/banner-772x250.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • turn-comments-off/assets/icon-128x128.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • turn-comments-off/assets/icon-256x256.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • turn-comments-off/tags/1.3.0/build/index.asset.php

    r2831413 r2984583  
    1 <?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready'), 'version' => '105d3c0577a1f1b9d0cf');
     1<?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready'), 'version' => '13623f35a22fbab135b9');
  • turn-comments-off/tags/1.3.0/build/index.js

    r2831413 r2984583  
    1 (()=>{"use strict";var e={n:o=>{var t=o&&o.__esModule?()=>o.default:()=>o;return e.d(t,{a:t}),t},d:(o,t)=>{for(var c in t)e.o(t,c)&&!e.o(o,c)&&Object.defineProperty(o,c,{enumerable:!0,get:t[c]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,t=window.wp.domReady;e.n(t)()((()=>{["core/comments","core/comments-query-loop","core/comment-author-avatar","core/comment-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/comments-pagination","core/comments-pagination-next","core/comments-pagination-numbers","core/comments-pagination-previous","core/comments-title","core/latest-comments","core/post-comment","core/post-comments-count","core/post-comments-form","core/post-comments-link"].forEach((e=>{void 0!==(0,o.getBlockType)(e)&&(0,o.unregisterBlockType)(e)}))}))})();
     1!function(){"use strict";var o={n:function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},d:function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(o,e){return Object.prototype.hasOwnProperty.call(o,e)}},e=window.wp.blocks,t=window.wp.domReady;o.n(t)()((()=>{["core/comments","core/comments-query-loop","core/comment-author-avatar","core/comment-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/comments-pagination","core/comments-pagination-next","core/comments-pagination-numbers","core/comments-pagination-previous","core/comments-title","core/latest-comments","core/post-comment","core/post-comments-count","core/post-comments-form","core/post-comments-link"].forEach((o=>{void 0!==(0,e.getBlockType)(o)&&(0,e.unregisterBlockType)(o)}))}))}();
  • turn-comments-off/tags/1.3.0/plugin.php

    r2889508 r2984583  
    33 * Plugin Name:  Turn Comments Off
    44 * Description:  Turn comments off everywhere in WordPress.
    5  * Version:      1.2.1
     5 * Version:      1.3.0
    66 * Plugin URI:   https://github.com/happyprime/turn-comments-off/
    77 * Author:       Happy Prime
    88 * Author URI:   https://happyprime.co
    99 * Text Domain:  turn-comments-off
    10  * Requires PHP: 5.6
     10 * Requires PHP: 7.4
    1111 *
    1212 * This program is free software; you can redistribute it and/or modify
     
    5959add_filter( 'wp_count_comments', __NAMESPACE__ . '\filter_wp_count_comments' );
    6060add_action( 'add_admin_bar_menus', __NAMESPACE__ . '\remove_admin_bar_comments_menu' );
     61add_action( 'admin_bar_menu', __NAMESPACE__ . '\remove_my_sites_comments_menu', 21 );
    6162add_action( 'admin_menu', __NAMESPACE__ . '\remove_comments_menu_page' );
    6263add_action( 'load-options-discussion.php', __NAMESPACE__ . '\block_comments_admin_screen' );
     
    6768 * it by priority 99 on init.
    6869 */
    69 function remove_comment_support() {
     70function remove_comment_support(): void {
    7071    $post_types = get_post_types_by_support( 'comments' );
    7172
     
    7980 * it by priority 99 on init.
    8081 */
    81 function remove_trackback_support() {
     82function remove_trackback_support(): void {
    8283    $post_types = get_post_types_by_support( 'trackbacks' );
    8384
     
    9394 * @since 1.1.0
    9495 */
    95 function unregister_comment_blocks_javascript() {
     96function unregister_comment_blocks_javascript(): void {
    9697    $asset_data = include_once __DIR__ . '/build/index.asset.php';
    9798
     
    112113 * @since 1.1.0
    113114 */
    114 function unregister_comment_blocks() {
     115function unregister_comment_blocks(): void {
    115116
    116117    // Retrieve all registered blocks.
     
    154155 * side menu in the dashboard.
    155156 */
    156 function remove_comments_menu_page() {
     157function remove_comments_menu_page(): void {
    157158    remove_menu_page( 'edit-comments.php' );
    158159    remove_submenu_page( 'options-general.php', 'options-discussion.php' );
     
    162163 * Remove the comments menu from the admin bar.
    163164 */
    164 function remove_admin_bar_comments_menu() {
     165function remove_admin_bar_comments_menu(): void {
    165166    remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
    166167}
    167168
    168169/**
     170 * Remove the "Manage Comments" node from each site's menu under My Sites.
     171 *
     172 * @since 1.3.0
     173 */
     174function remove_my_sites_comments_menu(): void {
     175    global $wp_admin_bar;
     176
     177    // Only parse for the menu if it's going to be there, part 1.
     178    if ( ! is_multisite() || ! is_user_logged_in() ) {
     179        return;
     180    }
     181
     182    // Only parse for the menu if it's going to be there, part 2.
     183    if ( count( $wp_admin_bar->user->blogs ) < 1 ) {
     184        return;
     185    }
     186
     187    // The plugin API is not always available on the front-end.
     188    if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
     189        require_once ABSPATH . '/wp-admin/includes/plugin.php';
     190    }
     191
     192    // We can't accurately remove the menu item if the plugin is not network activated.
     193    if ( ! is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
     194        return;
     195    }
     196
     197    foreach ( $wp_admin_bar->user->blogs as $blog ) {
     198        $wp_admin_bar->remove_menu( 'blog-' . $blog->userblog_id . '-c' );
     199    }
     200}
     201
     202/**
    169203 * Filter wp_count_comments() so that it always returns 0.
    170204 *
    171205 * This hides Recent Comments from the dashboard activity widget.
    172206 *
    173  * @return stdClass An object with expected count properties.
    174  */
    175 function filter_wp_count_comments() {
     207 * @return \stdClass An object with expected count properties.
     208 */
     209function filter_wp_count_comments(): \stdClass {
    176210    return (object) array(
    177211        'approved'       => 0,
     
    189223 * in the admin.
    190224 */
    191 function block_comments_admin_screen() {
     225function block_comments_admin_screen(): void {
    192226    wp_die( esc_html__( 'This screen is disabled by the Turn Comments Off plugin.', 'turn-comments-off' ) );
    193     exit;
    194 }
     227}
  • turn-comments-off/tags/1.3.0/readme.txt

    r2889508 r2984583  
    11# Turn Comments Off
    2 Contributors: happyprime, jeremyfelt, slocker, philcable, wpgirl369
     2Contributors: happyprime, jeremyfelt, slocker, philcable
    33Tags: comments
    44Requires at least: 5.9
    5 Tested up to: 6.2
    6 Stable tag: 1.2.1
     5Tested up to: 6.4
     6Stable tag: 1.3.0
    77License: GPLv2 or later
    8 Requires PHP: 5.6
     8Requires PHP: 7.4
    99
    1010Turn comments off everywhere in WordPress.
     
    2121* Remove the comments feed link.
    2222* Unregister all core comment blocks in the editor.
     23* Remove "Manage Comments" from My Sites on multisite. (If network activated.)
    2324
    2425No configuration necessary (or available).
     
    2728
    2829## Changelog
     30
     31### 1.3.0
     32
     33* Remove "Manage Comments" from site menus under My Sites on multisite.
     34* Confirm WordPress 6.4 support.
     35* Update `wordpress/scripts` dependency to 26.15.0.
     36* Improve linting configuration.
    2937
    3038### 1.2.1
  • turn-comments-off/trunk/build/index.asset.php

    r2831413 r2984583  
    1 <?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready'), 'version' => '105d3c0577a1f1b9d0cf');
     1<?php return array('dependencies' => array('wp-blocks', 'wp-dom-ready'), 'version' => '13623f35a22fbab135b9');
  • turn-comments-off/trunk/build/index.js

    r2831413 r2984583  
    1 (()=>{"use strict";var e={n:o=>{var t=o&&o.__esModule?()=>o.default:()=>o;return e.d(t,{a:t}),t},d:(o,t)=>{for(var c in t)e.o(t,c)&&!e.o(o,c)&&Object.defineProperty(o,c,{enumerable:!0,get:t[c]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,t=window.wp.domReady;e.n(t)()((()=>{["core/comments","core/comments-query-loop","core/comment-author-avatar","core/comment-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/comments-pagination","core/comments-pagination-next","core/comments-pagination-numbers","core/comments-pagination-previous","core/comments-title","core/latest-comments","core/post-comment","core/post-comments-count","core/post-comments-form","core/post-comments-link"].forEach((e=>{void 0!==(0,o.getBlockType)(e)&&(0,o.unregisterBlockType)(e)}))}))})();
     1!function(){"use strict";var o={n:function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},d:function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(o,e){return Object.prototype.hasOwnProperty.call(o,e)}},e=window.wp.blocks,t=window.wp.domReady;o.n(t)()((()=>{["core/comments","core/comments-query-loop","core/comment-author-avatar","core/comment-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/comments-pagination","core/comments-pagination-next","core/comments-pagination-numbers","core/comments-pagination-previous","core/comments-title","core/latest-comments","core/post-comment","core/post-comments-count","core/post-comments-form","core/post-comments-link"].forEach((o=>{void 0!==(0,e.getBlockType)(o)&&(0,e.unregisterBlockType)(o)}))}))}();
  • turn-comments-off/trunk/plugin.php

    r2889508 r2984583  
    33 * Plugin Name:  Turn Comments Off
    44 * Description:  Turn comments off everywhere in WordPress.
    5  * Version:      1.2.1
     5 * Version:      1.3.0
    66 * Plugin URI:   https://github.com/happyprime/turn-comments-off/
    77 * Author:       Happy Prime
    88 * Author URI:   https://happyprime.co
    99 * Text Domain:  turn-comments-off
    10  * Requires PHP: 5.6
     10 * Requires PHP: 7.4
    1111 *
    1212 * This program is free software; you can redistribute it and/or modify
     
    5959add_filter( 'wp_count_comments', __NAMESPACE__ . '\filter_wp_count_comments' );
    6060add_action( 'add_admin_bar_menus', __NAMESPACE__ . '\remove_admin_bar_comments_menu' );
     61add_action( 'admin_bar_menu', __NAMESPACE__ . '\remove_my_sites_comments_menu', 21 );
    6162add_action( 'admin_menu', __NAMESPACE__ . '\remove_comments_menu_page' );
    6263add_action( 'load-options-discussion.php', __NAMESPACE__ . '\block_comments_admin_screen' );
     
    6768 * it by priority 99 on init.
    6869 */
    69 function remove_comment_support() {
     70function remove_comment_support(): void {
    7071    $post_types = get_post_types_by_support( 'comments' );
    7172
     
    7980 * it by priority 99 on init.
    8081 */
    81 function remove_trackback_support() {
     82function remove_trackback_support(): void {
    8283    $post_types = get_post_types_by_support( 'trackbacks' );
    8384
     
    9394 * @since 1.1.0
    9495 */
    95 function unregister_comment_blocks_javascript() {
     96function unregister_comment_blocks_javascript(): void {
    9697    $asset_data = include_once __DIR__ . '/build/index.asset.php';
    9798
     
    112113 * @since 1.1.0
    113114 */
    114 function unregister_comment_blocks() {
     115function unregister_comment_blocks(): void {
    115116
    116117    // Retrieve all registered blocks.
     
    154155 * side menu in the dashboard.
    155156 */
    156 function remove_comments_menu_page() {
     157function remove_comments_menu_page(): void {
    157158    remove_menu_page( 'edit-comments.php' );
    158159    remove_submenu_page( 'options-general.php', 'options-discussion.php' );
     
    162163 * Remove the comments menu from the admin bar.
    163164 */
    164 function remove_admin_bar_comments_menu() {
     165function remove_admin_bar_comments_menu(): void {
    165166    remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
    166167}
    167168
    168169/**
     170 * Remove the "Manage Comments" node from each site's menu under My Sites.
     171 *
     172 * @since 1.3.0
     173 */
     174function remove_my_sites_comments_menu(): void {
     175    global $wp_admin_bar;
     176
     177    // Only parse for the menu if it's going to be there, part 1.
     178    if ( ! is_multisite() || ! is_user_logged_in() ) {
     179        return;
     180    }
     181
     182    // Only parse for the menu if it's going to be there, part 2.
     183    if ( count( $wp_admin_bar->user->blogs ) < 1 ) {
     184        return;
     185    }
     186
     187    // The plugin API is not always available on the front-end.
     188    if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
     189        require_once ABSPATH . '/wp-admin/includes/plugin.php';
     190    }
     191
     192    // We can't accurately remove the menu item if the plugin is not network activated.
     193    if ( ! is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
     194        return;
     195    }
     196
     197    foreach ( $wp_admin_bar->user->blogs as $blog ) {
     198        $wp_admin_bar->remove_menu( 'blog-' . $blog->userblog_id . '-c' );
     199    }
     200}
     201
     202/**
    169203 * Filter wp_count_comments() so that it always returns 0.
    170204 *
    171205 * This hides Recent Comments from the dashboard activity widget.
    172206 *
    173  * @return stdClass An object with expected count properties.
    174  */
    175 function filter_wp_count_comments() {
     207 * @return \stdClass An object with expected count properties.
     208 */
     209function filter_wp_count_comments(): \stdClass {
    176210    return (object) array(
    177211        'approved'       => 0,
     
    189223 * in the admin.
    190224 */
    191 function block_comments_admin_screen() {
     225function block_comments_admin_screen(): void {
    192226    wp_die( esc_html__( 'This screen is disabled by the Turn Comments Off plugin.', 'turn-comments-off' ) );
    193     exit;
    194 }
     227}
  • turn-comments-off/trunk/readme.txt

    r2889508 r2984583  
    11# Turn Comments Off
    2 Contributors: happyprime, jeremyfelt, slocker, philcable, wpgirl369
     2Contributors: happyprime, jeremyfelt, slocker, philcable
    33Tags: comments
    44Requires at least: 5.9
    5 Tested up to: 6.2
    6 Stable tag: 1.2.1
     5Tested up to: 6.4
     6Stable tag: 1.3.0
    77License: GPLv2 or later
    8 Requires PHP: 5.6
     8Requires PHP: 7.4
    99
    1010Turn comments off everywhere in WordPress.
     
    2121* Remove the comments feed link.
    2222* Unregister all core comment blocks in the editor.
     23* Remove "Manage Comments" from My Sites on multisite. (If network activated.)
    2324
    2425No configuration necessary (or available).
     
    2728
    2829## Changelog
     30
     31### 1.3.0
     32
     33* Remove "Manage Comments" from site menus under My Sites on multisite.
     34* Confirm WordPress 6.4 support.
     35* Update `wordpress/scripts` dependency to 26.15.0.
     36* Improve linting configuration.
    2937
    3038### 1.2.1
Note: See TracChangeset for help on using the changeset viewer.