Themes and plugins.
|
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
function wamt_add_to_settings_menu(){
|
||||||
|
$admin_permission = 'manage_options';
|
||||||
|
// add_options_page (Title, Setting Title, Permission, Special Definition, function name);
|
||||||
|
add_options_page(__('WP Add Mime Types Admin Settings', 'wp-add-mime-types'), __('Mime Type Settings','wp-add-mime-types'), $admin_permission, __FILE__, 'wamt_admin_settings_page');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Processing Setting menu for the plugin.
|
||||||
|
function wamt_admin_settings_page(){
|
||||||
|
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
||||||
|
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
||||||
|
|
||||||
|
$admin_permission = 'manage_options';
|
||||||
|
// Loading the stored setting data (wp_add_mime_types_array) from WordPress database.
|
||||||
|
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)){
|
||||||
|
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
||||||
|
$past_settings = get_option(WAMT_SETTING_FILE);
|
||||||
|
}else
|
||||||
|
$settings = get_option(WAMT_SETTING_FILE);
|
||||||
|
|
||||||
|
if($settings === false) $settings = array();
|
||||||
|
|
||||||
|
$permission = false;
|
||||||
|
// The user who can manage the WordPress option can only access the Setting menu of this plugin.
|
||||||
|
if(current_user_can($admin_permission)) $permission = true;
|
||||||
|
// If the adding data is not set, the value "mime_type_values" sets "empty".
|
||||||
|
$mime_type_values = array();
|
||||||
|
if(isset($settings['mime_type_values']) && !empty($settings['mime_type_values']))
|
||||||
|
$mime_type_values = unserialize($settings['mime_type_values']);
|
||||||
|
|
||||||
|
// When the adding data is saved (posted) at the setting menu, the data will update to the WordPress database after the security check
|
||||||
|
if(isset($_POST["wamt-form"]) && $_POST["wamt-form"]){
|
||||||
|
if(check_admin_referer("wamt-nonce-key", "wamt-form")){
|
||||||
|
if(isset($_POST['mime_type_values'])){
|
||||||
|
$p_set = esc_attr(strip_tags(html_entity_decode($_POST['mime_type_values']),ENT_QUOTES));
|
||||||
|
$mime_type_values = explode("\n", $p_set);
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach($mime_type_values as $m_type=>$m_value)
|
||||||
|
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
||||||
|
$mime_type_values[$m_type] = trim(str_replace(" ", " ", $m_value));
|
||||||
|
$settings['mime_type_values'] = serialize($mime_type_values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//$mime_type_values = unserialize($settings['mime_type_values']);
|
||||||
|
|
||||||
|
if(!isset($settings['security_attempt_enable']))
|
||||||
|
$settings['security_attempt_enable'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['security_attempt_enable']))
|
||||||
|
$settings['security_attempt_enable'] = wp_strip_all_tags($_POST['security_attempt_enable']);
|
||||||
|
}
|
||||||
|
if(!isset($settings['filename_sanitized_enable']))
|
||||||
|
$settings['filename_sanitized_enable'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['filename_sanitized_enable']))
|
||||||
|
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
||||||
|
}
|
||||||
|
if(!isset($settings['file_type_debug']))
|
||||||
|
$settings['file_type_debug'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['file_type_debug']))
|
||||||
|
$settings['file_type_debug'] = wp_strip_all_tags($_POST['file_type_debug']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Update to WordPress Data.
|
||||||
|
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
||||||
|
;//get_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
||||||
|
else{
|
||||||
|
if(isset($_POST["wamt-form"]) && $_POST["wamt-form"])
|
||||||
|
if(check_admin_referer("wamt-nonce-key", "wamt-form"))
|
||||||
|
update_option(WAMT_SETTING_FILE, $settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="add_mime_media_admin_setting_page_updated"><p><strong><?php _e('Updated', 'wp-add-mime-types'); ?></strong></p></div>
|
||||||
|
|
||||||
|
<div id="add_mime_media_admin_menu">
|
||||||
|
<h2><?php _e('WP Add Mime Types Admin Settings', 'wp-add-mime-types'); ?></h2>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<?php // for CSRF (Cross-Site Request Forgery): https://propansystem.net/blog/2018/02/20/post-6279/
|
||||||
|
wp_nonce_field("wamt-nonce-key", "wamt-form"); ?>
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; ">
|
||||||
|
<legend><h3><?php _e('List of allowed mime types and file extensions by WordPress','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<div style="overflow:scroll; height: 500px;">
|
||||||
|
<table>
|
||||||
|
<?php
|
||||||
|
// Get the list of the file extensions which WordPress allows the upload.
|
||||||
|
$allowed_mime_values = get_allowed_mime_types();
|
||||||
|
|
||||||
|
// Getting the extension name in the saved data
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach ($mime_type_values as $line){
|
||||||
|
$line_value = explode("=", $line);
|
||||||
|
if(count($line_value) != 2) continue;
|
||||||
|
$mimes[trim($line_value[0])] = trim($line_value[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List view of the allowed mime types including the addition (red color) in the admin settings.
|
||||||
|
if(!empty($allowed_mime_values)){
|
||||||
|
foreach($allowed_mime_values as $type=>$value){
|
||||||
|
// Escape strings
|
||||||
|
$type = wp_strip_all_tags($type);
|
||||||
|
$value = wp_strip_all_tags($value);
|
||||||
|
if(isset($mimes)){
|
||||||
|
$add_mime_type_check = "";
|
||||||
|
foreach($mimes as $a_type=>$a_value){
|
||||||
|
if(!strcmp($type, $a_type)){
|
||||||
|
$add_mime_type_check = " style='color:red;'";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<tr><td$add_mime_type_check>$type</td><td$add_mime_type_check>=</td><td$add_mime_type_check>$value</td></tr>\n";
|
||||||
|
}else{
|
||||||
|
echo "<tr><td>$type</td><td>=</td><td>$value</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
||||||
|
<legend><h3><?php _e('Security Options','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<?php _e('* The plugin avoids some security checks by WordPress core. If you do not want to avoid them, please turn on the following setting.','wp-add-mime-types'); ?></p>
|
||||||
|
<p><span style="color:red;"><?php if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)) _e('* The site administrator cannot add the value for mime type because the multisite is enabled. <br/>Please contact the multisite administrator if you would like to add the value.','wp-add-mime-types'); ?></span></p>
|
||||||
|
|
||||||
|
<?php // ?>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="security_attempt_enable" value="no" />
|
||||||
|
<input type="checkbox" name="security_attempt_enable" value="yes" <?php if( isset($settings['security_attempt_enable']) && $settings['security_attempt_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable the attempt to determine the real file type of a file by WordPress core.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
||||||
|
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="file_type_debug" value="no" />
|
||||||
|
<input type="checkbox" name="file_type_debug" value="yes" <?php if( isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable to debug output for file types recognized by WordPress when a file is uploaded by the media. <br/>* By enabling both this option and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is uploaded from Media.<br/>* PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
||||||
|
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
||||||
|
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types'); ?>
|
||||||
|
<br/><?php _e('* If the head in each line is set to "-", then the MIME type restricts.<br/>ex. -bmp = image/bmp<br/>The files which has "bmp" file extention becomes not to be able to upload.','wp-add-mime-types'); ?></p>
|
||||||
|
<p><span style="color:red;"><?php if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)) _e('* The site administrator cannot add the value for mime type because the multisite is enabled. <br/>Please contact the multisite administrator if you would like to add the value.','wp-add-mime-types'); ?></span></p>
|
||||||
|
|
||||||
|
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
||||||
|
<textarea name="mime_type_values" cols="100" rows="10" <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>><?php if(isset($mimes) && is_array($mimes)) foreach ($mimes as $m_type=>$m_value) echo $m_type . "\t= " .$m_value . "\n"; ?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if(is_multisite() && current_user_can('manage_network_options')){
|
||||||
|
$past_mime_type_values = "";
|
||||||
|
if(isset($past_settings['mime_type_values']))
|
||||||
|
$past_mime_type_values = unserialize($past_settings['mime_type_values']);
|
||||||
|
if(!empty($past_mime_type_values)){
|
||||||
|
|
||||||
|
?>
|
||||||
|
<br/>
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
||||||
|
<legend><h3><?php _e('Past Add Values before Multisite function was enabled.','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<p><span style="color:red;"><?php _e('* This is for multisite network administrators and site administrators.<br/> The following values are disabled after multisite function was enabled.','wp-add-mime-types'); ?></span></p>
|
||||||
|
|
||||||
|
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
||||||
|
<textarea name="mime_type_values" cols="100" rows="10" disabled><?php if(isset($past_mime_type_values) && is_array($past_mime_type_values)) foreach ($past_mime_type_values as $m_type=>$m_value) echo esc_html($m_value) . "\n"; ?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<input type="submit" value="<?php _e('Save', 'wp-add-mime-types'); ?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
<?php
|
||||||
|
function wamt_network_add_to_settings_menu(){
|
||||||
|
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
||||||
|
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
||||||
|
|
||||||
|
if( ! is_multisite() || ! is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
||||||
|
return ;
|
||||||
|
|
||||||
|
$admin_permission = 'manage_network_options';
|
||||||
|
|
||||||
|
// add_options_page (Title, Setting Title, Permission, Special Definition, function name);
|
||||||
|
add_submenu_page( 'settings.php', __('WP Add Mime Types Admin Settings for Network Administrator', 'wp-add-mime-types'), __('Mime Type Settings','wp-add-mime-types'), $admin_permission, __FILE__, 'wamt_network_admin_settings_page');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Processing Setting menu for the plugin.
|
||||||
|
function wamt_network_admin_settings_page(){
|
||||||
|
$admin_permission = 'manage_network_options';
|
||||||
|
// Loading the stored setting data (wp_add_mime_types_network_array) from WordPress database.
|
||||||
|
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
||||||
|
if($settings === false) $settings = array();
|
||||||
|
|
||||||
|
$permission = false;
|
||||||
|
// The user who can manage the WordPress option can only access the Setting menu of this plugin.
|
||||||
|
if(current_user_can($admin_permission)) $permission = true;
|
||||||
|
// If the adding data is not set, the value "mime_type_values" sets "empty".
|
||||||
|
$mime_type_values = array();
|
||||||
|
if(isset($settings['mime_type_values']) && !empty($settings['mime_type_values']))
|
||||||
|
$mime_type_values = unserialize($settings['mime_type_values']);
|
||||||
|
// When the adding data is saved (posted) at the setting menu, the data will update to the WordPress database after the security check
|
||||||
|
if(isset($_POST["wamt-network-form"]) && $_POST["wamt-network-form"]){
|
||||||
|
if(check_admin_referer("wamt-network-nonce-key", "wamt-network-form")){
|
||||||
|
if(isset($_POST['mime_type_values'])){
|
||||||
|
$p_set = esc_attr(strip_tags(html_entity_decode($_POST['mime_type_values']),ENT_QUOTES));
|
||||||
|
$mime_type_values = explode("\n", $p_set);
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach($mime_type_values as $m_type=>$m_value)
|
||||||
|
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
||||||
|
$mime_type_values[$m_type] = trim(str_replace(" ", " ", $m_value));
|
||||||
|
$settings['mime_type_values'] = serialize($mime_type_values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
// $mime_type_values = unserialize($settings['mime_type_values']);
|
||||||
|
|
||||||
|
if(!isset($settings['security_attempt_enable']))
|
||||||
|
$settings['security_attempt_enable'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['security_attempt_enable']))
|
||||||
|
$settings['security_attempt_enable'] = wp_strip_all_tags($_POST['security_attempt_enable']);
|
||||||
|
}
|
||||||
|
if(!isset($settings['filename_sanitized_enable']))
|
||||||
|
$settings['filename_sanitized_enable'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['filename_sanitized_enable']))
|
||||||
|
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
||||||
|
}
|
||||||
|
if(!isset($settings['file_type_debug']))
|
||||||
|
$settings['file_type_debug'] = "no";
|
||||||
|
else{
|
||||||
|
if(isset($_POST['file_type_debug']))
|
||||||
|
$settings['file_type_debug'] = wp_strip_all_tags($_POST['file_type_debug']);
|
||||||
|
}
|
||||||
|
// Update on wp_sitemeta
|
||||||
|
update_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="network_add_mime_media_admin_setting_page_updated"><p><strong><?php _e('Updated', 'wp-add-mime-types'); ?></strong></p></div>
|
||||||
|
|
||||||
|
<div id="network_add_mime_media_admin_menu">
|
||||||
|
<h2><?php _e('WP Add Mime Types Admin Settings for Network Administrator', 'wp-add-mime-types'); ?></h2>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<?php // for CSRF (Cross-Site Request Forgery): https://propansystem.net/blog/2018/02/20/post-6279/
|
||||||
|
wp_nonce_field("wamt-network-nonce-key", "wamt-network-form"); ?>
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
||||||
|
<legend><h3><?php _e('List of allowed mime types and file extensions by WordPress','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<div style="overflow:scroll; height: 500px;">
|
||||||
|
<table>
|
||||||
|
<?php
|
||||||
|
// Get the list of the file extensions which WordPress allows the upload.
|
||||||
|
$allowed_mime_values = get_allowed_mime_types();
|
||||||
|
|
||||||
|
// Getting the extension name in the saved data
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach ($mime_type_values as $line){
|
||||||
|
$line_value = explode("=", $line);
|
||||||
|
if(count($line_value) != 2) continue;
|
||||||
|
$mimes[trim($line_value[0])] = trim($line_value[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List view of the allowed mime types including the addition (red color) in the admin settings.
|
||||||
|
if(!empty($allowed_mime_values)){
|
||||||
|
foreach($allowed_mime_values as $type=>$value){
|
||||||
|
// Escape strings
|
||||||
|
$type = wp_strip_all_tags($type);
|
||||||
|
$value = wp_strip_all_tags($value);
|
||||||
|
if(isset($mimes)){
|
||||||
|
$add_mime_type_check = "";
|
||||||
|
foreach($mimes as $a_type=>$a_value){
|
||||||
|
if(!strcmp($type, $a_type)){
|
||||||
|
$add_mime_type_check = " style='color:red;'";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<tr><td$add_mime_type_check>$type</td><td$add_mime_type_check>=</td><td$add_mime_type_check>$value</td></tr>\n";
|
||||||
|
}else{
|
||||||
|
echo "<tr><td>$type</td><td>=</td><td>$value</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
||||||
|
<legend><h3><?php _e('Security Options','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<?php _e('* The plugin avoids some security checks by WordPress core. If you do not want to avoid them, please turn on the following setting.','wp-add-mime-types'); ?></p>
|
||||||
|
|
||||||
|
<?php // ?>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="security_attempt_enable" value="no" />
|
||||||
|
<input type="checkbox" name="security_attempt_enable" value="yes" <?php if( isset($settings['security_attempt_enable']) && $settings['security_attempt_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable the attempt to determine the real file type of a file by WordPress core.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
||||||
|
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="file_type_debug" value="no" />
|
||||||
|
<input type="checkbox" name="file_type_debug" value="yes" <?php if( isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable to debug output for file types recognized by WordPress when a file is uploaded by the media. <br/>* By enabling both this option and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is uploaded from Media.<br/>* PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.','wp-add-mime-types'); ?>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
||||||
|
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
||||||
|
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
||||||
|
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types'); ?>
|
||||||
|
<br/><?php _e('* If the head in each line is set to "-", then the MIME type restricts.<br/>ex. -bmp = image/bmp<br/>The files which has "bmp" file extention becomes not to be able to upload.','wp-add-mime-types'); ?></p>
|
||||||
|
|
||||||
|
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
||||||
|
<textarea name="mime_type_values" cols="100" rows="10" <?php if(!$permission) echo "disabled"; ?>><?php if(isset($mimes) && is_array($mimes)) foreach ($mimes as $m_type=>$m_value) echo $m_type . "\t= " .$m_value . "\n"; ?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<input type="submit" value="<?php _e('Save', 'wp-add-mime-types'); ?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,277 @@
|
||||||
|
=== WP Add Mime Types ===
|
||||||
|
Contributors: kimipooh
|
||||||
|
Tags: mime,file extention
|
||||||
|
Requires at least: 6.2
|
||||||
|
Requires PHP: 7.4
|
||||||
|
Tested up to: 6.7.2
|
||||||
|
Stable tag: 3.1.2
|
||||||
|
License: GPL v2
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
|
||||||
|
The plugin additionally allows the mime types and file extensions to WordPress.
|
||||||
|
|
||||||
|
== Description ==
|
||||||
|
|
||||||
|
The plugin additionally allows the mime types and file extensions to WordPress. In other words, your WordPress site can upload various file extensions.
|
||||||
|
|
||||||
|
== Installation ==
|
||||||
|
|
||||||
|
Please install this plugin and activate it.
|
||||||
|
If you use a language except English, please update the translation data in the updates of Dashboard.
|
||||||
|
|
||||||
|
If the multisite is enabled, please check the setting menu in the network administrator.
|
||||||
|
|
||||||
|
= Usage =
|
||||||
|
|
||||||
|
First of all, please check the "Media Type Settings" in the "Settings".
|
||||||
|
You can see the list of allowed mime types and file extensions by WordPress.
|
||||||
|
|
||||||
|
When you add the mime type or file extension, the data will be added to last item in this list at the red color.
|
||||||
|
|
||||||
|
About the mime type list, please see the list of mime types in the information of the Internet.
|
||||||
|
Ex. http://www.freeformatter.com/mime-types-list.html
|
||||||
|
|
||||||
|
The user who have the [manage_options](http://codex.wordpress.org/Roles_and_Capabilities#manage_options) permission can only add the setting.
|
||||||
|
|
||||||
|
If you would like to translate it to your language, please visit the GlotPress from https://wordpress.org/plugins/wp-add-mime-types/ .
|
||||||
|
|
||||||
|
If the multisite is enabled, the multisite network administrator can add/change/delete the mime type value in the multisite network setting menu. And the multisite network administrator or the site administrator can only see the past value (cannot change) before the site was migrated to the multisite.
|
||||||
|
|
||||||
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
= It fails to upload a file for the security reasons of WordPress despite having set it up with this plugin! =
|
||||||
|
If it fails to upload a file for the security reasons of WordPress despite having set it up with this plugin, then the MIME type of the uploaded file recognised by WordPress may be different from the MIME type you have set. In that case, you need to find out how WordPress recognised the MIME type of the file.
|
||||||
|
So, turn on “Enable to debug output for file types recognized by WordPress when a file is uploaded by the media.” setting.
|
||||||
|
and upload a file and set “mime type” recognized by WordPress in the setting of this plugin.
|
||||||
|
Please keep in mind that the “Enable to debug output for file types recognised by WordPress when a file is uploaded by the media.” setting must be turned off after you finish checking the mime type. If it is left on, file uploads will not work.
|
||||||
|
Reference: https://docs.google.com/presentation/d/1o4YHqP7s-EcctYSEYM2L7HLJtqhjA_mkY4VMjvTdj20/edit?usp=sharing (Google Slide)
|
||||||
|
|
||||||
|
= How to check the uploaded file type from Media. =
|
||||||
|
WordPress recognizes the file mime type by finfo_file function (wp-includes/functions.php). However, sometimes, the standard MIME type of a file and the MIME type of a WordPress-recognized file are different. By enabling both this option (in setting menu) and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is from Media. PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.
|
||||||
|
|
||||||
|
= Cannot work =
|
||||||
|
If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.
|
||||||
|
|
||||||
|
For example, if you install Media Library Assistant plugin, please turn off "Enable Upload MIME Type Support" in the Upload tag in this plugin setting.
|
||||||
|
|
||||||
|
= Can the plugin support the multi extensions? =
|
||||||
|
Yes. The function was supported by Version 2.4.0.
|
||||||
|
WordPress sanitizes the filename in case of 2 or more extensions.
|
||||||
|
ex. XXX.YYY.ZZZ --> XXX_.YYY.ZZZ.
|
||||||
|
The plugin fixes the sanitized extension when a file is uploaded in the media in case of allowed extensions.
|
||||||
|
ex. XXX.YYY.ZZZ -- sanitized --> XXX_.YYY.ZZZ -- fixed the plugin --> XXX.YYY.ZZZ
|
||||||
|
In detail, please see sanitize_file_name function in "wp-includes/formatting.php".
|
||||||
|
|
||||||
|
= Can I comment out in the setting value? =
|
||||||
|
Yes. You can comment out above version 2.3.0.
|
||||||
|
|
||||||
|
= Can the plugin avoid the security check for a file content by WordPress core? =
|
||||||
|
Yes. WordPress core has implemented the security check for a file content since version 4.7.1.
|
||||||
|
The plugin's default setting disables this security check .
|
||||||
|
|
||||||
|
= How do the plugin behave when it is installed and activated on the multisite network administration dashboard? =
|
||||||
|
The setting in the multisite network administration dashboard is taken precedence. The setting in each site administration dashboard is displayed, but the values aren't applied.
|
||||||
|
|
||||||
|
= How do the plugin behave when it is deactivated/uninstalled on the multisite network administration dashboard? =
|
||||||
|
|
||||||
|
The setting values in each site administration dashboard in case of activating the plugin in each site is applied.
|
||||||
|
|
||||||
|
= Don't the setting values in the multisite network administration dashboard and the setting values in each site administration dashboard influence each other? =
|
||||||
|
|
||||||
|
Yes, each setting values are saved as the other setting items.
|
||||||
|
|
||||||
|
= Is it possible to restrict the extensions? =
|
||||||
|
|
||||||
|
Yes, it is available on the version 3.0.0.
|
||||||
|
If the head in each line is set to '-', then the MIME type restricts.
|
||||||
|
ex. -bmp = image/bmp
|
||||||
|
The files which has "bmp" file extention becomes not to be able to upload.
|
||||||
|
|
||||||
|
== Screenshots ==
|
||||||
|
1. Setting Menu
|
||||||
|
2. Setting Menu in case of the multisite
|
||||||
|
3. Ignore to the right of '#' on a line
|
||||||
|
4. Security Options
|
||||||
|
|
||||||
|
== Changelog ==
|
||||||
|
= 3.1.2 =
|
||||||
|
- Tested up WordPress 6.7.2 with PHP 8.3.19 and 8.4.5.
|
||||||
|
- PHP 7.4 will soon no longer be supported.
|
||||||
|
|
||||||
|
= 3.1.1 =
|
||||||
|
- Fixes the type format mismatch issues since PHP 8.1 or later.
|
||||||
|
* Tested up WordPress 6.6.1 with PHP 8.3.6.
|
||||||
|
|
||||||
|
= 3.1.0 =
|
||||||
|
- Fixes type format mismatch issues in variable initialisation.
|
||||||
|
- Tested up WordPress 6.4.2 with PHP 8.2.0.
|
||||||
|
- Changed to require WordPress 6.2+ and PHP 7.4+.
|
||||||
|
- Tested up WordPress 6.5.2 with PHP 8.3.6.
|
||||||
|
|
||||||
|
= 3.0.3 =
|
||||||
|
- Fixed warning checking when retrieving serialized data.
|
||||||
|
|
||||||
|
= 3.0.2 =
|
||||||
|
- Enhanced error checking when retrieving serialized data.
|
||||||
|
|
||||||
|
= 3.0.1 =
|
||||||
|
- Fixed warning when the $settings data gets.
|
||||||
|
|
||||||
|
= 3.0.0 =
|
||||||
|
- Added the mime type restriction function by using '-' prefix. If the head in each line is set to '-', then the MIME type restricts. In case of "-bmp = image/bmp", the files which has "bmp" file extention becomes not to be able to upload.
|
||||||
|
- Fixed the warning on the multisite.
|
||||||
|
- Tested up WordPress 5.6.2 with PHP 8.0.0.
|
||||||
|
- Tested up WordPress 5.8
|
||||||
|
- Tested up WordPress 6.0
|
||||||
|
|
||||||
|
= 2.5.8 =
|
||||||
|
* Fixed the issue of the media uploads failing when activating this plugin for the first time, if the plugin settings are not saved whenever.
|
||||||
|
|
||||||
|
= 2.5.7 =
|
||||||
|
* Removed the folder (trunk) for this plugin in this plugin folder. The “trunk” folder was not needed. Due to this, activating the plugin in version 2.5.6, you might get an error message "Error: The plugin does not have a valid header".
|
||||||
|
|
||||||
|
= 2.5.6 =
|
||||||
|
* Added the "Enable to debug output for file types recognized by WordPress when a file is uploaded by the media." security option. In detail, please see "Frequently Asked Questions" section.
|
||||||
|
* Tested up to WordPress 5.6 and PHP 7.4.
|
||||||
|
|
||||||
|
= 2.5.5 =
|
||||||
|
* Fixed the error "the "Too few argument" for WordPress 5.0 or previous versions.
|
||||||
|
|
||||||
|
= 2.5.4 =
|
||||||
|
* Added the function for removing this plugin's settings in the database when this plugin is uninstall.
|
||||||
|
* Fixed the function names for not influencing the function name for other plugins.
|
||||||
|
|
||||||
|
= 2.5.3 =
|
||||||
|
* Fixed the issue of "Undefined variable: f_exp_more2_flag" warning.
|
||||||
|
|
||||||
|
= 2.5.2 =
|
||||||
|
* Improved the response of CSRF (Cross-Site Request Forgery) vulnerability for this plugin's settings.
|
||||||
|
|
||||||
|
= 2.5.1 =
|
||||||
|
* Added the response of CSRF (Cross-Site Request Forgery) vulnerability for this plugin's settings.
|
||||||
|
|
||||||
|
= 2.5.0 =
|
||||||
|
* Added the security option item in the admin menu for enabling the security check for a file content and for sanitizing the multiple file extensions within the filename by WordPress core.
|
||||||
|
* Supported the new language setting regarding load_plugin_textdomain function.
|
||||||
|
|
||||||
|
= 2.4.1 =
|
||||||
|
* Changed remove_underscore function name to wpaddmimetypes_remove_underscore because of the avoidance of the name conflict.
|
||||||
|
* Tested up to WordPress 5.2.2 and PHP 7.4.
|
||||||
|
|
||||||
|
= 2.4.0 =
|
||||||
|
* Support of the multi extension. Even if the file extension is "XXX.ZZZ", "XXX.YYY.ZZZ", "AAA.XXX.YYY.ZZZ" or more, it always picks up the tail of the extensions.
|
||||||
|
|
||||||
|
= 2.3.1 =
|
||||||
|
* Tested up to WordPress 5.2.2 and PHP 7.3.
|
||||||
|
|
||||||
|
= 2.3.0 =
|
||||||
|
* Tested up to WordPress 5.0 and PHP 7.2.
|
||||||
|
|
||||||
|
= 2.2.1 =
|
||||||
|
* Tested up to WordPress 4.9.
|
||||||
|
|
||||||
|
= 2.2.0 =
|
||||||
|
* Fixed foreach function warning if a setting value is empty.
|
||||||
|
* Added to escape HTML tags in a setting value using wp_strip_all_tags function.
|
||||||
|
* Added to ignore to the right of '#' on a line.
|
||||||
|
|
||||||
|
= 2.1.3 =
|
||||||
|
* Tested up to WordPress 4.8 and PHP 7.1
|
||||||
|
|
||||||
|
= 2.1.2 =
|
||||||
|
* Fixed the warning issue regarding explode function.
|
||||||
|
* Tested up to WordPress 4.7.2
|
||||||
|
|
||||||
|
= 2.1.1 =
|
||||||
|
* Fixed the issue that the safe files in WordPress, such as jpg, png, pdf cannot be uploaded.
|
||||||
|
|
||||||
|
= 2.1.0 =
|
||||||
|
* Tested up to WordPress 4.7.1
|
||||||
|
* Fixed finfo_file issue. See FAQ section.
|
||||||
|
|
||||||
|
= 2.0.6 =
|
||||||
|
* Tested up to WordPress 4.7
|
||||||
|
|
||||||
|
= 2.0.5 =
|
||||||
|
* Tested up to WordPress 4.6
|
||||||
|
|
||||||
|
= 2.0.4 =
|
||||||
|
* Fixed the help message in the administration menu.
|
||||||
|
|
||||||
|
= 2.0.3 =
|
||||||
|
* Fixed the help message in the administration menu.
|
||||||
|
* If the added mime type does not work, please turn off the mime type setting or deactivate other mime type plugins.
|
||||||
|
|
||||||
|
= 2.0.2 =
|
||||||
|
* Fixed the compatibility with Media Library Assistant plugin.
|
||||||
|
|
||||||
|
= 2.0.1 =
|
||||||
|
* Fixed the message in the setting menu
|
||||||
|
|
||||||
|
= 2.0.0 =
|
||||||
|
* Supported Multisite.
|
||||||
|
* Tested up to WordPress 4.5.1
|
||||||
|
|
||||||
|
= 1.3.13 =
|
||||||
|
* Tested up to WordPress 4.5.
|
||||||
|
|
||||||
|
= 1.3.12 =
|
||||||
|
* Migrated the translation function to GlotPress. If you translate it to your language, please visit the GlotPress from https://wordpress.org/plugins/wp-add-mime-types/ .
|
||||||
|
|
||||||
|
= 1.3.11 =
|
||||||
|
* Preparation of migrating the translation function to GlotPress.
|
||||||
|
|
||||||
|
= 1.3.10 =
|
||||||
|
* Tested up to WordPress 4.4.2
|
||||||
|
|
||||||
|
= 1.3.9 =
|
||||||
|
* Tested up to WordPress 4.4.1
|
||||||
|
|
||||||
|
= 1.3.8 =
|
||||||
|
* Tested up to WordPress 4.4
|
||||||
|
* Fixed language translation setting.
|
||||||
|
|
||||||
|
= 1.3.7 =
|
||||||
|
* Tested up to WordPress 4.3
|
||||||
|
|
||||||
|
= 1.3.6 =
|
||||||
|
* Fixed load_plugin_textdomain setting.
|
||||||
|
|
||||||
|
= 1.3.5 =
|
||||||
|
* Fixed load_plugin_textdomain setting.
|
||||||
|
|
||||||
|
= 1.3.4 =
|
||||||
|
* Tested up to WordPress 4.2.2
|
||||||
|
|
||||||
|
= 1.3.3 =
|
||||||
|
* Tested up to WordPress 4.1.1
|
||||||
|
|
||||||
|
= 1.3.2 =
|
||||||
|
* Tested up to WordPress 4.0
|
||||||
|
|
||||||
|
= 1.3.1 =
|
||||||
|
* Tested up to WordPress 3.9.1
|
||||||
|
|
||||||
|
= 1.3.0 =
|
||||||
|
* Tested up to WordPress 3.9
|
||||||
|
|
||||||
|
= 1.2.1 =
|
||||||
|
* Fixed Language support
|
||||||
|
|
||||||
|
= 1.2.0 =
|
||||||
|
* Tested up to WordPress 3.8
|
||||||
|
|
||||||
|
= 1.1.0 =
|
||||||
|
* Tested up to WordPress 3.7.1
|
||||||
|
|
||||||
|
= 1.0.1 =
|
||||||
|
* Fixed the display error if the setting value is empty for the first time.
|
||||||
|
|
||||||
|
= 1.0.0 =
|
||||||
|
* First Released.
|
||||||
|
* Language: English, Japanese
|
||||||
|
|
||||||
|
|
||||||
|
== Upgrade Notice ==
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: WP Add Mime Types
|
||||||
|
Plugin URI:
|
||||||
|
Description: The plugin additionally allows the mime types and file extensions to WordPress.
|
||||||
|
Version: 3.1.2
|
||||||
|
Author: Kimiya Kitani
|
||||||
|
Author URI: http://kitaney-wordpress.blogspot.jp/
|
||||||
|
Text Domain: wp-add-mime-types
|
||||||
|
Domain Path: /lang
|
||||||
|
*/
|
||||||
|
define('WAMT_DEFAULT_VAR', '3.1.1');
|
||||||
|
define('WAMT_PLUGIN_DIR', 'wp-add-mime-types');
|
||||||
|
define('WAMT_PLUGIN_NAME', 'wp-add-mime-types');
|
||||||
|
define('WAMT_PLUGIN_BASENAME', WAMT_PLUGIN_DIR . '/' . WAMT_PLUGIN_NAME . '.php');
|
||||||
|
define('WAMT_SITEADMIN_SETTING_FILE', 'wp_add_mime_types_network_array');
|
||||||
|
define('WAMT_SETTING_FILE', 'wp_add_mime_types_array');
|
||||||
|
|
||||||
|
require_once( dirname( __FILE__ ) . '/includes/admin.php');
|
||||||
|
|
||||||
|
// Uninstall settings when the plugin is uninstalled.
|
||||||
|
function wamt_uninstaller(){
|
||||||
|
if(is_multisite())
|
||||||
|
delete_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
||||||
|
delete_option(WAMT_SETTING_FILE);
|
||||||
|
}
|
||||||
|
if ( function_exists('register_uninstall_hook') )
|
||||||
|
register_uninstall_hook( __FILE__, 'wamt_uninstaller' );
|
||||||
|
|
||||||
|
// Multi-language support.
|
||||||
|
function wamt_enable_language_translation(){
|
||||||
|
load_plugin_textdomain('wp-add-mime-types')
|
||||||
|
or load_plugin_textdomain('wp-add-mime-types', false, dirname( WAMT_PLUGIN_BASENAME ) . '/lang/');
|
||||||
|
}
|
||||||
|
add_action('plugins_loaded', 'wamt_enable_language_translation');
|
||||||
|
|
||||||
|
// Add Setting to WordPress 'Settings' menu for Multisite.
|
||||||
|
if(is_multisite()){
|
||||||
|
add_action('network_admin_menu', 'wamt_network_add_to_settings_menu');
|
||||||
|
require_once( dirname( __FILE__ ) . '/includes/network-admin.php');
|
||||||
|
}
|
||||||
|
add_action('admin_menu', 'wamt_add_to_settings_menu');
|
||||||
|
|
||||||
|
// Procedure for adding the mime types and file extensions to WordPress.
|
||||||
|
function wamt_add_allow_upload_extension( $mimes ) {
|
||||||
|
$mime_type_values = array();
|
||||||
|
|
||||||
|
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
||||||
|
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
||||||
|
|
||||||
|
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
||||||
|
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
||||||
|
else
|
||||||
|
$settings = get_option(WAMT_SETTING_FILE);
|
||||||
|
|
||||||
|
if( !isset($settings['mime_type_values'] ) ) return $mimes;
|
||||||
|
$mime_type_values = maybe_unserialize($settings['mime_type_values']);
|
||||||
|
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach ((array)$mime_type_values as $line){
|
||||||
|
// Ignore to the right of '#' on a line.
|
||||||
|
$line = substr($line, 0, strcspn($line, '#'));
|
||||||
|
// Escape Strings
|
||||||
|
$line = wp_strip_all_tags($line);
|
||||||
|
// If 2 or more "=" character in the line data, it will be ignored.
|
||||||
|
$line_value = explode("=", $line);
|
||||||
|
if(count($line_value) != 2) continue;
|
||||||
|
|
||||||
|
// If the head in each line is set to '-', then the MIME type restricts.
|
||||||
|
// ex. -bmp = image/bmp
|
||||||
|
// The files which has "bmp" file extention becomes not to be able to upload.
|
||||||
|
$line_pref_str = explode("-", $line_value[0]);
|
||||||
|
if(count($line_pref_str) === 2):
|
||||||
|
if(isset($mimes[trim($line_pref_str[1])])):
|
||||||
|
unset($mimes[trim($line_pref_str[1])]);
|
||||||
|
endif;
|
||||||
|
else:
|
||||||
|
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
||||||
|
$mimes[trim($line_value[0])] = trim(str_replace(" ", " ", $line_value[1]));
|
||||||
|
endif;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register the Procedure process to WordPress.
|
||||||
|
add_filter( 'upload_mimes', 'wamt_add_allow_upload_extension');
|
||||||
|
|
||||||
|
// Using in add_allow_upload_extension_exception function.
|
||||||
|
function wamt_remove_underscore($filename, $filename_raw){
|
||||||
|
return str_replace("_.", ".", $filename);
|
||||||
|
}
|
||||||
|
// Exception for WordPress 4.7.1 file contents check system using finfo_file (wp-includes/functions.php)
|
||||||
|
// In case of custom extension in this plugins' setting, the WordPress 4.7.1 file contents check system is always true.
|
||||||
|
|
||||||
|
function wamt_add_allow_upload_extension_exception( $data, $file, $filename,$mimes,$real_mime=null) {
|
||||||
|
$mime_type_values = false;
|
||||||
|
|
||||||
|
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
||||||
|
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
||||||
|
else
|
||||||
|
$settings = get_option(WAMT_SETTING_FILE);
|
||||||
|
|
||||||
|
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
||||||
|
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
||||||
|
|
||||||
|
if(!isset($settings['mime_type_values']) || empty($settings['mime_type_values']))
|
||||||
|
return $data;
|
||||||
|
else
|
||||||
|
$mime_type_values = maybe_unserialize($settings['mime_type_values']);
|
||||||
|
|
||||||
|
$ext = $type = $proper_filename = false;
|
||||||
|
if(isset($data['ext'])) $ext = $data['ext'];
|
||||||
|
if(isset($data['type'])) $ext = $data['type'];
|
||||||
|
if(isset($data['proper_filename'])) $ext = $data['proper_filename'];
|
||||||
|
if($ext != false && $type != false) return $data;
|
||||||
|
|
||||||
|
// If file extension is 2 or more
|
||||||
|
$f_sp = explode(".", $filename);
|
||||||
|
$f_exp_count = count ($f_sp);
|
||||||
|
|
||||||
|
// Filename type is "XXX" (There is not file extension).
|
||||||
|
if($f_exp_count <= 1){
|
||||||
|
return $data;
|
||||||
|
/* Even if the file extension is "XXX.ZZZ", "XXX.YYY.ZZZ", "AAA.XXX.YYY.ZZZ" or more, it always picks up the tail of the extensions.
|
||||||
|
*/
|
||||||
|
}else{
|
||||||
|
$f_name = $f_sp[0];
|
||||||
|
$f_ext = $f_sp[$f_exp_count - 1];
|
||||||
|
// WordPress sanitizes the filename in case of 2 or more extensions.
|
||||||
|
// ex. XXX.YYY.ZZZ --> XXX_.YYY.ZZZ.
|
||||||
|
// The following function fixes the sanitized extension when a file is uploaded in the media in case of allowed extensions.
|
||||||
|
// ex. XXX.YYY.ZZZ -- sanitized --> XXX_.YYY.ZZZ -- fixed the plugin --> XXX.YYY.ZZZ
|
||||||
|
// In detail, please see sanitize_file_name function in "wp-includes/formatting.php".
|
||||||
|
//var_dump($settings['filename_sanitized_enable']);
|
||||||
|
if(isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes"){
|
||||||
|
}else{
|
||||||
|
add_filter( 'sanitize_file_name', 'wamt_remove_underscore', 10, 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If "security_attempt_enable" option disables (default) in the admin menu, the plugin avoids the security check regarding a file extension by WordPress core because of flexible management.
|
||||||
|
if(isset($settings['security_attempt_enable']) && $settings['security_attempt_enable'] === "yes"){
|
||||||
|
if(isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes"):
|
||||||
|
$finfo = finfo_open( FILEINFO_MIME_TYPE );
|
||||||
|
$real_mime = finfo_file($finfo,$file);
|
||||||
|
var_dump(__("WordPress recognizes that the file type is [". finfo_file($finfo,$file) . "].",'wp-add-mime-types'));
|
||||||
|
finfo_close($finfo);
|
||||||
|
endif;
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$flag = false;
|
||||||
|
if(!empty($mime_type_values)){
|
||||||
|
foreach ((array)$mime_type_values as $line){
|
||||||
|
// Ignore to the right of '#' on a line.
|
||||||
|
$line = substr($line, 0, strcspn($line, '#'));
|
||||||
|
// Escape Strings
|
||||||
|
$line = wp_strip_all_tags($line);
|
||||||
|
|
||||||
|
$line_value = explode("=", $line);
|
||||||
|
if(count($line_value) != 2) continue;
|
||||||
|
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
||||||
|
if(trim($line_value[0]) === $f_ext){
|
||||||
|
$ext = $f_ext;
|
||||||
|
$type = trim(str_replace(" ", " ", $line_value[1]));
|
||||||
|
$flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($flag)
|
||||||
|
return compact( 'ext', 'type', 'proper_filename' );
|
||||||
|
else
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's different arguments between WordPress 5.1 and previous versions.
|
||||||
|
global $wp_version;
|
||||||
|
if ( version_compare( $wp_version, '5.1') >= 0):
|
||||||
|
add_filter( 'wp_check_filetype_and_ext', 'wamt_add_allow_upload_extension_exception',10,5);
|
||||||
|
else:
|
||||||
|
add_filter( 'wp_check_filetype_and_ext', 'wamt_add_allow_upload_extension_exception',10,4);
|
||||||
|
endif;
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying 404 pages (not found).
|
||||||
|
*
|
||||||
|
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
get_header(); ?>
|
||||||
|
|
||||||
|
<?php if ( astra_page_layout() === 'left-sidebar' ) { ?>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div id="primary" <?php astra_primary_class(); ?>>
|
||||||
|
|
||||||
|
<?php astra_primary_content_top(); ?>
|
||||||
|
|
||||||
|
<?php astra_404_content_template(); ?>
|
||||||
|
|
||||||
|
<?php astra_primary_content_bottom(); ?>
|
||||||
|
|
||||||
|
</div><!-- #primary -->
|
||||||
|
|
||||||
|
<?php if ( astra_page_layout() === 'right-sidebar' ) { ?>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Security Policy
|
||||||
|
|
||||||
|
Thank you for your interest in helping us improve the security of our open source products, websites and other properties.
|
||||||
|
|
||||||
|
## How can I report a security bug?
|
||||||
|
|
||||||
|
We take plugin security extremely seriously. If you discover a security vulnerability, please report it in a safe and responsible manner.
|
||||||
|
|
||||||
|
You can report the issue through our [Bug Bounty Program](https://brainstormforce.com/bug-bounty-program/). We collaborate with Patchstack to provide opportunities for researchers to report vulnerabilities. The Patchstack team will help validate, triage, and handle any reported security issues.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => 'c71012491c40733ad1de');
|
||||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 384 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
|
@ -0,0 +1 @@
|
||||||
|
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-i18n'), 'version' => '078d2056e973ae49445d');
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import apiFetch from '@wordpress/api-fetch';
|
||||||
|
import DOMPurify from 'dompurify';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the class names.
|
||||||
|
*
|
||||||
|
* @param {...string} classes The class names.
|
||||||
|
*
|
||||||
|
* @return {string} Returns the class names.
|
||||||
|
*/
|
||||||
|
const classNames = ( ...classes ) => classes.filter( Boolean ).join( ' ' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the Astra Pro CTA button click event, opening the upgrade URL in a new tab.
|
||||||
|
* This function also handles the display of a spinner during the upgrade process.
|
||||||
|
*
|
||||||
|
* @param {Event} e - The event object.
|
||||||
|
* @param {Object} options - Options for the upgrade process.
|
||||||
|
* @param {string} options.url - The URL for the upgrade.
|
||||||
|
* @param {string} options.campaign - The UTM campaign parameter.
|
||||||
|
* @param {boolean} options.disableSpinner - Optional. Disables the spinner if true.
|
||||||
|
* @param {string} options.spinnerPosition - Optional. The position of the spinner.
|
||||||
|
*/
|
||||||
|
const handleGetAstraPro = (
|
||||||
|
e,
|
||||||
|
{ url = astra_admin.upgrade_url, campaign = '', disableSpinner = false, spinnerPosition = 'right' } = {}
|
||||||
|
) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if ( ! astra_admin.pro_installed_status ) {
|
||||||
|
// If a custom campaign is provided, modify the URL
|
||||||
|
if ( campaign ) {
|
||||||
|
const urlObj = new URL( url );
|
||||||
|
urlObj.searchParams.set( 'utm_campaign', campaign );
|
||||||
|
url = urlObj.toString();
|
||||||
|
}
|
||||||
|
window.open( url, '_blank' );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const spinnerHTML = disableSpinner ? '' : getSpinner();
|
||||||
|
const buttonHTML =
|
||||||
|
spinnerPosition === 'right'
|
||||||
|
? `<span class="button-text">${astra_admin.plugin_activating_text}</span>${spinnerHTML}`
|
||||||
|
: `${spinnerHTML}<span class="button-text">${astra_admin.plugin_activating_text}</span>`;
|
||||||
|
|
||||||
|
e.target.innerHTML = DOMPurify.sanitize( buttonHTML );
|
||||||
|
e.target.disabled = true;
|
||||||
|
|
||||||
|
const formData = new window.FormData();
|
||||||
|
formData.append( 'action', 'astra_recommended_plugin_activate' );
|
||||||
|
formData.append( 'security', astra_admin.plugin_manager_nonce );
|
||||||
|
formData.append( 'init', 'astra-addon/astra-addon.php' );
|
||||||
|
|
||||||
|
apiFetch( {
|
||||||
|
url: astra_admin.ajax_url,
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
} )
|
||||||
|
.then( ( data ) => {
|
||||||
|
if ( data.success ) {
|
||||||
|
window.open( astra_admin.astra_base_url, '_self' );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} )
|
||||||
|
.catch( ( error ) => {
|
||||||
|
e.target.innerText = __( 'Activation failed. Please try again.', 'astra' );
|
||||||
|
e.target.disabled = false;
|
||||||
|
console.error( 'Error during API request:', error );
|
||||||
|
// Optionally, notify the user about the error or handle it appropriately.
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a debounced function that delays its execution until after the specified delay.
|
||||||
|
*
|
||||||
|
* The debounce() function can also be used from lodash.debounce package in future.
|
||||||
|
*
|
||||||
|
* @param {Function} func - The function to debounce.
|
||||||
|
* @param {number} delay - The delay in milliseconds before the function is executed.
|
||||||
|
*
|
||||||
|
* @returns {Function} A debounced function.
|
||||||
|
*/
|
||||||
|
const debounce = ( func, delay ) => {
|
||||||
|
let timer;
|
||||||
|
function debounced( ...args ) {
|
||||||
|
clearTimeout( timer );
|
||||||
|
timer = setTimeout( () => func( ...args ), delay );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach a `cancel` method to clear the timeout.
|
||||||
|
debounced.cancel = () => {
|
||||||
|
clearTimeout( timer );
|
||||||
|
};
|
||||||
|
|
||||||
|
return debounced;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Astra Pro title.
|
||||||
|
*
|
||||||
|
* @return {string} Returns the Astra Pro title.
|
||||||
|
*/
|
||||||
|
const getAstraProTitle = () => {
|
||||||
|
return astra_admin.pro_installed_status ? __( 'Activate Now', 'astra' ) : __( 'Upgrade Now', 'astra' );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Astra Pro title.
|
||||||
|
*
|
||||||
|
* @return {string} Returns the Astra Pro title.
|
||||||
|
*/
|
||||||
|
const getAstraProTitleFreePage = () => {
|
||||||
|
return astra_admin.pro_installed_status ? __( 'Activate Now', 'astra' ) : __( 'See all Astra Pro Features', 'astra' );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the spinner SVG text.
|
||||||
|
*
|
||||||
|
* @return {string} Returns the spinner SVG text..
|
||||||
|
*/
|
||||||
|
const getSpinner = () => {
|
||||||
|
return `
|
||||||
|
<svg class="animate-spin installer-spinner ml-2 inline-block align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="16" height="16">
|
||||||
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
||||||
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function to save astra admin settings.
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*
|
||||||
|
* @param {string} key - Settings key.
|
||||||
|
* @param {string} value - The data to send.
|
||||||
|
* @param {Function} dispatch - The dispatch function.
|
||||||
|
* @param {Object} abortControllerRef - The ref object with to hold abort controller.
|
||||||
|
*
|
||||||
|
* @return {Promise} Returns a promise representing the processed request.
|
||||||
|
*/
|
||||||
|
const saveSetting = debounce(
|
||||||
|
(
|
||||||
|
{ action = 'astra_update_admin_setting', security = astra_admin.update_nonce, key = '', value },
|
||||||
|
dispatch,
|
||||||
|
abortControllerRef = { current: {} }
|
||||||
|
) => {
|
||||||
|
// Abort any previous request.
|
||||||
|
if ( abortControllerRef.current[ key ] ) {
|
||||||
|
abortControllerRef.current[ key ]?.abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new AbortController.
|
||||||
|
const abortController = new AbortController();
|
||||||
|
abortControllerRef.current[ key ] = abortController;
|
||||||
|
|
||||||
|
const formData = new window.FormData();
|
||||||
|
|
||||||
|
formData.append( 'action', action );
|
||||||
|
formData.append( 'security', security );
|
||||||
|
formData.append( 'key', key );
|
||||||
|
formData.append( 'value', value );
|
||||||
|
|
||||||
|
return apiFetch( {
|
||||||
|
url: astra_admin.ajax_url,
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
signal: abortControllerRef.current[ key ]?.signal, // Pass the signal to the fetch request.
|
||||||
|
} )
|
||||||
|
.then( () => {
|
||||||
|
dispatch( {
|
||||||
|
type: 'UPDATE_SETTINGS_SAVED_NOTIFICATION',
|
||||||
|
payload: __( 'Successfully saved!', 'astra' ),
|
||||||
|
} );
|
||||||
|
} )
|
||||||
|
.catch( ( error ) => {
|
||||||
|
// Ignore if it is intentionally aborted.
|
||||||
|
if ( error.name === 'AbortError' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error( 'Error during API request:', error );
|
||||||
|
dispatch( {
|
||||||
|
type: 'UPDATE_SETTINGS_SAVED_NOTIFICATION',
|
||||||
|
payload: __( 'An error occurred while saving.', 'astra' ),
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
300
|
||||||
|
);
|
||||||
|
|
||||||
|
export { classNames, handleGetAstraPro, debounce, getAstraProTitle, getAstraProTitleFreePage, getSpinner, saveSetting };
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Astra Admin Loader
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'Astra_Admin_Loader' ) ) {
|
||||||
|
/**
|
||||||
|
* Astra_Admin_Loader
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
class Astra_Admin_Loader {
|
||||||
|
/**
|
||||||
|
* Instance
|
||||||
|
*
|
||||||
|
* @var null $instance
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiator
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
* @return object initialized object of class.
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( ! isset( self::$instance ) ) {
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
self::$instance = new self();
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
define( 'ASTRA_THEME_ADMIN_DIR', ASTRA_THEME_DIR . 'admin/' );
|
||||||
|
define( 'ASTRA_THEME_ADMIN_URL', ASTRA_THEME_URI . 'admin/' );
|
||||||
|
|
||||||
|
$this->includes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include required classes.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function includes() {
|
||||||
|
/* Ajax init */
|
||||||
|
require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-admin-ajax.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
|
||||||
|
|
||||||
|
/* Setup Menu */
|
||||||
|
require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-menu.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
|
||||||
|
|
||||||
|
require_once ASTRA_THEME_ADMIN_DIR . 'includes/class-astra-theme-builder-free.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
|
||||||
|
|
||||||
|
/* BSF Analytics */
|
||||||
|
require_once ASTRA_THEME_ADMIN_DIR . 'class-astra-bsf-analytics.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Astra_Admin_Loader::get_instance();
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Astra BSF Analytics class helps to connect BSF Analytics.
|
||||||
|
*
|
||||||
|
* @package astra.
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) or exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Astra BSF Analytics class.
|
||||||
|
*
|
||||||
|
* @since 4.10.0
|
||||||
|
*/
|
||||||
|
class Astra_BSF_Analytics {
|
||||||
|
/**
|
||||||
|
* Instance object.
|
||||||
|
*
|
||||||
|
* @var self|null Class Instance.
|
||||||
|
*/
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.10.0
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
/*
|
||||||
|
* BSF Analytics.
|
||||||
|
*/
|
||||||
|
if ( ! class_exists( 'BSF_Analytics_Loader' ) ) {
|
||||||
|
require_once ASTRA_THEME_DIR . 'inc/lib/bsf-analytics/class-bsf-analytics-loader.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'init', array( $this, 'init_bsf_analytics' ), 5 );
|
||||||
|
add_filter( 'bsf_core_stats', array( $this, 'add_astra_analytics_data' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes BSF Analytics.
|
||||||
|
*
|
||||||
|
* @since 4.10.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function init_bsf_analytics() {
|
||||||
|
// Bail early if BSF_Analytics_Loader::get_instance is not callable and if Astra white labelling is enabled.
|
||||||
|
if ( ! is_callable( '\BSF_Analytics_Loader::get_instance' ) || astra_is_white_labelled() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kept it for future reference.
|
||||||
|
// add_filter(
|
||||||
|
// 'uds_survey_allowed_screens',
|
||||||
|
// static function ( $screens ) {
|
||||||
|
// $screens[] = 'themes';
|
||||||
|
// return $screens;
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
$bsf_analytics = \BSF_Analytics_Loader::get_instance();
|
||||||
|
$bsf_analytics->set_entity(
|
||||||
|
array(
|
||||||
|
'astra' => array(
|
||||||
|
'product_name' => 'Astra',
|
||||||
|
'path' => ASTRA_THEME_DIR . 'inc/lib/bsf-analytics',
|
||||||
|
'author' => 'brainstormforce',
|
||||||
|
'time_to_display' => '+24 hours',
|
||||||
|
'hide_optin_checkbox' => true,
|
||||||
|
|
||||||
|
/* Deactivation Survey */
|
||||||
|
'deactivation_survey' => apply_filters(
|
||||||
|
'astra_deactivation_survey_data',
|
||||||
|
array(
|
||||||
|
// Kept it for future reference.
|
||||||
|
// array(
|
||||||
|
// 'id' => 'deactivation-survey-astra',
|
||||||
|
// 'popup_logo' => ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg',
|
||||||
|
// 'plugin_slug' => 'astra',
|
||||||
|
// 'popup_title' => __( 'Quick Feedback', 'astra' ),
|
||||||
|
// 'support_url' => 'https://wpastra.com/contact/',
|
||||||
|
// 'popup_description' => __( 'If you have a moment, please share why you are deactivating Astra:', 'astra' ),
|
||||||
|
// 'show_on_screens' => array( 'themes' ),
|
||||||
|
// 'plugin_version' => ASTRA_THEME_VERSION,
|
||||||
|
// 'popup_reasons' => self::get_default_reasons(),
|
||||||
|
// ),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array of default reasons.
|
||||||
|
*
|
||||||
|
* @since 4.10.0
|
||||||
|
* @return array Default reasons.
|
||||||
|
*/
|
||||||
|
public static function get_default_reasons() {
|
||||||
|
return array(
|
||||||
|
'temporary_deactivation' => array(
|
||||||
|
'label' => esc_html__( 'This is a temporary deactivation for testing.', 'astra' ),
|
||||||
|
'placeholder' => esc_html__( 'How can we assist you?', 'astra' ),
|
||||||
|
'show_cta' => 'false',
|
||||||
|
'accept_feedback' => 'false',
|
||||||
|
),
|
||||||
|
'theme_not_working' => array(
|
||||||
|
'label' => esc_html__( 'The theme isn\'t working properly.', 'astra' ),
|
||||||
|
'placeholder' => esc_html__( 'Please tell us more about what went wrong?', 'astra' ),
|
||||||
|
'show_cta' => 'true',
|
||||||
|
'accept_feedback' => 'true',
|
||||||
|
),
|
||||||
|
'found_better_theme' => array(
|
||||||
|
'label' => esc_html__( 'I found a better alternative theme.', 'astra' ),
|
||||||
|
'placeholder' => esc_html__( 'Could you please specify which theme?', 'astra' ),
|
||||||
|
'show_cta' => 'false',
|
||||||
|
'accept_feedback' => 'true',
|
||||||
|
),
|
||||||
|
'missing_a_feature' => array(
|
||||||
|
'label' => esc_html__( 'It\'s missing a specific feature.', 'astra' ),
|
||||||
|
'placeholder' => esc_html__( 'Please tell us more about the feature.', 'astra' ),
|
||||||
|
'show_cta' => 'false',
|
||||||
|
'accept_feedback' => 'true',
|
||||||
|
),
|
||||||
|
'other' => array(
|
||||||
|
'label' => esc_html__( 'Other', 'astra' ),
|
||||||
|
'placeholder' => esc_html__( 'Please tell us more details.', 'astra' ),
|
||||||
|
'show_cta' => 'false',
|
||||||
|
'accept_feedback' => 'true',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback function to add Astra specific analytics data.
|
||||||
|
*
|
||||||
|
* @param array $stats_data existing stats_data.
|
||||||
|
*
|
||||||
|
* @since 4.10.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function add_astra_analytics_data( $stats_data ) {
|
||||||
|
if ( ! isset( $stats_data['plugin_data']['astra'] ) ) {
|
||||||
|
$stats_data['plugin_data']['astra'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$bsf_internal_referrer = get_option( 'bsf_product_referers', array() );
|
||||||
|
$admin_dashboard_settings = get_option( 'astra_admin_settings', array() );
|
||||||
|
$is_hf_builder_active = class_exists( 'Astra_Builder_Helper' ) ? Astra_Builder_Helper::$is_header_footer_builder_active : true;
|
||||||
|
|
||||||
|
$astra_stats = array(
|
||||||
|
'free_version' => ASTRA_THEME_VERSION,
|
||||||
|
'site_language' => get_locale(),
|
||||||
|
'numeric_values' => array(),
|
||||||
|
'boolean_values' => array(
|
||||||
|
'pro_active' => defined( 'ASTRA_EXT_VER' ),
|
||||||
|
'astra_sites_active' => is_plugin_active( 'astra-sites/astra-sites.php' ),
|
||||||
|
'astra_pro_sites_active' => is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ),
|
||||||
|
'is_using_dark_palette' => Astra_Global_Palette::is_dark_palette(),
|
||||||
|
),
|
||||||
|
'internal_referrer' => empty( $bsf_internal_referrer['astra'] ) ? '' : $bsf_internal_referrer['astra'],
|
||||||
|
'using_old_header_footer' => $is_hf_builder_active ? 'no' : 'yes',
|
||||||
|
'loading_google_fonts_locally' => isset( $admin_dashboard_settings['self_hosted_gfonts'] ) && $admin_dashboard_settings['self_hosted_gfonts'] ? 'yes' : 'no',
|
||||||
|
'preloading_local_fonts' => isset( $admin_dashboard_settings['preload_local_fonts'] ) && $admin_dashboard_settings['preload_local_fonts'] ? 'yes' : 'no',
|
||||||
|
);
|
||||||
|
|
||||||
|
$stats_data['plugin_data']['astra'] = array_merge_recursive( $stats_data['plugin_data']['astra'], $astra_stats );
|
||||||
|
|
||||||
|
return $stats_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiator.
|
||||||
|
*
|
||||||
|
* @since 4.10.0
|
||||||
|
* @return self initialized object of class.
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( null === self::$instance ) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates the Astra_BSF_Analytics class instance.
|
||||||
|
*/
|
||||||
|
Astra_BSF_Analytics::get_instance();
|
||||||
|
|
@ -0,0 +1,469 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Astra Admin Ajax Base.
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Astra_Admin_Ajax.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
class Astra_Admin_Ajax {
|
||||||
|
/**
|
||||||
|
* Ajax action prefix.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $prefix = 'astra';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance
|
||||||
|
*
|
||||||
|
* @var null $instance
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiator
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
* @return object initialized object of class.
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( ! isset( self::$instance ) ) {
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
self::$instance = new self();
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Errors class instance.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $errors = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
add_action(
|
||||||
|
'init',
|
||||||
|
function() {
|
||||||
|
$this->errors = array(
|
||||||
|
'permission' => esc_html__( 'Sorry, you are not allowed to do this operation.', 'astra' ),
|
||||||
|
'nonce' => esc_html__( 'Nonce validation failed', 'astra' ),
|
||||||
|
'default' => esc_html__( 'Sorry, something went wrong.', 'astra' ),
|
||||||
|
'invalid' => esc_html__( 'No post data found!', 'astra' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
add_action( 'wp_ajax_ast_disable_pro_notices', array( $this, 'disable_astra_pro_notices' ) );
|
||||||
|
add_action( 'wp_ajax_astra_recommended_plugin_install', array( $this, 'required_plugin_install' ) );
|
||||||
|
add_action( 'wp_ajax_ast_migrate_to_builder', array( $this, 'migrate_to_builder' ) );
|
||||||
|
add_action( 'wp_ajax_astra_update_admin_setting', array( $this, 'astra_update_admin_setting' ) );
|
||||||
|
add_action( 'wp_ajax_astra_analytics_optin_status', array( $this, 'astra_analytics_optin_status' ) );
|
||||||
|
add_action( 'wp_ajax_astra_recommended_plugin_activate', array( $this, 'required_plugin_activate' ) );
|
||||||
|
add_action( 'wp_ajax_astra_recommended_plugin_deactivate', array( $this, 'required_plugin_deactivate' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return boolean settings for admin dashboard app.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function astra_admin_settings_typewise() {
|
||||||
|
return apply_filters(
|
||||||
|
'astra_admin_settings_datatypes',
|
||||||
|
array(
|
||||||
|
'self_hosted_gfonts' => 'bool',
|
||||||
|
'preload_local_fonts' => 'bool',
|
||||||
|
'use_old_header_footer' => 'bool',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable pro upgrade notice from all over in Astra.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function disable_astra_pro_notices() {
|
||||||
|
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce verification.
|
||||||
|
*/
|
||||||
|
if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( esc_html__( 'You don\'t have the access', 'astra' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$migrate = isset( $_POST['status'] ) ? sanitize_key( $_POST['status'] ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
|
||||||
|
$migrate = 'true' === $migrate ? true : false;
|
||||||
|
astra_update_option( 'ast-disable-upgrade-notices', $migrate );
|
||||||
|
|
||||||
|
wp_send_json_success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate to New Header Builder
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function migrate_to_builder() {
|
||||||
|
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce verification.
|
||||||
|
*/
|
||||||
|
if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$migrate = isset( $_POST['status'] ) ? sanitize_key( $_POST['status'] ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$migrate = 'true' === $migrate ? true : false;
|
||||||
|
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$migration_flag = astra_get_option( 'v3-option-migration', false );
|
||||||
|
astra_update_option( 'is-header-footer-builder', $migrate );
|
||||||
|
|
||||||
|
if ( $migrate && false === $migration_flag ) {
|
||||||
|
require_once ASTRA_THEME_DIR . 'inc/theme-update/astra-builder-migration-updater.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
|
||||||
|
astra_header_builder_migration();
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_json_success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save settings.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function astra_update_admin_setting() {
|
||||||
|
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce verification.
|
||||||
|
*/
|
||||||
|
if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
$get_bool_settings = $this->astra_admin_settings_typewise();
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$sub_option_key = isset( $_POST['key'] ) ? sanitize_text_field( wp_unslash( $_POST['key'] ) ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$sub_option_value = '';
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
if ( isset( $get_bool_settings[ $sub_option_key ] ) ) {
|
||||||
|
if ( 'bool' === $get_bool_settings[ $sub_option_key ] ) {
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$val = isset( $_POST['value'] ) && 'true' === sanitize_text_field( $_POST['value'] ) ? true : false;
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$sub_option_value = $val;
|
||||||
|
} else {
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$val = isset( $_POST['value'] ) ? sanitize_text_field( wp_unslash( $_POST['value'] ) ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$sub_option_value = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
|
Astra_API_Init::update_admin_settings_option( $sub_option_key, $sub_option_value );
|
||||||
|
|
||||||
|
$response_data = array(
|
||||||
|
'message' => esc_html__( 'Successfully saved data!', 'astra' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_send_json_success( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Astra Analytics Opt-in.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.10.0
|
||||||
|
*/
|
||||||
|
public function astra_analytics_optin_status() {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nonce verification */
|
||||||
|
if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt_in = filter_input( INPUT_POST, 'value', FILTER_VALIDATE_BOOLEAN ) ? 'yes' : 'no';
|
||||||
|
update_site_option( 'astra_analytics_optin', $opt_in );
|
||||||
|
|
||||||
|
$response_data = array(
|
||||||
|
'message' => esc_html__( 'Successfully saved data!', 'astra' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_send_json_success( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ajax error message.
|
||||||
|
*
|
||||||
|
* @param string $type Message type.
|
||||||
|
* @return string
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function get_error_msg( $type ) {
|
||||||
|
|
||||||
|
if ( ! isset( $this->errors[ $type ] ) ) {
|
||||||
|
$type = 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->errors[ $type ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the installation and saving of required plugins.
|
||||||
|
*
|
||||||
|
* This function is responsible for installing and saving required plugins for the Astra theme.
|
||||||
|
* It checks for the plugin slug in the AJAX request, verifies the nonce, and initiates the plugin installation process.
|
||||||
|
* If the plugin is successfully installed, it schedules a database update to map the plugin slug to a custom key for analytics tracking.
|
||||||
|
*
|
||||||
|
* @since 4.8.12
|
||||||
|
*/
|
||||||
|
public function required_plugin_install() {
|
||||||
|
|
||||||
|
check_ajax_referer( 'updates', '_ajax_nonce' );
|
||||||
|
|
||||||
|
// Fetching the plugin slug from the AJAX request.
|
||||||
|
// @psalm-suppress PossiblyInvalidArgument
|
||||||
|
$plugin_slug = isset( $_POST['slug'] ) && is_string( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : '';
|
||||||
|
|
||||||
|
if ( empty( $plugin_slug ) ) {
|
||||||
|
wp_send_json_error( array( 'message' => __( 'Plugin slug is missing.', 'astra' ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schedule the database update if the plugin is installed successfully.
|
||||||
|
add_action(
|
||||||
|
'shutdown',
|
||||||
|
static function () use ( $plugin_slug ) {
|
||||||
|
// Iterate through all plugins to check if the installed plugin matches the current plugin slug.
|
||||||
|
$all_plugins = get_plugins();
|
||||||
|
foreach ( $all_plugins as $plugin_file => $_ ) {
|
||||||
|
if ( is_callable( 'BSF_UTM_Analytics::update_referer' ) && strpos( $plugin_file, $plugin_slug . '/' ) === 0 ) {
|
||||||
|
// If the plugin is found and the update_referer function is callable, update the referer with the corresponding product slug.
|
||||||
|
BSF_UTM_Analytics::update_referer( 'astra', $plugin_slug );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( function_exists( 'wp_ajax_install_plugin' ) ) {
|
||||||
|
// @psalm-suppress NoValue
|
||||||
|
wp_ajax_install_plugin();
|
||||||
|
} else {
|
||||||
|
wp_send_json_error( array( 'message' => __( 'Plugin installation function not found.', 'astra' ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required Plugin Activate
|
||||||
|
*
|
||||||
|
* @since 1.2.4
|
||||||
|
*/
|
||||||
|
public function required_plugin_activate() {
|
||||||
|
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce verification.
|
||||||
|
*/
|
||||||
|
if ( ! check_ajax_referer( 'astra_plugin_manager_nonce', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
wp_send_json_error(
|
||||||
|
array(
|
||||||
|
'success' => false,
|
||||||
|
'message' => esc_html__( 'No plugin specified', 'astra' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$plugin_init = isset( $_POST['init'] ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
|
||||||
|
$activate = activate_plugin( $plugin_init );
|
||||||
|
|
||||||
|
if ( is_wp_error( $activate ) ) {
|
||||||
|
/** @psalm-suppress PossiblyNullReference */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
wp_send_json_error(
|
||||||
|
array(
|
||||||
|
'success' => false,
|
||||||
|
'message' => $activate->get_error_message(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/** @psalm-suppress PossiblyNullReference */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Added this flag as tracker to track onboarding and funnel stats for SureCart owners.
|
||||||
|
*
|
||||||
|
* @since 4.7.0
|
||||||
|
*/
|
||||||
|
if ( 'surecart/surecart.php' === $plugin_init ) {
|
||||||
|
update_option( 'surecart_source', 'astra', false );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_json_success(
|
||||||
|
array(
|
||||||
|
'success' => true,
|
||||||
|
'message' => esc_html__( 'Plugin Successfully Activated', 'astra' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required Plugin Activate
|
||||||
|
*
|
||||||
|
* @since 1.2.4
|
||||||
|
*/
|
||||||
|
public function required_plugin_deactivate() {
|
||||||
|
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $_POST ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce verification.
|
||||||
|
*/
|
||||||
|
if ( ! check_ajax_referer( 'astra_plugin_manager_nonce', 'security', false ) ) {
|
||||||
|
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
|
||||||
|
wp_send_json_error( $response_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
wp_send_json_error(
|
||||||
|
array(
|
||||||
|
'success' => false,
|
||||||
|
'message' => esc_html__( 'No plugin specified', 'astra' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$plugin_init = isset( $_POST['init'] ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
|
||||||
|
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
|
||||||
|
$deactivate = deactivate_plugins( $plugin_init );
|
||||||
|
|
||||||
|
if ( is_wp_error( $deactivate ) ) {
|
||||||
|
wp_send_json_error(
|
||||||
|
array(
|
||||||
|
'success' => false,
|
||||||
|
'message' => $deactivate->get_error_message(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_json_success(
|
||||||
|
array(
|
||||||
|
'success' => true,
|
||||||
|
'message' => esc_html__( 'Plugin Successfully Deactivated', 'astra' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Astra_Admin_Ajax::get_instance();
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Class Astra_API_Init.
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bail if WP_REST_Controller class does not exist.
|
||||||
|
if ( ! class_exists( 'WP_REST_Controller' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Astra_API_Init.
|
||||||
|
*
|
||||||
|
* @since 4.1.0
|
||||||
|
*/
|
||||||
|
class Astra_API_Init extends WP_REST_Controller {
|
||||||
|
/**
|
||||||
|
* Instance
|
||||||
|
*
|
||||||
|
* @var null $instance
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiator
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
* @return object initialized object of class.
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( ! isset( self::$instance ) ) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Namespace.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $namespace = 'astra/v1';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route base.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $rest_base = '/admin/settings/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option name
|
||||||
|
*
|
||||||
|
* @var string $option_name DB option name.
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private static $option_name = 'astra_admin_settings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin settings dataset
|
||||||
|
*
|
||||||
|
* @var array $astra_admin_settings Settings array.
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private static $astra_admin_settings = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
self::$astra_admin_settings = get_option( self::$option_name, array() );
|
||||||
|
|
||||||
|
// REST API extensions init.
|
||||||
|
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register API routes.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function register_routes() {
|
||||||
|
register_rest_route(
|
||||||
|
$this->namespace,
|
||||||
|
$this->rest_base,
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'methods' => WP_REST_Server::READABLE,
|
||||||
|
'callback' => array( $this, 'get_admin_settings' ),
|
||||||
|
'permission_callback' => array( $this, 'get_permissions_check' ),
|
||||||
|
'args' => array(),
|
||||||
|
),
|
||||||
|
'schema' => array( $this, 'get_public_item_schema' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get common settings.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return array $updated_option defaults + set DB option data.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function get_admin_settings( $request ) {
|
||||||
|
$db_option = get_option( 'astra_admin_settings', array() );
|
||||||
|
|
||||||
|
$defaults = apply_filters(
|
||||||
|
'astra_dashboard_rest_options',
|
||||||
|
array(
|
||||||
|
'self_hosted_gfonts' => self::get_admin_settings_option( 'self_hosted_gfonts', false ),
|
||||||
|
'preload_local_fonts' => self::get_admin_settings_option( 'preload_local_fonts', false ),
|
||||||
|
'use_old_header_footer' => astra_get_option( 'is-header-footer-builder', false ),
|
||||||
|
'use_upgrade_notices' => astra_showcase_upgrade_notices(),
|
||||||
|
'analytics_enabled' => get_option( 'astra_analytics_optin', 'no' ) === 'yes',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return wp_parse_args( $db_option, $defaults );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a given request has permission to read notes.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|bool
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function get_permissions_check( $request ) {
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
return new WP_Error( 'astra_rest_cannot_view', esc_html__( 'Sorry, you cannot list resources.', 'astra' ), array( 'status' => rest_authorization_required_code() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an value,
|
||||||
|
* based on the settings database option for the admin settings page.
|
||||||
|
*
|
||||||
|
* @param string $key The sub-option key.
|
||||||
|
* @param mixed $default Option default value if option is not available.
|
||||||
|
* @return mixed Return the option value based on provided key
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public static function get_admin_settings_option( $key, $default = false ) {
|
||||||
|
return isset( self::$astra_admin_settings[ $key ] ) ? self::$astra_admin_settings[ $key ] : $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an value of a key,
|
||||||
|
* from the settings database option for the admin settings page.
|
||||||
|
*
|
||||||
|
* @param string $key The option key.
|
||||||
|
* @param mixed $value The value to update.
|
||||||
|
* @return mixed Return the option value based on provided key
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public static function update_admin_settings_option( $key, $value ) {
|
||||||
|
$astra_admin_updated_settings = get_option( self::$option_name, array() );
|
||||||
|
$astra_admin_updated_settings[ $key ] = $value;
|
||||||
|
update_option( self::$option_name, $astra_admin_updated_settings );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Astra_API_Init::get_instance();
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Site Builder Free Version Preview.
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'Astra_Theme_Builder_Free' ) ) {
|
||||||
|
|
||||||
|
define( 'ASTRA_THEME_BUILDER_FREE_DIR', ASTRA_THEME_DIR . 'admin/assets/theme-builder/' );
|
||||||
|
define( 'ASTRA_THEME_BUILDER_FREE_URI', ASTRA_THEME_URI . 'admin/assets/theme-builder/' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Site Builder initial setup.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
*/
|
||||||
|
class Astra_Theme_Builder_Free {
|
||||||
|
/**
|
||||||
|
* Member Variable
|
||||||
|
*
|
||||||
|
* @var null $instance
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiator
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( ! isset( self::$instance ) ) {
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
self::$instance = new self();
|
||||||
|
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$is_astra_addon_active = defined( 'ASTRA_EXT_VER' );
|
||||||
|
if ( ! $is_astra_addon_active ) {
|
||||||
|
add_action( 'admin_enqueue_scripts', array( $this, 'theme_builder_admin_enqueue_scripts' ) );
|
||||||
|
add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
|
||||||
|
add_action( 'admin_menu', array( $this, 'setup_menu' ) );
|
||||||
|
add_action( 'admin_init', array( $this, 'astra_theme_builder_disable_notices' ) );
|
||||||
|
}
|
||||||
|
add_action( 'admin_page_access_denied', array( $this, 'astra_theme_builder_access_denied_redirect' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts and styles.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function theme_builder_admin_enqueue_scripts() {
|
||||||
|
$file_prefix = '';
|
||||||
|
if ( is_rtl() ) {
|
||||||
|
$file_prefix .= '.rtl';
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_style( 'astra-theme-builder-style', ASTRA_THEME_BUILDER_FREE_URI . 'build/index' . $file_prefix . '.css', array(), ASTRA_THEME_VERSION );
|
||||||
|
|
||||||
|
wp_enqueue_script( 'astra-theme-builder-script', ASTRA_THEME_BUILDER_FREE_URI . 'build/index.js', array( 'wp-element' ), ASTRA_THEME_VERSION, true );
|
||||||
|
|
||||||
|
wp_enqueue_style( 'dashicons' );
|
||||||
|
|
||||||
|
$astra_addon_locale = ASTRA_THEME_ORG_VERSION ? 'astra-addon/astra-addon.php' : 'astra-pro/astra-pro.php';
|
||||||
|
|
||||||
|
$localized_data = array(
|
||||||
|
'title' => esc_html__( 'Site Builder', 'astra' ),
|
||||||
|
'rest_url' => '/wp-json/astra-addon/v1/custom-layouts/',
|
||||||
|
'new_custom_layout_base_url' => admin_url( 'post-new.php?post_type=astra-advanced-hook' ),
|
||||||
|
'astra_pricing_page_url' => astra_get_pro_url( '/pricing/', 'free-theme', 'site-builder', 'upgrade' ),
|
||||||
|
'astra_docs_page_url' => astra_get_pro_url( '/docs/custom-layouts-pro/', 'free-theme', 'site-builder', 'documentation' ),
|
||||||
|
'astra_base_url' => admin_url( 'admin.php?page=' . Astra_Menu::get_theme_page_slug() ),
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_localize_script( 'astra-theme-builder-script', 'astra_theme_builder', $localized_data );
|
||||||
|
wp_set_script_translations( 'astra-theme-builder-script', 'astra' );
|
||||||
|
|
||||||
|
$localize = array(
|
||||||
|
'pro_installed_status' => 'installed' === Astra_Menu::get_plugin_status( $astra_addon_locale ) ? true : false,
|
||||||
|
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||||
|
'upgrade_url' => astra_get_upgrade_url( 'dashboard' ),
|
||||||
|
'astra_base_url' => admin_url( 'admin.php?page=' . Astra_Menu::get_theme_page_slug() ),
|
||||||
|
'update_nonce' => wp_create_nonce( 'astra_update_admin_setting' ),
|
||||||
|
'plugin_manager_nonce' => wp_create_nonce( 'astra_plugin_manager_nonce' ),
|
||||||
|
'plugin_installer_nonce' => wp_create_nonce( 'updates' ),
|
||||||
|
'plugin_installing_text' => esc_html__( 'Installing', 'astra' ),
|
||||||
|
'plugin_installed_text' => esc_html__( 'Installed', 'astra' ),
|
||||||
|
'plugin_activating_text' => esc_html__( 'Activating', 'astra' ),
|
||||||
|
'plugin_activated_text' => esc_html__( 'Activated', 'astra' ),
|
||||||
|
'plugin_activate_text' => esc_html__( 'Activate', 'astra' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_localize_script( 'astra-theme-builder-script', 'astra_admin', $localize );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin Body Classes
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @param string $classes Space separated class string.
|
||||||
|
*/
|
||||||
|
public function admin_body_class( $classes = '' ) {
|
||||||
|
$theme_builder_class = isset( $_GET['page'] ) && 'theme-builder-free' === $_GET['page'] ? 'ast-theme-builder' : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching a $_GET value, no nonce available to validate.
|
||||||
|
$classes .= ' ' . $theme_builder_class . ' ';
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the admin settings.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function render_theme_builder() {
|
||||||
|
?>
|
||||||
|
<div class="ast-tb-menu-page-wrapper">
|
||||||
|
<div id="ast-tb-menu-page">
|
||||||
|
<div class="ast-tb-menu-page-content">
|
||||||
|
<div id="ast-tb-app-root" class="ast-tb-app-root"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup menu.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setup_menu() {
|
||||||
|
add_submenu_page( // phpcs:ignore WPThemeReview.PluginTerritory.NoAddAdminPages.add_menu_pages_add_submenu_page -- Taken the menu on top level
|
||||||
|
'astra',
|
||||||
|
__( 'Site Builder', 'astra' ),
|
||||||
|
__( 'Site Builder', 'astra' ),
|
||||||
|
'manage_options',
|
||||||
|
'theme-builder-free',
|
||||||
|
array( $this, 'render_theme_builder' ),
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable notices for Site Builder page.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function astra_theme_builder_disable_notices() {
|
||||||
|
|
||||||
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching a $_GET value, no nonce available to validate.
|
||||||
|
if ( isset( $_GET['page'] ) && 'theme-builder-free' === $_GET['page'] ) {
|
||||||
|
remove_all_actions( 'admin_notices' );
|
||||||
|
remove_all_actions( 'all_admin_notices' ); // For older versions of WordPress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to Site Builder pro from free preview if pro module is active.
|
||||||
|
*
|
||||||
|
* @since 4.5.0
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function astra_theme_builder_access_denied_redirect() {
|
||||||
|
|
||||||
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching a $_GET value, no nonce available to validate.
|
||||||
|
if ( isset( $_GET['page'] ) && 'theme-builder-free' === $_GET['page'] ) {
|
||||||
|
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
$is_astra_addon_active = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'advanced-hooks' ) );
|
||||||
|
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
||||||
|
if ( $is_astra_addon_active ) {
|
||||||
|
wp_safe_redirect( admin_url( 'admin.php?page=theme-builder' ) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kicking this off by calling 'get_instance()' method
|
||||||
|
*/
|
||||||
|
Astra_Theme_Builder_Free::get_instance();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying archive pages.
|
||||||
|
*
|
||||||
|
* @link https://codex.wordpress.org/Template_Hierarchy
|
||||||
|
*
|
||||||
|
* @package Astra
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // Exit if accessed directly.
|
||||||
|
}
|
||||||
|
|
||||||
|
get_header(); ?>
|
||||||
|
|
||||||
|
<?php if ( astra_page_layout() === 'left-sidebar' ) { ?>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div id="primary" <?php astra_primary_class(); ?>>
|
||||||
|
|
||||||
|
<?php astra_primary_content_top(); ?>
|
||||||
|
|
||||||
|
<?php astra_archive_header(); ?>
|
||||||
|
|
||||||
|
<?php astra_content_loop(); ?>
|
||||||
|
|
||||||
|
<?php astra_pagination(); ?>
|
||||||
|
|
||||||
|
<?php astra_primary_content_bottom(); ?>
|
||||||
|
|
||||||
|
</div><!-- #primary -->
|
||||||
|
|
||||||
|
<?php if ( astra_page_layout() === 'right-sidebar' ) { ?>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
html.flyout-lock{overflow-y:scroll!important;width:auto}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
html.flyout-lock{overflow-y:scroll!important;width:auto}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.wpcf7 form{position:relative}.wpcf7 form>div,.wpcf7 form>p{margin-bottom:1.2em}.wpcf7 .wpcf7-form-control-wrap{width:100%;display:block}.wpcf7 input:not([type=submit]):focus,.wpcf7 select:focus,.wpcf7 textarea:focus{border-color:var(--ast-border-color);outline:0}.wpcf7 input:not([type=submit]),.wpcf7 select,.wpcf7 textarea{width:100%;padding:.75em}.wpcf7 input[type=file]{color:#666;height:auto;border-width:1px;border-style:solid;border-color:var(--ast-border-color);border-radius:2px;background:#fafafa;box-shadow:none;box-sizing:border-box;transition:all .2s linear}.wpcf7 input[type=checkbox],.wpcf7 input[type=radio]{display:inline-block;background:#e9eef2;color:#555;clear:none;cursor:pointer;line-height:0;height:1.2em;margin:-3px 0 0 4px;outline:0;padding:0;border-radius:.2em;text-align:center;vertical-align:middle;width:1.4em;min-width:1.4em;transition:all .2s linear}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/contact-form-7-main.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.wpcf7 form{position:relative}.wpcf7 form>div,.wpcf7 form>p{margin-bottom:1.2em}.wpcf7 .wpcf7-form-control-wrap{width:100%;display:block}.wpcf7 input:not([type=submit]):focus,.wpcf7 select:focus,.wpcf7 textarea:focus{border-color:var(--ast-border-color);outline:0}.wpcf7 input:not([type=submit]),.wpcf7 select,.wpcf7 textarea{width:100%;padding:.75em}.wpcf7 input[type=file]{color:#666;height:auto;border-width:1px;border-style:solid;border-color:var(--ast-border-color);border-radius:2px;background:#fafafa;box-shadow:none;box-sizing:border-box;transition:all .2s linear}.wpcf7 input[type=checkbox],.wpcf7 input[type=radio]{display:inline-block;background:#e9eef2;color:#555;clear:none;cursor:pointer;line-height:0;height:1.2em;margin:-3px 4px 0 0;outline:0;padding:0;border-radius:.2em;text-align:center;vertical-align:middle;width:1.4em;min-width:1.4em;transition:all .2s linear}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.wpcf7 form{position:relative}.wpcf7 form>div,.wpcf7 form>p{margin-bottom:1.2em}.wpcf7 .wpcf7-form-control-wrap{width:100%;display:block}.wpcf7 input:not([type=submit]):focus,.wpcf7 select:focus,.wpcf7 textarea:focus{background:#fff;border-color:#eaeaea;outline:0;box-shadow:none}.wpcf7 input:not([type=submit]),.wpcf7 select,.wpcf7 textarea{width:100%;padding:.75em}.wpcf7 input[type=file]{color:#666;height:auto;border-width:1px;border-style:solid;border-color:#eaeaea;border-radius:2px;background:#fafafa;box-shadow:none;box-sizing:border-box;transition:all .2s linear}.wpcf7 input[type=checkbox],.wpcf7 input[type=radio]{display:inline-block;background:#e9eef2;color:#555;clear:none;cursor:pointer;line-height:0;height:1.2em;margin:-3px 0 0 4px;outline:0;padding:0;border-radius:.2em;text-align:center;vertical-align:middle;width:1.4em;min-width:1.4em;transition:all .2s linear}.wpcf7 .wpcf7-validation-errors{border-color:red}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/contact-form-7.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.wpcf7 form{position:relative}.wpcf7 form>div,.wpcf7 form>p{margin-bottom:1.2em}.wpcf7 .wpcf7-form-control-wrap{width:100%;display:block}.wpcf7 input:not([type=submit]):focus,.wpcf7 select:focus,.wpcf7 textarea:focus{background:#fff;border-color:var(--ast-border-color);outline:0;box-shadow:none}.wpcf7 input:not([type=submit]),.wpcf7 select,.wpcf7 textarea{width:100%;padding:.75em}.wpcf7 input[type=file]{color:#666;height:auto;border-width:1px;border-style:solid;border-color:var(--ast-border-color);border-radius:2px;background:#fafafa;box-shadow:none;box-sizing:border-box;transition:all .2s linear}.wpcf7 input[type=checkbox],.wpcf7 input[type=radio]{display:inline-block;background:#e9eef2;color:#555;clear:none;cursor:pointer;line-height:0;height:1.2em;margin:-3px 4px 0 0;outline:0;padding:0;border-radius:.2em;text-align:center;vertical-align:middle;width:1.4em;min-width:1.4em;transition:all .2s linear}.wpcf7 .wpcf7-validation-errors{border-color:red}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.et_divi_builder #et_builder_outer_content .et_pb_video_box .ast-oembed-container,.et_divi_builder #et_builder_outer_content .et_pb_video_box .ast-oembed-container>div{position:initial}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/divi-builder.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.et_divi_builder #et_builder_outer_content .et_pb_video_box .ast-oembed-container,.et_divi_builder #et_builder_outer_content .et_pb_video_box .ast-oembed-container>div{position:initial}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.gform_wrapper form{position:relative}.gform_wrapper .ui-datepicker-header select{padding:inherit}.gform_wrapper .gform_body .gfield_checkbox li>label{margin-top:4px}.gform_wrapper input:not([type=submit]):focus,.gform_wrapper select:focus,.gform_wrapper textarea:focus{background-color:#fff;border-color:var(--ast-border-color);outline:0;box-shadow:none}.ui-datepicker-header select{padding:0}@media (max-width:768px){.gform_wrapper.gf_browser_chrome form>.gform_body{width:100%}}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/gravity-forms.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.gform_wrapper form{position:relative}.gform_wrapper .ui-datepicker-header select{padding:inherit}.gform_wrapper .gform_body .gfield_checkbox li>label{margin-top:4px}.gform_wrapper input:not([type=submit]):focus,.gform_wrapper select:focus,.gform_wrapper textarea:focus{background-color:#fff;border-color:var(--ast-border-color);outline:0;box-shadow:none}.ui-datepicker-header select{padding:0}@media (max-width:768px){.gform_wrapper.gf_browser_chrome form>.gform_body{width:100%}}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/lifterlms-flex.min.css
vendored
Normal file
1
wp-content/themes/astra/assets/css/minified/compatibility/page-builder/bb-plugin.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.fl-builder-content{clear:both}.fl-theme-builder-archive .fl-post-column>.hentry,.fl-theme-builder-archive .fl-post-gallery-post.hentry{margin:0}.fl-theme-builder-archive h2.fl-post-feed-title{clear:initial}.ast-fluid-width-layout .fl-row-fixed-width .fl-row-fixed-width{padding-left:0;padding-right:0}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/page-builder/vc-plugin.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.js_active .vc_row{margin-left:auto;margin-right:auto}.js_active .ast-plain-container.ast-single-post #primary,.js_active .ast-plain-container.ast-single-post .hentry{margin:0;padding-top:0;padding-bottom:0}.js_active .ast-plain-container.ast-single-post .entry-header{margin-top:4em}.js_active .ast-plain-container.ast-single-post .entry-header.ast-header-without-markup{margin-top:0;margin-bottom:0}.js_active .ast-plain-container.ast-single-post .entry-header.ast-no-title.ast-no-meta{margin-bottom:0}@media (max-width:768px){.js_active .ast-plain-container.ast-single-post .entry-header{margin-top:1.5em}}.js_active .ast-page-builder-template.ast-left-sidebar .vc_row[data-vc-full-width],.js_active .ast-page-builder-template.ast-right-sidebar .vc_row[data-vc-full-width],.js_active .ast-plain-container.ast-left-sidebar .vc_row[data-vc-full-width],.js_active .ast-plain-container.ast-right-sidebar .vc_row[data-vc-full-width]{max-width:100%;left:0!important}.js_active .ast-left-sidebar .vc_row[data-vc-full-width],.js_active .ast-right-sidebar .vc_row[data-vc-full-width]{max-width:100%;left:0!important;padding-right:0!important;padding-left:0!important}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.siteorigin-panels .panel-row-style{z-index:0;position:relative}.siteorigin-panels .siteorigin-panels-stretch{max-width:100%;margin-right:auto!important;margin-left:auto!important}.siteorigin-panels .siteorigin-panels-stretch[data-stretch-type=full]{padding-right:0!important;padding-left:0!important}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/site-origin.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.siteorigin-panels .panel-row-style{z-index:0;position:relative}.siteorigin-panels .siteorigin-panels-stretch{max-width:100%;margin-left:auto!important;margin-right:auto!important}.siteorigin-panels .siteorigin-panels-stretch[data-stretch-type=full]{padding-left:0!important;padding-right:0!important}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.dokan-theme-astra .dokan-dashboard-wrap .dokan-btn:not(.tips),.dokan-theme-astra .dokan-dashboard-wrap input:not([type=checkbox]):not([type=radio]),.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container,.dokan-theme-astra .dokan-store-wrap input:not([type=checkbox]):not([type=radio]),.dokan-theme-astra select{min-height:40px;align-content:center}.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container input{margin-top:0}.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container .select2-selection{min-height:40px}.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container .select2-selection .select2-selection__rendered{display:block}.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container .select2-selection.select2-selection--single{padding:8.25px}.dokan-theme-astra .dokan-dashboard-wrap select+.select2-container .select2-selection__choice{margin-top:8px}.dokan-theme-astra .dokan-dashboard-wrap .dokan-select-product-category{padding:8.25px}.dokan-theme-astra .dokan-dashboard-wrap .dokan-panel input[type=button]{font-size:.875rem;line-height:1.42857143;padding:6px 12px}.dokan-theme-astra .dokan-dashboard-wrap .woocommerce-error,.dokan-theme-astra .dokan-dashboard-wrap .woocommerce-info,.dokan-theme-astra .dokan-dashboard-wrap .woocommerce-message{clear:both}@media (max-width:544px){.dokan-theme-astra .dokan-dashboard-wrap form{margin-bottom:.6em}}.dokan-theme-astra .media-modal .media-modal-content .media-frame-router button{color:unset}.dokan-theme-astra form select.orderby-search{width:max-content}.dokan-theme-astra #reviews #comments .commentlist .review_comment_container .comment-text{align-items:center}.dokan-theme-astra #reviews #comments .commentlist .review_comment_container .comment-text a+p{margin-bottom:1em}.dokan-theme-astra #reviews #comments .commentlist .review_comment_container .comment-text .dokan-review-wrapper{order:3}.dokan-theme-astra .dokan-reviews-area #dokan_comments-form .dokan-form-group{display:inline-flex;gap:5px}.dokan-theme-astra .dokan-reviews-area #dokan_comments-form select[name=comment_status]{width:160px}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
#ast-scroll-top{z-index:9999}.ast-sticky-add-to-cart{position:fixed;right:0;left:0;opacity:0;z-index:1200;transition:opacity .4s ease-in-out,transform .6s ease-in-out,outline .15s ease;transform:translate(0,0);background-color:var(--ast-global-color-primary,var(--ast-global-color-5))}.ast-sticky-add-to-cart.is-active{transform:translate(0,0);opacity:1}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content{display:flex;min-height:60px;padding:10px 0}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap{display:flex;align-items:center;flex-grow:1}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap img{max-height:50px;width:auto}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap .ast-sticky-add-to-cart-title{padding:5px 20px;font-size:18px;font-weight:inherit;line-height:1.5}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-stock-detail{display:none}.ast-sticky-add-to-cart-action-wrap{display:flex;align-items:center;justify-content:flex-end}.ast-sticky-add-to-cart-action-wrap .ast-quantity-add-to-cart{display:flex;align-items:flex-start}.ast-sticky-add-to-cart-action-wrap .cart{display:flex;align-items:center}.ast-sticky-add-to-cart-action-wrap .quantity{padding-left:14px}.ast-sticky-add-to-cart-action-wrap .quantity.ast-vertical-style-applied{margin-left:1em}.ast-sticky-add-to-cart-action-wrap .ast-sticky-add-to-cart-action-price{font-weight:700;padding-left:20px}.ast-sticky-add-to-cart-action-wrap .ast-sticky-add-to-cart-action-price del{opacity:.5;font-weight:400}.woocommerce div.ast-sticky-add-to-cart-action-wrap .button.single_add_to_cart_button{padding:11px 25px;width:100%}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
#ast-scroll-top{z-index:9999}.ast-sticky-add-to-cart{position:fixed;left:0;right:0;opacity:0;z-index:1200;transition:opacity .4s ease-in-out,transform .6s ease-in-out,outline .15s ease;transform:translate(0,0);background-color:var(--ast-global-color-primary,var(--ast-global-color-5))}.ast-sticky-add-to-cart.is-active{transform:translate(0,0);opacity:1}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content{display:flex;min-height:60px;padding:10px 0}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap{display:flex;align-items:center;flex-grow:1}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap img{max-height:50px;width:auto}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-sticky-add-to-cart-title-wrap .ast-sticky-add-to-cart-title{padding:5px 20px;font-size:18px;font-weight:inherit;line-height:1.5}.ast-sticky-add-to-cart .ast-sticky-add-to-cart-content .ast-stock-detail{display:none}.ast-sticky-add-to-cart-action-wrap{display:flex;align-items:center;justify-content:flex-end}.ast-sticky-add-to-cart-action-wrap .ast-quantity-add-to-cart{display:flex;align-items:flex-start}.ast-sticky-add-to-cart-action-wrap .cart{display:flex;align-items:center}.ast-sticky-add-to-cart-action-wrap .quantity{padding-right:14px}.ast-sticky-add-to-cart-action-wrap .quantity.ast-vertical-style-applied{margin-right:1em}.ast-sticky-add-to-cart-action-wrap .ast-sticky-add-to-cart-action-price{font-weight:700;padding-right:20px}.ast-sticky-add-to-cart-action-wrap .ast-sticky-add-to-cart-action-price del{opacity:.5;font-weight:400}.woocommerce div.ast-sticky-add-to-cart-action-wrap .button.single_add_to_cart_button{padding:11px 25px;width:100%}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.wp-block-woocommerce-cart input,.wp-block-woocommerce-cart select,.wp-block-woocommerce-checkout input,.wp-block-woocommerce-checkout select{height:auto}.wp-block-woocommerce-cart .wc-block-components-address-form .wc-block-components-address-form__address_2-toggle,.wp-block-woocommerce-cart .wc-block-components-order-summary .wc-block-components-panel__button,.wp-block-woocommerce-cart .wc-block-components-totals-coupon .wc-block-components-panel__button,.wp-block-woocommerce-checkout .wc-block-components-address-form .wc-block-components-address-form__address_2-toggle,.wp-block-woocommerce-checkout .wc-block-components-order-summary .wc-block-components-panel__button,.wp-block-woocommerce-checkout .wc-block-components-totals-coupon .wc-block-components-panel__button{background-color:transparent;color:inherit;line-height:inherit;padding:0;box-shadow:none;font-weight:inherit;text-transform:inherit;font-size:inherit;letter-spacing:inherit;border-style:inherit}.wp-block-woocommerce-cart .wc-block-components-radio-control__input:checked,.wp-block-woocommerce-cart .wc-block-components-radio-control__input:focus,.wp-block-woocommerce-checkout .wc-block-components-radio-control__input:checked,.wp-block-woocommerce-checkout .wc-block-components-radio-control__input:focus{background-color:inherit;outline:inherit}.wp-block-woocommerce-cart .wc-block-components-totals-coupon .wc-block-components-panel__button[aria-expanded=true],.wp-block-woocommerce-cart .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-order-summary .wc-block-components-panel__button[aria-expanded=true],.wp-block-woocommerce-checkout .wc-block-components-totals-coupon .wc-block-components-panel__button[aria-expanded=true],.wp-block-woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-order-summary .wc-block-components-panel__button[aria-expanded=true]{padding-bottom:8px}.wp-block-woocommerce-cart .wc-block-components-text-input.is-active label,.wp-block-woocommerce-checkout .wc-block-components-text-input.is-active label{top:-2px}
|
||||||
1
wp-content/themes/astra/assets/css/minified/compatibility/woocommerce/woocommerce.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
#customize-theme-controls .customize-pane-child.current-section-parent,.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent{transform:translateX(100%)}#customize-controls .control-section.control-section-ast_section .accordion-section-title{color:#555d66;background-color:#fff;border-bottom:1px solid #ddd;border-right:4px solid #fff;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}#customize-controls .control-section.control-section-ast_section .accordion-section-title:after{color:#a0a5aa}#customize-controls .control-section.control-section-ast_section .accordion-section-title:focus,#customize-controls .control-section.control-section-ast_section .accordion-section-title:hover{color:#0073aa;background:#f3f3f5;border-right-color:#0073aa}#customize-controls .control-section.control-section-ast_section .accordion-section-title:hover:after{color:#0073aa}#customize-controls .control-section-ast_section .accordion-section{margin-right:-24px;margin-left:-24px}.customize-section-description .astra-section-description ul{margin:0}.customize-section-description .astra-section-description ul>li{list-style-type:none}.customize-section-description .astra-section-description ul>li:last-child{margin-bottom:0}.astra-section-description a{text-decoration:none;font-style:italic;border-bottom:1px dotted transparent;transition:all ease-in-out .3s}.astra-section-description a:hover{border-bottom-color:inherit}#customize-controls .control-section-ast_section .customize-info .customize-section-description{margin-bottom:0}.customize-widgets-header{margin-right:-24px;margin-left:-24px}#customize-sidebar-outer-content{height:calc(100vh - 46px)}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
#customize-theme-controls .customize-pane-child.current-section-parent,.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent{transform:translateX(-100%)}#customize-controls .control-section.control-section-ast_section .accordion-section-title{color:#555d66;background-color:#fff;border-bottom:1px solid #ddd;border-left:4px solid #fff;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}#customize-controls .control-section.control-section-ast_section .accordion-section-title:after{color:#a0a5aa}#customize-controls .control-section.control-section-ast_section .accordion-section-title:focus,#customize-controls .control-section.control-section-ast_section .accordion-section-title:hover{color:#0073aa;background:#f3f3f5;border-left-color:#0073aa}#customize-controls .control-section.control-section-ast_section .accordion-section-title:hover:after{color:#0073aa}#customize-controls .control-section-ast_section .accordion-section{margin-left:-24px;margin-right:-24px}.customize-section-description .astra-section-description ul{margin:0}.customize-section-description .astra-section-description ul>li{list-style-type:none}.customize-section-description .astra-section-description ul>li:last-child{margin-bottom:0}.astra-section-description a{text-decoration:none;font-style:italic;border-bottom:1px dotted transparent;transition:all ease-in-out .3s}.astra-section-description a:hover{border-bottom-color:inherit}#customize-controls .control-section-ast_section .customize-info .customize-section-description{margin-bottom:0}.customize-widgets-header{margin-left:-24px;margin-right:-24px}#customize-sidebar-outer-content{height:calc(100vh - 46px)}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.gallery-item{display:inline-block;text-align:center;vertical-align:top;width:100%}.gallery-columns-2 .gallery-item{max-width:50%}.gallery-columns-3 .gallery-item{max-width:33.33%}.gallery-columns-4 .gallery-item{max-width:25%}.gallery-columns-5 .gallery-item{max-width:20%}.gallery-columns-6 .gallery-item{max-width:16.66%}.gallery-columns-7 .gallery-item{max-width:14.28%}.gallery-columns-8 .gallery-item{max-width:12.5%}.gallery-columns-9 .gallery-item{max-width:11.11%}.gallery-caption{display:block}.ast-blog-featured-section .gallery{margin-bottom:0}.single .entry-content .gallery{margin-right:-10px;margin-left:-10px}.gallery-caption{color:var(--ast-gallery-block-color);padding:10px;border-radius:0 0 2px 2px;border:1px solid var(--ast-border-color);border-top:none;font-size:.9em}.gallery-icon{border-bottom:0;border-radius:2px 2px 0 0;border:1px solid var(--ast-border-color);overflow:hidden}.gallery-item{margin:0;padding:10px;border-radius:2px}.gallery-item:last-child{margin-bottom:2em}.elementor-image-gallery .gallery-icon{border:none}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.gallery-item{display:inline-block;text-align:center;vertical-align:top;width:100%}.gallery-columns-2 .gallery-item{max-width:50%}.gallery-columns-3 .gallery-item{max-width:33.33%}.gallery-columns-4 .gallery-item{max-width:25%}.gallery-columns-5 .gallery-item{max-width:20%}.gallery-columns-6 .gallery-item{max-width:16.66%}.gallery-columns-7 .gallery-item{max-width:14.28%}.gallery-columns-8 .gallery-item{max-width:12.5%}.gallery-columns-9 .gallery-item{max-width:11.11%}.gallery-caption{display:block}.ast-blog-featured-section .gallery{margin-bottom:0}.single .entry-content .gallery{margin-left:-10px;margin-right:-10px}.gallery-caption{color:var(--ast-gallery-block-color);padding:10px;border-radius:0 0 2px 2px;border:1px solid var(--ast-border-color);border-top:none;font-size:.9em}.gallery-icon{border-bottom:0;border-radius:2px 2px 0 0;border:1px solid var(--ast-border-color);overflow:hidden}.gallery-item{margin:0;padding:10px;border-radius:2px}.gallery-item:last-child{margin-bottom:2em}.elementor-image-gallery .gallery-icon{border:none}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.ast-desktop .astra-menu-animation-slide-up>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transform:translateY(.5em);transition:visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-up>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transform:translateY(0);transition:opacity .2s ease,visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-up>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .astra-menu-animation-slide-down>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transform:translateY(-.5em);transition:visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-down>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transform:translateY(0);transition:opacity .2s ease,visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-down>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .astra-menu-animation-fade>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transition:opacity ease-in-out .3s}.ast-desktop .astra-menu-animation-fade>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transition:opacity ease-in-out .3s}.ast-desktop .astra-menu-animation-fade>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .menu-item.ast-menu-hover>.sub-menu.toggled-on{opacity:1;visibility:visible}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
.ast-desktop .astra-menu-animation-slide-up>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transform:translateY(.5em);transition:visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-up>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-up>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transform:translateY(0);transition:opacity .2s ease,visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-up>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-up>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .astra-menu-animation-slide-down>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transform:translateY(-.5em);transition:visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-down>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-slide-down>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transform:translateY(0);transition:opacity .2s ease,visibility .2s ease,transform .2s ease}.ast-desktop .astra-menu-animation-slide-down>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-slide-down>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .astra-menu-animation-fade>.menu-item>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item>.sub-menu .sub-menu{opacity:0;visibility:hidden;transition:opacity ease-in-out .3s}.ast-desktop .astra-menu-animation-fade>.menu-item .menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item .menu-item:hover>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item.focus>.sub-menu,.ast-desktop .astra-menu-animation-fade>.menu-item:hover>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.menu-item:hover>.sub-menu{opacity:1;visibility:visible;transition:opacity ease-in-out .3s}.ast-desktop .astra-menu-animation-fade>.full-width-mega.menu-item.focus>.astra-full-megamenu-wrapper,.ast-desktop .astra-menu-animation-fade>.full-width-mega.menu-item:hover>.astra-full-megamenu-wrapper{-js-display:flex;display:flex}.ast-desktop .menu-item.ast-menu-hover>.sub-menu.toggled-on{opacity:1;visibility:visible}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="Astra" horiz-adv-x="1024">
|
||||||
|
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||||
|
<missing-glyph horiz-adv-x="1024" />
|
||||||
|
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||||
|
<glyph unicode="" glyph-name="format_align_justify" d="M128 810.667h768v-86h-768v86zM128 554.667v86h768v-86h-768zM128 384.667v84h768v-84h-768zM128 212.667v86h768v-86h-768zM128 42.667v86h768v-86h-768z" />
|
||||||
|
<glyph unicode="" glyph-name="drag_handle" d="M170 298.667v86h684v-86h-684zM854 554.667v-86h-684v86h684z" />
|
||||||
|
<glyph unicode="" glyph-name="zoom_in" d="M896 298.667v-256h-256l98 98-124 122 62 62 122-124zM384 42.667h-256v256l98-98 122 124 62-62-124-122zM128 554.667v256h256l-98-98 124-122-62-62-122 124zM640 810.667h256v-256l-98 98-122-124-62 62 124 122z" />
|
||||||
|
<glyph unicode="" glyph-name="close" d="M810 664.667l-238-238 238-238-60-60-238 238-238-238-60 60 238 238-238 238 60 60 238-238 238 238z" />
|
||||||
|
<glyph unicode="" glyph-name="menu" d="M128 682.667h768v-86h-768v86zM128 384.667v84h768v-84h-768zM128 170.667v86h768v-86h-768z" />
|
||||||
|
<glyph unicode="" glyph-name="search" d="M406 340.667c106 0 192 86 192 192s-86 192-192 192-192-86-192-192 86-192 192-192zM662 340.667l212-212-64-64-212 212v34l-12 12c-48-42-112-66-180-66-154 0-278 122-278 276s124 278 278 278 276-124 276-278c0-68-24-132-66-180l12-12h34z" />
|
||||||
|
<glyph unicode="" glyph-name="reorder" d="M128 724.667h768v-84h-768v84zM128 468.667v86h768v-86h-768zM128 128.667v84h768v-84h-768zM128 298.667v86h768v-86h-768z" />
|
||||||
|
<glyph unicode="" glyph-name="down_arrow" d="M962.878 664.013c-12.701 12.701-33.34 12.701-46.040 0l-404.837-405.631-405.631 405.631c-12.701 12.701-33.34 12.701-46.040 0s-12.701-33.34 0-46.040l427.857-427.857c6.35-6.35 14.288-9.526 23.020-9.526 7.938 0 16.67 3.175 23.020 9.526l427.857 427.857c13.495 12.701 13.495 33.34 0.794 46.040z" />
|
||||||
|
<glyph unicode="" glyph-name="check-circle" horiz-adv-x="878" d="M733.714 531.428c0 9.714-3.429 19.429-10.286 26.286l-52 51.429c-6.857 6.857-16 10.857-25.714 10.857s-18.857-4-25.714-10.857l-233.143-232.571-129.143 129.143c-6.857 6.857-16 10.857-25.714 10.857s-18.857-4-25.714-10.857l-52-51.429c-6.857-6.857-10.286-16.571-10.286-26.286s3.429-18.857 10.286-25.714l206.857-206.857c6.857-6.857 16.571-10.857 25.714-10.857 9.714 0 19.429 4 26.286 10.857l310.286 310.286c6.857 6.857 10.286 16 10.286 25.714zM877.714 438.857c0-242.286-196.571-438.857-438.857-438.857s-438.857 196.571-438.857 438.857 196.571 438.857 438.857 438.857 438.857-196.571 438.857-438.857z" />
|
||||||
|
<glyph unicode="" glyph-name="certificate" horiz-adv-x="878" d="M786.286 438.857l78.857-77.143c10.857-10.286 14.857-25.714 11.429-40-4-14.286-15.429-25.714-29.714-29.143l-107.429-27.429 30.286-106.286c4-14.286 0-29.714-10.857-40-10.286-10.857-25.714-14.857-40-10.857l-106.286 30.286-27.429-107.429c-3.429-14.286-14.857-25.714-29.143-29.714-3.429-0.571-7.429-1.143-10.857-1.143-10.857 0-21.714 4.571-29.143 12.571l-77.143 78.857-77.143-78.857c-10.286-10.857-25.714-14.857-40-11.429-14.857 4-25.714 15.429-29.143 29.714l-27.429 107.429-106.286-30.286c-14.286-4-29.714 0-40 10.857-10.857 10.286-14.857 25.714-10.857 40l30.286 106.286-107.429 27.429c-14.286 3.429-25.714 14.857-29.714 29.143-3.429 14.286 0.571 29.714 11.429 40l78.857 77.143-78.857 77.143c-10.857 10.286-14.857 25.714-11.429 40 4 14.286 15.429 25.714 29.714 29.143l107.429 27.429-30.286 106.286c-4 14.286 0 29.714 10.857 40 10.286 10.857 25.714 14.857 40 10.857l106.286-30.286 27.429 107.429c3.429 14.286 14.857 25.714 29.143 29.143 14.286 4 29.714 0 40-10.857l77.143-79.429 77.143 79.429c10.286 10.857 25.143 14.857 40 10.857 14.286-3.429 25.714-14.857 29.143-29.143l27.429-107.429 106.286 30.286c14.286 4 29.714 0 40-10.857 10.857-10.286 14.857-25.714 10.857-40l-30.286-106.286 107.429-27.429c14.286-3.429 25.714-14.857 29.714-29.143 3.429-14.286-0.571-29.714-11.429-40z" />
|
||||||
|
<glyph unicode="" glyph-name="circle-o" horiz-adv-x="878" d="M438.857 749.714c-171.429 0-310.857-139.429-310.857-310.857s139.429-310.857 310.857-310.857 310.857 139.429 310.857 310.857-139.429 310.857-310.857 310.857zM877.714 438.857c0-242.286-196.571-438.857-438.857-438.857s-438.857 196.571-438.857 438.857 196.571 438.857 438.857 438.857v0c242.286 0 438.857-196.571 438.857-438.857z" />
|
||||||
|
<glyph unicode="" glyph-name="shopping-cart" horiz-adv-x="951" d="M365.714 73.143c0-40-33.143-73.143-73.143-73.143s-73.143 33.143-73.143 73.143 33.143 73.143 73.143 73.143 73.143-33.143 73.143-73.143zM877.714 73.143c0-40-33.143-73.143-73.143-73.143s-73.143 33.143-73.143 73.143 33.143 73.143 73.143 73.143 73.143-33.143 73.143-73.143zM950.857 694.857v-292.571c0-18.286-14.286-34.286-32.571-36.571l-596.571-69.714c2.857-13.143 7.429-26.286 7.429-40 0-13.143-8-25.143-13.714-36.571h525.714c20 0 36.571-16.571 36.571-36.571s-16.571-36.571-36.571-36.571h-585.143c-20 0-36.571 16.571-36.571 36.571 0 17.714 25.714 60.571 34.857 78.286l-101.143 470.286h-116.571c-20 0-36.571 16.571-36.571 36.571s16.571 36.571 36.571 36.571h146.286c38.286 0 39.429-45.714 45.143-73.143h686.286c20 0 36.571-16.571 36.571-36.571z" />
|
||||||
|
<glyph unicode="" glyph-name="shopping-bag" d="M1004 146.286l20-178.857c1.143-10.286-2.286-20.571-9.143-28.571-6.857-7.429-17.143-12-27.429-12h-950.857c-10.286 0-20.571 4.571-27.429 12-6.857 8-10.286 18.286-9.143 28.571l20 178.857h984zM950.857 625.714l49.143-442.857h-976l49.143 442.857c2.286 18.286 17.714 32.571 36.571 32.571h146.286v-73.143c0-40.571 32.571-73.143 73.143-73.143s73.143 32.571 73.143 73.143v73.143h219.429v-73.143c0-40.571 32.571-73.143 73.143-73.143s73.143 32.571 73.143 73.143v73.143h146.286c18.857 0 34.286-14.286 36.571-32.571zM731.429 731.428v-146.286c0-20-16.571-36.571-36.571-36.571s-36.571 16.571-36.571 36.571v146.286c0 80.571-65.714 146.286-146.286 146.286s-146.286-65.714-146.286-146.286v-146.286c0-20-16.571-36.571-36.571-36.571s-36.571 16.571-36.571 36.571v146.286c0 121.143 98.286 219.429 219.429 219.429s219.429-98.286 219.429-219.429z" />
|
||||||
|
<glyph unicode="" glyph-name="shopping-basket" horiz-adv-x="1170" d="M1097.143 512c40.571 0 73.143-32.571 73.143-73.143s-32.571-73.143-73.143-73.143h-8.571l-65.714-378.286c-6.286-34.857-36.571-60.571-72-60.571h-731.429c-35.429 0-65.714 25.714-72 60.571l-65.714 378.286h-8.571c-40.571 0-73.143 32.571-73.143 73.143s32.571 73.143 73.143 73.143h1024zM277.143 54.857c20 1.714 35.429 19.429 33.714 39.429l-18.286 237.714c-1.714 20-19.429 35.429-39.429 33.714s-35.429-19.429-33.714-39.429l18.286-237.714c1.714-18.857 17.714-33.714 36.571-33.714h2.857zM512 91.428v237.714c0 20-16.571 36.571-36.571 36.571s-36.571-16.571-36.571-36.571v-237.714c0-20 16.571-36.571 36.571-36.571s36.571 16.571 36.571 36.571zM731.429 91.428v237.714c0 20-16.571 36.571-36.571 36.571s-36.571-16.571-36.571-36.571v-237.714c0-20 16.571-36.571 36.571-36.571s36.571 16.571 36.571 36.571zM932.571 88.571l18.286 237.714c1.714 20-13.714 37.714-33.714 39.429s-37.714-13.714-39.429-33.714l-18.286-237.714c-1.714-20 13.714-37.714 33.714-39.429h2.857c18.857 0 34.857 14.857 36.571 33.714zM272 784l-53.143-235.429h-75.429l57.714 252c14.857 66.857 73.714 113.714 142.286 113.714h95.429c0 20 16.571 36.571 36.571 36.571h219.429c20 0 36.571-16.571 36.571-36.571h95.429c68.571 0 127.429-46.857 142.286-113.714l57.714-252h-75.429l-53.143 235.429c-8 33.714-37.143 57.143-71.429 57.143h-95.429c0-20-16.571-36.571-36.571-36.571h-219.429c-20 0-36.571 16.571-36.571 36.571h-95.429c-34.286 0-63.429-23.429-71.429-57.143z" />
|
||||||
|
</font></defs></svg>
|
||||||
|
After Width: | Height: | Size: 7.5 KiB |
|
|
@ -0,0 +1 @@
|
||||||
|
window.addEventListener("load",function(t){astrawpWooQuantityButtons(),quantityInput()});let astraminiCarttargetNodes=document.querySelectorAll(".ast-site-header-cart");function astrawpWooQuantityButtons(l){document.querySelector(".woocommerce div.product form.cart");l=l||".qty",$quantityBoxesWrap=document.querySelectorAll("div.quantity:not(.elementor-widget-woocommerce-cart .quantity):not(.buttons_added), td.quantity:not(.elementor-widget-woocommerce-cart .quantity):not(.buttons_added)");for(var t=0;t<$quantityBoxesWrap.length;t++){var e=$quantityBoxesWrap[t],a=e.querySelector(l);if(a&&"date"!==a.getAttribute("type")&&"hidden"!==a.getAttribute("type")){($qty_parent=a.parentElement).classList.add("buttons_added");var n=`<span class="screen-reader-text">${astra_qty_btn.minus_qty}</span><a href="javascript:void(0)" id="minus_qty-${t}" class="minus %s">-</a>`,r=`<span class="screen-reader-text">${astra_qty_btn.plus_qty}</span><a href="javascript:void(0)" id="plus_qty-${t}" class="plus %s">+</a>`;if("vertical-icon"===astra_qty_btn.style_type)$qty_parent.classList.add("ast-vertical-style-applied"),a.classList.add("vertical-icons-applied"),$qty_parent.insertAdjacentHTML("beforeend",n.replace("%s","ast-vertical-icon")+r.replace("%s","ast-vertical-icon"));else{let t="";"no-internal-border"===astra_qty_btn.style_type&&(a.classList.add("ast-no-internal-border"),t="no-internal-border"),$qty_parent.insertAdjacentHTML("afterbegin",n.replace("%s",t)),$qty_parent.insertAdjacentHTML("beforeend",r.replace("%s",t))}$quantityEach=document.querySelectorAll("input"+l+":not(.product-quantity)");for(var s=0;s<$quantityEach.length;s++){var o=$quantityEach[s],i=o.getAttribute("min");i&&0<i&&parseFloat(o.value)<i&&(o.value=i)}a=document.getElementsByTagName("BODY")[0],n=document.getElementsByClassName("cart")[0];if(a.classList.contains("single-product")&&!n.classList.contains("grouped_form")){let e=document.querySelector(".woocommerce input[type=number].qty");e&&e.addEventListener("keyup",function(){var t=e.value;e.value=t})}for(var u=e.querySelectorAll(".plus, .minus"),c=0;c<u.length;c++)u[c].addEventListener("click",function(t){var e,a=t.target.parentElement.querySelector(l),n=parseFloat(a.value),r=parseFloat(a.getAttribute("max")),s=parseFloat(a.getAttribute("min")),o=parseFloat(a.getAttribute("step")),i=Number.isInteger(o),n=n||0,r=r||"",s=s||0,o=o||1,r=(t.target.classList.contains("plus")?r&&(r===n||n>Number(r))?a.value=r:(e=n+parseFloat(o),a.value=i?e:e.toFixed(1)):s&&(s===n||n<s)?a.value=s:0<n&&(e=n-parseFloat(o),a.value=i?e:e.toFixed(1)),new Event("change",{bubbles:!0})),u=(a.dispatchEvent(r),document.getElementsByName("update_cart"));if(0<u.length)for(var c=0;c<u.length;c++)u[c].disabled=!1,u[c].click();s=a.value,n=a.getAttribute("name").replace(/cart\[([\w]+)\]\[qty\]/g,"$1");sendAjaxQuantityRequest(t.currentTarget,s,n)},!1)}}}function sendAjaxQuantityRequest(t,a,n){let r=t.closest(".woocommerce-mini-cart");if(r&&astra&&astra.single_product_qty_ajax_nonce&&astra.ajax_url){t=astra.single_product_qty_ajax_nonce;r.classList.add("ajax-mini-cart-qty-loading");let e=new XMLHttpRequest;e.open("POST",astra.ajax_url,!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send("action=astra_add_cart_single_product_quantity&hash="+n+"&quantity="+a+"&qtyNonce="+t),e.onload=function(){var t;e.readyState==XMLHttpRequest.DONE&&(200<=e.status||400<=e.status)&&((t=document.createEvent("HTMLEvents")).initEvent("wc_fragment_refresh",!0,!1),document.body.dispatchEvent(t),setTimeout(()=>{r.classList.remove("ajax-mini-cart-qty-loading")},500))}}}astraminiCarttargetNodes.forEach(function(t){var e;null!=t&&(e={attributes:!1,childList:!0,subtree:!0},new MutationObserver(()=>{astrawpWooQuantityButtons(),quantityInput()}).observe(t,e))}),jQuery(function(t){t(document.body).on("wc_fragments_refreshed",function(){astrawpWooQuantityButtons(),quantityInput()})}),setTimeout(()=>{var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){astrawpWooQuantityButtons()}),t.apply(this,arguments)}},2e3);let typingTimer,doneTypingInterval=500;function quantityInput(){document.querySelector(".woocommerce-mini-cart")&&document.querySelectorAll(".input-text.qty").forEach(t=>{t.addEventListener("keyup",a=>{"Tab"!==a.key&&9!==a.keyCode&&(clearTimeout(typingTimer),t.value)&&(typingTimer=setTimeout(()=>{var t=a.target.value,e=a.target.getAttribute("name").replace(/cart\[([\w]+)\]\[qty\]/g,"$1");t&&sendAjaxQuantityRequest(a.target,t,e)},doneTypingInterval))})})}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
(e=>{ASTControlTrigger={triggerHook:function(t,s){e("body").trigger("astra-control-trigger."+t,s)},addHook:function(t,s){e("body").on("astra-control-trigger."+t,s)},removeHook:function(t,s){e("body").off("astra-control-trigger."+t,s)}},ASTCustomizerToggles={"astra-settings[display-site-title-responsive]":[],"astra-settings[display-site-tagline-responsive]":[],"astra-settings[ast-header-retina-logo]":[],custom_logo:[],"astra-settings[header-main-rt-section]":[],"astra-settings[hide-custom-menu-mobile]":[],"astra-settings[blog-width]":[],"astra-settings[blog-post-structure]":[],"astra-settings[blog-single-post-structure]":[],"astra-settings[blog-single-width]":[],"astra-settings[blog-single-meta]":[],"astra-settings[footer-sml-layout]":[],"astra-settings[footer-sml-section-1]":[],"astra-settings[footer-sml-section-2]":[],"astra-settings[footer-sml-divider]":[],"astra-settings[header-main-sep]":[],"astra-settings[disable-primary-nav]":[],"astra-settings[footer-adv]":[],"astra-settings[shop-archive-width]":[],"astra-settings[mobile-header-logo]":[],"astra-settings[different-mobile-logo]":[]}})(jQuery);
|
||||||