Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpaul committed Nov 3, 2022
2 parents 83611cb + 28ae6ae commit 89facaf
Show file tree
Hide file tree
Showing 45 changed files with 6,452 additions and 1,116 deletions.
48 changes: 1 addition & 47 deletions .github/hookdoc-tmpl/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Welcome to the Sophi for WordPress Plugin Developer Documentation
# Sophi for WordPress Developer Documentation

This resource is generated documentation on actions and filters found in the Sophi for WordPress plugin, as well as some helpful tutorials on how to utilize those hooks. Use the sidebar to browse and navigate.

Expand Down Expand Up @@ -32,52 +32,6 @@ If you're looking to contribute to or extend the Sophi for WordPress plugin, the
- `composer lint` (lint PHP files)
- `composer lint-fix` (lint PHP files and automatically correct coding standard violations)

### WP-CLI Commands

### Sync content to Sophi Collector

`$ wp sophi sync [--post_types=<string>] [--limit=<number>] [--per_page=<number>] [--include=<number>]`

Sync all supported content to Sophi Collector, firing off update events for all of them. The expected use case with the Sophi for WordPress plugin is that someone will install it on an existing site and instead of having to manually update each piece of content to ensure that it makes it to the Collector, they can run this script to handle that all at once.

#### Options

**`--post_types=<string>`**

Post types to be processed. Comma separated for passing multiple post types.

default: `false`
options:
- any post type name
- `false`

**`--limit=<number>`**

Limit the amount of posts to be synced.

default: `false`
options:
- `false`, no limit
- `N`, max number of posts to sync

**`--per_page=<number>`**

Number of posts to process each batch.

default: `false`
options:
- `false`, no limit
- `N`, max number of posts to sync each batch

**`--include=<number>`**

Post IDs to process. Comma separated for passing multiple item.

default: `false`
options:
- `false`, no limit
- `N`, Post IDs to sync

For more information about using Sophi for WordPress, please see the [Sophi website](https://sophi.io/).

To report an issue with Sophi for WordPress or contribute back to the project, please visit the [GitHub repository](https://github.com/globeandmail/sophi-for-wordpress/).
Expand Down
2 changes: 1 addition & 1 deletion .github/hookdoc-tmpl/static/styles-10up.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nav h3:nth-of-type(3) {
}

nav h3:nth-of-type(3):after {
content: 'Docs';
content: 'Tutorials';
visibility: visible;
position: absolute;
left: 0;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.1.0
- name: Set Node.js 16
uses: actions/setup-node@v3
with:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/php-compatibility-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHP Compatibility-dev for 8.0

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
php-compatibility:
name: PHP minimum 8.0

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
coverage: none

- name: Install dependencies
run: |
composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer g require --dev phpcompatibility/phpcompatibility-wp:"*"
composer g config minimum-stability dev
composer g require --dev phpcompatibility/phpcompatibility-wp
composer g require --dev phpcompatibility/php-compatibility:"dev-develop as 9.99.99"
- name: Run PHP Compatibility
run: ~/.composer/vendor/bin/phpcs sophi.php includes/ --standard=PHPCompatibilityWP --severity=1 --runtime-set testVersion 8.0- --extensions=php
2 changes: 1 addition & 1 deletion .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [1.3.0] - 2022-10-28
**Note that this version bumps the minimum WordPress version from 5.6 to 6.0 and adds an integration with the Sophi Override feature.**

### Added
- Override feature to the Sophi Site Automation Block (props [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@fabiankaegy](https://github.com/fabiankaegy), [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#333](https://github.com/globeandmail/sophi-for-wordpress/pull/333), [#345](https://github.com/globeandmail/sophi-for-wordpress/pull/345)).
- [GET] `/wp-json/sophi/v1/site-automation` WP REST endpoint to Get Posts from Site Automation (props [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@fabiankaegy](https://github.com/fabiankaegy), [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#333](https://github.com/globeandmail/sophi-for-wordpress/pull/333)).
- [POST] `/wp-json/sophi/v1/site-automation-override` WP REST endpoint to Override the Posts for Site Automation (props [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@fabiankaegy](https://github.com/fabiankaegy), [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#333](https://github.com/globeandmail/sophi-for-wordpress/pull/333)).
- `api_version` to the block JSON files (props [@faisal-alvi](https://github.com/faisal-alvi) via [#345](https://github.com/globeandmail/sophi-for-wordpress/pull/345)).
- Display message when no posts are returned from Sophi Site Automation (props [@faisal-alvi](https://github.com/faisal-alvi) via [#345](https://github.com/globeandmail/sophi-for-wordpress/pull/345)).
- Functionality to remove old error messages when posts are found (props [@faisal-alvi](https://github.com/faisal-alvi) via [#345](https://github.com/globeandmail/sophi-for-wordpress/pull/345)).
- Tracker Address option on plugin settings page (props [@faisal-alvi](https://github.com/faisal-alvi), [@YMufleh](https://github.com/YMufleh), [@jeffpaul](https://github.com/jeffpaul) via [#342](https://github.com/globeandmail/sophi-for-wordpress/pull/342)).
- New tutorial for modifying tracking data on documentation site (props [@iamdharmesh](https://github.com/iamdharmesh), [@YMufleh](https://github.com/YMufleh), [@dkotter](https://github.com/dkotter) via [#327](https://github.com/globeandmail/sophi-for-wordpress/pull/327)).

### Changed
- Bump minimum WordPress version from 5.6 to 6.0 (props [@faisal-alvi](https://github.com/faisal-alvi) via [#346](https://github.com/globeandmail/sophi-for-wordpress/pull/346)).
- Sophi Site Automation Block from a server-side-rendered custom block to a nested block (props [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@fabiankaegy](https://github.com/fabiankaegy), [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#333](https://github.com/globeandmail/sophi-for-wordpress/pull/333), [#345](https://github.com/globeandmail/sophi-for-wordpress/pull/345)).
- Replaced hardcoded tracker endpoint value with the new Tracker Address setting (props [@faisal-alvi](https://github.com/faisal-alvi), [@YMufleh](https://github.com/YMufleh), [@jeffpaul](https://github.com/jeffpaul) via [#342](https://github.com/globeandmail/sophi-for-wordpress/pull/342)).
- Developer Documentation updates (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi) via [#332](https://github.com/globeandmail/sophi-for-wordpress/pull/332), [#333](https://github.com/globeandmail/sophi-for-wordpress/pull/333)).

### Fixed
- Prevent duplicate CMS publish/update event tracking (props [@cadic](https://github.com/cadic), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#335](https://github.com/globeandmail/sophi-for-wordpress/pull/335)).

### Security
- Added latest PHPCompatibility checks for PHP 8.0 (props [@Sidsector9](https://github.com/Sidsector9) via [#331](https://github.com/globeandmail/sophi-for-wordpress/pull/331)).
- Update dependency `phpunit/phpunit` from 8.5.29 to 9.5.25 (props [@renovate](https://github.com/apps/renovate), [@Sidsector9](https://github.com/Sidsector9), [@faisal-alvi](https://github.com/faisal-alvi) via [#329](https://github.com/globeandmail/sophi-for-wordpress/pull/329), [#337](https://github.com/globeandmail/sophi-for-wordpress/pull/337), [#339](https://github.com/globeandmail/sophi-for-wordpress/pull/339)).
- Update dependency `10up-toolkit` from 4.1.2 to 4.3.0 (props [@renovate](https://github.com/apps/renovate), [@Sidsector9](https://github.com/Sidsector9), [@faisal-alvi](https://github.com/faisal-alvi) via [#330](https://github.com/globeandmail/sophi-for-wordpress/pull/330), [#340](https://github.com/globeandmail/sophi-for-wordpress/pull/340)).
- Update `actions/checkout` action from v2 to v3 and v3.0.2 to v3.1.0 (props [@renovate](https://github.com/apps/renovate) via [#334](https://github.com/globeandmail/sophi-for-wordpress/pull/334)).

## [1.2.1] - 2022-08-30
### Changed
- Bump `content_update` schema from 2-0-3 to 2-0-5 (props [@jeffpaul](https://github.com/jeffpaul), [@vjayaseelan90](https://github.com/vjayaseelan90), [@YMufleh](https://github.com/YMufleh) via [#323](https://github.com/globeandmail/sophi-for-wordpress/pull/323)).
Expand Down Expand Up @@ -240,6 +268,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Initial public release! 🎉

[Unreleased]: https://github.com/globeandmail/sophi-for-wordpress/compare/trunk...develop
[1.3.0]: https://github.com/globeandmail/sophi-for-wordpress/compare/1.2.1...1.3.0
[1.2.1]: https://github.com/globeandmail/sophi-for-wordpress/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/globeandmail/sophi-for-wordpress/compare/1.1.3...1.2.0
[1.1.3]: https://github.com/globeandmail/sophi-for-wordpress/compare/1.1.2...1.1.3
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Diana Padron (@dianapadron)](https://profiles.wordpress.org/dianapadron), [Jozsef Kozo (@kojraai)](https://github.com/kojraai), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Ramon Ahnert (@Rahmon)](https://github.com/Rahmon), [Felipe Elia (@felipeelia)](https://github.com/felipeelia), [Thorsten Ott (@tott)](https://github.com/tott), [Alasdair McKie (@amckie)](https://github.com/amckie), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Thorsten Ott (@tott)](https://github.com/tott), [Yazan Mufleh (@YMufleh)](https://github.com/YMufleh), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Max Lyuchin (@cadic)](https://github.com/cadic), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Mend Renovate (@renovate)](https://github.com/apps/renovate), [Vijay Jayaseelan (@vjayaseelan90)](https://github.com/vjayaseelan90).
[Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Diana Padron (@dianapadron)](https://profiles.wordpress.org/dianapadron), [Jozsef Kozo (@kojraai)](https://github.com/kojraai), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Ramon Ahnert (@Rahmon)](https://github.com/Rahmon), [Felipe Elia (@felipeelia)](https://github.com/felipeelia), [Thorsten Ott (@tott)](https://github.com/tott), [Alasdair McKie (@amckie)](https://github.com/amckie), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Thorsten Ott (@tott)](https://github.com/tott), [Yazan Mufleh (@YMufleh)](https://github.com/YMufleh), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Max Lyuchin (@cadic)](https://github.com/cadic), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Mend Renovate (@renovate)](https://github.com/apps/renovate), [Vijay Jayaseelan (@vjayaseelan90)](https://github.com/vjayaseelan90), [Fabian Kägy (@fabiankaegy)](https://github.com/fabiankaegy), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc).

## Libraries

Expand Down
43 changes: 3 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* [Using the plugin](#usage)
* [Site Automation block](#site-automation-block)
* [Query integration](#query-integration)
* [Documentation](#documentation)
* [Developer Documentation](#developer-documentation)
* [FAQs](#frequently-asked-questions)
* [Changelog](#changelog)
* [Contributing](#contributing)
Expand All @@ -40,7 +40,7 @@ Sophi-driven pages outperform human curated pages by a significant margin and fr

## Requirements

* [WordPress](http://wordpress.org) 5.6+
* [WordPress](http://wordpress.org) 6.0+
* [PHP](https://php.net/) 7.4+
* [Sophi.io account](https://www.sophi.io/contact/) and related credentials to authorize and authenticate access within the plugin settings

Expand Down Expand Up @@ -132,44 +132,7 @@ While the above query integration works just fine, it has been observed on [Word

`phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts`

### Post content type

By default, Sophi for WordPress uses post format as the content type. This plugin uses `content_type` internally to distinguish between WordPress post type and Sophi type.

Sophi accepts 4 types: article, video, audio, and image. The default type is `article`. Any other types that are not included above will be treated as `article`.

If you're not using post format for content type, you can utilize `sophi_post_content_type` to set the content type.

```php
add_filter(
'sophi_post_content_type',
function( $type, $post ) {
// You logic here.

return $new_type;
},
10,
2
);
```

### Canonical URL

Sophi for WordPress uses `wp_get_canonical_url` function introduced in WordPress 4.6 to get the canonical URL for given post. The plugin compares this canonical URL to post permalink to set the `isCanonical` attribute.

WordPress SEO (Yoast) canonical is supported out of the box. For other SEO plugins and custom implementations, [`get_canonical_url`](https://developer.wordpress.org/reference/functions/wp_get_canonical_url/) filter can be used to change the canonical URL.

### Object caching

Object caching is encouraged, as the plugin saves Sophi data as a transient. If you do not have object caching, then the data will be saved as a transient in the options table but note that these will eventually expire.

The default caching period is five minutes. This can be modified with the `sophi_cache_duration` hook.

### Sophi API empty response

If the Sophi API returns an empty Post ID array, the plugin will result in a "no results" response. The `sophi_curated_post_list` filter can be used to modify the Sophi API response to allow manual posts to be injected into the final array previous to returning the filterable value from `posts_pre_query` (e.g., via a fallback method to inject posts that would be a good fit).

## Documentation
## Developer Documentation

Sophi for WordPress has an in-depth documentation site that details the available actions and filters found within the plugin, as well as some helpful tutorials on how to use those hooks. [Visit the developer docs ☞](https://globeandmail.github.io/sophi-for-wordpress/)

Expand Down
3 changes: 1 addition & 2 deletions assets/js/frontend/sophi-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
try {
window.sophi = SOPHIDATA;
} catch (e) {}

(function (f, g) {
window.sophi = window.sophi || {};
var c = window.sophi;
Expand All @@ -25,7 +24,7 @@ try {
} catch (e) {
a = void 0;
}
b.loadFrom = a ? `${a}sophi.min.js` : b.loadFrom || 'https://cdn.sophi.io/latest/sophi.min.js';
b.loadFrom = a ? `${a}sophi.min.js` : b.loadFrom || b.tracker_address;
b.legacy = a
? `${a}sophi.legacy.min.js`
: b.loadFrom || 'https://cdn.sophi.io/latest/sophi.legacy.min.js';
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"snowplow/snowplow-tracker": "0.5.0"
},
"require-dev": {
"phpunit/phpunit": "8.5.29",
"10up/wp_mock": "dev-master",
"phpunit/phpunit": "9.5.25",
"10up/wp_mock": "dev-trunk",
"automattic/vipwpcs": "2.3.3",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.2",
"10up/phpcs-composer": "dev-master"
Expand Down
Loading

0 comments on commit 89facaf

Please sign in to comment.