/var/www/(Del)hsihk.com/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-notices.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
/**
 * Display notices in admin.
 *
 * @author         WooThemes
 * @category     Admin
 * @package     WooCommerce/Admin
 * @version     2.1.0
 */

if ( ! defined'ABSPATH' ) ) {
    exit; 
// Exit if accessed directly
}

if ( ! 
class_exists'WC_Admin_Notices' ) ) :

/**
 * WC_Admin_Notices Class
 */
class WC_Admin_Notices {

    
/**
     * Hook in tabs.
     */
    
public function __construct() {
        
add_action'switch_theme', array( $this'reset_admin_notices' ) );
        
add_action'woocommerce_updated', array( $this'reset_admin_notices' ) );
        
add_action'admin_print_styles', array( $this'add_notices' ) );
    }

    
/**
     * Reset notices for themes when switched or a new version of WC is installed
     */
    
public function reset_admin_notices() {
        
update_option'woocommerce_admin_notices', array( 'template_files''theme_support' ) );
    }

    
/**
     * Add notices + styles if needed.
     */
    
public function add_notices() {
        if ( 
get_option'_wc_needs_update' ) == || get_option'_wc_needs_pages' ) == ) {
            
wp_enqueue_style'woocommerce-activation'plugins_url(  '/assets/css/activation.css'WC_PLUGIN_FILE ) );
            
add_action'admin_notices', array( $this'install_notice' ) );
        }

        
$notices get_option'woocommerce_admin_notices', array() );

        if ( ! empty( 
$_GET['hide_theme_support_notice'] ) ) {
            
$notices array_diff$notices, array( 'theme_support' ) );
            
update_option'woocommerce_admin_notices'$notices );
        }

        if ( ! empty( 
$_GET['hide_template_files_notice'] ) ) {
            
$notices array_diff$notices, array( 'template_files' ) );
            
update_option'woocommerce_admin_notices'$notices );
        }

        if ( 
in_array'theme_support'$notices ) && ! current_theme_supports'woocommerce' ) ) {
            
$template get_option'template' );

            if ( ! 
in_array$templatewc_get_core_supported_themes() ) ) {
                
wp_enqueue_style'woocommerce-activation'plugins_url(  '/assets/css/activation.css'WC_PLUGIN_FILE ) );
                
add_action'admin_notices', array( $this'theme_check_notice' ) );
            }
        }

        if ( 
in_array'template_files'$notices ) ) {
            
wp_enqueue_style'woocommerce-activation'plugins_url(  '/assets/css/activation.css'WC_PLUGIN_FILE ) );
            
add_action'admin_notices', array( $this'template_file_check_notice' ) );
        }

        if ( 
in_array'translation_upgrade'$notices ) ) {
            
wp_enqueue_style'woocommerce-activation'plugins_url(  '/assets/css/activation.css'WC_PLUGIN_FILE ) );
            
add_action'admin_notices', array( $this'translation_upgrade_notice' ) );
        }

        if ( ! 
class_exists'WC_Mijireh_Checkout' ) && ( $mijireh get_option'woocommerce_mijireh_checkout_settings'false ) ) && ! empty( $mijireh['enabled'] ) && $mijireh['enabled'] === 'yes' && empty( $_GET['action'] ) ) {
            
add_action'admin_notices', array( $this'mijireh_notice' ) );
        }
    }

    
/**
     * Show the install notices
     */
    
public function install_notice() {
        
// If we need to update, include a message with the update button
        
if ( get_option'_wc_needs_update' ) == ) {
            include( 
'views/html-notice-update.php' );
        }

        
// If we have just installed, show a message with the install pages button
        
elseif ( get_option'_wc_needs_pages' ) == ) {
            include( 
'views/html-notice-install.php' );
        }
    }

    
/**
     * Show the Theme Check notice
     */
    
public function theme_check_notice() {
        include( 
'views/html-notice-theme-support.php' );
    }

    
/**
     * Show the translation upgrade notice
     */
    
public function translation_upgrade_notice() {
        
$screen get_current_screen();

        if ( 
'update-core' !== $screen->id ) {
            include( 
'views/html-notice-translation-upgrade.php' );
        }
    }

    
/**
     * Show a notice highlighting bad template files
     */
    
public function template_file_check_notice() {
        if ( isset( 
$_GET['page'] ) && 'wc-status' == $_GET['page'] ) {
            return;
        }

        
$core_templates WC_Admin_Status::scan_template_filesWC()->plugin_path() . '/templates' );
        
$outdated       false;

        foreach ( 
$core_templates as $file ) {
            
$theme_file false;
            if ( 
file_existsget_stylesheet_directory() . '/' $file ) ) {
                
$theme_file get_stylesheet_directory() . '/' $file;
            } elseif ( 
file_existsget_stylesheet_directory() . '/woocommerce/' $file ) ) {
                
$theme_file get_stylesheet_directory() . '/woocommerce/' $file;
            } elseif ( 
file_existsget_template_directory() . '/' $file ) ) {
                
$theme_file get_template_directory() . '/' $file;
            } elseif( 
file_existsget_template_directory() . '/woocommerce/' $file ) ) {
                
$theme_file get_template_directory() . '/woocommerce/' $file;
            }

            if ( 
$theme_file ) {
                
$core_version  WC_Admin_Status::get_file_versionWC()->plugin_path() . '/templates/' $file );
                
$theme_version WC_Admin_Status::get_file_version$theme_file );

                if ( 
$core_version && $theme_version && version_compare$theme_version$core_version'<' ) ) {
                    
$outdated true;
                    break;
                }
            }
        }

        if ( 
$outdated ) {
            include( 
'views/html-notice-template-check.php' );
        }
    }

    
/**
     * Notice to say Mijireh has been deprecated in 2.2
     */
    
public function mijireh_notice() {
        include( 
'views/html-notice-mijireh.php' );
    }
}

endif;

return new 
WC_Admin_Notices();