Skip to content

Commit

Permalink
Updates namespacing from wpsp to wpcomsp
Browse files Browse the repository at this point in the history
  • Loading branch information
tommusrhodus committed Jul 16, 2024
1 parent 470c42f commit 3516c4d
Show file tree
Hide file tree
Showing 33 changed files with 75 additions and 78 deletions.
4 changes: 2 additions & 2 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="wpsp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Custom ruleset for wpsp blocks monorepo</description>
<ruleset name="wpcomsp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Custom ruleset for wpcomsp blocks monorepo</description>

<rule ref="./vendor/a8cteam51/team51-configs/quality-tools/phpcs.xml.dist"/>

Expand Down
6 changes: 3 additions & 3 deletions .utilities/class-wpsp-blocks-self-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* Plugin Autoupdate Filter Self Update class.
* sets up autoupdates for this GitHub-hosted plugin.
*
* @package wpsp
* @package wpcomsp
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

class WPSP_Blocks_Self_Update {
class WPCOMSP_Blocks_Self_Update {

public static $instance;

/**
* Get instance of this class.
*
* @return WPSP_Blocks_Self_Update
* @return WPCOMSP_Blocks_Self_Update
*/
public static function get_instance() {
if ( ! self::$instance ) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "a8cteam51/wpsp",
"name": "a8cteam51/wpcomsp",
"type": "wordpress-project",

"description": "",
Expand Down
2 changes: 1 addition & 1 deletion dynamic-table-of-contents/build/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "wpsp/dynamic-table-of-contents",
"name": "wpcomsp/dynamic-table-of-contents",
"version": "0.1.9",
"title": "Dynamic Table of Contents",
"category": "design",
Expand Down
2 changes: 1 addition & 1 deletion dynamic-table-of-contents/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dynamic-table-of-contents/build/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$asset_deps = require trailingslashit( plugin_dir_path( __FILE__ ) ) . 'view.asset.php';

wp_enqueue_script(
'wpsp-dynamic-table-of-contents-view',
'wpcomsp-dynamic-table-of-contents-view',
plugins_url( 'view.js', __FILE__ ),
$asset_deps['dependencies'],
$asset_deps['version'],
Expand All @@ -25,7 +25,7 @@
<div <?php echo wp_kses_post( get_block_wrapper_attributes() ); ?>>
<?php
$block_title = isset( $attributes['title'] ) ?? '';
$block_title = apply_filters( 'wpsp_dynamic_table_of_contents_block_title', $block_title, $attributes );
$block_title = apply_filters( 'wpcomsp_dynamic_table_of_contents_block_title', $block_title, $attributes );

if ( ! empty( $block_title ) ) {
printf(
Expand Down
2 changes: 1 addition & 1 deletion dynamic-table-of-contents/build/style-index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dynamic-table-of-contents/build/view.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* Plugin Autoupdate Filter Self Update class.
* sets up autoupdates for this GitHub-hosted plugin.
*
* @package wpsp
* @package wpcomsp
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

class WPSP_Blocks_Self_Update {
class WPCOMSP_Blocks_Self_Update {

public static $instance;

/**
* Get instance of this class.
*
* @return WPSP_Blocks_Self_Update
* @return WPCOMSP_Blocks_Self_Update
*/
public static function get_instance() {
if ( ! self::$instance ) {
Expand Down
22 changes: 11 additions & 11 deletions dynamic-table-of-contents/dynamic-table-of-contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: dynamic-table-of-contents
*
* @package wpsp
* @package wpcomsp
*/

// Exit if accessed directly.
Expand All @@ -23,12 +23,12 @@
// Define the plugin folder name.


// If no other WPSP Block Plugin added the self update class, add it.
if ( ! class_exists( 'WPSP_Blocks_Self_Update' ) ) {
require __DIR__ . '/classes/class-wpsp-blocks-self-update.php';
// If no other WPCOMSP Block Plugin added the self update class, add it.
if ( ! class_exists( 'WPCOMSP_Blocks_Self_Update' ) ) {
require __DIR__ . '/classes/class-wpcomsp-blocks-self-update.php';

$wpsp_blocks_self_update = WPSP_Blocks_Self_Update::get_instance();
$wpsp_blocks_self_update->hooks();
$wpcomsp_blocks_self_update = WPCOMSP_Blocks_Self_Update::get_instance();
$wpcomsp_blocks_self_update->hooks();
}

/**
Expand All @@ -40,7 +40,7 @@
* @return array
*/
add_filter(
'wpsp_installed_blocks',
'wpcomsp_installed_blocks',
function ( $blocks ) {
$plugin_data = get_plugin_data( __FILE__ );

Expand All @@ -58,10 +58,10 @@ function ( $blocks ) {
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function wpsp_dynamic_table_of_contents_block_init() {
function wpcomsp_dynamic_table_of_contents_block_init() {
register_block_type( __DIR__ . '/build' );
}
add_action( 'init', 'wpsp_dynamic_table_of_contents_block_init' );
add_action( 'init', 'wpcomsp_dynamic_table_of_contents_block_init' );

/**
* Filter the render block output of heading blocks.
Expand All @@ -71,7 +71,7 @@ function wpsp_dynamic_table_of_contents_block_init() {
*
* @return string Block content.
*/
function wpsp_dynamic_table_of_contents_block_render( $block_content, $block ) {
function wpcomsp_dynamic_table_of_contents_block_render( $block_content, $block ) {
if ( 'core/heading' !== $block['blockName'] ) {
return $block_content;
}
Expand All @@ -91,4 +91,4 @@ function wpsp_dynamic_table_of_contents_block_render( $block_content, $block ) {

return $processor->get_updated_html();
}
add_filter( 'render_block', 'wpsp_dynamic_table_of_contents_block_render', 10, 2 );
add_filter( 'render_block', 'wpcomsp_dynamic_table_of_contents_block_render', 10, 2 );
2 changes: 1 addition & 1 deletion dynamic-table-of-contents/src/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "wpsp/dynamic-table-of-contents",
"name": "wpcomsp/dynamic-table-of-contents",
"version": "0.1.9",
"title": "Dynamic Table of Contents",
"category": "design",
Expand Down
4 changes: 2 additions & 2 deletions dynamic-table-of-contents/src/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$asset_deps = require trailingslashit( plugin_dir_path( __FILE__ ) ) . 'view.asset.php';

wp_enqueue_script(
'wpsp-dynamic-table-of-contents-view',
'wpcomsp-dynamic-table-of-contents-view',
plugins_url( 'view.js', __FILE__ ),
$asset_deps['dependencies'],
$asset_deps['version'],
Expand All @@ -25,7 +25,7 @@
<div <?php echo wp_kses_post( get_block_wrapper_attributes() ); ?>>
<?php
$block_title = isset( $attributes['title'] ) ?? '';
$block_title = apply_filters( 'wpsp_dynamic_table_of_contents_block_title', $block_title, $attributes );
$block_title = apply_filters( 'wpcomsp_dynamic_table_of_contents_block_title', $block_title, $attributes );

if ( ! empty( $block_title ) ) {
printf(
Expand Down
2 changes: 1 addition & 1 deletion dynamic-table-of-contents/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
}

.wp-block-wpsp-dynamic-table-of-contents {
.wp-block-wpcomsp-dynamic-table-of-contents {
font-family: var(--wp--preset--font-family--sans-serif);
max-width: 312px;

Expand Down
6 changes: 3 additions & 3 deletions dynamic-table-of-contents/src/view.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const $headings = document.querySelectorAll('.wp-block-post-content h1, .wp-block-post-content h2, .wp-block-post-content h3, .wp-block-post-content h4, .wp-block-post-content h5, .wp-block-post-content h6');
const $headingList = document.querySelector('.wp-block-wpsp-dynamic-table-of-contents ul');
const $headingList = document.querySelector('.wp-block-wpcomsp-dynamic-table-of-contents ul');

// This is the observer that will be used to highlight the current heading.
const $observer = new IntersectionObserver((entries) => {
let $links = document.querySelectorAll('.wp-block-wpsp-dynamic-table-of-contents a');
let $links = document.querySelectorAll('.wp-block-wpcomsp-dynamic-table-of-contents a');

entries.forEach((entry) => {
const $id = entry.target.id;
const $link = document.querySelector(`.wp-block-wpsp-dynamic-table-of-contents a[href="#${$id}"]`);
const $link = document.querySelector(`.wp-block-wpcomsp-dynamic-table-of-contents a[href="#${$id}"]`);

if (entry.isIntersecting) {
$links.forEach((link) => {
Expand Down
2 changes: 1 addition & 1 deletion hello-world/build/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "wpsp/hello-world",
"name": "wpcomsp/hello-world",
"version": "0.1.0",
"title": "Hello World",
"category": "widgets",
Expand Down
2 changes: 1 addition & 1 deletion hello-world/build/index.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.wp-block-wpsp-hello-world{border:1px dotted red}
.wp-block-wpcomsp-hello-world{border:1px dotted red}
2 changes: 1 addition & 1 deletion hello-world/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hello-world/build/style-index.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.wp-block-wpsp-hello-world{background-color:#21759b;color:#fff;padding:2px}
.wp-block-wpcomsp-hello-world{background-color:#21759b;color:#fff;padding:2px}
2 changes: 1 addition & 1 deletion hello-world/build/view.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log("Hello World! (from wpsp-hello-world block)");
console.log("Hello World! (from wpcomsp-hello-world block)");
Loading

0 comments on commit 3516c4d

Please sign in to comment.