PluginProbe
Hello Plus / trunk
Hello Plus vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / admin / components / admin-controller.php

admin-controller.php in Hello Plus trunk, at modules/admin/components/admin-controller.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\Admin\Components;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 class Admin_Controller {
10
11 public function plugin_row_meta( $plugin_meta, $plugin_file ) {
12 if ( HELLOPLUS_PLUGIN_BASE === $plugin_file ) {
13 $row_meta = [
14 'changelog' => '<a href="#" id="hello-plus-whats-new-link" aria-label="' . esc_attr( esc_html__( 'Changelog', 'hello-plus' ) ) . '" >' . esc_html__( 'Changelog', 'hello-plus' ) . '</a><div id="hello-plus-whats-new"></div>',
15 ];
16
17 $plugin_meta = array_merge( $plugin_meta, $row_meta );
18 }
19
20 return $plugin_meta;
21 }
22
23 public function maybe_init_cart() {
24 if ( ! class_exists( 'WooCommerce' ) ) {
25 return;
26 }
27
28 $has_cart = is_a( WC()->cart, 'WC_Cart' );
29 if ( ! $has_cart ) {
30 $session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
31 WC()->session = new $session_class();
32 WC()->session->init();
33 WC()->cart = new \WC_Cart();
34 WC()->customer = new \WC_Customer( get_current_user_id(), true );
35 }
36 }
37
38
39 public function __construct() {
40 add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 );
41 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'maybe_init_cart' ] );
42 }
43 }
44