Skip to content
Draft
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
18 changes: 1 addition & 17 deletions .buildkite/pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -eu
echo "steps:"

phpVersions=('7.4')
wpVersions=('5.9' 'latest')
wpVersions=('latest')

# Exclude combinations with <php version>-<wp version>
exclusions=('7.3-4.9.15' '7.4-4.9.15' '7.4-5.0.10' '7.4-5.1.6' '7.4-5.2.7')
Expand Down Expand Up @@ -37,19 +37,3 @@ for phpVersion in ${phpVersions[@]}; do
echo " run: wordpress"
done
done

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \""$phpVersion"\""
echo " TEST_WP_VERSION: "$wpVersion""
echo " WP_MULTISITE: \"1\""
echo " label: 'PHP: "$phpVersion" | WP: "$wpVersion" | Multisite: Yes'"
echo " plugins:"
echo " - docker-compose#v3.7.0:"
echo " config: docker-compose-phpunit.yml"
echo " env:"
echo " - WP_MULTISITE"
echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " run: wordpress"
38 changes: 35 additions & 3 deletions commercestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,44 @@

const CS_FEATURE_VARIABLE_PRICE = true;
const CS_FEATURE_MARKETING = false;
const CS_DEFAULT_SLUG = 'products'; // Override with the CS_SLUG constant
const CS_DEFAULT_SLUG = 'store'; // Override with the CS_SLUG constant

// @todo replace hardcoding of post_type and taxonomies with the following constants all throughout the codebase
const CS_POST_TYPE = 'download';
const CS_ICON = 'download'; // Change the reports icon here

const CS_POST_TYPE = 'infoproduct'; // 'download'
const CS_TAG_TYPE = CS_POST_TYPE . '_tag';
const CS_CAT_TYPE = CS_POST_TYPE . '_category';
const CS_LOG_TYPE = 'cs_log_type';

// Custom Post Types - Not fully implemented across the board
const CS_PRODUCT_CPT = CS_POST_TYPE;
const CS_PAYMENT_CPT = 'cs_payment';
const CS_DISCOUNT_CPT = 'cs_discount';
const CS_LOG_CPT = 'cs_log';


const CS_QUERY_VAR = CS_POST_TYPE; // 'download';

// Tease out the word 'download' that is used in different contexts.
// search and replace back during build?
const CS_EX_ADMIN_PAGE = 'download';
const CS_EX_DOWNLOAD_ADMIN_PAGE = 'download';

const CS_EX_DOWNLOAD_CSS_CLASS = 'download';
const CS_EX_DOWNLOAD_SHORTCODE = 'download';
const CS_EX_DOWNLOAD_ITEM = 'download';
const CS_EX_DOWNLOAD_ARGS = 'download';
const CS_EX_DOWNLOAD_MESSAGES = 'download';
const CS_EX_DOWNLOAD_MESSAGES_TYPE = 'download';

class CSFilter {
const CATEGORY_ARGS = 'cs_' . CS_CAT_TYPE . '_args';
const CATEGORY_LABELS = 'cs_' . CS_CAT_TYPE . '_labels';

const TAG_ARGS = 'cs_' . CS_TAG_TYPE . '_args';
const TAG_LABELS = 'cs_' . CS_TAG_TYPE . '_labels';
}


const CS_BASE_PLUGIN = __FILE__;

Expand Down
24 changes: 12 additions & 12 deletions includes/admin/admin-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function cs_products_tabs( $views ) {

return $views;
}
add_filter( 'views_edit-download', 'cs_products_tabs', 10, 1 );
add_filter( 'views_edit-' . CS_POST_TYPE, 'cs_products_tabs', 10, 1 );

/**
* When the Download list table loads, call the function to view our tabs.
Expand All @@ -63,7 +63,7 @@ function cs_taxonomies_tabs() {

// Get taxonomies
$taxonomy = sanitize_key( $_GET['taxonomy'] );
$taxonomies = get_object_taxonomies( 'download' );
$taxonomies = get_object_taxonomies( CS_POST_TYPE );

// Bail if current taxonomy is not a download taxonomy
if ( ! in_array( $taxonomy, $taxonomies, true ) ) {
Expand All @@ -85,7 +85,7 @@ function cs_taxonomies_tabs() {
function cs_admin_adjust_submenus() {

// Get taxonomies
$taxonomies = get_object_taxonomies( 'download' );
$taxonomies = get_object_taxonomies( CS_POST_TYPE );

// Bail if no taxonomies
if ( empty( $taxonomies ) ) {
Expand All @@ -94,11 +94,11 @@ function cs_admin_adjust_submenus() {

// Loop through each taxonomy and remove the menu
foreach ( $taxonomies as $taxonomy ) {
remove_submenu_page( 'edit.php?post_type=download', 'edit-tags.php?taxonomy=' . $taxonomy . '&amp;post_type=download' );
remove_submenu_page( 'edit.php?post_type=' . CS_POST_TYPE, 'edit-tags.php?taxonomy=' . $taxonomy . '&amp;post_type=' . CS_POST_TYPE );
}

// Remove the "Add New" link for downloads
remove_submenu_page( 'edit.php?post_type=download', 'post-new.php?post_type=download' );
remove_submenu_page( 'edit.php?post_type=' . CS_POST_TYPE, 'post-new.php?post_type=' . CS_POST_TYPE);
}
add_action( 'admin_menu', 'cs_admin_adjust_submenus', 999 );

Expand All @@ -123,15 +123,15 @@ function cs_taxonomies_modify_menu_highlight() {

// Get taxonomies
$taxonomy = sanitize_key( $_GET['taxonomy'] );
$taxonomies = get_object_taxonomies( 'download' );
$taxonomies = get_object_taxonomies( CS_POST_TYPE );

// Bail if current taxonomy is not a download taxonomy
if ( ! in_array( $taxonomy, $taxonomies, true ) ) {
return;
}

// Force the submenu file
$submenu_file = 'edit.php?post_type=download';
$submenu_file = 'edit.php?post_type=' . CS_POST_TYPE;
}
add_filter( 'admin_head', 'cs_taxonomies_modify_menu_highlight', 9999 );

Expand All @@ -154,13 +154,13 @@ function cs_add_new_modify_menu_highlight() {
// Get post_type
$post_type = sanitize_key( $_GET['post_type'] );

// Bail if current post type is not download
if ( 'download' !== $post_type ) {
// Bail if current post type is not ours
if ( CS_POST_TYPE !== $post_type ) {
return;
}

// Force the submenu file
$submenu_file = 'edit.php?post_type=download';
$submenu_file = 'edit.php?post_type=' . CS_POST_TYPE;
}
add_filter( 'admin_head', 'cs_add_new_modify_menu_highlight', 9999 );

Expand All @@ -180,13 +180,13 @@ function cs_display_product_tabs() {
);

// Get taxonomies
$taxonomies = get_object_taxonomies( 'download', 'objects' );
$taxonomies = get_object_taxonomies( CS_POST_TYPE, 'objects' );
foreach ( $taxonomies as $tax => $details ) {
$tabs[ $tax ] = array(
'name' => $details->labels->menu_name,
'url' => add_query_arg( array(
'taxonomy' => $tax,
'post_type' => 'download'
'post_type' => CS_POST_TYPE
), admin_url( 'edit-tags.php' ) )
);
}
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/admin-deprecated-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function cs_tools_banned_emails_display() {
<div class="inside">
<p><?php _e( 'Emails placed in the box below will not be allowed to make purchases.', 'commercestore' ); ?></p>
<form method="post"
action="<?php echo admin_url( 'edit.php?post_type=download&page=cs-tools&tab=general' ); ?>">
action="<?php echo admin_url( 'edit.php?post_type=' . CS_POST_TYPE . '&page=cs-tools&tab=general' ); ?>">
<p>
<textarea name="banned_emails" rows="10"
class="large-text"><?php echo implode( "\n", cs_get_banned_emails() ); ?></textarea>
Expand Down Expand Up @@ -69,7 +69,7 @@ function cs_trigger_purchase_delete( $data ) {

cs_delete_purchase( $payment_id );

cs_redirect( admin_url( '/edit.php?post_type=download&page=cs-payment-history&cs-message=payment_deleted' ) );
cs_redirect( admin_url( '/edit.php?post_type=' . CS_POST_TYPE . '&page=cs-payment-history&cs-message=payment_deleted' ) );
}
}
add_action( 'cs_delete_payment', 'cs_trigger_purchase_delete' );
2 changes: 1 addition & 1 deletion includes/admin/admin-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
function cs_admin_rate_us( $footer_text ) {
global $typenow;

if ( $typenow == 'download' ) {
if ( $typenow == CS_POST_TYPE ) {
$rate_text = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">CommerceStore</a>! Please <a href="%2$s" target="_blank">rate us on WordPress.org</a>', 'commercestore' ),
'https://commercestore.com',
'https://wordpress.org/support/plugin/commercestore/reviews/?rate=5#new-post'
Expand Down
Loading