Skip to content

Commit

Permalink
Committing built version of 8174865
Browse files Browse the repository at this point in the history
  • Loading branch information
10upbot on GitHub committed Apr 23, 2021
1 parent 48b18f8 commit d8ce8cc
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 34 deletions.
Binary file modified .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions includes/blocks/site-automation-block/markup.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
* Site Automation block markup.
*
* @package SophiWP
*
* @var array $attributes The blocks attributes.
* @var array $curated_posts Curated content from Sophi.
*/

?>
<ul class="sophi-site-automation-block" id="<?php printf( 'sophi-site-automation-%1$s-%2$s', esc_attr( $attributes['pageName'] ), esc_attr( $attributes['widgetName'] ) ); ?>">
<?php foreach ( $curated_posts as $curated_post ) : ?>
<ul class="sophi-site-automation-block" id="<?php printf( 'sophi-site-automation-%1$s-%2$s', esc_attr( $attributes['pageName'] ), esc_attr( $attributes['widgetName'] ) ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ?>">
<?php foreach ( $curated_posts as $curated_post ) : // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ?>
<li class="curated-item">
<?php if ( ! empty( $attributes['displayFeaturedImage'] ) && has_post_thumbnail( $curated_post ) ) : ?>
<?php if ( ! empty( $attributes['addLinkToFeaturedImage'] ) ) : ?>
Expand Down
2 changes: 2 additions & 0 deletions includes/blocks/site-automation-block/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ function render_block_callback( $attributes, $content, $block ) {
return '';
}

// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
$curated_posts = get_posts(
[
'sophi_curated_page' => $attributes['pageName'],
'sophi_curated_widget' => $attributes['widgetName'],
'suppress_filters' => false,
]
);

Expand Down
4 changes: 4 additions & 0 deletions includes/classes/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function( $post_type ) use ( $post_types ) {
do {

if ( ! empty( $include ) ) {
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
$posts = get_posts(
array(
'posts_per_page' => $per_page,
Expand All @@ -135,16 +136,19 @@ function( $post_type ) use ( $post_types ) {
'post_status' => 'publish',
'post__in' => $include,
'ignore_sticky_posts' => true,
'suppress_filters' => false,
)
);
} else {
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
$posts = get_posts(
array(
'posts_per_page' => $per_page,
'post_type' => get_supported_post_types(),
'paged' => $paged,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
'suppress_filters' => false,
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/SiteAutomation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private function request() {
return $request;
}

if ( wp_remote_retrieve_response_code( $request ) != 200 ) {
if ( wp_remote_retrieve_response_code( $request ) !== 200 ) {
return new \WP_Error( wp_remote_retrieve_response_code( $request ), $request['response']['message'] );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/functions/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function setup() {
function register_blocks() {

// Require custom blocks.
require_once SOPHI_WP_INC . '/blocks/site-automation-block/register.php';
require_once SOPHI_WP_INC . '/blocks/site-automation-block/register.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant

// Call block register functions for each block.
SiteAutomationBlock\register();
Expand Down
2 changes: 1 addition & 1 deletion includes/functions/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function setup() {

add_action( 'admin_menu', $n( 'settings_page' ) );
add_action( 'admin_init', $n( 'fields_setup' ) );
add_filter( 'plugin_action_links_' . plugin_basename( SOPHI_WP_PATH . '/sophi-for-wordpress.php' ), $n( 'add_action_links' ) );
add_filter( 'plugin_action_links_' . plugin_basename( SOPHI_WP_PATH . '/sophi.php' ), $n( 'add_action_links' ) );
}

/**
Expand Down
3 changes: 2 additions & 1 deletion includes/functions/tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function amp_tracking( $analytics_entries ) {
* Prepare data for JS tracking.
*/
function get_tracking_data() {
global $wp, $post;
global $post;

$env = get_sophi_settings( 'environment' );

Expand All @@ -95,6 +95,7 @@ function get_tracking_data() {
'appId' => sprintf( '%s-website', get_sophi_settings( 'tracker_client_id' ) ),
'collectorEndpoint' => get_sophi_settings( 'collector_url' ),
'linkedDomains' => [ get_domain() ],
'noConfigFile' => true,
'plugin' => [
'adblock' => false,
'private' => false,
Expand Down
2 changes: 0 additions & 2 deletions includes/functions/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* @return string Breadcrumbs.
*/
function get_breadcrumb() {
global $wp;

if ( is_front_page() ) {
return 'homepage';
}
Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Sophi for WordPress ===
=== Sophi ===
Contributors: 10up
Tags: Sophi, Site Automation, Collector, AI, Artifical Intelligence, ML, Machine Learning, Content Curation
Requires at least: 5.6
Tested up to: 5.6
Tested up to: 5.7
Requires PHP: 7.4
Stable tag: 1.0.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -193,5 +193,11 @@ The same [Privacy & Terms that govern The Globe and Mail](https://www.theglobean

== Changelog ==

= 1.0.1 =
* **Added:** `noConfigFile` setting (props [@dinhtungdu](https://profiles.wordpress.org/dinhtungdu/)).
* **Added:** GitHub Actions to deploy releases and update readme/asset changes for WordPress.org (props [@jeffpaul](https://profiles.wordpress.org/jeffpaul/), [@dinhtungdu](https://profiles.wordpress.org/dinhtungdu/)).
* **Changed:** Renamed plugin from `Sophi for WordPress` to `Sophi` (props [@jeffpaul](https://profiles.wordpress.org/jeffpaul/)).
* **Fixed:** Minor fixes from WordPress VIP code scan (props [@dkotter](https://profiles.wordpress.org/dkotter/)).

= 1.0.0 =
* Initial public release! 🎉
10 changes: 7 additions & 3 deletions sophi-for-wordpress.php → sophi.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Plugin Name: Sophi for WordPress
* Plugin Name: Sophi
* Plugin URI: https://github.com/globeandmail/sophi-for-wordpress
* Description: WordPress VIP-compatible plugin for the Sophi.io Site Automation service.
* Version: 1.0.0
* Version: 1.0.1
* Requires at least: 5.6
* Requires PHP: 7.4
* Author: 10up
Expand All @@ -17,11 +17,13 @@
*/

// Useful global constants.
define( 'SOPHI_WP_VERSION', '1.0.0' );
define( 'SOPHI_WP_VERSION', '1.0.1' );
define( 'SOPHI_WP_URL', plugin_dir_url( __FILE__ ) );
define( 'SOPHI_WP_PATH', plugin_dir_path( __FILE__ ) );
define( 'SOPHI_WP_INC', SOPHI_WP_PATH . 'includes/' );

// phpcs:disable WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant

// Require Composer autoloader if it exists.
if ( file_exists( SOPHI_WP_PATH . 'vendor/autoload.php' ) ) {
require_once SOPHI_WP_PATH . 'vendor/autoload.php';
Expand All @@ -35,6 +37,8 @@
require_once SOPHI_WP_INC . 'functions/content-sync.php';
require_once SOPHI_WP_INC . 'functions/blocks.php';

// phpcs:enable WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant

// Activation/Deactivation.
register_activation_hook( __FILE__, '\SophiWP\Core\activate' );
register_deactivation_hook( __FILE__, '\SophiWP\Core\deactivate' );
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit7e6cfe6632ef312ed1530dcd38369377::getLoader();
return ComposerAutoloaderInitdc2afe3aa376433502dbc3d418e32b47::getLoader();
8 changes: 4 additions & 4 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => 'd99d5ef7d4e48a1afbaa15208c026d43f5523b77',
'name' => 'globeandmail/sophi-wp',
'reference' => '8174865f2273bec9abdf191242851a67cf11d378',
'name' => 'globeandmail/sophi-for-wordpress',
),
'versions' =>
array (
Expand All @@ -44,14 +44,14 @@ class InstalledVersions
),
'reference' => 'dff976c2f3487d42c1db75a3b180e2b9f0e72ce0',
),
'globeandmail/sophi-wp' =>
'globeandmail/sophi-for-wordpress' =>
array (
'pretty_version' => 'dev-trunk',
'version' => 'dev-trunk',
'aliases' =>
array (
),
'reference' => 'd99d5ef7d4e48a1afbaa15208c026d43f5523b77',
'reference' => '8174865f2273bec9abdf191242851a67cf11d378',
),
'ramsey/collection' =>
array (
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit7e6cfe6632ef312ed1530dcd38369377
class ComposerAutoloaderInitdc2afe3aa376433502dbc3d418e32b47
{
private static $loader;

Expand All @@ -24,15 +24,15 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit7e6cfe6632ef312ed1530dcd38369377', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitdc2afe3aa376433502dbc3d418e32b47', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit7e6cfe6632ef312ed1530dcd38369377', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitdc2afe3aa376433502dbc3d418e32b47', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
Expand All @@ -53,19 +53,19 @@ public static function getLoader()
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire7e6cfe6632ef312ed1530dcd38369377($fileIdentifier, $file);
composerRequiredc2afe3aa376433502dbc3d418e32b47($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequire7e6cfe6632ef312ed1530dcd38369377($fileIdentifier, $file)
function composerRequiredc2afe3aa376433502dbc3d418e32b47($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377
class ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
Expand Down Expand Up @@ -63,9 +63,9 @@ class ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7e6cfe6632ef312ed1530dcd38369377::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitdc2afe3aa376433502dbc3d418e32b47::$classMap;

}, null, ClassLoader::class);
}
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
'aliases' =>
array (
),
'reference' => 'd99d5ef7d4e48a1afbaa15208c026d43f5523b77',
'name' => 'globeandmail/sophi-wp',
'reference' => '8174865f2273bec9abdf191242851a67cf11d378',
'name' => 'globeandmail/sophi-for-wordpress',
),
'versions' =>
array (
Expand All @@ -20,14 +20,14 @@
),
'reference' => 'dff976c2f3487d42c1db75a3b180e2b9f0e72ce0',
),
'globeandmail/sophi-wp' =>
'globeandmail/sophi-for-wordpress' =>
array (
'pretty_version' => 'dev-trunk',
'version' => 'dev-trunk',
'aliases' =>
array (
),
'reference' => 'd99d5ef7d4e48a1afbaa15208c026d43f5523b77',
'reference' => '8174865f2273bec9abdf191242851a67cf11d378',
),
'ramsey/collection' =>
array (
Expand Down

0 comments on commit d8ce8cc

Please sign in to comment.