34 /** |
44 /** |
35 * Function to getting url to current BWS_Menu. |
45 * Function to getting url to current BWS_Menu. |
36 * |
46 * |
37 * @since 1.9.7 |
47 * @since 1.9.7 |
38 */ |
48 */ |
39 if ( ! function_exists ( 'bws_menu_url' ) ) { |
49 if ( ! function_exists( 'bws_menu_url' ) ) { |
40 if ( ! isset( $bws_menu_source ) || 'plugins' == $bws_menu_source ) { |
50 if ( ! isset( $bws_menu_source ) || 'plugins' === $bws_menu_source ) { |
41 function bws_menu_url( $path = '' ) { |
51 function bws_menu_url( $path = '' ) { |
42 return plugins_url( $path, __FILE__ ); |
52 return plugins_url( $path, __FILE__ ); |
43 } |
53 } |
44 } else { |
54 } else { |
45 function bws_menu_url( $path = '' ) { |
55 function bws_menu_url( $path = '' ) { |
46 $bws_menu_current_dir = str_replace( '\\', '/', dirname( __FILE__ ) ); |
56 $bws_menu_current_dir = str_replace( '\\', '/', dirname( __FILE__ ) ); |
47 $bws_menu_abspath = str_replace( '\\', '/', ABSPATH ); |
57 $bws_menu_abspath = str_replace( '\\', '/', ABSPATH ); |
48 $bws_menu_current_url = site_url( str_replace( $bws_menu_abspath, '', $bws_menu_current_dir ) ); |
58 $bws_menu_current_url = site_url( str_replace( $bws_menu_abspath, '', $bws_menu_current_dir ) ); |
49 |
59 |
50 return sprintf( '%s/%s', $bws_menu_current_url, $path ); |
60 return sprintf( '%s/%s', $bws_menu_current_url, $path ); |
51 } |
61 } |
52 } |
62 } |
53 } |
63 } |
54 |
64 |
55 /** |
65 /** |
56 * Function check if plugin is compatible with current WP version |
66 * Function check if plugin is compatible with current WP version |
57 * @return void |
67 * |
58 */ |
68 * @return void |
|
69 */ |
59 if ( ! function_exists( 'bws_wp_min_version_check' ) ) { |
70 if ( ! function_exists( 'bws_wp_min_version_check' ) ) { |
60 function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) { |
71 function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) { |
61 global $wp_version, $bws_versions_notice_array; |
72 global $wp_version, $bws_versions_notice_array; |
62 if ( false == $min_wp ) |
73 if ( false === $min_wp ) { |
63 $min_wp = $require_wp; |
74 $min_wp = $require_wp; |
64 if ( version_compare( $wp_version, $min_wp, "<" ) ) { |
75 } |
65 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
76 if ( version_compare( $wp_version, $min_wp, '<' ) ) { |
|
77 include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
66 if ( is_plugin_active( $plugin_basename ) ) { |
78 if ( is_plugin_active( $plugin_basename ) ) { |
67 deactivate_plugins( $plugin_basename ); |
79 deactivate_plugins( $plugin_basename ); |
68 $admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' ); |
80 $admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' ); |
69 wp_die( |
81 wp_die( |
70 sprintf( |
82 sprintf( |
71 "<strong>%s</strong> %s <strong>WordPress %s</strong> %s <br /><br />%s <a href='%s'>%s</a>.", |
83 "<strong>%s</strong> %s <strong>WordPress %s</strong> %s <br /><br />%s <a href='%s'>%s</a>.", |
72 $plugin_info['Name'], |
84 esc_html( $plugin_info['Name'] ), |
73 __( 'requires', 'bestwebsoft' ), |
85 esc_html__( 'requires', 'bestwebsoft' ), |
74 $require_wp, |
86 esc_html( $require_wp ), |
75 __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ), |
87 esc_html__( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ), |
76 __( 'Back to the WordPress', 'bestwebsoft' ), |
88 esc_html__( 'Back to the WordPress', 'bestwebsoft' ), |
77 $admin_url, |
89 esc_url( $admin_url ), |
78 __( 'Plugins page', 'bestwebsoft' ) |
90 esc_html__( 'Plugins page', 'bestwebsoft' ) |
79 ) |
91 ) |
80 ); |
92 ); |
81 } |
93 } |
82 } elseif ( version_compare( $wp_version, $require_wp, "<" ) ) { |
94 } elseif ( version_compare( $wp_version, $require_wp, '<' ) ) { |
83 $bws_versions_notice_array[] = array( 'name' => $plugin_info['Name'], 'version' => $require_wp ); |
95 $bws_versions_notice_array[] = array( |
84 } |
96 'name' => $plugin_info['Name'], |
85 } |
97 'version' => $require_wp, |
86 } |
98 ); |
87 |
99 } |
|
100 } |
|
101 } |
|
102 |
|
103 /** |
|
104 * Function display review block |
|
105 * |
|
106 * @echo string |
|
107 */ |
88 if ( ! function_exists( 'bws_plugin_reviews_block' ) ) { |
108 if ( ! function_exists( 'bws_plugin_reviews_block' ) ) { |
89 function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?> |
109 function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?> |
90 <div class="bws-plugin-reviews"> |
110 <div class="bws-plugin-reviews"> |
91 <div class="bws-plugin-reviews-rate"> |
111 <div class="bws-plugin-reviews-rate"> |
92 <?php _e( 'Like the plugin?', 'bestwebsoft' ); ?> |
112 <?php esc_html_e( 'Like the plugin?', 'bestwebsoft' ); ?> |
93 <a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( __( '%s reviews', 'bestwebsoft' ), sanitize_text_field( $plugin_name ) ); ?>"> |
113 <a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( esc_html__( '%s reviews', 'bestwebsoft' ), esc_html( sanitize_text_field( $plugin_name ) ) ); ?>"> |
94 <?php _e( 'Rate it', 'bestwebsoft' ); ?> |
114 <?php esc_html_e( 'Rate it', 'bestwebsoft' ); ?> |
95 <span class="dashicons dashicons-star-filled"></span> |
115 <span class="dashicons dashicons-star-filled"></span> |
96 <span class="dashicons dashicons-star-filled"></span> |
116 <span class="dashicons dashicons-star-filled"></span> |
97 <span class="dashicons dashicons-star-filled"></span> |
117 <span class="dashicons dashicons-star-filled"></span> |
98 <span class="dashicons dashicons-star-filled"></span> |
118 <span class="dashicons dashicons-star-filled"></span> |
99 <span class="dashicons dashicons-star-filled"></span> |
119 <span class="dashicons dashicons-star-filled"></span> |
100 </a> |
120 </a> |
101 </div> |
121 </div> |
102 <div class="bws-plugin-reviews-support"> |
122 <div class="bws-plugin-reviews-support"> |
103 <?php _e( 'Need help?', 'bestwebsoft' ); ?> |
123 <?php esc_html_e( 'Need help?', 'bestwebsoft' ); ?> |
104 <a href="https://support.bestwebsoft.com"><?php _e( 'Visit Help Center', 'bestwebsoft' ); ?></a> |
124 <a href="https://support.bestwebsoft.com"><?php esc_html_e( 'Visit Help Center', 'bestwebsoft' ); ?></a> |
105 </div> |
125 </div> |
106 <div class="bws-plugin-reviews-donate"> |
126 <div class="bws-plugin-reviews-donate"> |
107 <?php _e( 'Want to support the plugin?', 'bestwebsoft' ); ?> |
127 <?php esc_html_e( 'Want to support the plugin?', 'bestwebsoft' ); ?> |
108 <a href="https://bestwebsoft.com/donate/"><?php _e( 'Donate', 'bestwebsoft' ); ?></a> |
128 <a href="https://bestwebsoft.com/donate/"><?php esc_html_e( 'Donate', 'bestwebsoft' ); ?></a> |
109 </div> |
129 </div> |
110 </div> |
130 </div> |
111 <?php } |
131 <?php |
112 } |
132 } |
113 |
133 } |
114 if ( ! function_exists ( 'bws_plugin_update_row' ) ) { |
134 |
|
135 /** |
|
136 * Function display license notification |
|
137 * |
|
138 * @echo string |
|
139 */ |
|
140 if ( ! function_exists( 'bws_plugin_update_row' ) ) { |
115 function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) { |
141 function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) { |
116 global $bstwbsftwppdtplgns_options, $wp_version; |
142 global $bstwbsftwppdtplgns_options, $wp_version; |
117 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
143 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
118 if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) { |
144 if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) { |
119 $explode_plugin_key = explode( '/', $plugin_key ); |
145 $explode_plugin_key = explode( '/', $plugin_key ); |
120 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
146 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
121 $style = ( $wp_version < 4.6 ) ? ' style="background-color: #FFEBE8;border-color: #CC0000;"' : ''; |
147 $style = ( $wp_version < 4.6 ) ? ' style="background-color: #FFEBE8;border-color: #CC0000;"' : ''; |
122 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
148 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
123 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . $class . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
149 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
124 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
150 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
125 <div class="update-message' . $div_class . '"' . $style . '>'; |
151 <div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>'; |
126 if ( $wp_version >= 4.6 ) |
152 if ( $wp_version >= 4.6 ) { |
127 echo '<p>'; |
153 echo '<p>'; |
128 echo '<strong>' . __( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '.</strong> ' . __( 'You can use one license of the Pro plugin for one domain only. Please check and edit your license or domain if necessary using your personal Client Area. We strongly recommend you to solve the problem within 24 hours, otherwise the Pro plugin will be deactivated.', 'bestwebsoft' ) . ' <a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/articles/204240089">' . __( 'Learn More', 'bestwebsoft' ) . '</a>'; |
154 } |
129 if ( $wp_version >= 4.6 ) |
155 echo '<strong>' . esc_html__( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '.</strong> ' . esc_html__( 'You can use one license of the Pro plugin for one domain only. Please check and edit your license or domain if necessary using your personal Client Area. We strongly recommend you to solve the problem within 24 hours, otherwise the Pro plugin will be deactivated.', 'bestwebsoft' ) . ' <a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/articles/204240089">' . esc_html__( 'Learn More', 'bestwebsoft' ) . '</a>'; |
130 echo '</p>'; |
156 if ( $wp_version >= 4.6 ) { |
|
157 echo '</p>'; |
|
158 } |
131 echo '</div> |
159 echo '</div> |
132 </td> |
160 </td> |
133 </tr>'; |
161 </tr>'; |
134 } elseif ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") ) ) { |
162 } elseif ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) ) ) { |
135 $explode_plugin_key = explode( '/', $plugin_key ); |
163 $explode_plugin_key = explode( '/', $plugin_key ); |
136 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
164 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
137 $style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : ''; |
165 $style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : ''; |
138 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
166 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
139 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . $class . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
167 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
140 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
168 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
141 <div class="update-message' . $div_class . '"' . $style . '>'; |
169 <div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>'; |
142 if ( $wp_version >= 4.6 ) |
170 if ( $wp_version >= 4.6 ) { |
143 echo '<p>'; |
171 echo '<p>'; |
144 if ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) && $link_slug != false ) { |
172 } |
145 echo __( 'Notice: Your Pro Trial license has expired. To continue using the plugin, you should buy a Pro license', 'bestwebsoft' ) . ' - <a href="https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/">https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/</a>'; |
173 if ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) && false !== $link_slug ) { |
146 } else { |
174 echo esc_html__( 'Notice: Your Pro Trial license has expired. To continue using the plugin, you should buy a Pro license', 'bestwebsoft' ) . ' - <a href="https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/">https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/</a>'; |
147 echo __( 'Your license has expired. To continue getting top-priority support and plugin updates, you should extend it.', 'bestwebsoft' ) . ' <a target="_new" href="https://support.bestwebsoft.com/entries/53487136">' . __( "Learn more", 'bestwebsoft' ) . '</a>'; |
175 } else { |
148 } |
176 echo esc_html__( 'Your license has expired. To continue getting top-priority support and plugin updates, you should extend it.', 'bestwebsoft' ) . ' <a target="_new" href="https://support.bestwebsoft.com/entries/53487136">' . esc_html__( 'Learn more', 'bestwebsoft' ) . '</a>'; |
149 if ( $wp_version >= 4.6 ) |
177 } |
150 echo '</p>'; |
178 if ( $wp_version >= 4.6 ) { |
151 echo '</div> |
179 echo '</p>'; |
|
180 } |
|
181 echo '</div> |
152 </td> |
182 </td> |
153 </tr>'; |
183 </tr>'; |
154 } elseif ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) ) { |
184 } elseif ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) ) { |
155 $explode_plugin_key = explode( '/', $plugin_key ); |
185 $explode_plugin_key = explode( '/', $plugin_key ); |
156 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
186 $class = ( $wp_version >= 4.6 ) ? 'active' : ''; |
157 $style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : ''; |
187 $style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : ''; |
158 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
188 $div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : ''; |
159 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . $class . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
189 echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '"> |
160 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
190 <td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"> |
161 <div class="update-message' . $div_class . '"' . $style . '>'; |
191 <div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>'; |
162 if ( $wp_version >= 4.6 ) |
192 if ( $wp_version >= 4.6 ) { |
163 echo '<p>'; |
193 echo '<p>'; |
164 if ( $free_plugin_name != false ) { |
194 } |
165 printf( __( 'Notice: You are using the Pro Trial license of %s plugin.', 'bestwebsoft' ), $free_plugin_name ); |
195 if ( false !== $free_plugin_name ) { |
166 } else { |
196 printf( esc_html__( 'Notice: You are using the Pro Trial license of %s plugin.', 'bestwebsoft' ), esc_html( $free_plugin_name ) ); |
167 _e( 'Notice: You are using the Pro Trial license of plugin.', 'bestwebsoft' ); |
197 } else { |
168 } |
198 esc_html_e( 'Notice: You are using the Pro Trial license of plugin.', 'bestwebsoft' ); |
169 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) ) |
199 } |
170 echo ' ' . __( 'The Pro Trial license will expire on', 'bestwebsoft' ) . ' ' . $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] . '.'; |
200 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) ) { |
171 if ( $wp_version >= 4.6 ) |
201 echo ' ' . esc_html__( 'The Pro Trial license will expire on', 'bestwebsoft' ) . ' ' . esc_html( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) . '.'; |
172 echo '</p>'; |
202 } |
|
203 if ( $wp_version >= 4.6 ) { |
|
204 echo '</p>'; |
|
205 } |
173 echo '</div> |
206 echo '</div> |
174 </td> |
207 </td> |
175 </tr>'; |
208 </tr>'; |
176 } |
209 } |
177 } |
210 } |
178 } |
211 } |
179 |
212 |
|
213 /** |
|
214 * Function display admin notices |
|
215 * |
|
216 * @echo string |
|
217 */ |
180 if ( ! function_exists( 'bws_admin_notices' ) ) { |
218 if ( ! function_exists( 'bws_admin_notices' ) ) { |
181 function bws_admin_notices() { |
219 function bws_admin_notices() { |
182 global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout; |
220 global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout; |
183 |
221 |
184 /* bws_plugin_banner_go_pro */ |
222 /* bws_plugin_banner_go_pro */ |
185 if ( ! empty( $bws_plugin_banner_go_pro ) ) { |
223 if ( ! empty( $bws_plugin_banner_go_pro ) ) { |
186 /* get $bws_plugins */ |
224 /* get $bws_plugins */ |
187 require( dirname( __FILE__ ) . '/product_list.php' ); |
225 require dirname( __FILE__ ) . '/product_list.php'; |
188 |
226 |
189 foreach ( $bstwbsftwppdtplgns_banner_array as $value ) { |
227 foreach ( $bstwbsftwppdtplgns_banner_array as $value ) { |
190 if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) { |
228 if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) { |
191 |
229 |
192 if ( isset( $bws_plugins[ $value[1] ]['pro_version'] ) && is_plugin_active( $bws_plugins[ $value[1] ]['pro_version'] ) ) { |
230 if ( isset( $bws_plugins[ $value[1] ]['pro_version'] ) && is_plugin_active( $bws_plugins[ $value[1] ]['pro_version'] ) ) { |
193 continue; |
231 continue; |
194 } |
232 } |
195 |
233 |
196 $single_banner_value = $bws_plugin_banner_go_pro[ $value[0] ]; ?> |
234 $single_banner_value = $bws_plugin_banner_go_pro[ $value[0] ]; |
|
235 ?> |
197 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
236 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
198 <div class="<?php echo $single_banner_value['prefix']; ?>_message bws_banner_on_plugin_page bws_go_pro_banner" style="display: none;"> |
237 <div class="<?php echo esc_attr( $single_banner_value['prefix'] ); ?>_message bws_banner_on_plugin_page bws_go_pro_banner" style="display: none;"> |
199 <button class="<?php echo $single_banner_value['prefix']; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
238 <button class="<?php echo esc_attr( $single_banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
200 <div class="icon"> |
239 <div class="icon"> |
201 <img title="" src="<?php echo esc_attr( $single_banner_value['banner_url'] ); ?>" alt="" /> |
240 <img title="" src="<?php echo esc_attr( $single_banner_value['banner_url'] ); ?>" alt="" /> |
202 </div> |
241 </div> |
203 <div class="text"> |
242 <div class="text"> |
204 <?php _e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo $single_banner_value['plugin_info']['Name']; ?> plugin</strong> <?php _e( 'to', 'bestwebsoft' ); ?> <strong>Pro</strong> <?php _e( 'version!', 'bestwebsoft' ); ?><br /> |
243 <?php esc_html_e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo esc_html( $single_banner_value['plugin_info']['Name'] ); ?> plugin</strong> <?php esc_html_e( 'to', 'bestwebsoft' ); ?> <strong>Pro</strong> <?php esc_html_e( 'version!', 'bestwebsoft' ); ?><br /> |
205 <span><?php _e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span> |
244 <span><?php esc_html_e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span> |
206 </div> |
245 </div> |
207 <div class="button_div"> |
246 <div class="button_div"> |
208 <a class="button" target="_blank" href="<?php echo $single_banner_value['bws_link']; ?>"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a> |
247 <a class="button" target="_blank" href="<?php echo esc_url( $single_banner_value['bws_link'] ); ?>"><?php esc_html_e( 'Learn More', 'bestwebsoft' ); ?></a> |
209 </div> |
248 </div> |
210 </div> |
249 </div> |
211 </div> |
250 </div> |
212 <?php break; |
251 <?php |
|
252 break; |
213 } |
253 } |
214 } |
254 } |
215 } |
255 } |
216 |
256 |
217 /* $bws_plugin_banner_timeout */ |
257 /* $bws_plugin_banner_timeout */ |
218 if ( ! empty( $bws_plugin_banner_timeout ) ) { |
258 if ( ! empty( $bws_plugin_banner_timeout ) ) { |
219 foreach ( $bws_plugin_banner_timeout as $banner_value ) { ?> |
259 foreach ( $bws_plugin_banner_timeout as $banner_value ) { |
|
260 ?> |
220 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
261 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
221 <div class="<?php echo $banner_value['prefix']; ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;"> |
262 <div class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;"> |
222 <button class="<?php echo $banner_value['prefix']; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
263 <button class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
223 <div class="icon"> |
264 <div class="icon"> |
224 <img title="" src="<?php echo esc_attr( $banner_value['banner_url'] ); ?>" alt="" /> |
265 <img title="" src="<?php echo esc_url( $banner_value['banner_url'] ); ?>" alt="" /> |
225 </div> |
266 </div> |
226 <div class="text"><?php printf( __( "Your license key for %s expires on %s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . $banner_value['plugin_name'] . '</strong>', $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php _e( "Learn more", 'bestwebsoft' ); ?></a></div> |
267 <div class="text"><?php printf( esc_html__( "Your license key for %1\$s expires on %2\$s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . esc_html__( $banner_value['plugin_name'] ) . '</strong>', esc_html__( $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ) ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php esc_html_e( 'Learn more', 'bestwebsoft' ); ?></a></div> |
227 </div> |
268 </div> |
228 </div> |
269 </div> |
229 <?php } |
270 <?php |
|
271 } |
230 } |
272 } |
231 |
273 |
232 /* versions notice */ |
274 /* versions notice */ |
233 if ( ! empty( $bws_versions_notice_array ) ) { |
275 if ( ! empty( $bws_versions_notice_array ) ) { |
234 foreach ( $bws_versions_notice_array as $key => $value ) { ?> |
276 foreach ( $bws_versions_notice_array as $key => $value ) { |
|
277 ?> |
235 <div class="update-nag"> |
278 <div class="update-nag"> |
236 <?php printf( |
279 <?php |
237 "<strong>%s</strong> %s <strong>WordPress %s</strong> %s", |
280 printf( |
238 $value['name'], |
281 '<strong>%s</strong> %s <strong>WordPress %s</strong> %s', |
239 __( 'requires', 'bestwebsoft' ), |
282 esc_html__( $value['name'] ), |
240 $value['version'], |
283 esc_html__( 'requires', 'bestwebsoft' ), |
241 __( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' ) |
284 esc_html__( $value['version'] ), |
242 ); ?> |
285 esc_html__( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' ) |
|
286 ); |
|
287 ?> |
243 </div> |
288 </div> |
244 <?php } |
289 <?php |
|
290 } |
245 } |
291 } |
246 |
292 |
247 /* banner_to_settings notice */ |
293 /* banner_to_settings notice */ |
248 if ( ! empty( $bws_plugin_banner_to_settings ) ) { |
294 if ( ! empty( $bws_plugin_banner_to_settings ) ) { |
249 if ( 1 == count( $bws_plugin_banner_to_settings ) ) { ?> |
295 if ( 1 === count( $bws_plugin_banner_to_settings ) ) { |
|
296 ?> |
250 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
297 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
251 <div class="bws_banner_on_plugin_page bws_banner_to_settings"> |
298 <div class="bws_banner_on_plugin_page bws_banner_to_settings"> |
252 <div class="icon"> |
299 <div class="icon"> |
253 <img title="" src="<?php echo esc_attr( $bws_plugin_banner_to_settings[0]['banner_url'] ); ?>" alt="" /> |
300 <img title="" src="<?php echo esc_url( $bws_plugin_banner_to_settings[0]['banner_url'] ); ?>" alt="" /> |
254 </div> |
301 </div> |
255 <div class="text"> |
302 <div class="text"> |
256 <strong><?php printf( __( 'Thank you for installing %s plugin!', 'bestwebsoft' ), $bws_plugin_banner_to_settings[0]['plugin_info']['Name'] ); ?></strong> |
303 <strong><?php printf( esc_html__( 'Thank you for installing %s plugin!', 'bestwebsoft' ), esc_html( $bws_plugin_banner_to_settings[0]['plugin_info']['Name'] ) ); ?></strong> |
257 <br /> |
304 <br /> |
258 <?php _e( "Let's get started", 'bestwebsoft' ); ?>: |
305 <?php esc_html_e( "Let's get started", 'bestwebsoft' ); ?>: |
259 <a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['settings_url'] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a> |
306 <a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['settings_url'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a> |
260 <?php if ( false != $bws_plugin_banner_to_settings[0]['post_type_url'] ) { ?> |
307 <?php if ( false !== $bws_plugin_banner_to_settings[0]['post_type_url'] ) { ?> |
261 <?php _e( 'or', 'bestwebsoft' ); ?> |
308 <?php esc_html_e( 'or', 'bestwebsoft' ); ?> |
262 <a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['post_type_url'] ) ); ?>"><?php _e( 'Add New', 'bestwebsoft' ); ?></a> |
309 <a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['post_type_url'] ) ); ?>"><?php esc_html_e( 'Add New', 'bestwebsoft' ); ?></a> |
263 <?php } ?> |
310 <?php } ?> |
264 </div> |
311 </div> |
265 <form action="" method="post"> |
312 <form action="" method="post"> |
266 <button class="notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
313 <button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
267 <input type="hidden" name="bws_hide_settings_notice_<?php echo $bws_plugin_banner_to_settings[0]['plugin_options_name']; ?>" value="hide" /> |
314 <input type="hidden" name="bws_hide_settings_notice_<?php echo esc_html( $bws_plugin_banner_to_settings[0]['plugin_options_name'] ); ?>" value="hide" /> |
268 <?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?> |
315 <?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?> |
269 </form> |
316 </form> |
270 </div> |
317 </div> |
271 </div> |
318 </div> |
272 <?php } else { ?> |
319 <?php } else { ?> |
273 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
320 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
274 <div class="bws_banner_on_plugin_page bws_banner_to_settings_joint"> |
321 <div class="bws_banner_on_plugin_page bws_banner_to_settings_joint"> |
275 <form action="" method="post"> |
322 <form action="" method="post"> |
276 <button class="notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
323 <button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
277 <div class="bws-text"> |
324 <div class="bws-text"> |
278 <div class="icon"> |
325 <div class="icon"> |
279 <span class="dashicons dashicons-admin-plugins"></span> |
326 <span class="dashicons dashicons-admin-plugins"></span> |
280 </div> |
327 </div> |
281 <strong><?php _e( 'Thank you for installing plugins by BestWebSoft!', 'bestwebsoft' ); ?></strong> |
328 <strong><?php esc_html_e( 'Thank you for installing plugins by BestWebSoft!', 'bestwebsoft' ); ?></strong> |
282 <div class="hide-if-no-js bws-more-links"> |
329 <div class="hide-if-no-js bws-more-links"> |
283 <a href="#" class="bws-more"><?php _e( 'More Details', 'bestwebsoft' ); ?></a> |
330 <a href="#" class="bws-more"><?php esc_html_e( 'More Details', 'bestwebsoft' ); ?></a> |
284 <a href="#" class="bws-less hidden"><?php _e( 'Less Details', 'bestwebsoft' ); ?></a> |
331 <a href="#" class="bws-less hidden"><?php esc_html_e( 'Less Details', 'bestwebsoft' ); ?></a> |
285 </div> |
332 </div> |
286 <?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?> |
333 <?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?> |
287 <div class="clear"></div> |
334 <div class="clear"></div> |
288 </div> |
335 </div> |
289 <div class="bws-details hide-if-js"> |
336 <div class="bws-details hide-if-js"> |
290 <?php foreach ( $bws_plugin_banner_to_settings as $value ) { ?> |
337 <?php foreach ( $bws_plugin_banner_to_settings as $value ) { ?> |
291 <div> |
338 <div> |
292 <strong><?php echo str_replace( ' by BestWebSoft', '', $value['plugin_info']['Name'] ); ?></strong> <a href="<?php echo esc_url( self_admin_url( $value['settings_url'] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a> |
339 <strong><?php echo esc_html( str_replace( ' by BestWebSoft', '', $value['plugin_info']['Name'] ) ); ?></strong> <a href="<?php echo esc_url( self_admin_url( $value['settings_url'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a> |
293 <?php if ( false != $value['post_type_url'] ) { ?> |
340 <?php if ( false !== $value['post_type_url'] ) { ?> |
294  | <a target="_blank" href="<?php echo esc_url( self_admin_url( $value['post_type_url'] ) ); ?>"><?php _e( 'Add New', 'bestwebsoft' ); ?></a> |
341  | <a target="_blank" href="<?php echo esc_url( self_admin_url( $value['post_type_url'] ) ); ?>"><?php esc_html_e( 'Add New', 'bestwebsoft' ); ?></a> |
295 <?php } ?> |
342 <?php } ?> |
296 <input type="hidden" name="bws_hide_settings_notice_<?php echo $value['plugin_options_name']; ?>" value="hide" /> |
343 <input type="hidden" name="bws_hide_settings_notice_<?php echo esc_html( $value['plugin_options_name'] ); ?>" value="hide" /> |
297 </div> |
344 </div> |
298 <?php } ?> |
345 <?php } ?> |
299 </div> |
346 </div> |
300 </div> |
347 </div> |
301 </form> |
348 </form> |
302 </div> |
349 </div> |
303 <?php } |
350 <?php |
|
351 } |
304 } |
352 } |
305 |
353 |
306 /** |
354 /** |
307 * show notices about deprecated_function |
355 * Show notices about deprecated_function |
|
356 * |
308 * @since 1.9.8 |
357 * @since 1.9.8 |
309 */ |
358 */ |
310 if ( ! empty( $bstwbsftwppdtplgns_options['deprecated_function'] ) ) { ?> |
359 if ( ! empty( $bstwbsftwppdtplgns_options['deprecated_function'] ) ) { |
|
360 ?> |
311 <div class="update-nag"> |
361 <div class="update-nag"> |
312 <strong><?php _e( 'Deprecated function(-s) is used on the site here:', 'bestwebsoft' ); ?></strong> |
362 <strong><?php esc_html_e( 'Deprecated function(-s) is used on the site here:', 'bestwebsoft' ); ?></strong> |
313 <?php $i = 1; |
363 <?php |
|
364 $i = 1; |
314 foreach ( $bstwbsftwppdtplgns_options['deprecated_function'] as $function_name => $attr ) { |
365 foreach ( $bstwbsftwppdtplgns_options['deprecated_function'] as $function_name => $attr ) { |
315 if ( 1 != $i ) |
366 if ( 1 !== $i ) { |
316 echo ' ,'; |
367 echo ' ,'; |
|
368 } |
317 if ( ! empty( $attr['product-name'] ) ) { |
369 if ( ! empty( $attr['product-name'] ) ) { |
318 echo $attr['product-name']; |
370 echo esc_html( $attr['product-name'] ); |
319 } elseif ( ! empty( $attr['file'] ) ) { |
371 } elseif ( ! empty( $attr['file'] ) ) { |
320 echo $attr['file']; |
372 echo esc_url( $attr['file'] ); |
321 } |
373 } |
322 unset( $bstwbsftwppdtplgns_options['deprecated_function'][ $function_name ] ); |
374 unset( $bstwbsftwppdtplgns_options['deprecated_function'][ $function_name ] ); |
323 $i++; |
375 $i++; |
324 } ?>. |
376 } |
|
377 ?> |
|
378 . |
325 <br/> |
379 <br/> |
326 <?php _e( 'This function(-s) will be removed over time. Please update the product(-s).', 'bestwebsoft' ); ?> |
380 <?php esc_html_e( 'This function(-s) will be removed over time. Please update the product(-s).', 'bestwebsoft' ); ?> |
327 </div> |
381 </div> |
328 <?php if ( is_multisite() ) |
382 <?php |
|
383 if ( is_multisite() ) { |
329 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
384 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
330 else |
385 } else { |
331 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
386 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
332 } |
387 } |
333 } |
388 } |
334 } |
389 } |
335 |
390 } |
|
391 |
|
392 /** |
|
393 * Function display banner |
|
394 * |
|
395 * @return array |
|
396 */ |
336 if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) { |
397 if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) { |
337 function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) { |
398 function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) { |
338 global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array; |
399 global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array; |
339 |
400 |
340 if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] ) |
401 if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] ) { |
341 return; |
402 return; |
342 |
403 } |
343 $bws_link = esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $bws_link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info["Version"] . '&wp_v=' . $wp_version ); |
404 |
344 |
405 $bws_link = esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $bws_link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info['Version'] . '&wp_v=' . $wp_version ); |
345 if ( false == strrpos( $banner_url_or_slug, '/' ) ) { |
406 |
|
407 if ( false === strrpos( $banner_url_or_slug, '/' ) ) { |
346 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
408 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
347 } |
409 } |
348 |
410 |
349 $bws_plugin_banner_go_pro[ $this_banner_prefix . '_hide_banner_on_plugin_page' ] = array( |
411 $bws_plugin_banner_go_pro[ $this_banner_prefix . '_hide_banner_on_plugin_page' ] = array( |
350 'plugin_info' => $plugin_info, |
412 'plugin_info' => $plugin_info, |
351 'prefix' => $this_banner_prefix, |
413 'prefix' => $this_banner_prefix, |
352 'bws_link' => $bws_link, |
414 'bws_link' => $bws_link, |
353 'banner_url' => $banner_url_or_slug |
415 'banner_url' => $banner_url_or_slug, |
354 ); |
416 ); |
355 |
417 |
356 if ( empty( $bstwbsftwppdtplgns_banner_array ) ) { |
418 if ( empty( $bstwbsftwppdtplgns_banner_array ) ) { |
357 if ( ! function_exists( 'bws_get_banner_array' ) ) |
419 if ( ! function_exists( 'bws_get_banner_array' ) ) { |
358 require_once( dirname( __FILE__ ) . '/bws_menu.php' ); |
420 require_once dirname( __FILE__ ) . '/bws_menu.php'; |
|
421 } |
359 bws_get_banner_array(); |
422 bws_get_banner_array(); |
360 } |
423 } |
361 } |
424 } |
362 } |
425 } |
363 |
426 |
|
427 /** |
|
428 * Function update banner params |
|
429 * |
|
430 * @return global array |
|
431 */ |
364 if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) { |
432 if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) { |
365 function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) { |
433 function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) { |
366 global $bws_plugin_banner_timeout; |
434 global $bws_plugin_banner_timeout; |
367 |
435 |
368 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( date("m/d/Y") ) ) ) { |
436 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( gmdate( 'm/d/Y' ) ) ) ) { |
369 |
437 |
370 if ( false == strrpos( $banner_url_or_slug, '/' ) ) { |
438 if ( false === strrpos( $banner_url_or_slug, '/' ) ) { |
371 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
439 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
372 } |
440 } |
373 |
441 |
374 $bws_plugin_banner_timeout[] = array( |
442 $bws_plugin_banner_timeout[] = array( |
375 'plugin_key' => $plugin_key, |
443 'plugin_key' => $plugin_key, |
376 'prefix' => $plugin_prefix, |
444 'prefix' => $plugin_prefix, |
377 'plugin_name' => $plugin_name, |
445 'plugin_name' => $plugin_name, |
378 'banner_url' => $banner_url_or_slug |
446 'banner_url' => $banner_url_or_slug, |
379 ); |
447 ); |
380 } |
448 } |
381 } |
449 } |
382 } |
450 } |
383 |
451 |
|
452 /** |
|
453 * Function settings for banner |
|
454 * |
|
455 * @return global array |
|
456 */ |
384 if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) { |
457 if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) { |
385 function bws_plugin_banner_to_settings( $plugin_info, $plugin_options_name, $banner_url_or_slug, $settings_url, $post_type_url = false ) { |
458 function bws_plugin_banner_to_settings( $plugin_info, $plugin_options_name, $banner_url_or_slug, $settings_url, $post_type_url = false ) { |
386 global $bws_plugin_banner_to_settings; |
459 global $bws_plugin_banner_to_settings; |
387 |
460 |
388 $is_network_admin = is_network_admin(); |
461 $is_network_admin = is_network_admin(); |
389 |
462 |
390 $plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name ); |
463 $plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name ); |
391 |
464 |
392 if ( isset( $plugin_options['display_settings_notice'] ) && 0 == $plugin_options['display_settings_notice'] ) |
465 if ( isset( $plugin_options['display_settings_notice'] ) && 0 === $plugin_options['display_settings_notice'] ) { |
393 return; |
466 return; |
394 |
467 } |
395 if ( isset( $_POST['bws_hide_settings_notice_' . $plugin_options_name ] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ) ) { |
468 |
|
469 if ( isset( $_POST[ 'bws_hide_settings_notice_' . $plugin_options_name ] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ) ) { |
396 $plugin_options['display_settings_notice'] = 0; |
470 $plugin_options['display_settings_notice'] = 0; |
397 if ( $is_network_admin ) |
471 if ( $is_network_admin ) { |
398 update_site_option( $plugin_options_name, $plugin_options ); |
472 update_site_option( $plugin_options_name, $plugin_options ); |
399 else |
473 } else { |
400 update_option( $plugin_options_name, $plugin_options ); |
474 update_option( $plugin_options_name, $plugin_options ); |
|
475 } |
401 return; |
476 return; |
402 } |
477 } |
403 |
478 |
404 if ( false == strrpos( $banner_url_or_slug, '/' ) ) { |
479 if ( false === strrpos( $banner_url_or_slug, '/' ) ) { |
405 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
480 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
406 } |
481 } |
407 |
482 |
408 $bws_plugin_banner_to_settings[] = array( |
483 $bws_plugin_banner_to_settings[] = array( |
409 'plugin_info' => $plugin_info, |
484 'plugin_info' => $plugin_info, |
410 'plugin_options_name' => $plugin_options_name, |
485 'plugin_options_name' => $plugin_options_name, |
411 'banner_url' => $banner_url_or_slug, |
486 'banner_url' => $banner_url_or_slug, |
412 'settings_url' => $settings_url, |
487 'settings_url' => $settings_url, |
413 'post_type_url' => $post_type_url |
488 'post_type_url' => $post_type_url, |
414 ); |
489 ); |
415 } |
490 } |
416 } |
491 } |
417 |
492 |
|
493 /** |
|
494 * Function display for feature banner |
|
495 * |
|
496 * @echo string |
|
497 */ |
418 if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) { |
498 if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) { |
419 function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) { |
499 function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) { |
420 $is_network_admin = is_network_admin(); |
500 $is_network_admin = is_network_admin(); |
421 |
501 |
422 $plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name ); |
502 $plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name ); |
423 |
503 |
424 if ( isset( $plugin_options['display_suggest_feature_banner'] ) && 0 == $plugin_options['display_suggest_feature_banner'] ) |
504 if ( isset( $plugin_options['display_suggest_feature_banner'] ) && 0 === $plugin_options['display_suggest_feature_banner'] ) { |
425 return; |
505 return; |
|
506 } |
426 |
507 |
427 if ( ! isset( $plugin_options['first_install'] ) ) { |
508 if ( ! isset( $plugin_options['first_install'] ) ) { |
428 $plugin_options['first_install'] = strtotime( "now" ); |
509 $plugin_options['first_install'] = strtotime( 'now' ); |
429 $update_option = $return = true; |
510 $update_option = $return = true; |
430 } elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) { |
511 } elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) { |
431 $return = true; |
512 $return = true; |
432 } |
513 } |
433 |
514 |
434 if ( ! isset( $plugin_options['go_settings_counter'] ) ) { |
515 if ( ! isset( $plugin_options['go_settings_counter'] ) ) { |
435 $plugin_options['go_settings_counter'] = 1; |
516 $plugin_options['go_settings_counter'] = 1; |
436 $update_option = $return = true; |
517 $update_option = $return = true; |
437 } elseif ( 20 > $plugin_options['go_settings_counter'] ) { |
518 } elseif ( 20 > $plugin_options['go_settings_counter'] ) { |
438 $plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1; |
519 $plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1; |
439 $update_option = $return = true; |
520 $update_option = $return = true; |
440 } |
521 } |
441 |
522 |
442 if ( isset( $update_option ) ) { |
523 if ( isset( $update_option ) ) { |
443 if ( $is_network_admin ) |
524 if ( $is_network_admin ) { |
444 update_site_option( $plugin_options_name, $plugin_options ); |
525 update_site_option( $plugin_options_name, $plugin_options ); |
445 else |
526 } else { |
446 update_option( $plugin_options_name, $plugin_options ); |
527 update_option( $plugin_options_name, $plugin_options ); |
447 } |
528 } |
448 |
529 } |
449 if ( isset( $return ) ) |
530 |
|
531 if ( isset( $return ) ) { |
450 return; |
532 return; |
451 |
533 } |
452 if ( isset( $_POST['bws_hide_suggest_feature_banner_' . $plugin_options_name ] ) && check_admin_referer( $plugin_info['Name'], 'bws_settings_nonce_name' ) ) { |
534 |
|
535 if ( isset( $_POST[ 'bws_hide_suggest_feature_banner_' . $plugin_options_name ] ) && check_admin_referer( $plugin_info['Name'], 'bws_settings_nonce_name' ) ) { |
453 $plugin_options['display_suggest_feature_banner'] = 0; |
536 $plugin_options['display_suggest_feature_banner'] = 0; |
454 if ( $is_network_admin ) |
537 if ( $is_network_admin ) { |
455 update_site_option( $plugin_options_name, $plugin_options ); |
538 update_site_option( $plugin_options_name, $plugin_options ); |
456 else |
539 } else { |
457 update_option( $plugin_options_name, $plugin_options ); |
540 update_option( $plugin_options_name, $plugin_options ); |
|
541 } |
458 return; |
542 return; |
459 } |
543 } |
460 |
544 |
461 if ( false == strrpos( $banner_url_or_slug, '/' ) ) { |
545 if ( false === strrpos( $banner_url_or_slug, '/' ) ) { |
462 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
546 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png'; |
463 } ?> |
547 } |
|
548 ?> |
464 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
549 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
465 <div class="bws_banner_on_plugin_page bws_suggest_feature_banner"> |
550 <div class="bws_banner_on_plugin_page bws_suggest_feature_banner"> |
466 <div class="icon"> |
551 <div class="icon"> |
467 <img title="" src="<?php echo esc_attr( $banner_url_or_slug ); ?>" alt="" /> |
552 <img title="" src="<?php echo esc_url( $banner_url_or_slug ); ?>" alt="" /> |
468 </div> |
553 </div> |
469 <div class="text"> |
554 <div class="text"> |
470 <strong><?php printf( __( 'Thank you for choosing %s plugin!', 'bestwebsoft' ), $plugin_info['Name'] ); ?></strong><br /> |
555 <strong><?php printf( esc_html__( 'Thank you for choosing %s plugin!', 'bestwebsoft' ), esc_html( $plugin_info['Name'] ) ); ?></strong><br /> |
471 <?php _e( "If you have a feature, suggestion or idea you'd like to see in the plugin, we'd love to hear about it!", 'bestwebsoft' ); ?> |
556 <?php esc_html_e( "If you have a feature, suggestion or idea you'd like to see in the plugin, we'd love to hear about it!", 'bestwebsoft' ); ?> |
472 <a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/requests/new"><?php _e( 'Suggest a Feature', 'bestwebsoft' ); ?></a> |
557 <a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/requests/new"><?php esc_html_e( 'Suggest a Feature', 'bestwebsoft' ); ?></a> |
473 </div> |
558 </div> |
474 <form action="" method="post"> |
559 <form action="" method="post"> |
475 <button class="notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
560 <button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
476 <input type="hidden" name="bws_hide_suggest_feature_banner_<?php echo $plugin_options_name; ?>" value="hide" /> |
561 <input type="hidden" name="bws_hide_suggest_feature_banner_<?php echo esc_html( $plugin_options_name ); ?>" value="hide" /> |
477 <?php wp_nonce_field( $plugin_info['Name'], 'bws_settings_nonce_name' ); ?> |
562 <?php wp_nonce_field( $plugin_info['Name'], 'bws_settings_nonce_name' ); ?> |
478 </form> |
563 </form> |
479 </div> |
564 </div> |
480 </div> |
565 </div> |
481 <?php } |
566 <?php |
482 } |
567 } |
483 |
568 } |
|
569 |
|
570 /** |
|
571 * Function display affiliate postbox |
|
572 * |
|
573 * @echo string |
|
574 */ |
|
575 if ( ! function_exists( 'bws_affiliate_postbox' ) ) { |
|
576 function bws_affiliate_postbox() { |
|
577 |
|
578 $dismissed = get_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', true ); |
|
579 |
|
580 if ( ! empty( $dismissed ) && strtotime( '-3 month' ) < $dismissed ) { |
|
581 return; |
|
582 } |
|
583 |
|
584 if ( isset( $_POST['bws_hide_affiliate_banner'] ) && check_admin_referer( 'bws_affiliate_postbox', 'bws_settings_nonce_name' ) ) { |
|
585 update_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', strtotime( 'now' ) ); |
|
586 return; |
|
587 } |
|
588 |
|
589 $bws_link = esc_url( 'https://bestwebsoft.com/affiliate/?utm_source=plugin&utm_medium=settings&utm_campaign=affiliate_program' ); |
|
590 ?> |
|
591 <div id="bws-affiliate-postbox" class="postbox"> |
|
592 <form action="" method="post"> |
|
593 <button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button> |
|
594 <input type="hidden" name="bws_hide_affiliate_banner" value="hide" /> |
|
595 <?php wp_nonce_field( 'bws_affiliate_postbox', 'bws_settings_nonce_name' ); ?> |
|
596 </form> |
|
597 <p>BESTWEBSOFT</p> |
|
598 <h3><?php esc_html_e( 'Affiliate Program', 'bestwebsoft' ); ?></h3> |
|
599 <div class="bws-affiliate-get"><?php printf( esc_html__( 'Get %s', 'bestwebsoft' ), '20%' ); ?></div> |
|
600 <div><?php esc_html_e( 'from each BestWebSoft plugin and theme sale you refer', 'bestwebsoft' ); ?></div> |
|
601 <div class="bws-row"> |
|
602 <div class="bws-cell"> |
|
603 <img src="<?php echo esc_url( bws_menu_url( 'images/join-icon.svg' ) ); ?>" alt="" /> |
|
604 <div><?php esc_html_e( 'Join affiliate program', 'bestwebsoft' ); ?></div> |
|
605 </div> |
|
606 <div class="bws-cell"> |
|
607 <img src="<?php echo esc_url( bws_menu_url( 'images/promote-icon.svg' ) ); ?>" alt="" /> |
|
608 <div><?php esc_html_e( 'Promote and sell products', 'bestwebsoft' ); ?></div> |
|
609 </div> |
|
610 <div class="bws-cell"> |
|
611 <img src="<?php echo esc_url( bws_menu_url( 'images/earn-icon.svg' ) ); ?>" alt="" /> |
|
612 <div><?php esc_html_e( 'Get commission!', 'bestwebsoft' ); ?></div> |
|
613 </div> |
|
614 </div> |
|
615 <div class="clear"></div> |
|
616 <p> |
|
617 <a class="button" href="<?php echo esc_url( $bws_link ); ?>" target="_blank"><?php esc_html_e( 'Start Now', 'bestwebsoft' ); ?></a> |
|
618 </p> |
|
619 </div> |
|
620 <?php |
|
621 } |
|
622 } |
|
623 |
|
624 /** |
|
625 * Function display settings notice |
|
626 * |
|
627 * @echo string |
|
628 */ |
484 if ( ! function_exists( 'bws_show_settings_notice' ) ) { |
629 if ( ! function_exists( 'bws_show_settings_notice' ) ) { |
485 function bws_show_settings_notice() { ?> |
630 function bws_show_settings_notice() { |
|
631 ?> |
486 <div id="bws_save_settings_notice" class="updated fade below-h2" style="display:none;"> |
632 <div id="bws_save_settings_notice" class="updated fade below-h2" style="display:none;"> |
487 <p> |
633 <p> |
488 <strong><?php _e( 'Notice', 'bestwebsoft' ); ?></strong>: <?php _e( "The plugin's settings have been changed.", 'bestwebsoft' ); ?> |
634 <strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?></strong>: <?php esc_html_e( "The plugin's settings have been changed.", 'bestwebsoft' ); ?> |
489 <a class="bws_save_anchor" href="#bws-submit-button"><?php _e( 'Save Changes', 'bestwebsoft' ); ?></a> |
635 <a class="bws_save_anchor" href="#bws-submit-button"><?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?></a> |
490 </p> |
636 </p> |
491 </div> |
637 </div> |
492 <?php } |
638 <?php |
493 } |
639 } |
494 |
640 } |
|
641 |
|
642 /** |
|
643 * Function for hide premium options |
|
644 * |
|
645 * @echo string |
|
646 */ |
495 if ( ! function_exists( 'bws_hide_premium_options' ) ) { |
647 if ( ! function_exists( 'bws_hide_premium_options' ) ) { |
496 function bws_hide_premium_options( $options ) { |
648 function bws_hide_premium_options( $options ) { |
497 if ( ! isset( $options['hide_premium_options'] ) || ! is_array( $options['hide_premium_options'] ) ) |
649 if ( ! isset( $options['hide_premium_options'] ) || ! is_array( $options['hide_premium_options'] ) ) { |
498 $options['hide_premium_options'] = array(); |
650 $options['hide_premium_options'] = array(); |
|
651 } |
499 |
652 |
500 $options['hide_premium_options'][] = get_current_user_id(); |
653 $options['hide_premium_options'][] = get_current_user_id(); |
501 |
654 |
502 return array( |
655 return array( |
503 'message' => __( 'You can always look at premium options by checking the "Pro Options" in the "Misc" tab.', 'bestwebsoft' ), |
656 'message' => esc_html__( 'You can always look at premium options by checking the "Pro Options" in the "Misc" tab.', 'bestwebsoft' ), |
504 'options' => $options ); |
657 'options' => $options, |
505 } |
658 ); |
506 } |
659 } |
507 |
660 } |
|
661 |
|
662 /** |
|
663 * Function for check checkbox for hide premium options |
|
664 * |
|
665 * @return bool |
|
666 */ |
508 if ( ! function_exists( 'bws_hide_premium_options_check' ) ) { |
667 if ( ! function_exists( 'bws_hide_premium_options_check' ) ) { |
509 function bws_hide_premium_options_check( $options ) { |
668 function bws_hide_premium_options_check( $options ) { |
510 if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) |
669 if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) { |
511 return true; |
670 return true; |
512 else |
671 } else { |
513 return false; |
672 return false; |
514 } |
673 } |
515 } |
674 } |
516 |
675 } |
517 if ( ! function_exists ( 'bws_plugins_admin_init' ) ) { |
676 |
|
677 /** |
|
678 * Function init fir dashboard |
|
679 */ |
|
680 if ( ! function_exists( 'bws_plugins_admin_init' ) ) { |
518 function bws_plugins_admin_init() { |
681 function bws_plugins_admin_init() { |
519 if ( isset( $_GET['bws_activate_plugin'] ) && check_admin_referer( 'bws_activate_plugin' . $_GET['bws_activate_plugin'] ) ) { |
682 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; |
520 |
683 if ( isset( $_GET['bws_activate_plugin'] ) && check_admin_referer( 'bws_activate_plugin' . sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) ) ) { |
521 $plugin = isset( $_GET['bws_activate_plugin'] ) ? sanitize_text_field( $_GET['bws_activate_plugin'] ) : ''; |
684 |
|
685 $plugin = isset( $_GET['bws_activate_plugin'] ) ? sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) : ''; |
522 $result = activate_plugin( $plugin, '', is_network_admin() ); |
686 $result = activate_plugin( $plugin, '', is_network_admin() ); |
523 if ( is_wp_error( $result ) ) { |
687 if ( is_wp_error( $result ) ) { |
524 if ( 'unexpected_output' == $result->get_error_code() ) { |
688 if ( 'unexpected_output' === $result->get_error_code() ) { |
525 $redirect = self_admin_url( 'admin.php?page=bws_panel&error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . $plugin ); |
689 $redirect = self_admin_url( 'admin.php?page=bws_panel&error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . $plugin ); |
526 wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); |
690 wp_safe_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); |
527 exit(); |
691 exit(); |
528 } else { |
692 } else { |
529 wp_die( $result ); |
693 wp_die( esc_html( $result ) ); |
530 } |
694 } |
531 } |
695 } |
532 |
696 |
533 if ( ! is_network_admin() ) { |
697 if ( ! is_network_admin() ) { |
534 $recent = (array) get_option( 'recently_activated' ); |
698 $recent = (array) get_option( 'recently_activated' ); |
938 <span class="bws_hidden_help_text">' . $content . '</span> |
1172 <span class="bws_hidden_help_text">' . $content . '</span> |
939 </span>'; |
1173 </span>'; |
940 } |
1174 } |
941 } |
1175 } |
942 |
1176 |
943 /* add help tab */ |
1177 /** |
|
1178 * Function add help tab |
|
1179 * |
|
1180 * @since 1.9.8 |
|
1181 */ |
944 if ( ! function_exists( 'bws_help_tab' ) ) { |
1182 if ( ! function_exists( 'bws_help_tab' ) ) { |
945 function bws_help_tab( $screen, $args ) { |
1183 function bws_help_tab( $screen, $args ) { |
946 $url = ( ! empty( $args['section'] ) ) ? 'https://support.bestwebsoft.com/hc/en-us/sections/' . $args['section'] : 'https://support.bestwebsoft.com/'; |
1184 $url = ( ! empty( $args['section'] ) ) ? 'https://support.bestwebsoft.com/hc/en-us/sections/' . $args['section'] : 'https://support.bestwebsoft.com/'; |
947 |
1185 |
948 $content = '<p><a href="' . esc_url( $url ) . '" target="_blank">' . __( 'Visit Help Center', 'bestwebsoft' ) . '</a></p>'; |
1186 $content = '<p><a href="' . esc_url( $url ) . '" target="_blank">' . __( 'Visit Help Center', 'bestwebsoft' ) . '</a></p>'; |
949 |
1187 |
950 $screen->add_help_tab( |
1188 $screen->add_help_tab( |
951 array( |
1189 array( |
952 'id' => $args['id'] . '_help_tab', |
1190 'id' => $args['id'] . '_help_tab', |
953 'title' => __( 'FAQ', 'bestwebsoft' ), |
1191 'title' => esc_html__( 'FAQ', 'bestwebsoft' ), |
954 'content' => $content |
1192 'content' => wp_kses_post( $content ), |
955 ) |
1193 ) |
956 ); |
1194 ); |
957 |
1195 |
958 $screen->set_help_sidebar( |
1196 $screen->set_help_sidebar( |
959 '<p><strong>' . __( 'For more information:', 'bestwebsoft' ) . '</strong></p>' . |
1197 '<p><strong>' . esc_html__( 'For more information:', 'bestwebsoft' ) . '</strong></p>' . |
960 '<p><a href="https://drive.google.com/folderview?id=0B5l8lO-CaKt9VGh0a09vUjNFNjA&usp=sharing#list" target="_blank">' . __( 'Documentation', 'bestwebsoft' ) . '</a></p>' . |
1198 '<p><a href="https://bestwebsoft.com/documentation/" target="_blank">' . esc_html__( 'Documentation', 'bestwebsoft' ) . '</a></p>' . |
961 '<p><a href="https://www.youtube.com/user/bestwebsoft/playlists?flow=grid&sort=da&view=1" target="_blank">' . __( 'Video Instructions', 'bestwebsoft' ) . '</a></p>' . |
1199 '<p><a href="https://www.youtube.com/user/bestwebsoft/playlists?flow=grid&sort=da&view=1" target="_blank">' . esc_html__( 'Video Instructions', 'bestwebsoft' ) . '</a></p>' . |
962 '<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Submit a Request', 'bestwebsoft' ) . '</a></p>' |
1200 '<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . esc_html__( 'Submit a Request', 'bestwebsoft' ) . '</a></p>' |
963 ); |
1201 ); |
964 } |
1202 } |
965 } |
1203 } |
966 |
1204 |
|
1205 /** |
|
1206 * Function add css and js |
|
1207 * |
|
1208 * @since 1.9.8 |
|
1209 */ |
967 if ( ! function_exists( 'bws_enqueue_custom_code_css_js' ) ) { |
1210 if ( ! function_exists( 'bws_enqueue_custom_code_css_js' ) ) { |
968 function bws_enqueue_custom_code_css_js() { |
1211 function bws_enqueue_custom_code_css_js() { |
969 global $bstwbsftwppdtplgns_options; |
1212 global $bstwbsftwppdtplgns_options; |
970 |
1213 |
971 if ( ! isset( $bstwbsftwppdtplgns_options ) ) |
1214 if ( ! isset( $bstwbsftwppdtplgns_options ) ) { |
972 $bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
1215 $bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
|
1216 } |
973 |
1217 |
974 if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) { |
1218 if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) { |
975 $is_multisite = is_multisite(); |
1219 $is_multisite = is_multisite(); |
976 if ( $is_multisite ) |
1220 if ( $is_multisite ) { |
977 $blog_id = get_current_blog_id(); |
1221 $blog_id = get_current_blog_id(); |
978 |
1222 } |
979 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'] ) ) |
1223 |
980 wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'] ); |
1224 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'] ) ) { |
981 elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'] ) ) |
1225 wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'], array(), '2.4.2' ); |
982 wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'] ); |
1226 } elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'] ) ) { |
983 |
1227 wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'], array(), '2.4.2' ); |
984 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'] ) ) |
1228 } |
985 wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'] ); |
1229 |
986 elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'] ) ) |
1230 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'] ) ) { |
987 wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'] ); |
1231 wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'], array(), '2.4.2' ); |
988 } |
1232 } elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'] ) ) { |
989 } |
1233 wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'], array(), '2.4.2' ); |
990 } |
1234 } |
991 |
1235 } |
|
1236 } |
|
1237 } |
|
1238 |
|
1239 /** |
|
1240 * Function add custom php code |
|
1241 * |
|
1242 * @since 1.9.8 |
|
1243 */ |
992 if ( ! function_exists( 'bws_enqueue_custom_code_php' ) ) { |
1244 if ( ! function_exists( 'bws_enqueue_custom_code_php' ) ) { |
993 function bws_enqueue_custom_code_php() { |
1245 function bws_enqueue_custom_code_php() { |
994 if ( is_admin() ) |
1246 if ( is_admin() ) { |
995 return; |
1247 return; |
|
1248 } |
996 |
1249 |
997 global $bstwbsftwppdtplgns_options; |
1250 global $bstwbsftwppdtplgns_options; |
998 |
1251 |
999 if ( ! isset( $bstwbsftwppdtplgns_options ) ) |
1252 if ( ! isset( $bstwbsftwppdtplgns_options ) ) { |
1000 $bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
1253 $bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
|
1254 } |
1001 |
1255 |
1002 if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) { |
1256 if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) { |
1003 |
1257 |
1004 $is_multisite = is_multisite(); |
1258 $is_multisite = is_multisite(); |
1005 if ( $is_multisite ) |
1259 if ( $is_multisite ) { |
1006 $blog_id = get_current_blog_id(); |
1260 $blog_id = get_current_blog_id(); |
|
1261 } |
1007 |
1262 |
1008 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) { |
1263 if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) { |
1009 if ( file_exists( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) { |
1264 if ( file_exists( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) { |
1010 if ( ! defined( 'BWS_GLOBAL' ) ) |
1265 if ( ! defined( 'BWS_GLOBAL' ) ) { |
1011 define( 'BWS_GLOBAL', true ); |
1266 define( 'BWS_GLOBAL', true ); |
1012 require_once( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ); |
1267 } |
|
1268 require_once $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php']; |
1013 } else { |
1269 } else { |
1014 unset( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ); |
1270 unset( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ); |
1015 if ( $is_multisite ) |
1271 if ( $is_multisite ) { |
1016 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1272 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1017 else |
1273 } else { |
1018 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1274 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
|
1275 } |
1019 } |
1276 } |
1020 } elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) { |
1277 } elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) { |
1021 if ( file_exists( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) { |
1278 if ( file_exists( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) { |
1022 if ( ! defined( 'BWS_GLOBAL' ) ) |
1279 if ( ! defined( 'BWS_GLOBAL' ) ) { |
1023 define( 'BWS_GLOBAL', true ); |
1280 define( 'BWS_GLOBAL', true ); |
1024 require_once( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ); |
1281 } |
|
1282 require_once $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php']; |
1025 } else { |
1283 } else { |
1026 unset( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ); |
1284 unset( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ); |
1027 if ( $is_multisite ) |
1285 if ( $is_multisite ) { |
1028 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1286 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1029 else |
1287 } else { |
1030 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
1288 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); |
|
1289 } |
1031 } |
1290 } |
1032 } |
1291 } |
1033 } |
1292 } |
1034 } |
1293 } |
1035 } |
1294 } |
1036 |
1295 |
|
1296 /** |
|
1297 * Function delete plugin |
|
1298 * |
|
1299 * @since 1.9.8 |
|
1300 */ |
1037 if ( ! function_exists( 'bws_delete_plugin' ) ) { |
1301 if ( ! function_exists( 'bws_delete_plugin' ) ) { |
1038 function bws_delete_plugin( $basename ) { |
1302 function bws_delete_plugin( $basename ) { |
1039 global $bstwbsftwppdtplgns_options; |
1303 global $bstwbsftwppdtplgns_options; |
1040 |
1304 |
1041 $is_multisite = is_multisite(); |
1305 $is_multisite = is_multisite(); |
1042 if ( $is_multisite ) |
1306 if ( $is_multisite ) { |
1043 $blog_id = get_current_blog_id(); |
1307 $blog_id = get_current_blog_id(); |
1044 |
1308 } |
1045 if ( ! isset( $bstwbsftwppdtplgns_options ) ) |
1309 |
|
1310 if ( ! isset( $bstwbsftwppdtplgns_options ) ) { |
1046 $bstwbsftwppdtplgns_options = ( $is_multisite ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
1311 $bstwbsftwppdtplgns_options = ( $is_multisite ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); |
|
1312 } |
1047 |
1313 |
1048 /* remove bws_menu versions */ |
1314 /* remove bws_menu versions */ |
1049 unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $basename ] ); |
1315 unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $basename ] ); |
1050 /* remove track usage data */ |
1316 /* remove track usage data */ |
1051 if ( isset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] ) ) |
1317 if ( isset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] ) ) { |
1052 unset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] ); |
1318 unset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] ); |
|
1319 } |
1053 /* if empty ['bws_menu']['version'] - there is no other bws plugins - delete all */ |
1320 /* if empty ['bws_menu']['version'] - there is no other bws plugins - delete all */ |
1054 if ( empty( $bstwbsftwppdtplgns_options['bws_menu']['version'] ) ) { |
1321 if ( empty( $bstwbsftwppdtplgns_options['bws_menu']['version'] ) ) { |
1055 /* remove options */ |
1322 /* remove options */ |
1056 if ( $is_multisite ) |
1323 if ( $is_multisite ) { |
1057 delete_site_option( 'bstwbsftwppdtplgns_options' ); |
1324 delete_site_option( 'bstwbsftwppdtplgns_options' ); |
1058 else |
1325 } else { |
1059 delete_option( 'bstwbsftwppdtplgns_options' ); |
1326 delete_option( 'bstwbsftwppdtplgns_options' ); |
|
1327 } |
1060 |
1328 |
1061 /* remove custom_code */ |
1329 /* remove custom_code */ |
1062 if ( $is_multisite ) { |
1330 if ( $is_multisite ) { |
1063 global $wpdb; |
1331 global $wpdb; |
1064 $old_blog = $wpdb->blogid; |
1332 $old_blog = $wpdb->blogid; |
1065 /* Get all blog ids */ |
1333 /* Get all blog ids */ |
1066 $blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" ); |
1334 $blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" ); |
1067 foreach ( $blogids as $blog_id ) { |
1335 foreach ( $blogids as $blog_id ) { |
1068 switch_to_blog( $blog_id ); |
1336 switch_to_blog( $blog_id ); |
1069 $upload_dir = wp_upload_dir(); |
1337 $upload_dir = wp_upload_dir(); |
1070 $folder = $upload_dir['basedir'] . '/bws-custom-code'; |
1338 $folder = $upload_dir['basedir'] . '/bws-custom-code'; |
1071 if ( file_exists( $folder ) && is_dir( $folder ) ) { |
1339 if ( file_exists( $folder ) && is_dir( $folder ) ) { |
1072 array_map( 'unlink', glob( "$folder/*" ) ); |
1340 array_map( 'unlink', glob( "$folder/*" ) ); |
1073 rmdir( $folder ); |
1341 rmdir( $folder ); |
1074 } |
1342 } |
1075 } |
1343 } |
1076 switch_to_blog( $old_blog ); |
1344 switch_to_blog( $old_blog ); |
1077 } else { |
1345 } else { |
1078 $upload_dir = wp_upload_dir(); |
1346 $upload_dir = wp_upload_dir(); |
1079 $folder = $upload_dir['basedir'] . '/bws-custom-code'; |
1347 $folder = $upload_dir['basedir'] . '/bws-custom-code'; |
1080 if ( file_exists( $folder ) && is_dir( $folder ) ) { |
1348 if ( file_exists( $folder ) && is_dir( $folder ) ) { |
1081 array_map( 'unlink', glob( "$folder/*" ) ); |
1349 array_map( 'unlink', glob( "$folder/*" ) ); |
1082 rmdir( $folder ); |
1350 rmdir( $folder ); |
1083 } |
1351 } |
1084 } |
1352 } |