Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@bf36ec7 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Feb 8, 2024
1 parent b16e092 commit c4bf415
Show file tree
Hide file tree
Showing 42 changed files with 2,399 additions and 2,434 deletions.
1 change: 1 addition & 0 deletions includes/class-platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private function register_modules() {
new Block_Area_Modules( $this->get_version(), $this->get_loader() );
new Block_Editor( $this->get_version(), $this->get_loader() );
new Block_Utils\JS_Utils_Loader( $this->get_version(), $this->get_loader() );

new Convert_To_Blocks( $this->get_version(), $this->get_loader() );
new Courses( $this->get_version(), $this->get_loader() );
new Datasets( $this->get_version(), $this->get_loader() );
Expand Down
9 changes: 6 additions & 3 deletions includes/class-prc-platform-activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

class PRC_Platform_Activator {
public static function activate() {
// I want to update some options here possibly...
// I want to ensure some network settings are set like maximum file size and etc....
flush_rewrite_rules();
require_once plugin_dir_path(__FILE__) . 'class-prc-platform-content-bootstrapper.php';

wp_mail(
DEFAULT_TECHNICAL_CONTACT,
'PRC Platform Activated 🚀',
'The PRC Platform has been activated on ' . get_site_url()
);

$bootstrapper = new PRC_Platform_Content_Bootstrapper();
$bootstrapper->run();

flush_rewrite_rules();
}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,20 @@
<?php
namespace PRC\Platform;
use WP_Error;

/**
* Bootstraps content for PRC Platform development, if no data is present.
*/
class Content_Bootstrapper {
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;

public static $handle = 'prc-platform-content-boostrapper';

/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $version, $loader ) {
$this->version = $version;
$this->init($loader);
}

public function init( $loader = null ) {
if ( !PRC_PLATFORM_TESTING_MODE ) {
return;
}
if ( null !== $loader ) {
// $loader->add_action('', $this, 'my_func');
// $loader->add_filter('', $this, 'my_func');
}
class PRC_Platform_Content_Bootstrapper {
public $option_name;

public function __construct() {
$this->option_name = 'prc_platform_content_bootstrapped';
}

// Get the id of the first post of a given post type.
// if the ID is 1, then we know that the post type is empty so update_option( 'prc_platform_content_bootstrapped', true ); and return true, otherwise return false. check for the option first, if it's true, then return true.
public function detect_lack_of_content() {
$option = get_option( 'prc_platform_content_bootstrapped' );
$option = get_option( $this->option_name );
if ( true === $option ) {
return true;
}
Expand All @@ -59,10 +31,19 @@ public function detect_lack_of_content() {
return false;
}

public function bootstrap_content() {
public function run() {
if ( !PRC_PLATFORM_TESTING_MODE ) {
return;
}
$already_bootstrapped = get_option( $this->option_name );
if ( $already_bootstrapped || true !== $this->detect_lack_of_content() ) {
return;
}
$this->create_sample_topics();
$this->create_sample_report();
$this->create_sample_fact_sheet();
$this->configure_sample_options();

}

public function create_sample_topics() {
Expand Down Expand Up @@ -156,6 +137,8 @@ public function create_sample_block_module() {
}

public function configure_sample_options() {

$tagline = 'Numbers, Facts and Trends Shaping Your World';
update_option( 'blogdescription', $tagline );
update_option( self::$option_name, true );
}
}
11 changes: 0 additions & 11 deletions includes/content-bootstrapper/.package.json.template

This file was deleted.

6 changes: 3 additions & 3 deletions includes/facets/blocks/facet-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"homepage": "https://github.com/pewresearch/pewresearch-org/blob/main/plugins/prc-platform-core/includes/facets/",
"main": "build/index.js",
"scripts": {
"build": "wp-scripts build",
"build": "wp-scripts build --experimental-modules",
"start": "wp-scripts start --experimental-modules",
"format": "wp-scripts format",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "wp-scripts plugin-zip",
"start": "wp-scripts start"
"plugin-zip": "wp-scripts plugin-zip"
},
"devDependencies": {
"@wordpress/scripts": "^26.16.0"
Expand Down
4 changes: 2 additions & 2 deletions includes/facets/blocks/facets-context-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@wordpress/scripts": "^26.16.0"
},
"scripts": {
"build": "wp-scripts build",
"start": "wp-scripts start",
"build": "wp-scripts build --experimental-modules",
"start": "wp-scripts start --experimental-modules",
"test": "wp-scripts test-unit"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions includes/facets/blocks/selected-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"homepage": "https://github.com/pewresearch/pewresearch-org/blob/main/plugins/prc-platform-core/includes/facets/",
"main": "build/index.js",
"scripts": {
"build": "wp-scripts build",
"build": "wp-scripts build --experimental-modules",
"start": "wp-scripts start --experimental-modules",
"format": "wp-scripts format",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "wp-scripts plugin-zip",
"start": "wp-scripts start"
"plugin-zip": "wp-scripts plugin-zip"
},
"devDependencies": {
"@wordpress/scripts": "^26.16.0"
Expand Down
3 changes: 3 additions & 0 deletions includes/facets/cache/WIP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Facets Cache

This needs to be reworked for the multisite collapse
Loading

0 comments on commit c4bf415

Please sign in to comment.