first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
/**
* Interface for Batch Exporter
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Promise for structuring exporters.
*
* @since 1.7.0
*/
interface PUM_Interface_Batch_Exporter {
/**
* Determines whether the current user can perform an export.
*
* @return bool Whether the current user can perform an export.
*/
public function can_export();
/**
* Handles sending appropriate headers depending on the type of export.
*
* @return void
*/
public function headers();
/**
* Retrieves the data for export.
*
* @return array[] Multi-dimensional array of data for export.
*/
public function get_data();
/**
* Performs the export process.
*
* @return void
*/
public function export();
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Interface for Batch Importer
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Promise for structuring importers.
*
* @since 1.7.0
*/
interface PUM_Interface_Batch_Importer {
/**
* Determines whether the current user can perform an import.
*
* @return bool Whether the current user can perform an import.
*/
public function can_import();
/**
* Prepares the data for import.
*
* @return array[] Multi-dimensional array of data for import.
*/
public function get_data();
/**
* Performs the import process.
*
* @return void
*/
public function import();
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Interface for Batch PrefetchProcess
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Second-level interface for registering a batch process that leverages
* pre-fetch and data storage.
*
* @since 1.7.0
*/
interface PUM_Interface_Batch_PrefetchProcess extends PUM_Interface_Batch_Process {
/**
* Initializes the batch process.
*
* This is the point where any relevant data should be initialized for use by the processor methods.
*
* @param null|mixed $data
*
* @return void
*/
public function init( $data = null );
/**
* Pre-fetches data to speed up processing.
*/
public function pre_fetch();
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Interface for Batch Process
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Base interface for registering a batch process.
*
* @since 1.7.0
*/
interface PUM_Interface_Batch_Process {
/**
* Determines if the current user can perform the current batch process.
*
* @return bool True if the current user has the needed capability, otherwise false.
*/
public function can_process();
/**
* Processes a single step (batch).
*
* @return int|string|WP_Error Next step number, 'done', or a WP_Error object.
*/
public function process_step();
/**
* Retrieves the calculated completion percentage.
*
* @return int Percentage completed.
*/
public function get_percentage_complete();
/**
* Retrieves a message based on the given message code.
*
* @param string $code Message code.
*
* @return string Message.
*/
public function get_message( $code );
/**
* Defines logic to execute once batch processing is complete.
*/
public function finish();
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* Interface for CSV Exporter
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Promise for structuring CSV exporters.
*
* @since 1.7.0
*/
interface PUM_Interface_CSV_Exporter extends PUM_Interface_Batch_Exporter {
/**
* Sets the CSV columns.
*
* @return array<string,string> CSV columns.
*/
public function csv_cols();
/**
* Retrieves the CSV columns array.
*
* Alias for csv_cols(), usually used to implement a filter on the return.
*
* @return array<string,string> CSV columns.
*/
public function get_csv_cols();
/**
* Outputs the CSV columns.
*
* @return void
*/
public function csv_cols_out();
/**
* Outputs the CSV rows.
*
* @return void
*/
public function csv_rows_out();
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* Interface for CSV Importer
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Promise for structuring CSV importers.
*
* @since 1.7.0
*
* @see PUM_Interface_Batch_Importer
*/
interface PUM_Interface_CSV_Importer extends PUM_Interface_Batch_Importer {
/**
* Maps CSV columns to their corresponding import fields.
*
* @param array $import_fields Import fields to map.
*/
public function map_fields( $import_fields = [] );
/**
* Retrieves the CSV columns.
*
* @return array The columns in the CSV.
*/
public function get_columns();
/**
* Maps a single CSV row to the data passed in via init().
*
* @param array $csv_row CSV row data.
*
* @return array CSV row data mapped to form-defined arguments.
*/
public function map_row( $csv_row );
/**
* Retrieves the first row of the CSV.
*
* This is used for showing an example of what the import will look like.
*
* @return array The first row after the header of the CSV.
*/
public function get_first_row();
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* Interface for Integration
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
interface PUM_Interface_Integration {
/**
* @return string
*/
public function label();
/**
* @return bool
*/
public function enabled();
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Interface for Form Integration
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
interface PUM_Interface_Integration_Form extends PUM_Interface_Integration {
/**
* @return array
*/
public function get_forms();
/**
* @param string $id
*
* @return mixed
*/
public function get_form( $id );
/**
* @return array
*/
public function get_form_selectlist();
/**
* @param array $js
*
* @return array
*/
public function custom_scripts( $js = [] );
/**
* @param array $css
*
* @return array
*/
public function custom_styles( $css = [] );
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* Interface for Settings Integration
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
interface PUM_Interface_Integration_Settings extends PUM_Interface_Integration {
/**
* @param array $fields
*
* @return array
*/
public function append_fields( $fields = [] );
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* Interface for Provider
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Interface PUM_Interface_Provider
*
* @since 1.7.0
*/
interface PUM_Interface_Provider {
/**
* Determines whether to load this providers fields in the shortcode editor among other things.
*
* @return bool
*/
public function enabled();
/**
* Contains each providers unique global settings.
*
* @return array
*/
public function register_settings();
/**
* Contains each providers unique global settings tab sections..
*
* @param array $sections
*
* @return array
*/
public function register_settings_tab_section( $sections = [] );
/**
* Creates the inputs for each of the needed extra fields for the email provider
*
* @param $shortcode_atts
*/
public function render_fields( $shortcode_atts );
/**
* Allows processing of form value sanitization.
*
* @param array $values
*
* @return array $values
*/
public function form_sanitization( $values = [] );
/**
* Allows processing of form value validation.
*
* @param WP_Error $errors
* @param array $values
*
* @return WP_Error
*/
public function form_validation( WP_Error $errors, $values = [] );
/**
* Subscribes the user to the list.
*
* @param $values
* @param array $json_response
* @param WP_Error $errors
*/
public function form_submission( $values, &$json_response, WP_Error &$errors );
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Interface for Repository
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Interface PUM_Interface_Repository
*
* Interface between WP_Query and our data needs. Essentially a query factory.
*
* @package ForumWP\Interfaces
*/
interface PUM_Interface_Repository {
/**
* @param int $id
*
* @return WP_Post|PUM_Abstract_Model_Post
*/
public function get_item( $id );
/**
* @param int $id
*
* @return bool
*/
public function has_item( $id );
/**
* @param array $args
*
* @return WP_Post[||PUM_Abstract_Model_Post[]
*/
public function get_items( $args = [] );
/**
* @param array $data
*
* @return WP_Post|PUM_Abstract_Model_Post
*/
public function create_item( $data );
/**
* @param int $id
* @param array $data
*
* @return WP_Post|PUM_Abstract_Model_Post
*/
public function update_item( $id, $data );
/**
* @param int $id
*
* @return bool
*/
public function delete_item( $id );
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Interface for Posts Upgrade
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Second-level interface for registering a batch process that leverages
* pre-fetch and data storage.
*
* @since 1.7.0
*/
interface PUM_Interface_Upgrade_Posts extends PUM_Interface_Batch_PrefetchProcess {
/**
* Used to filter popup query based on conditional info.
*
* @return array Returns an array of popup post type query args for this upgrade.
*/
public function custom_query_args();
}