Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/php-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ jobs:
with:
composer-options: --prefer-dist --no-progress

- name: Run PHPCS
run: composer run cs

- name: Setup wp-env
run: wp-env start
env:
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wp }}

# Commented out until we finish linting all the files
# - name: Run PHPCS diff tests
# run: bash bin/phpcs-diff.sh

- name: Run PHPUnit tests (single site)
run: composer integration

Expand Down
673 changes: 300 additions & 373 deletions modules/custom-status/custom-status.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/custom-status/lib/custom-status-configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@

jQuery( document ).ready( function () {
jQuery( '.delete-status a' ).on( 'click', function () {
if ( ! confirm( ef_confirm_delete_status_string ) ) {
if ( ! confirm( __ef_localize_custom_status_configure.delete_status_string ) ) {
return false;
}
} );
Expand Down
64 changes: 64 additions & 0 deletions modules/custom-status/views/configure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

defined( 'ABSPATH' ) || exit();

// phpcs:disable:WordPress.Security.NonceVerification.Missing -- Disabling nonce verification because that is not available here, it's just rendering it. The actual save is done in helper_settings_validate_and_save and that's guarded well.

global $edit_flow;

?>

<div id="col-right">
<div class="col-wrap">
<?php $custom_status_list_table->display(); ?>
<?php wp_nonce_field( 'custom-status-sortable', 'custom-status-sortable' ); ?>
<p class="description" style="padding-top:10px;"><?php esc_html_e( 'Deleting a post status will assign all posts to the default post status.', 'edit-flow' ); ?></p>
</div>
</div>

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3 class="nav-tab-wrapper">
<?php $add_new_nav_class = empty( $action ) ? 'nav-tab-active' : ''; ?>
<a href="<?php echo esc_url( $this->get_link() ); ?>" class="nav-tab <?php echo esc_attr( $add_new_nav_class ); ?>"><?php esc_html_e( 'Add New', 'edit-flow' ); ?></a>
<?php $options_nav_class = 'change-options' === $action ? 'nav-tab-active' : ''; ?>
<a href="<?php echo esc_url( $this->get_link( array( 'action' => 'change-options' ) ) ); ?>" class="nav-tab <?php echo esc_attr( $options_nav_class ); ?>"><?php esc_html_e( 'Options', 'edit-flow' ); ?></a>
</h3>

<?php if ( 'change-options' === $action ) { ?>
<form class="basic-settings" action="<?php echo esc_url( $this->get_link( array( 'action' => 'change-options' ) ) ); ?>" method="post">
<?php settings_fields( $this->module->options_group_name ); ?>
<?php do_settings_sections( $this->module->options_group_name ); ?>
<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="<?php echo esc_attr( $this->module->name ); ?>" />
<?php submit_button(); ?>
</form>
<?php } else { ?>
<!-- Custom form for adding a new Custom Status term -->
<form class="add:the-list:" action="<?php echo esc_url( $this->get_link() ); ?>" method="post" id="addstatus" name="addstatus">
<div class="form-field form-required">
<label for="status_name"><?php esc_html_e( 'Name', 'edit-flow' ); ?></label>
<input type="text" aria-required="true" size="20" maxlength="20" id="status_name" name="status_name" value="<?php echo ( empty( $_POST['status_name'] ) ? '' : esc_attr( $_POST['status_name'] ) ); ?>" />
<?php $edit_flow->settings->helper_print_error_or_description( 'name', __( 'The name is used to identify the status. (Max: 20 characters)', 'edit-flow' ) ); ?>
</div>

<div class="form-field">
<label for="status_description"><?php esc_html_e( 'Description', 'edit-flow' ); ?></label>
<textarea cols="40" rows="5" id="status_description" name="status_description"><?php echo ( empty( $_POST['status_description'] ) ? '' : esc_textarea( $_POST['status_description'] ) ); ?></textarea>
<?php $edit_flow->settings->helper_print_error_or_description( 'description', __( 'The description is primarily for administrative use, to give you some context on what the custom status is to be used for.', 'edit-flow' ) ); ?>
</div>

<?php wp_nonce_field( 'custom-status-add-nonce' ); ?>
<input id="action" name="action" type="hidden" value="add-new" />
<p class="submit"><?php submit_button( __( 'Add New Status', 'edit-flow' ), 'primary', 'submit', false ); ?><a class="cancel-settings-link" href="<?php echo esc_url( EDIT_FLOW_SETTINGS_PAGE ); ?>"><?php esc_html_e( 'Back to Edit Flow', 'edit-flow' ); ?></a></p>
</form>
<?php } ?>
</div>
</div>
</div>

<?php

// phpcs:enable:WordPress.Security.NonceVerification.Missing

$custom_status_list_table->inline_edit();
47 changes: 47 additions & 0 deletions modules/custom-status/views/edit-status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

defined( 'ABSPATH' ) || exit();

global $edit_flow;

?>

<div id="ajax-response"></div>

<form method="post" action="<?php echo esc_url( $edit_status_link ); ?>" >
<input type="hidden" name="term-id" value="<?php echo esc_attr( $term_id ); ?>" />

<?php
wp_original_referer_field();
wp_nonce_field( 'edit-status' );
?>

<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php esc_html_e( 'Custom Status', 'edit-flow' ); ?></label></th>
<?php $readonly_attr = 'draft' === $custom_status->slug ? 'readonly="readonly"' : ''; ?>
<td><input name="name" id="name" type="text" value="<?php echo esc_attr( $name ); ?>" size="40" aria-required="true" <?php echo esc_attr( $readonly_attr ); ?> />
<?php $edit_flow->settings->helper_print_error_or_description( 'name', __( 'The name is used to identify the status. (Max: 20 characters)', 'edit-flow' ) ); ?>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><?php esc_html_e( 'Slug', 'edit-flow' ); ?></th>
<td>
<input type="text" disabled="disabled" value="<?php echo esc_attr( $custom_status->slug ); ?>" />
<?php $edit_flow->settings->helper_print_error_or_description( 'slug', __( 'The slug is the unique ID for the status and is changed when the name is changed.', 'edit-flow' ) ); ?>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="description"><?php esc_html_e( 'Description', 'edit-flow' ); ?></label></th>
<td>
<textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_textarea( $description ); ?></textarea>
<?php $edit_flow->settings->helper_print_error_or_description( 'description', __( 'The description is primarily for administrative use, to give you some context on what the custom status is to be used for.', 'edit-flow' ) ); ?>
</td>
</tr>
</table>

<p class="submit">
<?php submit_button( __( 'Update Status', 'edit-flow' ), 'primary', 'submit', false ); ?>
<a class="cancel-settings-link" href="<?php echo esc_url( $this->get_link() ); ?>"><?php esc_html_e( 'Cancel', 'edit-flow' ); ?></a>
</p>
</form>
2 changes: 1 addition & 1 deletion modules/editorial-metadata/editorial-metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ public function print_configure_view() {
" method="post">
<?php settings_fields( $this->module->options_group_name ); ?>
<?php do_settings_sections( $this->module->options_group_name ); ?>
<?php echo '<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="' . esc_attr( $this->module->name ) . '" />'; ?>
<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="<?php echo esc_attr( $this->module->name ); ?>" />
<?php submit_button(); ?>
</form>
<?php else : ?>
Expand Down
14 changes: 2 additions & 12 deletions modules/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,10 @@ public function print_default_header( $current_module ) {
<div class="wrap edit-flow-admin">
<?php if ( 'settings' != $current_module->name ) : ?>
<?php echo wp_kses_post( $page_icon ); ?>
<h2><a href="<?php echo esc_url( EDIT_FLOW_SETTINGS_PAGE ); ?>"><?php _e( 'Edit Flow', 'edit-flow' ); ?></a>:&nbsp;<?php echo esc_attr( $current_module->title ); ?>
<?php
if ( isset( $display_text ) ) {
echo wp_kses_post( $display_text ); }
?>
</h2>
<h2><a href="<?php echo esc_url( EDIT_FLOW_SETTINGS_PAGE ); ?>"><?php _e( 'Edit Flow', 'edit-flow' ); ?></a>:&nbsp;<?php echo esc_attr( $current_module->title ); ?><?php echo ( isset( $display_text ) ? wp_kses_post( $display_text ) : '' ); ?></h2>
<?php else : ?>
<?php echo wp_kses_post( $page_icon ); ?>
<h2><?php _e( 'Edit Flow', 'edit-flow' ); ?>
<?php
if ( isset( $display_text ) ) {
echo wp_kses_post( $display_text ); }
?>
</h2>
<h2><?php _e( 'Edit Flow', 'edit-flow' ); ?><?php echo ( isset( $display_text ) ? wp_kses_post( $display_text ) : '' ); ?></h2>
<?php endif; ?>

<div class="explanation">
Expand Down
4 changes: 2 additions & 2 deletions modules/user-groups/user-groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public function print_configure_view() {
<form class="basic-settings" action="<?php echo esc_url( $this->get_link( array( 'action' => 'change-options' ) ) ); ?>" method="post">
<?php settings_fields( $this->module->options_group_name ); ?>
<?php do_settings_sections( $this->module->options_group_name ); ?>
<?php echo '<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="' . esc_attr( $this->module->name ) . '" />'; ?>
<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="<?php echo esc_attr( $this->module->name ); ?>" />
<?php submit_button(); ?>
</form>
<?php else : ?>
Expand All @@ -665,7 +665,7 @@ public function print_configure_view() {
<?php $edit_flow->settings->helper_print_error_or_description( 'description', __( 'The description is primarily for administrative use, to give you some context on what the user group is to be used for.', 'edit-flow' ) ); ?>
</div>
<?php wp_nonce_field( 'add-usergroup' ); ?>
<?php echo '<input id="form-action" name="form-action" type="hidden" value="add-usergroup" />'; ?>
<input id="form-action" name="form-action" type="hidden" value="add-usergroup" />
<p class="submit"><?php submit_button( __( 'Add New User Group', 'edit-flow' ), 'primary', 'submit', false ); ?><a class="cancel-settings-link" href="<?php echo esc_url( EDIT_FLOW_SETTINGS_PAGE ); ?>"><?php _e( 'Back to Edit Flow', 'edit-flow' ); ?></a></p>
</form>
<?php endif; ?>
Expand Down