Skip to content

Commit

Permalink
=> MarketPress
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Jun 16, 2024
1 parent b823207 commit 5ecb8c9
Show file tree
Hide file tree
Showing 24 changed files with 263 additions and 263 deletions.
2 changes: 1 addition & 1 deletion admin/class-courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function header_columns( $columns ) {
/**
* Paid column is needed?
*/
if ( ! BrainPress_Helper_Integration_PSeCommerce::$is_active && ! BrainPress_Helper_Integration_WooCommerce::$is_active ) {
if ( ! BrainPress_Helper_Integration_MarketPress::$is_active && ! BrainPress_Helper_Integration_WooCommerce::$is_active ) {
unset( $columns['paid'] );
}

Expand Down
18 changes: 9 additions & 9 deletions admin/class-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,14 @@ public static function step_6() {
*/
$is_payment_available = false;
$filters_to_check = array(
'brainpress_is_psecommerce_active',
'brainpress_is_marketpress_active',
'brainpress_is_woocommerce_active',
);
foreach ( $filters_to_check as $filter ) {
if ( $is_payment_available ) {
continue;
}
$is_payment_available = apply_filters( 'brainpress_is_psecommerce_active', $is_payment_available );
$is_payment_available = apply_filters( 'brainpress_is_marketpress_active', $is_payment_available );
}
if ( ! $is_payment_available ) {
$disable_payment = false;
Expand All @@ -600,7 +600,7 @@ public static function step_6() {
$is_paid_course = ! empty( self::$settings['payment_paid_course'] );
//$data_course = new BrainPress_Data_Course();
$data_instructor = new BrainPress_Data_Instructor();
$mp_class = new Brainpress_Helper_Extension_PSeCommerce();
$mp_class = new Brainpress_Helper_Extension_MarketPress();
$utility_class = new BrainPress_Helper_Utility();

$install_url = add_query_arg(
Expand All @@ -615,25 +615,25 @@ public static function step_6() {
array(
'post_type' => self::$post_type,
'page' => 'brainpress_settings',
'tab' => 'psecommerce',
'tab' => 'marketpress',
),
admin_url( 'edit.php' )
);

$install_message = __( 'Bitte wende Dich an Deinen Administrator, um PSeCommerce für Deine Seite zu aktivieren.', 'brainpress' );
$install_message = __( 'Bitte wende Dich an Deinen Administrator, um MarketPress für Deine Seite zu aktivieren.', 'brainpress' );
$install_message2 = '';
$installed = $mp_class->installed();

if ( current_user_can( 'install_plugins' ) || current_user_can( 'activate_plugins ' ) ) {
$install_message = __( 'Um mit dem Verkauf Deines Kurses zu beginnen, bitte <a href="%s">Installiere und aktiviere PSeCommerce</a>.', 'brainpress' );
$install_message = __( 'Um mit dem Verkauf Deines Kurses zu beginnen, bitte <a href="%s">Installiere und aktiviere MarketPress</a>.', 'brainpress' );

if ( $installed && $mp_class->activated() ) {
$install_message = __( 'Um mit dem Verkauf Deines Kurses zu beginnen, bitte <a href="%s">Setup komplettieren</a> für PSeCommerce.', 'brainpress' );
$install_message = __( 'Um mit dem Verkauf Deines Kurses zu beginnen, bitte <a href="%s">Setup komplettieren</a> für MarketPress.', 'brainpress' );
$install_url = $mp_url;
}

if ( false === $installed ) {
$install_message2 = __( 'Die Vollversion von PSeCommerce wurde mit BrainPress gebündelt.', 'brainpress' );
$install_message2 = __( 'Die Vollversion von MarketPress wurde mit BrainPress gebündelt.', 'brainpress' );
}
}
$install_message = sprintf( $install_message, esc_url_raw( $install_url ) );
Expand All @@ -644,7 +644,7 @@ public static function step_6() {
$payment_message = sprintf(
'<div class="payment-message %1$s"><h4>%2$s</h4>%3$s%4$s<p>%5$s: WooCommerce</p></div>',
esc_attr( $is_paid_course ? '' : 'hidden' ),
__( 'Verkaufe Deine Kurse online mit PSeCommerce.', 'brainpress' ),
__( 'Verkaufe Deine Kurse online mit MarketPress.', 'brainpress' ),
! empty( $install_message2 ) ? sprintf( '<p>%s</p>', $install_message2 ) : '',
! empty( $install_message ) ? sprintf( '<p>%s</p>', $install_message ) : '',
__( 'Andere unterstützte Plugins', 'brainpress' )
Expand Down
2 changes: 1 addition & 1 deletion admin/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BrainPress_Admin_Settings extends BrainPress_Admin_Controller_Menu {
'BasicCertificate',
'Shortcodes',
'Extensions',
'PSeCommerce',
'MarketPress',
'WooCommerce',
'Setup',
);
Expand Down
10 changes: 5 additions & 5 deletions asset/js/brainpress-front.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ var BrainPress = BrainPress || {};
//$( '.view-response' ).link_popup( { link_text: '<span class="dashicons dashicons-visibility"></span>' });
$( '.workbook-table .view-response' ).link_popup( { link_text: '<span class="dashicons dashicons-visibility"></span>', offset_x: -160 });
$( '.workbook-table .feedback' ).link_popup( { link_text: '<span class="dashicons dashicons-admin-comments"></span>' });
bind_psecommerce_add_to_cart_button();
bind_marketpress_add_to_cart_button();

/**
* close message
Expand Down Expand Up @@ -1020,8 +1020,8 @@ var BrainPress = BrainPress || {};
/**
* MP add to cart
*/
function bind_psecommerce_add_to_cart_button() {
if ( undefined === _brainpress.psecommerce_is_used || 'no' === _brainpress.psecommerce_is_used ) {
function bind_marketpress_add_to_cart_button() {
if ( undefined === _brainpress.marketpress_is_used || 'no' === _brainpress.marketpress_is_used ) {
return;
}
$('body.single-course button.mp_button-addcart').on( 'click', function() {
Expand All @@ -1034,8 +1034,8 @@ var BrainPress = BrainPress || {};
cart_action: 'add_item'
}
}).done( function(data) {
if ( data.success && undefined !== _brainpress.psecommerce_cart_url ) {
window.location.assign( _brainpress.psecommerce_cart_url );
if ( data.success && undefined !== _brainpress.marketpress_cart_url ) {
window.location.assign( _brainpress.marketpress_cart_url );
}
});
return false;
Expand Down
2 changes: 1 addition & 1 deletion asset/js/brainpress-front.min.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ BrainPress wird mit einem eigenen Theme geliefert – gestaltet und sofort einsa

![Bild](https://github.com/cp-psourcewp-content/uploads/2024/01/cp-features-735x470.jpg)

Durch die Integration von PSeCommerce und WooCommerce kannst Du Deine Kurse über jedes der über 100 Zahlungsgateways verkaufen.
Durch die Integration von MarketPress und WooCommerce kannst Du Deine Kurse über jedes der über 100 Zahlungsgateways verkaufen.

### PSeCommerce & WooCommerce
### MarketPress & WooCommerce

Erstelle und verwalte die nächste große Academy, Tuts+ oder Lynda mit integriertem PSeCommerce und WooCommerce. Beginne mit der Annahme von Zahlungen mit einer der über 100 verfügbaren Zahlungsoptionen.
Erstelle und verwalte die nächste große Academy, Tuts+ oder Lynda mit integriertem MarketPress und WooCommerce. Beginne mit der Annahme von Zahlungen mit einer der über 100 verfügbaren Zahlungsoptionen.



Expand Down Expand Up @@ -173,25 +173,25 @@ Beginnen wir mit dem Hinzufügen eines Kurses. Gehe zu _BrainPress > Neuer Kurs_

![BrainPress - New Course - Enrollment](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-New-Course-Enrollment.png)

Tick the '_This is a Paid Course_' option to display payment options. For payments, BrainPress Pro integrates with both [PSeCommerce](https://premium.wpmudev.org/project/e-commerce/ "PSeCommerce ClassicPress e-Commerce") and [WooCommerce](https://wordpress.org/plugins/woocommerce/). Please note that currently, only one of them (either PSeCommerce or WooCommerce) should be activated, activating both at the same time may cause conflicts. For PSeCommerce integration, the first time the above payment option is selected, you'll be presented with a message about PSeCommerce, like so:
Tick the '_This is a Paid Course_' option to display payment options. For payments, BrainPress Pro integrates with both [MarketPress](https://premium.wpmudev.org/project/e-commerce/ "MarketPress ClassicPress e-Commerce") and [WooCommerce](https://wordpress.org/plugins/woocommerce/). Please note that currently, only one of them (either MarketPress or WooCommerce) should be activated, activating both at the same time may cause conflicts. For MarketPress integration, the first time the above payment option is selected, you'll be presented with a message about MarketPress, like so:

![BrainPress Pro - Activate PSeCommerce](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-Pro-1.2.5.4-Payment-settings-Activate-PSeCommerce.png)
![BrainPress Pro - Activate MarketPress](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-Pro-1.2.5.4-Payment-settings-Activate-MarketPress.png)

Click the _Begin Activating PSeCommerce_ link to begin the PSeCommerce activation process and expose the payment options. Or for WooCommerce integration, simply ensure that WooCommerce is installed and activated, then tick the '_Use WooCommerce to sell courses_' setting at _BrainPress Pro > Settings_. You can optionally select to redirect WooCommerce product posts to a parent course as well.
Click the _Begin Activating MarketPress_ link to begin the MarketPress activation process and expose the payment options. Or for WooCommerce integration, simply ensure that WooCommerce is installed and activated, then tick the '_Use WooCommerce to sell courses_' setting at _BrainPress Pro > Settings_. You can optionally select to redirect WooCommerce product posts to a parent course as well.

![BrainPress Pro - Settings - WooCommerce Integration](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-Pro-1.2.5.4-WooCommerce-Settings.png)

WooCommerce settings at BrainPress Pro > Settings

  With either PSeCommerce or WooCommerce installed and activated, and with the settings configured as above, you'll then see payment options for your Course.
  With either MarketPress or WooCommerce installed and activated, and with the settings configured as above, you'll then see payment options for your Course.

![BrainPress - New Course - Enrollment - This is a paid course](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-New-Course-Enrollment-This-is-a-paid-course.png)

* Tick the '_Automatically generate Stock Keeping Unit_' option to have BrainPress Pro automatically create a unique SKU. Otherwise you can enter a _SKU_ value yourself.
* Enter the _Price_.
* Tick the '_Enabled Sale Price_' option to specify that this course on sale.
* Enter a _Sale Price_ to be used with the above option.
* If you're using PSeCommerce, you'll have an option to _Edit Payment Gateways_ where you'll be presented with a pop-up dialog and will be able to select and configure the payment gateways.
* If you're using MarketPress, you'll have an option to _Edit Payment Gateways_ where you'll be presented with a pop-up dialog and will be able to select and configure the payment gateways.

![BrainPress Pro - Payment Gateways](https://premium.wpmudev.org/wp-content/uploads/2014/09/BrainPress-Pro-1.2.1.9-Payment-Gateways.png)

Expand Down
2 changes: 1 addition & 1 deletion include/brainpress/class-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function init() {
add_action( 'wp_ajax_update_discussion', array( 'BrainPress_Data_Discussion', 'ajax_update' ) );

// MP Notice
add_action( 'admin_notices', array( 'BrainPress_Helper_Extension_PSeCommerce', 'mp_notice' ) );
add_action( 'admin_notices', array( 'BrainPress_Helper_Extension_MarketPress', 'mp_notice' ) );

// Admin class
add_filter( 'admin_body_class', array( __CLASS__, 'admin_classes' ) );
Expand Down
6 changes: 3 additions & 3 deletions include/brainpress/class-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ private static function _2p0() {
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'email/new_order/content', $value );

// MP
$value = is_plugin_active( 'psecommerce/psecommerce.php' );
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'psecommerce/enabled', $value );
$value = is_plugin_active( 'marketpress/marketpress.php' );
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'marketpress/enabled', $value );
$value = get_option( 'redirect_mp_to_course', false );
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'psecommerce/redirect', $value );
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'marketpress/redirect', $value );

// WooCommerce Integration
$settings = BrainPress_Helper_Utility::set_array_value( $settings, 'woocommerce/enabled', get_option( 'use_woo', 0 ) );
Expand Down
6 changes: 3 additions & 3 deletions include/brainpress/data/class-course.php
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,11 @@ public static function is_paid_course( $course_id ) {
$is_paid = cp_is_true( $is_paid );
}
/**
* Check for supported integration: PSeCommerce
* Check for supported integration: MarketPress
*/
if ( $is_paid && class_exists( 'BrainPress_Helper_Integration_PSeCommerce' ) ) {
if ( $is_paid && class_exists( 'BrainPress_Helper_Integration_MarketPress' ) ) {
if ( defined( 'MP_VERSION' ) && MP_VERSION ) {
$is_paid = BrainPress_Helper_Integration_PSeCommerce::$is_active;
$is_paid = BrainPress_Helper_Integration_MarketPress::$is_active;
$is_paid = cp_is_true( $is_paid );
return $is_paid;
}
Expand Down
2 changes: 1 addition & 1 deletion include/brainpress/helper/class-extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class BrainPress_Helper_Extension {
private static $plugins = array();

public static function init() {
$plugins = array( 'PSeCommerce', 'CP_TCPDF' );
$plugins = array( 'MarketPress', 'CP_TCPDF' );
foreach ( $plugins as $plugin ) {
if ( method_exists( 'BrainPress_Helper_Extension_' . $plugin, 'init' ) ) {
call_user_func( 'BrainPress_Helper_Extension_' . $plugin . '::init' );
Expand Down
4 changes: 2 additions & 2 deletions include/brainpress/helper/class-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static function init() {
public static function get_plugins() {
if ( null === self::$plugins ) {
self::$plugins = array();
self::$plugins['psecommerce'] = array(
'class' => 'BrainPress_Helper_Integration_PSeCommerce',
self::$plugins['marketpress'] = array(
'class' => 'BrainPress_Helper_Integration_MarketPress',
'method' => 'init',
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

class BrainPress_Helper_Extension_PSeCommerce {
class BrainPress_Helper_Extension_MarketPress {

private static $installed = false;

private static $activated = false;

private static $base_path = array(
'pro' => 'psecommerce/psecommerce.php',
'free' => 'psecommerce/psecommerce.php',
'pro' => 'marketpress/marketpress.php',
'free' => 'marketpress/marketpress.php',
);

public static function init() {
Expand All @@ -21,8 +21,8 @@ public static function init() {
}

public static function add_to_extensions_list( $plugins ) {
$download_source = 'n3rds.work\/wp-update-server\/?action=download&slug=psecommerce';
$external_url = 'https://github.com/cp-psourcepiestingtal_source/psecommerce-shopsystem/';
$download_source = 'n3rds.work\/wp-update-server\/?action=download&slug=marketpress';
$external_url = 'https://github.com/cp-psourcepiestingtal_source/marketpress-shopsystem/';
$source_message = __( 'PSource Server', 'brainpress' );
$is_link = false;
$base_path = self::$base_path['free'];
Expand All @@ -34,7 +34,7 @@ public static function add_to_extensions_list( $plugins ) {
$source_message = 'PSource Server';
$external_url = '';
$is_link = true;
$download_source = 'n3rds.work\/wp-update-server\/?action=download&slug=psecommerce';
$download_source = 'n3rds.work\/wp-update-server\/?action=download&slug=marketpress';
$base_path = self::$base_path['pro'];

if ( is_plugin_active( 'psource-updates/update-notifications.php' ) ) {
Expand All @@ -45,8 +45,8 @@ public static function add_to_extensions_list( $plugins ) {
}

$plugins[] = array(
'name' => 'PSeCommerce',
'slug' => 'psecommerce',
'name' => 'MarketPress',
'slug' => 'marketpress',
'base_path' => $base_path,
'source' => $download_source,
'source_message' => $source_message,
Expand Down Expand Up @@ -105,7 +105,7 @@ public static function mp_notice() {
* check user meta
*/
$user_id = get_current_user_id();
$show = get_user_option( 'psecommerce-run-notice' );
$show = get_user_option( 'marketpress-run-notice' );
if ( 'hide' == $show ) {
return;
}
Expand All @@ -127,16 +127,16 @@ public static function mp_notice() {
),
admin_url( 'edit.php' )
);
$message = sprintf( '<strong>%s</strong> ', __( 'Installiere das PSeCommerce-Plugin, um Kurse zu verkaufen.', 'brainpress' ) );
$message .= sprintf( '<a href="%s">%s</a>', $mp_settings_url, __( 'Installiere PSeCommerce', 'brainpress' ) );
$message = sprintf( '<strong>%s</strong> ', __( 'Installiere das MarketPress-Plugin, um Kurse zu verkaufen.', 'brainpress' ) );
$message .= sprintf( '<a href="%s">%s</a>', $mp_settings_url, __( 'Installiere MarketPress', 'brainpress' ) );
} elseif ( ! self::activated() ) {
$mp_link = sprintf( '<a href="%s">%s</a>', admin_url( 'plugins.php' ), __( 'PSeCommerce', 'brainpress' ) );
$mp_link = sprintf( '<a href="%s">%s</a>', admin_url( 'plugins.php' ), __( 'MarketPress', 'brainpress' ) );
$message = sprintf( __( 'Aktiviere %s um mit den Verkauf von Kursen zu beginnen.', 'brainpress' ), $mp_link );
} elseif ( self::activated() ) {
if ( defined( 'MP_VERSION' ) ) {
if ( version_compare( MP_VERSION, '1.5.2' ) < 0 ) {
$plugin_url = admin_url( 'plugins.php' );
$mp = sprintf( '<a href="%s">%s</a>', $plugin_url, '<strong>PSeCommerce</strong>' );
$mp = sprintf( '<a href="%s">%s</a>', $plugin_url, '<strong>MarketPress</strong>' );
$cp = defined( 'CP_IS_PREMIUM' ) && CP_IS_PREMIUM ? '<strong>BrainPress</strong>' : '<strong>BrainPress</strong>';
$cp = sprintf( '<a href="%s">%s</a>', $plugin_url, $cp );
$message = __( 'Wenn Du eine ältere Version des %s-Plugins verwendest, benötigst Du aus Kompatibilitätsgründen die neueste Version.', 'brainpress' );
Expand All @@ -149,11 +149,11 @@ public static function mp_notice() {
if ( ! empty( $message ) ) {
$data = array(
'dismissible' => true,
'option-name' => 'psecommerce-run-notice',
'nonce' => wp_create_nonce( 'psecommerce-run-notice'.$user_id ),
'option-name' => 'marketpress-run-notice',
'nonce' => wp_create_nonce( 'marketpress-run-notice'.$user_id ),
'user_id' => $user_id,
);
echo BrainPress_Helper_UI::admin_notice( $message, 'warning', 'psecommerce-run-notice', $data );
echo BrainPress_Helper_UI::admin_notice( $message, 'warning', 'marketpress-run-notice', $data );
}
}
}
Loading

0 comments on commit 5ecb8c9

Please sign in to comment.