Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
al-esc committed May 29, 2024
1 parent 21a3ecb commit 678c614
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 108 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor/
dist/
.DS_Store
*.code-workspace
.idea
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
<h3 align="center">WordPress Plugin Template</h3>
<h4>Included:</h4>

- OOP architecture

- Build pipeline

- PSR-4 Autoloading

- GitHub workflows for:

- Building release asset

- PR labeler

- Release drafter
<h3 align="center">Pantheon Content Cloud for WordPress</h3>
56 changes: 28 additions & 28 deletions app/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @package crowdfavorite\tips
*/

namespace Tips;
namespace PCC;

/**
* The main class
Expand All @@ -20,26 +20,9 @@ class Plugin
* @access private
* @static
*
* @var Main
* @var Plugin
*/
private static $instance;

/**
* Get instance of the class.
*
* @access public
* @static
*
* @return Main
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}

return self::$instance;
}
private static Plugin $instance;

/**
* The main class construct.
Expand All @@ -52,34 +35,51 @@ public function __construct()
/**
* Initialize the plugin.
*/
private function init()
private function init(): void
{
add_action(
'admin_enqueue_scripts',
[$this, 'enqueueAssets']
);
}

/**
* Get instance of the class.
*
* @access public
* @static
*
* @return Plugin
*/
public static function getInstance(): Plugin
{
if (!self::$instance) {
self::$instance = new self();
}

return self::$instance;
}

/**
* `wp_enqueue_scripts` hook.
*
* @return void
*/
public function enqueueAssets()
public function enqueueAssets(): void
{
wp_enqueue_script(
TIPS_HANDLE,
TIPS_PLUGIN_DIR_URL . 'dist/app.js',
PCC_HANDLE,
PCC_PLUGIN_DIR_URL . 'dist/app.js',
[],
filemtime(TIPS_PLUGIN_DIR . 'dist/app.js'),
filemtime(PCC_PLUGIN_DIR . 'dist/app.js'),
true
);

wp_enqueue_style(
TIPS_HANDLE,
TIPS_PLUGIN_DIR_URL . 'dist/app.css',
PCC_HANDLE,
PCC_PLUGIN_DIR_URL . 'dist/app.css',
[],
filemtime(TIPS_PLUGIN_DIR . 'dist/app.css')
filemtime(PCC_PLUGIN_DIR . 'dist/app.css')
);
}
}
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "crowdfavorite/tips",
"name": "pantheon/pcc-for-wordpress",
"type": "wordpress-plugin",
"description": "TIPS is plugin scaffolding",
"description": "Publish WordPress content from Google Docs with Pantheon Content Cloud.",
"keywords": [
"wordpress",
"plugin"
"wordpress",
"plugin"
],
"support": {
"email": "alexn@crowdfavorite.com"
"email": "contact@pantheon.io"
},
"authors": [
{
"name": "Al Esc",
"email": "alexn@crowdfavorite.com",
"homepage": "https://crowfavorite.com"
}
{
"name": "Pantheon",
"email": "contact@pantheon.io",
"homepage": "https://pantheon.io"
}
],
"autoload": {
"psr-4": {
"Tips\\": "app/"
}
"psr-4": {
"PCC\\": "app/"
}
},
"require": {
"php": ">=7.0.0"
"php": ">=8.3"
}
}
6 changes: 3 additions & 3 deletions composer.lock

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

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "tips",
"name": "pcc-for-wordpress",
"version": "0.0.1",
"description": "TIPS is plugin scaffolding.",
"description": "Publish WordPress content from Google Docs with Pantheon Content Cloud.",
"scripts": {
"dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"author": "Al Esc",
"private": "true",
"devDependencies": {
"laravel-mix": "^5.0.9",
"resolve-url-loader": "^3.1.2",
"sass": "^1.29.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.12"
"laravel-mix": "^5.0.9",
"resolve-url-loader": "^3.1.2",
"sass": "^1.29.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.12"
}
}
36 changes: 36 additions & 0 deletions pcc-for-wordpress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php //phpcs:disable Files.SideEffects.FoundWithSymbols

/**
* Plugin Name: Pantheon Content Cloud for WordPress
* Description: Publish WordPress content from Google Docs with Pantheon Content Cloud.
* Plugin URI: https://pantheon.io
* Author: Pantheon
* Author URI: https://pantheon.io
* Version: 0.0.1
*
* @package pantheon\pcc-for-wordpress
*/

namespace PCC;

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

// Constant Definitions.
define('PCC_PLUGIN_FILE', __FILE__);
define('PCC_PLUGIN_DIR', plugin_dir_path(PCC_PLUGIN_FILE));
define('PCC_BASENAME', plugin_basename(PCC_PLUGIN_FILE));
define('PCC_PLUGIN_DIR_URL', plugin_dir_url(PCC_PLUGIN_FILE));
define('PCC_HANDLE', 'pcc');

// Only require the autoload.php file if it exists.
// If it does not, assume that it is the root project's responsibility to load the necessary files.
call_user_func(static function ($rootPath) {
$autoload = "{$rootPath}vendor/autoload.php";
if (is_readable($autoload)) {
require_once $autoload;
}
add_action('plugins_loaded', ['PCC\Plugin', 'getInstance'], -10);
}, PCC_PLUGIN_DIR);
36 changes: 0 additions & 36 deletions tips.php

This file was deleted.

0 comments on commit 678c614

Please sign in to comment.