Skip to content

Commit

Permalink
Cord concept. Cleaned up code and verbatim. New issue templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
sybrew committed Mar 27, 2019
1 parent 4ff78c0 commit 2d70d5a
Show file tree
Hide file tree
Showing 46 changed files with 1,620 additions and 200 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
*.woff binary
*.woff2 binary

# GitHub baggage for development.
.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
README.md export-ignore
composer.json export-ignore
phpcs.xml export-ignore
*.po export-ignore
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing to the Extension Manager

Please see [The SEO Framework's CONTRIBUTING.md](https://github.com/sybrew/the-seo-framework/blob/master/.github/CONTRIBUTING.md).
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/---security-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "\U0001F46E Security issue"
about: "Please report security issues at https://theseoframework.com/contact/."
title: ''
labels: ''
assignees: sybrew

---

Please disclose security issues responsibly and not publicly via GitHub.

So, for security reasons, please report all security issues via https://theseoframework.com/contact/.
14 changes: 10 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
name: "\U0001F98B Bug report"
about: "Report a bug if something's not working as expected for you in the Extension Manager."
title: ''
labels: ''
assignees: ''

---

Expand All @@ -18,7 +21,10 @@ Steps to reproduce the behavior:
<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
<!--
If applicable, add screenshots to help explain your problem.
Learn how to do this here: https://help.github.com/en/articles/file-attachments-on-issues-and-pull-requests
-->

**Additional context**
<!-- Add any other context about the problem here. -->
<!-- Add any other context about the problem here, like your WordPress and web browser version. -->
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "\U0001F4A1 Enhancement idea"
about: "We'd love to know what could've been done better in the Extension Manager."
title: ''
labels: ''
assignees: ''

---

<!-- Found room for improvement on existing features? Or do you think a new feature should be added? Let us know! -->
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
name: "\U0001F680 Feature request"
about: "Suggest a new feature for the Extension Manager."
title: ''
labels: ''
assignees: ''

---

For increased exposure, features requests should be sent to the main project:
https://github.com/sybrew/the-seo-framework/issues/new

Feature requests here will be closed.
<!-- We'd love to know what we can add! Please elaborate why you think this feature is useful. -->
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/support.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
name: Support
about: Describe your issue clear and concise
name: "\U0001F4AC Support"
about: "Are you running into issues with the Extension Manager? Reach out to us here."
title: ''
labels: ''
assignees: ''

---

<!-- Keep it short and sweet! -->
<!-- Please keep your inquiry short! -->
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Packages
*.zip
*.7z
*.gz
*.tar
*.rar

## Local storage
*.log
*.ser
*.sql
*.sqlite

## Common work-file extensions
*.tmp
*.bak

## OS generated files
.DS_Store
.DS_Store?
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
14 changes: 7 additions & 7 deletions bootstrap/upgrader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
* @access private
* @uses trait \TSF_Extension_Manager\Enclose_Stray_Private
* @uses trait \TSF_Extension_Manager\Construct_Core_Once_Interface
* @see package \TSF_Extension_Manager\Overload
* @see @package TSF_Extension_Manager\Overload
* @uses trait \TSF_Extension_Manager\Memory
* @see package \TSF_Extension_Manager\Factory
* @see @package TSF_Extension_Manager\Factory
*/
final class Upgrader {
use Enclose_Stray_Private,
Construct_Core_Once_Interface,
Memory;
Construct_Core_Once_Interface,
Memory;

/**
* The db revision option key.
Expand Down Expand Up @@ -114,10 +114,10 @@ private function construct() {
* @since 1.5.0
*/
private function set_defaults() {
$this->upgrades = new \stdClass;
$this->upgrades = new \stdClass;
$this->previous_db_versions = \get_option( static::O, [] );
$this->current_db_versions = $this->previous_db_versions;
$this->active_callbacks = [];
$this->current_db_versions = $this->previous_db_versions;
$this->active_callbacks = [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ window.tsfem_e_focus_inpost = function( $ ) {

/**
* @param {(boolean|object<number,string>|array)} inflections
* @param {boolean|object<number,string>|array)} synonyms
* @param {(boolean|object<number,string>|array)} synonyms
*/
let inflections = activeWords( idPrefix ).get( 'inflections' ),
synonyms = activeWords( idPrefix ).get( 'synonyms' );
Expand Down
164 changes: 164 additions & 0 deletions extensions/free/cord/trunk/cord.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?php
/**
* @package TSF_Extension_Manager\Extension\Cord
*/
namespace TSF_Extension_Manager\Extension\Cord;

/**
* Extension Name: Cord
* Extension URI: https://theseoframework.com/extensions/cord/
* Extension Description: The Cord extension connects your website to search engines, so they can be notified of your website changes instantly.
* Extension Version: 1.0.0
* Extension Author: Sybre Waaijer
* Extension Author URI: https://cyberwire.nl/
* Extension License: GPLv3
* Extension Menu Slug: theseoframework-cord
*/

defined( 'ABSPATH' ) or die;

/**
* Cord extension for The SEO Framework
* Copyright (C) 2019 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* The extension version.
* @since 1.0.0
* NOTE: The presence does NOT guarantee the extension is loaded!!!
*/
define( 'TSFEM_E_CORD_VERSION', '1.0.0' );

/**
* The extension database version.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_DB_VERSION', '1000' );

/**
* The extension file, absolute unix path.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_BASE_FILE', __FILE__ );

/**
* The extension map URL. Used for calling browser files.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_DIR_URL', \TSF_Extension_Manager\extension_dir_url( TSFEM_E_CORD_BASE_FILE ) );

/**
* The extension file relative to the plugins dir.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_DIR_PATH', \TSF_Extension_Manager\extension_dir_path( TSFEM_E_CORD_BASE_FILE ) );

/**
* The plugin class map absolute path.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_PATH_CLASS', TSFEM_E_CORD_DIR_PATH . 'inc' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR );

/**
* The plugin trait map absolute path.
* @since 1.0.0
*/
define( 'TSFEM_E_CORD_PATH_TRAIT', TSFEM_E_CORD_DIR_PATH . 'inc' . DIRECTORY_SEPARATOR . 'traits' . DIRECTORY_SEPARATOR );

/**
* Verify integrity and sets up autoloader.
* @since 1.0.0
*/
if ( false === \tsf_extension_manager()->_init_early_extension_autoloader( TSFEM_E_CORD_PATH_CLASS, 'Cord', $_instance, $bits ) )
return;

// if ( TSFEM_E_CORD_DB_VERSION > \tsf_extension_manager_db_version( 'cord' ) ) {
// require TSFEM_E_CORD_DIR_PATH . 'upgrade.php';
// }

\add_action( 'plugins_loaded', __NAMESPACE__ . '\\_cord_init', 11 );
/**
* Initializes the extension.
*
* @since 1.0.0
* @staticvar bool $loaded True when loaded.
* @action 'plugins_loaded'
* @priority 11
* @access private
*
* @return bool True if class is loaded.
*/
function _cord_init() {

static $loaded;

if ( isset( $loaded ) )
return $loaded;

if ( \is_admin() ) {
new Admin;
} else {
// new Front; // TODO CRON?
}

return $loaded = true;
}

/**
* Returns the active base class.
*
* @since 1.0.0
*
* @return string The active class name.
*/
function get_active_class() {
if ( \is_admin() ) {
return __NAMESPACE__ . '\\Admin';
} else {
return __NAMESPACE__ . '\\Front'; // TODO
}
}

/**
* Returns the settings class.
*
* @since 1.0.0
*
* @return string The settings class name.
*/
function get_layout_class() {
return __NAMESPACE__ . '\\Settings';
}

/**
* Requires trait files once.
*
* @since 1.0.0
* @uses TSFEM_E_CORD_PATH_TRAIT
* @access private
* @staticvar array $loaded
*
* @param string $file Trait file name.
* @return bool True if loaded, false otherwise.
*/
function _load_trait( $file ) {

static $loaded = [];

if ( isset( $loaded[ $file ] ) )
return $loaded[ $file ];

return $loaded[ $file ] = (bool) require TSFEM_E_CORD_PATH_TRAIT . $file . '.trait.php';
}
Loading

0 comments on commit 2d70d5a

Please sign in to comment.