Changeset 2878554
- Timestamp:
- 03/12/2023 01:06:09 AM (2 years ago)
- Location:
- wc-pre-order/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
wc-pre-order/trunk/includes/Frontend/Cart.php
r2550859 r2878554 7 7 /** 8 8 * Class Cart 9 * 9 10 * @package SpringDevs\PreOrder\Frontend 10 11 */ 11 class Cart 12 { 12 class Cart { 13 13 14 public function __construct()15 {16 add_filter('woocommerce_cart_item_name', [$this, 'change_cart_item_name'], 10, 3);17 }18 14 19 public function change_cart_item_name($item_name, $cart_item, $cart_item_key) 20 { 21 $product = wc_get_product($cart_item['product_id']); 22 $has_preorder = Helper::has_preorder($product->get_id()); 23 if ($has_preorder) { 24 $item_name .= '<br /><small>' . __(get_option('preorder_order_item_marker_txt', 'Pre-Order product'), "sdevs_preorder") . '</small>'; 25 $product_cls = new Product(); 26 $summery_txt = $product_cls->display_txt($product, false); 27 $item_name .= '<br /><small>' . __($summery_txt, "sdevs_preorder") . '</small>'; 28 } 29 return $item_name; 30 } 15 public function __construct() { 16 add_filter( 'woocommerce_cart_item_name', array( $this, 'change_cart_item_name' ), 10, 3 ); 17 } 18 19 public function change_cart_item_name( $item_name, $cart_item, $cart_item_key ) { 20 $product = wc_get_product( $cart_item['product_id'] ); 21 $has_preorder = Helper::has_preorder( $product->get_id() ); 22 if ( $has_preorder ) { 23 $item_name .= '<br /><small class="sdevs_preorder_cart_marker">' . __( get_option( 'preorder_order_item_marker_txt', 'Pre-Order product' ), 'sdevs_preorder' ) . '</small>'; 24 $product_cls = new Product(); 25 $summery_txt = $product_cls->display_txt( $product, false ); 26 $item_name .= '<br /><small class="sdevs_preorder_cart_label">' . __( $summery_txt, 'sdevs_preorder' ) . '</small>'; 27 } 28 return $item_name; 29 } 31 30 } -
wc-pre-order/trunk/includes/Frontend/Order.php
r2550859 r2878554 5 5 /** 6 6 * Class Order 7 * 7 8 * @package SpringDevs\PreOrder\Frontend 8 9 */ 9 class Order 10 { 10 class Order { 11 11 12 public function __construct()13 {14 add_action('woocommerce_order_item_meta_start', [$this, 'add_meta_data'], 10, 3);15 add_action('woocommerce_my_account_my_orders_column_order-status', [$this, 'add_preorder_marker']);16 }17 12 18 public function add_meta_data($item_id, $item, $order) 19 { 20 $has_preorder = $item->get_meta('_has_preorder', true); 21 if ($has_preorder) { 22 echo '<br /><small>' . __(get_option('preorder_order_item_marker_txt', 'Pre-Order Product'), "sdevs_preorder") . '</small>'; 23 $rels_date = $item->get_meta('_relase_date', true); 24 if ($rels_date) { 25 echo '<br /><small>' . __('Release date: ', 'sdevs_preorder') . date('F d, Y', strtotime($rels_date)) . '</small>'; 26 } else { 27 echo '<br /><small>' . __('Release date: N/A', 'sdevs_preorder') . '</small>'; 28 } 29 } 30 } 13 public function __construct() { 14 add_action( 'woocommerce_order_item_meta_start', array( $this, 'add_meta_data' ), 10, 3 ); 15 add_action( 'woocommerce_my_account_my_orders_column_order-status', array( $this, 'add_preorder_marker' ) ); 16 } 31 17 32 public function add_preorder_marker($order) 33 { 34 $post_ids = get_post_meta($order->get_id(), '_preorders', true); 35 if ($post_ids && is_array($post_ids) && count($post_ids) > 0) { 36 echo wc_get_order_status_name($order->get_status()); 37 echo '<br><mark>' . esc_html(esc_html__('Has Pre-Orders', 'sdevs_preorder')) . '</mark>'; 38 } else { 39 echo wc_get_order_status_name($order->get_status()); 40 } 41 } 18 public function add_meta_data( $item_id, $item, $order ) { 19 $has_preorder = $item->get_meta( '_has_preorder', true ); 20 if ( $has_preorder ) { 21 echo '<br /><small class="sdevs_preorder_marker_label">' . __( get_option( 'preorder_order_item_marker_txt', 'Pre-Order Product' ), 'sdevs_preorder' ) . '</small>'; 22 $rels_date = $item->get_meta( '_relase_date', true ); 23 if ( $rels_date ) { 24 echo '<br /><small class="sdevs_preorder_order_label">' . __( 'Release date: ', 'sdevs_preorder' ) . date( 'F d, Y', strtotime( $rels_date ) ) . '</small>'; 25 } else { 26 echo '<br /><small>' . __( 'Release date: N/A', 'sdevs_preorder' ) . '</small>'; 27 } 28 } 29 } 30 31 public function add_preorder_marker( $order ) { 32 $post_ids = get_post_meta( $order->get_id(), '_preorders', true ); 33 if ( $post_ids && is_array( $post_ids ) && count( $post_ids ) > 0 ) { 34 echo wc_get_order_status_name( $order->get_status() ); 35 echo '<br><mark>' . esc_html( esc_html__( 'Has Pre-Orders', 'sdevs_preorder' ) ) . '</mark>'; 36 } else { 37 echo wc_get_order_status_name( $order->get_status() ); 38 } 39 } 42 40 } -
wc-pre-order/trunk/includes/Frontend/Product.php
r2878118 r2878554 109 109 if ( $echo ) : 110 110 ?> 111 <p >111 <p class="sdevs_preorder_single_notice"> 112 112 <strong <?php echo $attr; ?>><?php _e( $summery_text, 'sdevs_preorder' ); ?></strong> 113 113 </p> -
wc-pre-order/trunk/pre-order.php
r2878118 r2878554 4 4 Plugin URI: https://wordpress.org/plugins/sdevs-wc-preorder 5 5 Description: Allow customers to pre-order from your store. 6 Version: 1.0. 46 Version: 1.0.5 7 7 Author: SpringDevs 8 8 Author URI: https://springdevs.com/ … … 58 58 * @var string 59 59 */ 60 const version = '1.0. 4';60 const version = '1.0.5'; 61 61 62 62 /** -
wc-pre-order/trunk/readme.txt
r2878122 r2878554 5 5 Requires at least: 4.0 6 6 Tested up to: 6.1 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 50 50 == Changelog == 51 51 52 = 1.0.5 - March 12, 2023 = 53 * Add classes to label, marker. 54 52 55 = 1.0.4 - March 11, 2023 = 53 56 * Label placement setting added -
wc-pre-order/trunk/vendor/autoload.php
r2878118 r2878554 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 8b057caf3cd808091e292aea40097efa::getLoader();25 return ComposerAutoloaderInit78c8d9959a9c1ed0e2bdc2e719554cb4::getLoader(); -
wc-pre-order/trunk/vendor/composer/InstalledVersions.php
r2878118 r2878554 22 22 * 23 23 * To require its presence, you can require `composer-runtime-api ^2.0` 24 * 25 * @final 24 26 */ 25 27 class InstalledVersions … … 27 29 /** 28 30 * @var mixed[]|null 29 * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null31 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 30 32 */ 31 33 private static $installed; … … 38 40 /** 39 41 * @var array[] 40 * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>42 * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 41 43 */ 42 44 private static $installedByVendor = array(); … … 242 244 /** 243 245 * @return array 244 * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}246 * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} 245 247 */ 246 248 public static function getRootPackage() … … 256 258 * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. 257 259 * @return array[] 258 * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}260 * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} 259 261 */ 260 262 public static function getRawData() … … 279 281 * 280 282 * @return array[] 281 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>283 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 282 284 */ 283 285 public static function getAllRawData() … … 302 304 * @return void 303 305 * 304 * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data306 * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data 305 307 */ 306 308 public static function reload($data) … … 312 314 /** 313 315 * @return array[] 314 * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>316 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> 315 317 */ 316 318 private static function getInstalled() -
wc-pre-order/trunk/vendor/composer/autoload_real.php
r2878118 r2878554 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 8b057caf3cd808091e292aea40097efa5 class ComposerAutoloaderInit78c8d9959a9c1ed0e2bdc2e719554cb4 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 8b057caf3cd808091e292aea40097efa', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit78c8d9959a9c1ed0e2bdc2e719554cb4', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 8b057caf3cd808091e292aea40097efa', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit78c8d9959a9c1ed0e2bdc2e719554cb4', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit 8b057caf3cd808091e292aea40097efa::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4::getInitializer($loader)); 31 31 32 32 $loader->register(true); 33 33 34 $filesToLoad = \Composer\Autoload\ComposerStaticInit 8b057caf3cd808091e292aea40097efa::$files;34 $filesToLoad = \Composer\Autoload\ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4::$files; 35 35 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 36 36 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
wc-pre-order/trunk/vendor/composer/autoload_static.php
r2550859 r2878554 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 8b057caf3cd808091e292aea40097efa7 class ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4 8 8 { 9 9 public static $files = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit 8b057caf3cd808091e292aea40097efa::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit 8b057caf3cd808091e292aea40097efa::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit 8b057caf3cd808091e292aea40097efa::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInit78c8d9959a9c1ed0e2bdc2e719554cb4::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
wc-pre-order/trunk/vendor/composer/installed.php
r2878118 r2878554 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => 'dev-stable', 4 'version' => 'dev-stable', 3 'name' => 'springdevs/pre-order', 4 'pretty_version' => 'dev-next', 5 'version' => 'dev-next', 6 'reference' => 'f51fe8338cfbfc47434eafbf10fa8e2b373d7c41', 5 7 'type' => 'wordpress-plugin', 6 8 'install_path' => __DIR__ . '/../../', 7 9 'aliases' => array(), 8 'reference' => '434d19b20b4937e43fda3cc30df84c238d4cc525',9 'name' => 'springdevs/pre-order',10 10 'dev' => true, 11 11 ), 12 12 'versions' => array( 13 13 'springdevs/pre-order' => array( 14 'pretty_version' => 'dev-stable', 15 'version' => 'dev-stable', 14 'pretty_version' => 'dev-next', 15 'version' => 'dev-next', 16 'reference' => 'f51fe8338cfbfc47434eafbf10fa8e2b373d7c41', 16 17 'type' => 'wordpress-plugin', 17 18 'install_path' => __DIR__ . '/../../', 18 19 'aliases' => array(), 19 'reference' => '434d19b20b4937e43fda3cc30df84c238d4cc525',20 20 'dev_requirement' => false, 21 21 ),
Note: See TracChangeset
for help on using the changeset viewer.