Skip to content

Commit

Permalink
Merge pull request #2 from GauravKhupse/github_action_deploy
Browse files Browse the repository at this point in the history
GitHub action deploy
  • Loading branch information
Nikschavan committed Aug 31, 2020
2 parents 97d5f31 + 712acfe commit 5962533
Show file tree
Hide file tree
Showing 16 changed files with 503 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .distignore
Expand Up @@ -27,3 +27,5 @@ node_modules
*.sql
*.tar.gz
*.zip
.github
.wordpress-org
16 changes: 16 additions & 0 deletions .github/workflows/push-asset-readme-update.yml
@@ -0,0 +1,16 @@
name: Plugin asset/readme update
on:
push:
branches:
- master
jobs:
master:
name: Push to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@master
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
16 changes: 16 additions & 0 deletions .github/workflows/push-to-deploy.yml
@@ -0,0 +1,16 @@
name: Deploy to WordPress.org
on:
push:
tags:
- "*"
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@master
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
Binary file added .wordpress-org/banner-1544x500.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -3,8 +3,8 @@
**Donate link:** https://www.paypal.me/BrainstormForce
**Tags:** schema, json-ld, breadcrumb, google, schema.org, structured data, seo, microdata
**Requires at least:** 4.4
**Tested up to:** 4.7.4
**Stable tag:** 1.0.0
**Tested up to:** 5.5
**Stable tag:** 1.0.1
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -23,5 +23,10 @@ Credits - [SEO Yoast](https://github.com/Yoast/wordpress-seo/blob/trunk/frontend

## Changelog ##

### 1.0.1 ###
* Improvement - Updated code with the latest WordPress PHP_CodeSniffer rules.
* Improvement - Compatibility with WordPress 5.5.

### 1.0 ###
* Initial Release.

28 changes: 14 additions & 14 deletions class-json-ld-breadcrumbs.php
Expand Up @@ -6,7 +6,7 @@
*/

// Exit if the file is called directy by URL.
defined( 'ABSPATH' ) or exit;
defined( 'ABSPATH' ) || exit;

if ( ! class_exists( 'JSON_LD_Breadcrumbs' ) ) {

Expand All @@ -23,7 +23,7 @@ class JSON_LD_Breadcrumbs {
* @since v1.0.0
* @var Object JSON_LD_Breadcrumbs
*/
private static $_instance = null;
private static $instance = null;

/**
* Crumb position. Increases everytime a new crumb is added.
Expand All @@ -48,11 +48,11 @@ class JSON_LD_Breadcrumbs {
* @return (Object) Instance of JSON_LD_Breadcrumbs
*/
public static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new self;
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}

return self::$_instance;
return self::$instance;
}

/**
Expand Down Expand Up @@ -123,7 +123,7 @@ private function maybe_add_blog_crumb() {
private function add_crumb( $name, $url = '', $image = '' ) {
$this->crumb_position = $this->crumb_position + 1;

if ( '' == $image ) {
if ( '' === $image ) {
$this->crumbs[] = array(
'@type' => 'ListItem',
'position' => $this->crumb_position,
Expand Down Expand Up @@ -302,14 +302,14 @@ private function add_breadcrumb_crumbs() {
$this->maybe_add_home_crumb();
$this->maybe_add_blog_crumb();

if ( ( 'page' === $this->show_on_front && is_front_page() ) || ( 'posts' === $this->show_on_front && is_home() ) ) {
if ( ( 'page' === $this->show_on_front && is_front_page() ) || ( 'posts' === $this->show_on_front && is_home() ) ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf
// Do nothing.
} elseif ( 'page' == $this->show_on_front && is_home() ) {
} elseif ( 'page' === $this->show_on_front && is_home() ) {
$this->add_crumb( get_the_title( $this->page_for_posts ), get_permalink( $this->page_for_posts ) );
} elseif ( is_singular() ) {
$this->maybe_add_pt_archive_crumb_for_post();

if ( isset( $this->post->post_parent ) && 0 == $this->post->post_parent ) {
if ( isset( $this->post->post_parent ) && 0 === $this->post->post_parent ) {
$this->maybe_add_taxonomy_crumbs_for_post();
} else {
$this->add_post_ancestor_crumbs();
Expand Down Expand Up @@ -352,8 +352,8 @@ private function add_breadcrumb_crumbs() {
'Error 404: Page not found',
null
);
}// End if().
}// End if().
}
}

return apply_filters( 'json_ld_breadcrumb_itemlist_array', $this->crumbs );
}
Expand Down Expand Up @@ -383,12 +383,12 @@ private function json_schema( $schema ) {
$schema_output = null;

if ( ! empty( $schema ) && is_array( $schema ) ) {
$schema_output .= '<script type="application/ld+json">' . json_encode( $schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
$schema_output .= '<script type="application/ld+json">' . wp_json_encode( $schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
}

echo $schema_output;
echo $schema_output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

}

}// End if().
}
13 changes: 13 additions & 0 deletions composer.json
@@ -0,0 +1,13 @@
{
"name": "Nikschavan/json-ld-breadcrumbs",
"description": "Adds JSON-LD based breadcrumb schema to your site visible only to the Search Engines.",
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"wp-coding-standards/wpcs": "dev-master",
"phpcompatibility/phpcompatibility-wp": "*"
},
"scripts": {
"format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
"lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source"
}
}
4 changes: 2 additions & 2 deletions json-ld-breadcrumbs.php
Expand Up @@ -13,13 +13,13 @@
*/

// Exit if the file is called directy by URL.
defined( 'ABSPATH' ) or exit;
defined( 'ABSPATH' ) || exit;

define( 'JSON_LD_BREADCRUMBS_VER', '1.0.0' );
define( 'JSON_LD_BREADCRUMBS_DIR', plugin_dir_path( __FILE__ ) );
define( 'JSON_LD_BREADCRUMBS_URL', plugins_url( '/', __FILE__ ) );
define( 'JSON_LD_BREADCRUMBS_PATH', plugin_basename( __FILE__ ) );

// Boorstrap the plugin.
include 'class-json-ld-breadcrumbs.php';
require 'class-json-ld-breadcrumbs.php';
add_action( 'wp', 'JSON_LD_Breadcrumbs::instance' );
6 changes: 3 additions & 3 deletions languages/json-ld-breadcrumbs.pot
@@ -1,15 +1,15 @@
# Copyright (C) 2017 Nikhil Chavan
# Copyright (C) 2020 Nikhil Chavan
# This file is distributed under the same license as the JSON-LD Breadcrumbs package.
msgid ""
msgstr ""
"Project-Id-Version: JSON-LD Breadcrumbs 1.0.0\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/json-ld-breadcrumbs\n"
"POT-Creation-Date: 2017-04-24 03:24:39+00:00\n"
"POT-Creation-Date: 2020-08-24 17:51:27+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: grunt-wp-i18n 0.5.4\n"
Expand Down

0 comments on commit 5962533

Please sign in to comment.