Upload limit plugin.
This commit is contained in:
parent
713c1fc8be
commit
42c09d59c6
|
|
@ -0,0 +1,188 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class Codepopular_WMUFS
|
||||
*/
|
||||
class Codepopular_WMUFS
|
||||
{
|
||||
static function init() {
|
||||
|
||||
if ( is_admin() ) {
|
||||
add_action('admin_enqueue_scripts', array( __CLASS__, 'wmufs_style_and_script' ));
|
||||
add_action('admin_menu', array( __CLASS__, 'upload_max_file_size_add_pages' ));
|
||||
add_filter('plugin_action_links_' . WMUFS_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ));
|
||||
add_filter('plugin_row_meta', array( __CLASS__, 'plugin_meta_links' ), 10, 2);
|
||||
add_filter('admin_footer_text', array( __CLASS__, 'admin_footer_text' ));
|
||||
|
||||
if ( isset($_POST['upload_max_file_size_field']) ) {
|
||||
$retrieved_nonce = isset($_POST['upload_max_file_size_nonce']) ? sanitize_text_field(wp_unslash($_POST['upload_max_file_size_nonce'])) : '';
|
||||
if ( ! wp_verify_nonce($retrieved_nonce, 'upload_max_file_size_action') ) {
|
||||
die('Failed security check');
|
||||
}
|
||||
$max_size = (int) $_POST['upload_max_file_size_field'] * 1024 * 1024;
|
||||
$max_execution_time = isset($_POST['wmufs_maximum_execution_time']) ? sanitize_text_field(wp_unslash( (int) $_POST['wmufs_maximum_execution_time'])) : '';
|
||||
update_option('wmufs_maximum_execution_time', $max_execution_time);
|
||||
update_option('max_file_size', $max_size);
|
||||
wp_safe_redirect(admin_url('upload.php?page=upload_max_file_size&max-size-updated=true'));
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('upload_size_limit', array( __CLASS__, 'upload_max_increase_upload' ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Plugin Style and Scripts.
|
||||
* @return string
|
||||
*/
|
||||
|
||||
static function wmufs_style_and_script() {
|
||||
wp_enqueue_style('wmufs-admin-style', WMUFS_PLUGIN_URL . 'assets/css/wmufs.min.css', null, WMUFS_PLUGIN_VERSION);
|
||||
|
||||
wp_enqueue_script('wmufs-admin', WMUFS_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery' ), WMUFS_PLUGIN_VERSION, true);
|
||||
|
||||
// Ajax admin localization.
|
||||
$admin_notice_nonce = wp_create_nonce('wmufs_notice_status');
|
||||
wp_localize_script(
|
||||
'wmufs-admin',
|
||||
'wmufs_admin_notice_ajax_object',
|
||||
array(
|
||||
'wmufs_admin_notice_ajax_url' => admin_url('admin-ajax.php'),
|
||||
'nonce' => $admin_notice_nonce,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// get plugin version from header
|
||||
static function get_plugin_version() {
|
||||
$plugin_data = get_file_data(__FILE__, array( 'version' => 'Version' ), 'plugin');
|
||||
|
||||
return $plugin_data['version'];
|
||||
} // get_plugin_version
|
||||
|
||||
|
||||
// test if we're on plugin's page
|
||||
static function is_plugin_page() {
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
if ( $current_screen->id == 'media_page_upload_max_file_size' ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} // is_plugin_page
|
||||
|
||||
|
||||
// add settings link to plugins page
|
||||
static function plugin_action_links( $links ) {
|
||||
$settings_link = '<a href="' . admin_url('upload.php?page=upload_max_file_size') . '" title="Adjust Max File Upload Size Settings">Settings</a>';
|
||||
|
||||
array_unshift($links, $settings_link);
|
||||
|
||||
return $links;
|
||||
} // plugin_action_links
|
||||
|
||||
|
||||
// add links to plugin's description in plugins table
|
||||
static function plugin_meta_links( $links, $file ) {
|
||||
$support_link = '<a target="_blank" href="https://wordpress.org/support/plugin/wp-maximum-upload-file-size/" title="Get help">Support</a>';
|
||||
|
||||
|
||||
if ( $file == plugin_basename(__FILE__) ) {
|
||||
$links[] = $support_link;
|
||||
}
|
||||
|
||||
return $links;
|
||||
} // plugin_meta_links
|
||||
|
||||
|
||||
// additional powered by text in admin footer; only on plugin's page
|
||||
static function admin_footer_text( $text ) {
|
||||
if ( ! self::is_plugin_page() ) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$text = '<span id="footer-thankyou">If you like <strong><ins>WP Maximum Upload File Size</ins></strong> please leave us a <a target="_blank" style="color:#f9b918" href="https://wordpress.org/support/view/plugin-reviews/wp-maximum-upload-file-size?rate=5#postform">★★★★★</a> rating. A huge thank you in advance!</span>';
|
||||
return $text;
|
||||
} // admin_footer_text
|
||||
|
||||
|
||||
/**
|
||||
* Add menu pages
|
||||
*
|
||||
* @since 1.0
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
*/
|
||||
static function upload_max_file_size_add_pages() {
|
||||
// Add a new menu on main menu
|
||||
add_submenu_page(
|
||||
'upload.php', // Parent Slug.
|
||||
'Increase Max Upload File Size', // Page Title.
|
||||
'Increase Upload Limit', // Menu Title
|
||||
'manage_options',
|
||||
'upload_max_file_size',
|
||||
[ __CLASS__, 'upload_max_file_size_dash' ]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest value from array
|
||||
* @param $search
|
||||
* @param $arr
|
||||
* @return mixed|null
|
||||
*/
|
||||
static function get_closest( $search, $arr ) {
|
||||
$closest = null;
|
||||
foreach ( $arr as $item ) {
|
||||
if ( $closest === null || abs($search - $closest) > abs($item - $search) ) {
|
||||
$closest = $item;
|
||||
}
|
||||
}
|
||||
return $closest;
|
||||
} // get_closest
|
||||
|
||||
|
||||
/**
|
||||
* Dashboard Page
|
||||
*/
|
||||
static function upload_max_file_size_dash() {
|
||||
|
||||
include_once(WMUFS_PLUGIN_PATH . 'inc/class-wmufs-helper.php');
|
||||
include_once WMUFS_PLUGIN_PATH . 'admin/templates/class-wmufs-template.php';
|
||||
|
||||
add_action('admin_head', [ __CLASS__, 'wmufs_remove_admin_action' ]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove admin notices in admin page.
|
||||
*
|
||||
* @return array|mixed.
|
||||
*/
|
||||
static function wmufs_remove_admin_action() {
|
||||
remove_all_actions('user_admin_notices');
|
||||
remove_all_actions('admin_notices');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to increase max_file_size
|
||||
*
|
||||
* @since 1.4
|
||||
*
|
||||
* @return int max_size in bytes
|
||||
*
|
||||
*/
|
||||
static function upload_max_increase_upload( $data ) {
|
||||
return get_option('max_file_size') ? get_option('max_file_size') : $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance of the class // Codepopular_WMUFS
|
||||
*/
|
||||
add_action('init', array( 'Codepopular_WMUFS', 'init' ));
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
<!--Recommend Dostart Theme-->
|
||||
|
||||
<div class="wmufs_card_mini wmufs_mb_20">
|
||||
<div class="wmufs-title">
|
||||
<h3><?php esc_html_e('Get Free WordPress Theme', 'wp-maximum-upload-file-size') ?></h3>
|
||||
<div class="wmufs-recommended-content">
|
||||
<a href="<?php echo esc_url_raw('https://wordpress.org/themes/dostart');?>" target="_blank">
|
||||
<img src="<?php echo esc_url( WMUFS_PLUGIN_URL . 'assets/images/dostart.png' ); ?>" alt="<?php echo esc_html('dostart');?>">
|
||||
</a>
|
||||
<div class="wmufs-btn">
|
||||
<a target="_blank" href="<?php echo esc_url_raw('https://wordpress.org/themes/dostart');?>"><?php esc_html_e('Download Now', 'wp-maximum-upload-file-size'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Recommend Unlimited Theme Addons-->
|
||||
|
||||
<div class="wmufs_card_mini wmufs_mb_20">
|
||||
<div class="wmufs-title">
|
||||
<h3><?php esc_html_e('Try Free Elementor Addons Plugin', 'wp-maximum-upload-file-size') ?></h3>
|
||||
<div class="wmufs-recommended-content">
|
||||
<a href="<?php echo esc_url_raw('https://wordpress.org/plugins/unlimited-theme-addons/');?>" target="_blank">
|
||||
<img src="<?php echo esc_url( WMUFS_PLUGIN_URL . 'assets/images/unlimited-theme-addon.png' ); ?>" alt="<?php echo esc_html('dostart');?>">
|
||||
</a>
|
||||
<div class="wmufs-btn">
|
||||
<a target="_blank" href="<?php echo esc_url_raw('https://wordpress.org/plugins/unlimited-theme-addons/');?>"><?php esc_html_e('Download Now', 'wp-maximum-upload-file-size'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Recommend Unlimited Theme Addons-->
|
||||
|
||||
<div class="wmufs_card_mini">
|
||||
<div class="wmufs-title">
|
||||
<div class="wmufs-recommended-content">
|
||||
<a target="_blank" href="<?php echo esc_url_raw('https://codepopular.com/contact/');?>"> <div class="wmufs-btn wmufs_support_btn">
|
||||
<span class="dashicons dashicons-money"></span> <?php esc_html_e(' Contact Us', 'wp-maximum-upload-file-size'); ?>
|
||||
</div></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php //echo ini_get( 'upload_max_filesize' ); ?>
|
||||
<?php //echo ini_get( 'post_max_size' ); ?>
|
||||
<?php // echo wp_max_upload_size(); ?>
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
if ( isset($_GET['max-size-updated']) ) { ?>
|
||||
<div class="notice-success notice is-dismissible">
|
||||
<p><?php echo esc_html__('Maximum Upload File Size Saved Changed!', 'wp-maximum-upload-file-size');?></p>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
$max_size = get_option('max_file_size');
|
||||
if ( ! $max_size ) {
|
||||
$max_size = wp_max_upload_size();
|
||||
}
|
||||
$max_size = $max_size / 1024 / 1024;
|
||||
$upload_sizes = array(
|
||||
'16' => '16 MB',
|
||||
'32' => '32 MB',
|
||||
'40' => '40 MB',
|
||||
'64' => '64 MB',
|
||||
'128' => '128 MB',
|
||||
'256' => '256 MB',
|
||||
'512' => '512 MB',
|
||||
'1024' => '1 GB',
|
||||
'2048' => '2 GB',
|
||||
'3072' => '3 GB',
|
||||
'4096' => '4 GB',
|
||||
'5120' => '5 GB',
|
||||
);
|
||||
|
||||
//$current_max_size = self::get_closest($max_size, $upload_sizes);
|
||||
|
||||
|
||||
$wpufs_max_execution_time = get_option('wmufs_maximum_execution_time') != '' ? get_option('wmufs_maximum_execution_time') : ini_get('max_execution_time');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap wmufs_mb_50">
|
||||
<h1><span class="dashicons dashicons-upload" style="font-size: inherit; line-height: unset;"></span><?php echo esc_html_e( 'Increase Maximum Upload File Size', 'wp-maximum-upload-file-size' ); ?></h1><br>
|
||||
<div class="wmufs_admin_deashboard">
|
||||
<!-- Row -->
|
||||
<div class="wmufs_row" id="poststuff">
|
||||
|
||||
<!-- Start Content Area -->
|
||||
<div class="wmufs_admin_left wmufs_card wmufs-col-8">
|
||||
<form method="post">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="upload_max_file_size_field">Choose Maximum Upload File Size</label></th>
|
||||
<td>
|
||||
<select id="upload_max_file_size_field" name="upload_max_file_size_field"> <?php
|
||||
foreach ( $upload_sizes as $key => $size ) {
|
||||
echo '<option value="' . esc_attr($key) . '" ' . ($key == $max_size ? 'selected' : '') . '>' . esc_html($size) . '</option>';
|
||||
} ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="upload_max_file_size_field">Maximum Execution Time</label></th>
|
||||
<td>
|
||||
<input name="wmufs_maximum_execution_time" type="number" value="<?php echo esc_html($wpufs_max_execution_time);?>">
|
||||
<br><small>Example: 300, 600, 1800, 3600</small>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php wp_nonce_field('upload_max_file_size_action', 'upload_max_file_size_nonce'); ?>
|
||||
<?php submit_button(); ?>
|
||||
</form>
|
||||
|
||||
<table class="wmufs-system-status">
|
||||
|
||||
<tr>
|
||||
<th><?php esc_html_e('Title','wp-maximum-upload-file-size');?></th>
|
||||
<th><?php esc_html_e('Status', 'wp-maximum-upload-file-size');?></th>
|
||||
<th><?php esc_html_e('Message', 'wp-maximum-upload-file-size');?></th>
|
||||
</tr>
|
||||
<!-- PHP Version -->
|
||||
<?php
|
||||
foreach ( $system_status as $value ) { ?>
|
||||
<tr>
|
||||
<td><?php printf( '%s', esc_html( $value['title'] ) ); ?></td>
|
||||
|
||||
<td>
|
||||
<?php if ( 1 == $value['status'] ) { ?>
|
||||
<span class="dashicons dashicons-yes"></span>
|
||||
<?php } else { ?>
|
||||
<span class="dashicons dashicons-warning"></span>
|
||||
|
||||
<?php }; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( 1 == $value['status'] ) { ?>
|
||||
<p class="wpifw_status_message"> <?php printf( '%s', esc_html( $value['version'] ) ); ?> <?php echo $value['success_message']; //phpcs:ignore ?></p>
|
||||
<?php } else { ?>
|
||||
<?php printf( '%s', esc_html( $value['version'] ) ); ?>
|
||||
<p class="wpifw_status_message"><?php echo $value['error_message']; //phpcs:ignore ?></p>
|
||||
|
||||
<?php }; ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="support-ticket">
|
||||
<h2><?php echo esc_html__('Do you need any free help?', 'wp-maximum-upload-file-size'); ?></h2>
|
||||
<a target="_blank" href="<?php echo esc_url_raw('https://wordpress.org/support/plugin/wp-maximum-upload-file-size/');?>"><?php echo esc_html__('Open Ticket', 'wp-maximum-upload-file-size'); ?></a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Content Area -->
|
||||
|
||||
<!-- Start Sidebar Area -->
|
||||
<div class="wmufs_admin_right_sidebar wmufs_card wmufs-col-4">
|
||||
<?php include_once WMUFS_PLUGIN_PATH . 'admin/templates/class-wmufs-sidebar.php'; ?>
|
||||
</div>
|
||||
<!-- End Sidebar area-->
|
||||
|
||||
</div> <!-- End Row--->
|
||||
</div>
|
||||
</div> <!-- End Wrapper -->
|
||||
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
|
||||
/**----------------------------------------
|
||||
CodePopular Promotion.
|
||||
--------------------------------------------*/
|
||||
|
||||
.codepopular_notice {
|
||||
padding: 20px 10px;
|
||||
|
||||
h4{
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
line-height: 1.5714285714;
|
||||
max-width: 800px
|
||||
}
|
||||
|
||||
a {
|
||||
box-shadow: none;
|
||||
color: #2271b1;
|
||||
outline: none;
|
||||
text-decoration: underline;
|
||||
transition: opacity .3s;
|
||||
|
||||
&:hover {
|
||||
opacity: .5
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&__buttons {
|
||||
margin-top: -10px;
|
||||
overflow: hidden;
|
||||
padding: 10px 0
|
||||
}
|
||||
|
||||
&__button {
|
||||
float: left;
|
||||
margin: 20px 20px 0 0;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.codepopular__button {
|
||||
background-color: #fff;
|
||||
border: 1px solid transparent;
|
||||
box-shadow: none !important;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5714285714;
|
||||
min-width: 180px;
|
||||
opacity: 1 !important;
|
||||
outline: none !important;
|
||||
padding: 9px 30px;
|
||||
position: relative;
|
||||
margin:3px;
|
||||
text-align: center;
|
||||
text-decoration: none !important;
|
||||
transition: color .3s !important;
|
||||
z-index: 10;
|
||||
|
||||
&:before {
|
||||
float: left;
|
||||
font-family: dashicons;
|
||||
font-size: 20px;
|
||||
line-height: 1.1;
|
||||
margin-right: 10px
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
transition: width .3s;
|
||||
width: 0;
|
||||
z-index: -1
|
||||
}
|
||||
|
||||
&:hover:after {
|
||||
width: 100%
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.btn__blue:hover,
|
||||
.btn__gray:hover,
|
||||
.btn__green:hover,
|
||||
.btn__yellow:hover,
|
||||
.btn__dark:hover,
|
||||
.btn__red:hover {
|
||||
color: #fff !important
|
||||
}
|
||||
|
||||
.btn__blue {
|
||||
border-color: #2271b1;
|
||||
color: #2271b1 !important;
|
||||
|
||||
&:after {
|
||||
background-color: #2271b1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.btn__green {
|
||||
border-color: #00a32a;
|
||||
color: #00a32a !important;
|
||||
|
||||
&:after {
|
||||
background-color: #00a32a
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.btn__yellow {
|
||||
border-color: #ffad43;
|
||||
color: #ffa23b!important;
|
||||
|
||||
&:after {
|
||||
background-color: #eea404
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.btn__dark {
|
||||
border-color: #838280;
|
||||
color: #4b4640!important;
|
||||
|
||||
&:after {
|
||||
background-color: #51504e
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.btn__red {
|
||||
border-color: #d63638;
|
||||
color: #d63638 !important;
|
||||
|
||||
&:after {
|
||||
background-color: #d63638
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.btn__gray {
|
||||
border-color: #c3c4c7;
|
||||
color: #c3c4c7 !important;
|
||||
|
||||
&:after {
|
||||
background-color: #c3c4c7
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
.form-table th {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.gray-box {
|
||||
display: inline-block;
|
||||
padding: 15px;
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
|
||||
.support-ticket {
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
.support-ticket h2 {
|
||||
font-size: 25px;
|
||||
}
|
||||
.support-ticket a {
|
||||
text-decoration: none;
|
||||
font-size: 16px;
|
||||
background: #6d0eff;
|
||||
padding: 9px 23px;
|
||||
color: #fff;
|
||||
border-radius: 20px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.wmufs_support_btn {
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #525252 !important;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
padding: 20px 10px;
|
||||
}
|
||||
.wmufs_support_btn .dashicons {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.wmufs_mb_50 {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.wmufs_mb_20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wmufs_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.wmufs_card {
|
||||
background: #fff;
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 1px 3px 9px 1px #eee;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.wmufs-col-8 {
|
||||
width: 100%;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.wmufs-col-4 {
|
||||
width: 21.3333333333%;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.wmufs_card_mini {
|
||||
border: 1px solid #eee;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.wmufs-title h3 {
|
||||
border: 1px solid #eee;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
background: #f5f5f5;
|
||||
margin: 0px 0px 10px 0px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
/**
|
||||
Button Design
|
||||
*/
|
||||
.wmufs-btn {
|
||||
background: #6d0eff;
|
||||
text-align: center;
|
||||
}
|
||||
.wmufs-btn a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
padding: 10px;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
display: block;
|
||||
}
|
||||
.wmufs-btn a:hover,
|
||||
.wmufs-btn a:focus,
|
||||
.wmufs-btn a:active {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.wmufs-recommended-content img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wmufs-recommended-content a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/******** System Status ******************/
|
||||
.wmufs-system-status {
|
||||
width: 100%;
|
||||
}
|
||||
.wmufs-system-status .dashicons-warning {
|
||||
color: #cd5c5c;
|
||||
font-size: 20px;
|
||||
}
|
||||
.wmufs-system-status .dashicons-yes {
|
||||
color: green;
|
||||
font-size: 20px;
|
||||
}
|
||||
.wmufs-system-status tr td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
.wmufs-system-status th {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.wmufs-system-status th:first-child {
|
||||
border-right: none;
|
||||
}
|
||||
.wmufs-system-status th:last-child {
|
||||
border-left: none;
|
||||
}
|
||||
.wmufs-system-status td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.wmufs-system-status td:nth-child(2) {
|
||||
border-left: none;
|
||||
text-align: center;
|
||||
}
|
||||
.wmufs-system-status td:last-child {
|
||||
border-left: none;
|
||||
}
|
||||
.wmufs-system-status tr:last-child td {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.wpifw_status_message {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 786px) {
|
||||
.wmufs_row {
|
||||
display: block;
|
||||
}
|
||||
.wmufs-col-8 {
|
||||
width: 100%;
|
||||
}
|
||||
.wmufs-col-4 {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
/**----------------------------------------
|
||||
CodePopular Promotion.
|
||||
--------------------------------------------*/
|
||||
.codepopular_notice {
|
||||
padding: 20px 10px;
|
||||
}
|
||||
.codepopular_notice h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
.codepopular_notice p {
|
||||
font-size: 14px;
|
||||
line-height: 1.5714285714;
|
||||
max-width: 800px;
|
||||
}
|
||||
.codepopular_notice a {
|
||||
box-shadow: none;
|
||||
color: #2271b1;
|
||||
outline: none;
|
||||
text-decoration: underline;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
.codepopular_notice a:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.codepopular_notice__buttons {
|
||||
margin-top: -10px;
|
||||
overflow: hidden;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.codepopular_notice__button {
|
||||
float: left;
|
||||
margin: 20px 20px 0 0;
|
||||
}
|
||||
.codepopular_notice__button:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
.codepopular_notice .codepopular__button {
|
||||
background-color: #fff;
|
||||
border: 1px solid transparent;
|
||||
box-shadow: none !important;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5714285714;
|
||||
min-width: 180px;
|
||||
opacity: 1 !important;
|
||||
outline: none !important;
|
||||
padding: 9px 30px;
|
||||
position: relative;
|
||||
margin: 3px;
|
||||
text-align: center;
|
||||
text-decoration: none !important;
|
||||
transition: color 0.3s !important;
|
||||
z-index: 10;
|
||||
}
|
||||
.codepopular_notice .codepopular__button:before {
|
||||
float: left;
|
||||
font-family: dashicons;
|
||||
font-size: 20px;
|
||||
line-height: 1.1;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.codepopular_notice .codepopular__button:after {
|
||||
content: "";
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
transition: width 0.3s;
|
||||
width: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
.codepopular_notice .codepopular__button:hover:after {
|
||||
width: 100%;
|
||||
}
|
||||
.codepopular_notice .btn__blue:hover,
|
||||
.codepopular_notice .btn__gray:hover,
|
||||
.codepopular_notice .btn__green:hover,
|
||||
.codepopular_notice .btn__yellow:hover,
|
||||
.codepopular_notice .btn__dark:hover,
|
||||
.codepopular_notice .btn__red:hover {
|
||||
color: #fff !important;
|
||||
}
|
||||
.codepopular_notice .btn__blue {
|
||||
border-color: #2271b1;
|
||||
color: #2271b1 !important;
|
||||
}
|
||||
.codepopular_notice .btn__blue:after {
|
||||
background-color: #2271b1;
|
||||
}
|
||||
.codepopular_notice .btn__green {
|
||||
border-color: #00a32a;
|
||||
color: #00a32a !important;
|
||||
}
|
||||
.codepopular_notice .btn__green:after {
|
||||
background-color: #00a32a;
|
||||
}
|
||||
.codepopular_notice .btn__yellow {
|
||||
border-color: #ffad43;
|
||||
color: #ffa23b !important;
|
||||
}
|
||||
.codepopular_notice .btn__yellow:after {
|
||||
background-color: #eea404;
|
||||
}
|
||||
.codepopular_notice .btn__dark {
|
||||
border-color: #838280;
|
||||
color: #4b4640 !important;
|
||||
}
|
||||
.codepopular_notice .btn__dark:after {
|
||||
background-color: #51504e;
|
||||
}
|
||||
.codepopular_notice .btn__red {
|
||||
border-color: #d63638;
|
||||
color: #d63638 !important;
|
||||
}
|
||||
.codepopular_notice .btn__red:after {
|
||||
background-color: #d63638;
|
||||
}
|
||||
.codepopular_notice .btn__gray {
|
||||
border-color: #c3c4c7;
|
||||
color: #c3c4c7 !important;
|
||||
}
|
||||
.codepopular_notice .btn__gray:after {
|
||||
background-color: #c3c4c7;
|
||||
}/*# sourceMappingURL=wmufs.css.map */
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
.form-table th{width:230px}.gray-box{display:inline-block;padding:15px;background-color:#e6e6e6}.support-ticket{text-align:center;border:1px solid #ccc;margin-top:20px;padding:20px}.support-ticket h2{font-size:25px}.support-ticket a{text-decoration:none;font-size:16px;background:#6d0eff;padding:9px 23px;color:#fff;border-radius:20px;display:inline-block}.wmufs_support_btn{color:#fff;display:flex;align-items:center;justify-content:center;background:#525252 !important;font-size:20px;font-weight:bold;padding:20px 10px}.wmufs_support_btn .dashicons{padding-right:10px}.wmufs_mb_50{margin-bottom:50px}.wmufs_mb_20{margin-bottom:20px}.wmufs_row{display:flex;width:100%;overflow:hidden;justify-content:space-between}.wmufs_card{background:#fff;border:1px solid #eee;box-shadow:1px 3px 9px 1px #eee;padding:10px 20px}.wmufs-col-8{width:100%;margin-right:20px}.wmufs-col-4{width:21.3333333333%;flex:0 0 auto;margin-right:20px}.wmufs_card_mini{border:1px solid #eee;padding:10px}.wmufs-title h3{border:1px solid #eee;padding:10px;text-align:center;background:#f5f5f5;margin:0px 0px 10px 0px;font-size:18px}.wmufs-btn{background:#6d0eff;text-align:center}.wmufs-btn a{color:#fff;text-decoration:none;padding:10px;font-weight:bold;font-size:16px;display:block}.wmufs-btn a:hover,.wmufs-btn a:focus,.wmufs-btn a:active{outline:0;box-shadow:none}.wmufs-recommended-content img{width:100%}.wmufs-recommended-content a{text-decoration:none}.wmufs-system-status{width:100%}.wmufs-system-status .dashicons-warning{color:#cd5c5c;font-size:20px}.wmufs-system-status .dashicons-yes{color:green;font-size:20px}.wmufs-system-status tr td:first-child{text-align:left}.wmufs-system-status th{border:1px solid #ccc;padding:10px;border-bottom:none}.wmufs-system-status th:first-child{border-right:none}.wmufs-system-status th:last-child{border-left:none}.wmufs-system-status td{border:1px solid #ccc;padding:10px;border-bottom:none}.wmufs-system-status td:nth-child(2){border-left:none;text-align:center}.wmufs-system-status td:last-child{border-left:none}.wmufs-system-status tr:last-child td{border-bottom:1px solid #ccc}.wpifw_status_message{margin:0}@media(max-width: 786px){.wmufs_row{display:block}.wmufs-col-8{width:100%}.wmufs-col-4{width:100%}}.codepopular_notice{padding:20px 10px}.codepopular_notice h4{font-size:16px}.codepopular_notice p{font-size:14px;line-height:1.5714285714;max-width:800px}.codepopular_notice a{box-shadow:none;color:#2271b1;outline:none;text-decoration:underline;transition:opacity .3s}.codepopular_notice a:hover{opacity:.5}.codepopular_notice__buttons{margin-top:-10px;overflow:hidden;padding:10px 0}.codepopular_notice__button{float:left;margin:20px 20px 0 0}.codepopular_notice__button:last-child{margin-right:0}.codepopular_notice .codepopular__button{background-color:#fff;border:1px solid rgba(0,0,0,0);box-shadow:none !important;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:14px;font-weight:500;line-height:1.5714285714;min-width:180px;opacity:1 !important;outline:none !important;padding:9px 30px;position:relative;margin:3px;text-align:center;text-decoration:none !important;transition:color .3s !important;z-index:10}.codepopular_notice .codepopular__button:before{float:left;font-family:dashicons;font-size:20px;line-height:1.1;margin-right:10px}.codepopular_notice .codepopular__button:after{content:"";height:100%;left:0;position:absolute;top:0;transition:width .3s;width:0;z-index:-1}.codepopular_notice .codepopular__button:hover:after{width:100%}.codepopular_notice .btn__blue:hover,.codepopular_notice .btn__gray:hover,.codepopular_notice .btn__green:hover,.codepopular_notice .btn__yellow:hover,.codepopular_notice .btn__dark:hover,.codepopular_notice .btn__red:hover{color:#fff !important}.codepopular_notice .btn__blue{border-color:#2271b1;color:#2271b1 !important}.codepopular_notice .btn__blue:after{background-color:#2271b1}.codepopular_notice .btn__green{border-color:#00a32a;color:#00a32a !important}.codepopular_notice .btn__green:after{background-color:#00a32a}.codepopular_notice .btn__yellow{border-color:#ffad43;color:#ffa23b !important}.codepopular_notice .btn__yellow:after{background-color:#eea404}.codepopular_notice .btn__dark{border-color:#838280;color:#4b4640 !important}.codepopular_notice .btn__dark:after{background-color:#51504e}.codepopular_notice .btn__red{border-color:#d63638;color:#d63638 !important}.codepopular_notice .btn__red:after{background-color:#d63638}.codepopular_notice .btn__gray{border-color:#c3c4c7;color:#c3c4c7 !important}.codepopular_notice .btn__gray:after{background-color:#c3c4c7}/*# sourceMappingURL=wmufs.min.css.map */
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,236 @@
|
|||
.form-table th {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.gray-box {
|
||||
display: inline-block;
|
||||
padding: 15px;
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
|
||||
|
||||
.support-ticket {
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
|
||||
|
||||
h2 {
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
font-size: 16px;
|
||||
background: #6d0eff;
|
||||
padding: 9px 23px;
|
||||
color: #fff;
|
||||
border-radius: 20px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.wmufs_support_btn {
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #525252 !important;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
padding: 20px 10px;
|
||||
|
||||
.dashicons {
|
||||
padding-right: 10px
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.wmufs_mb_50 {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.wmufs_mb_20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wmufs_row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.wmufs_card {
|
||||
background: #fff;
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 1px 3px 9px 1px #eee;
|
||||
padding: 10px 20px
|
||||
}
|
||||
|
||||
.wmufs-col-8 {
|
||||
width: 100%;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.wmufs-col-4 {
|
||||
width: 21.3333333333%;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px
|
||||
}
|
||||
|
||||
|
||||
|
||||
.wmufs_card_mini {
|
||||
border: 1px solid #eee;
|
||||
padding: 10px
|
||||
}
|
||||
|
||||
.wmufs-title h3 {
|
||||
border: 1px solid #eee;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
background: #f5f5f5;
|
||||
margin: 0px 0px 10px 0px;
|
||||
font-size: 18px;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Button Design
|
||||
*/
|
||||
|
||||
.wmufs-btn {
|
||||
background: #6d0eff;
|
||||
text-align: center;
|
||||
|
||||
.wmufs-btn a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
padding: 10px;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus,
|
||||
a:active {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.wmufs-recommended-content img {
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.wmufs-recommended-content a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******** System Status ******************/
|
||||
|
||||
.wmufs-system-status {
|
||||
width: 100%;
|
||||
|
||||
.dashicons-warning {
|
||||
color: #cd5c5c;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.dashicons-yes {
|
||||
color: green;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
tr td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
th:first-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
th:last-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
td:nth-child(2) {
|
||||
border-left: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
td:last-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
tr:last-child td {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.wpifw_status_message {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media(max-width: 786px) {
|
||||
.wmufs_row {
|
||||
display: block
|
||||
}
|
||||
|
||||
.wmufs-col-8 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wmufs-col-4 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@import "./promotion";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 184 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$('#hideWmufsNotice').on('click', function(){
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
url: wmufs_admin_notice_ajax_object.wmufs_admin_notice_ajax_url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'wmufs_admin_notice_ajax_object_save', data: 1,
|
||||
_ajax_nonce: wmufs_admin_notice_ajax_object.nonce,
|
||||
},
|
||||
success: function (data) {
|
||||
console.log("success");
|
||||
console.log(data);
|
||||
if (data.success == true) {
|
||||
$('.hideWmufsNotice').hide('fast');
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -0,0 +1,511 @@
|
|||
<?php
|
||||
class WMUFS_File_Chunk{
|
||||
|
||||
|
||||
private static $instance = null;
|
||||
|
||||
|
||||
protected $max_upload_size;
|
||||
|
||||
/**
|
||||
* Make instance of the admin class.
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! self::$instance)
|
||||
self::$instance = new self();
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load all action and filters.
|
||||
* @return void
|
||||
*/
|
||||
public function init(){
|
||||
$this->max_upload_size = wp_max_upload_size();
|
||||
add_action( 'wp_ajax_wmufs_chunker', array( $this, 'wmufs_ajax_chunk_receiver' ) );
|
||||
add_filter( 'plupload_init', array( $this, 'wmufs_filter_plupload_settings' ) );
|
||||
add_filter( 'plupload_default_settings', array( $this, 'wmufs_filter_plupload_settings' ) );
|
||||
add_filter( 'plupload_default_params', array( $this, 'wmufs_filter_plupload_params' ) );
|
||||
add_filter( 'upload_post_params', array( $this, 'wmufs_filter_plupload_params' ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $plupload_params
|
||||
* @return mixed
|
||||
*/
|
||||
public function wmufs_filter_plupload_params( $plupload_params ) {
|
||||
|
||||
$plupload_params['action'] = 'wmufs_chunker';
|
||||
|
||||
return $plupload_params;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AJAX chunk receiver.
|
||||
*
|
||||
* Ajax callback for plupload to handle chunked uploads.
|
||||
* Based on code by Davit Barbakadze
|
||||
* https://gist.github.com/jayarjo/5846636
|
||||
*
|
||||
* Mirrors /wp-admin/async-upload.php
|
||||
*
|
||||
*/
|
||||
public function wmufs_ajax_chunk_receiver() {
|
||||
|
||||
/** Check that we have an upload and there are no errors. */
|
||||
if ( empty( $_FILES ) || $_FILES['async-upload']['error'] ) {
|
||||
/** Failed to move uploaded file. */
|
||||
die();
|
||||
}
|
||||
|
||||
/** Authenticate user. */
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'upload_files' ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
|
||||
}
|
||||
check_admin_referer( 'media-form' );
|
||||
|
||||
/** Check and get file chunks. */
|
||||
$chunk = isset( $_REQUEST['chunk'] ) ? intval( $_REQUEST['chunk'] ) : 0; //zero index
|
||||
$current_part = $chunk + 1;
|
||||
$chunks = isset( $_REQUEST['chunks'] ) ? intval( $_REQUEST['chunks'] ) : 0;
|
||||
|
||||
/** Get file name and path + name. */
|
||||
$fileName = isset( $_REQUEST['name'] ) ? $_REQUEST['name'] : $_FILES['async-upload']['name'];
|
||||
|
||||
|
||||
$wmufs_temp_dir = apply_filters( 'wmufs_temp_dir', WP_CONTENT_DIR . '/wmufs-temp' );
|
||||
|
||||
//only run on first chunk
|
||||
if ( $chunk === 0 ) {
|
||||
// Create temp directory if it doesn't exist
|
||||
if ( ! @is_dir( $wmufs_temp_dir ) ) {
|
||||
wp_mkdir_p( $wmufs_temp_dir );
|
||||
}
|
||||
|
||||
// Protect temp directory from browsing.
|
||||
$index_pathname = $wmufs_temp_dir . '/index.php';
|
||||
if ( ! file_exists( $index_pathname ) ) {
|
||||
$file = fopen( $index_pathname, 'w' );
|
||||
if ( false !== $file ) {
|
||||
fwrite( $file, "<?php\n// Silence is golden.\n" );
|
||||
fclose( $file );
|
||||
}
|
||||
}
|
||||
|
||||
//scan temp dir for files older than 24 hours and delete them.
|
||||
$files = glob( $wmufs_temp_dir . '/*.part' );
|
||||
if ( is_array( $files ) ) {
|
||||
foreach ( $files as $file ) {
|
||||
if ( @filemtime( $file ) < time() - DAY_IN_SECONDS ) {
|
||||
@unlink( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$filePath = sprintf( '%s/%d-%s.part', $wmufs_temp_dir, get_current_blog_id(), sha1( $fileName ) );
|
||||
|
||||
//debugging
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||
$size = file_exists( $filePath ) ? size_format( filesize( $filePath ), 3 ) : '0 B';
|
||||
error_log( "WMUFS: Processing \"$fileName\" part $current_part of $chunks as $filePath. $size processed so far." );
|
||||
}
|
||||
|
||||
$wmufs_max_upload_size = $this->get_upload_limit();
|
||||
if ( file_exists( $filePath ) && filesize( $filePath ) + filesize( $_FILES['async-upload']['tmp_name'] ) > $wmufs_max_upload_size ) {
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||
error_log( "WMUFS: File size limit exceeded." );
|
||||
}
|
||||
|
||||
if ( ! $chunks || $chunk == $chunks - 1 ) {
|
||||
@unlink( $filePath );
|
||||
|
||||
if ( ! isset( $_REQUEST['short'] ) || ! isset( $_REQUEST['type'] ) ) {
|
||||
echo wp_json_encode( array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( 'The file size has exceeded the maximum file size setting.', 'tuxedo-big-file-uploads' ),
|
||||
'filename' => $fileName,
|
||||
),
|
||||
) );
|
||||
wp_die();
|
||||
} else {
|
||||
status_header( 202 );
|
||||
printf(
|
||||
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
|
||||
sprintf(
|
||||
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
|
||||
__( 'Dismiss' )
|
||||
),
|
||||
sprintf(
|
||||
/* translators: %s: Name of the file that failed to upload. */
|
||||
__( '“%s” has failed to upload.' ),
|
||||
esc_html( $fileName )
|
||||
),
|
||||
__( 'The file size has exceeded the maximum file size setting.', 'tuxedo-big-file-uploads' )
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/** Open temp file. */
|
||||
if ( $chunk == 0 ) {
|
||||
$out = @fopen( $filePath, 'wb');
|
||||
} elseif ( is_writable( $filePath ) ) { //
|
||||
$out = @fopen( $filePath, 'ab' );
|
||||
} else {
|
||||
$out = false;
|
||||
}
|
||||
|
||||
if ( $out ) {
|
||||
|
||||
/** Read binary input stream and append it to temp file. */
|
||||
$in = @fopen( $_FILES['async-upload']['tmp_name'], 'rb' );
|
||||
|
||||
if ( $in ) {
|
||||
while ( $buff = fread( $in, 4096 ) ) {
|
||||
fwrite( $out, $buff );
|
||||
}
|
||||
} else {
|
||||
/** Failed to open input stream. */
|
||||
/** Attempt to clean up unfinished output. */
|
||||
@fclose( $out );
|
||||
@unlink( $filePath );
|
||||
error_log( "WMUFS: Error reading uploaded part $current_part of $chunks." );
|
||||
|
||||
if ( ! isset( $_REQUEST['short'] ) || ! isset( $_REQUEST['type'] ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => sprintf( __( 'There was an error reading uploaded part %1$d of %2$d.', 'tuxedo-big-file-uploads' ), $current_part, $chunks ),
|
||||
'filename' => esc_html( $fileName ),
|
||||
),
|
||||
)
|
||||
);
|
||||
wp_die();
|
||||
} else {
|
||||
status_header( 202 );
|
||||
printf(
|
||||
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
|
||||
sprintf(
|
||||
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
|
||||
__( 'Dismiss' )
|
||||
),
|
||||
sprintf(
|
||||
/* translators: %s: Name of the file that failed to upload. */
|
||||
__( '“%s” has failed to upload.' ),
|
||||
esc_html( $fileName )
|
||||
),
|
||||
sprintf( __( 'There was an error reading uploaded part %1$d of %2$d.', 'tuxedo-big-file-uploads' ), $current_part, $chunks )
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@fclose( $in );
|
||||
@fclose( $out );
|
||||
@unlink( $_FILES['async-upload']['tmp_name'] );
|
||||
} else {
|
||||
/** Failed to open output stream. */
|
||||
error_log( "BFU: Failed to open output stream $filePath to write part $current_part of $chunks." );
|
||||
|
||||
if ( ! isset( $_REQUEST['short'] ) || ! isset( $_REQUEST['type'] ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => sprintf( __( 'There was an error opening the temp file %s for writing. Available temp directory space may be exceeded or the temp file was cleaned up before the upload completed.', 'tuxedo-big-file-uploads' ), esc_html( $filePath ) ),
|
||||
'filename' => esc_html( $fileName ),
|
||||
),
|
||||
)
|
||||
);
|
||||
wp_die();
|
||||
} else {
|
||||
status_header( 202 );
|
||||
printf(
|
||||
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
|
||||
sprintf(
|
||||
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
|
||||
__( 'Dismiss' )
|
||||
),
|
||||
sprintf(
|
||||
/* translators: %s: Name of the file that failed to upload. */
|
||||
__( '“%s” has failed to upload.' ),
|
||||
esc_html( $fileName )
|
||||
),
|
||||
sprintf( __( 'There was an error opening the temp file %s for writing. Available temp directory space may be exceeded or the temp file was cleaned up before the upload completed.', 'tuxedo-big-file-uploads' ), esc_html( $filePath ) )
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if file has finished uploading all parts. */
|
||||
if ( ! $chunks || $chunk == $chunks - 1 ) {
|
||||
|
||||
//debugging
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||
$size = file_exists( $filePath ) ? size_format( filesize( $filePath ), 3 ) : '0 B';
|
||||
error_log( "BFU: Completing \"$fileName\" upload with a $size final size." );
|
||||
}
|
||||
|
||||
/** Recreate upload in $_FILES global and pass off to WordPress. */
|
||||
$_FILES['async-upload']['tmp_name'] = $filePath;
|
||||
$_FILES['async-upload']['name'] = $fileName;
|
||||
$_FILES['async-upload']['size'] = filesize( $_FILES['async-upload']['tmp_name'] );
|
||||
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] );
|
||||
$_FILES['async-upload']['type'] = $wp_filetype['type'];
|
||||
|
||||
header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
|
||||
|
||||
if ( ! isset( $_REQUEST['short'] ) || ! isset( $_REQUEST['type'] ) ) { //ajax like media uploader in modal
|
||||
|
||||
// Compatibility with Easy Digital Downloads plugin.
|
||||
if ( function_exists( 'edd_change_downloads_upload_dir' ) ) {
|
||||
global $pagenow;
|
||||
$pagenow = 'async-upload.php';
|
||||
edd_change_downloads_upload_dir();
|
||||
}
|
||||
|
||||
send_nosniff_header();
|
||||
nocache_headers();
|
||||
|
||||
$this->wp_ajax_upload_attachment();
|
||||
die( '0' );
|
||||
|
||||
} else { //non-ajax like add new media page
|
||||
$post_id = 0;
|
||||
if ( isset( $_REQUEST['post_id'] ) ) {
|
||||
$post_id = absint( $_REQUEST['post_id'] );
|
||||
if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
|
||||
$post_id = 0;
|
||||
}
|
||||
|
||||
$id = media_handle_upload( 'async-upload', $post_id, [], [
|
||||
'action' => 'wp_handle_sideload',
|
||||
'test_form' => false,
|
||||
] );
|
||||
if ( is_wp_error( $id ) ) {
|
||||
printf(
|
||||
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
|
||||
sprintf(
|
||||
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
|
||||
__( 'Dismiss' )
|
||||
),
|
||||
sprintf(
|
||||
/* translators: %s: Name of the file that failed to upload. */
|
||||
__( '“%s” has failed to upload.' ),
|
||||
esc_html( $_FILES['async-upload']['name'] )
|
||||
),
|
||||
esc_html( $id->get_error_message() )
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $_REQUEST['short'] ) {
|
||||
// Short form response - attachment ID only.
|
||||
echo $id;
|
||||
} else {
|
||||
// Long form response - big chunk of HTML.
|
||||
$type = $_REQUEST['type'];
|
||||
|
||||
/**
|
||||
* Filters the returned ID of an uploaded attachment.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$type`, refers to the attachment type.
|
||||
*
|
||||
* Possible hook names include:
|
||||
*
|
||||
* - `async_upload_audio`
|
||||
* - `async_upload_file`
|
||||
* - `async_upload_image`
|
||||
* - `async_upload_video`
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @param int $id Uploaded attachment ID.
|
||||
*/
|
||||
echo apply_filters( "async_upload_{$type}", $id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the maximum upload limit in bytes for the current user.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function get_upload_limit() {
|
||||
$max_size = (int) get_option('max_file_size');
|
||||
if ( ! $max_size ) {
|
||||
$max_size = wp_max_upload_size();
|
||||
}
|
||||
return $max_size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copied from wp-admin/includes/ajax-actions.php because we have to override the args for
|
||||
* the media_handle_upload function. As of WP 6.0.1
|
||||
*/
|
||||
function wp_ajax_upload_attachment() {
|
||||
check_ajax_referer( 'media-form' );
|
||||
/*
|
||||
* This function does not use wp_send_json_success() / wp_send_json_error()
|
||||
* as the html4 Plupload handler requires a text/html content-type for older IE.
|
||||
* See https://core.trac.wordpress.org/ticket/31037
|
||||
*/
|
||||
|
||||
if ( ! current_user_can( 'upload_files' ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( 'Sorry, you are not allowed to upload files.' ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['post_id'] ) ) {
|
||||
$post_id = $_REQUEST['post_id'];
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( 'Sorry, you are not allowed to attach files to this post.' ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
} else {
|
||||
$post_id = null;
|
||||
}
|
||||
|
||||
$post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array();
|
||||
|
||||
if ( is_wp_error( $post_data ) ) {
|
||||
wp_die( $post_data->get_error_message() );
|
||||
}
|
||||
|
||||
// If the context is custom header or background, make sure the uploaded file is an image.
|
||||
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) {
|
||||
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] );
|
||||
|
||||
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
}
|
||||
|
||||
//this is the modded function from wp-admin/includes/ajax-actions.php
|
||||
$attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data, [
|
||||
'action' => 'wp_handle_sideload',
|
||||
'test_form' => false,
|
||||
] );
|
||||
|
||||
if ( is_wp_error( $attachment_id ) ) {
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => $attachment_id->get_error_message(),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
|
||||
if ( 'custom-background' === $post_data['context'] ) {
|
||||
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
|
||||
}
|
||||
|
||||
if ( 'custom-header' === $post_data['context'] ) {
|
||||
update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
|
||||
}
|
||||
}
|
||||
|
||||
$attachment = wp_prepare_attachment_for_js( $attachment_id );
|
||||
if ( ! $attachment ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
echo wp_json_encode(
|
||||
array(
|
||||
'success' => true,
|
||||
'data' => $attachment,
|
||||
)
|
||||
);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter plupload settings.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public function wmufs_filter_plupload_settings( $plupload_settings ) {
|
||||
|
||||
$max_chunk = ( MB_IN_BYTES * 20 ); //20MB max chunk size (to avoid timeouts)
|
||||
if ( $max_chunk > $this->max_upload_size ) {
|
||||
$default_chunk = ( $this->max_upload_size * 0.8 ) / KB_IN_BYTES;
|
||||
} else {
|
||||
$default_chunk = $max_chunk / KB_IN_BYTES;
|
||||
}
|
||||
//define( 'WMUFS_FILE_UPLOADS_CHUNK_SIZE_KB', 512 );//TODO remove
|
||||
if ( ! defined( 'WMUFS_FILE_UPLOADS_CHUNK_SIZE_KB' ) ) {
|
||||
define( 'WMUFS_FILE_UPLOADS_CHUNK_SIZE_KB', $default_chunk );
|
||||
}
|
||||
|
||||
if ( ! defined( 'WMUFS_FILE_UPLOADS_RETRIES' ) ) {
|
||||
define( 'WMUFS_FILE_UPLOADS_RETRIES', 1 );
|
||||
}
|
||||
|
||||
$plupload_settings['url'] = admin_url( 'admin-ajax.php' );
|
||||
$plupload_settings['filters']['max_file_size'] = $this->get_upload_limit( '' ) . 'b';
|
||||
$plupload_settings['chunk_size'] = WMUFS_FILE_UPLOADS_CHUNK_SIZE_KB . 'kb';
|
||||
$plupload_settings['max_retries'] = WMUFS_FILE_UPLOADS_RETRIES;
|
||||
|
||||
return $plupload_settings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WMUFS_File_Chunk::get_instance()->init();
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
|
||||
<?php
|
||||
// Read plugin header data.
|
||||
$wmufs_plugin_data = get_plugin_data( WMUFS_PLUGIN_URL );
|
||||
|
||||
/**
|
||||
* WordPress check upload file size.
|
||||
* @return string
|
||||
*/
|
||||
function wmufs_wp_minimum_upload_file_size() {
|
||||
$wp_size = wp_max_upload_size();
|
||||
if ( ! $wp_size ) {
|
||||
$wp_size = 'unknown';
|
||||
return $wp_size;
|
||||
}
|
||||
return esc_html( size_format( $wp_size ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimum upload size set by hosting provider.
|
||||
* @return string
|
||||
*/
|
||||
function wmufs_wp_upload_size_by_from_hosting() {
|
||||
$ini_size = ini_get( 'upload_max_filesize' );
|
||||
if ( ! $ini_size ) {
|
||||
$ini_size = 'unknown';
|
||||
} elseif ( is_numeric( $ini_size ) ) {
|
||||
$ini_size .= ' bytes';
|
||||
} else {
|
||||
$ini_size .= 'B';
|
||||
}
|
||||
|
||||
return $ini_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $from
|
||||
* @return int|null
|
||||
*/
|
||||
function convertToBytes( string $from ): ?int {
|
||||
$units = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB' ];
|
||||
$number = substr( $from, 0, - 2 );
|
||||
$suffix = strtoupper( substr( $from, - 2 ) );
|
||||
|
||||
//B or no suffix
|
||||
if ( is_numeric( substr( $suffix, 0, 1 ) ) ) {
|
||||
return preg_replace( '/[^\d]/', '', $from );
|
||||
}
|
||||
|
||||
$exponent = array_flip( $units )[ $suffix ] ?? null;
|
||||
if ( $exponent === null ) { //phpcs:ignore
|
||||
return null;
|
||||
}
|
||||
|
||||
return (int) $number * ( 1024 ** $exponent );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check zipArchive extension enable from hosting.
|
||||
* @return bool
|
||||
*/
|
||||
function wmufs_check_zip_extension(): bool
|
||||
{
|
||||
$extension = '';
|
||||
$extension = in_array( 'zip', get_loaded_extensions() );
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check MBstring extension enable from hosting.
|
||||
* @return bool
|
||||
*/
|
||||
function wmufs_check_mbstring_extension(): bool
|
||||
{
|
||||
$extension = '';
|
||||
$extension = in_array( 'mbstring', get_loaded_extensions() );
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check dom extension
|
||||
* @return bool
|
||||
*/
|
||||
function wmufs_check_dom_extension(): bool
|
||||
{
|
||||
$extension = '';
|
||||
$extension = in_array( 'dom', get_loaded_extensions() );
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
// Minimum PHP version.
|
||||
$wmufs_current_php_version = phpversion();
|
||||
$wmufs_minimum_php_version = $wmufs_plugin_data['RequiresPHP'] ? $wmufs_plugin_data['RequiresPHP'] : '5.6';
|
||||
$wmufs_php_version_status = $wmufs_current_php_version < $wmufs_minimum_php_version ? 0 : 1;
|
||||
|
||||
// Minimum WordPress Version.
|
||||
$wmufs_wp_current_version = get_bloginfo( 'version' );
|
||||
$wmufs_minimum_wp_version = $wmufs_plugin_data['RequiresWP'] ? $wmufs_plugin_data['RequiresWP'] : '4.4';
|
||||
$wmufs_wp_version_status = $wmufs_wp_current_version < $wmufs_minimum_wp_version ? 0 : 1;
|
||||
|
||||
// Minimum Woocommerce Version.
|
||||
if ( class_exists('woocommerce') ) {
|
||||
$wmufs_wc_current_version = WC_VERSION;
|
||||
}else {
|
||||
$wmufs_wc_current_version = 'Not Active Woocommerce';
|
||||
}
|
||||
|
||||
$wmufs_minimum_wc_version = isset( $wmufs_plugin_data['WC requires at least'] ) ? $wmufs_plugin_data['WC requires at least'] : '3.2';
|
||||
$wmufs_wc_status = $wmufs_wc_current_version < $wmufs_minimum_wc_version ? 0 : 1;
|
||||
|
||||
// WordPress minimum upload size .
|
||||
$wmufs_wp_minimum_upload_file_size = '40MB';
|
||||
|
||||
// Minimum WordPress upload size..
|
||||
$wmufs_wp_upload_size_status = convertToBytes( wmufs_wp_minimum_upload_file_size() ) < convertToBytes( $wmufs_wp_minimum_upload_file_size ) ? 0 : 1;
|
||||
|
||||
// Minimum upload file size from hosting provider.
|
||||
$wmufs_wp_upload_size_status_from_hosting = convertToBytes( wmufs_wp_upload_size_by_from_hosting() ) < convertToBytes( $wmufs_wp_minimum_upload_file_size ) ? 0 : 1;
|
||||
|
||||
// PHP Limit Time
|
||||
$wmufs_php_minimum_limit_time = '120';
|
||||
$wmufs_php_current_limit_time = ini_get('max_execution_time');
|
||||
$wmufs_php_limit_time_status = $wmufs_php_minimum_limit_time <= $wmufs_php_current_limit_time ? 1 : 0;
|
||||
|
||||
// Check if zipArchie extension is enable in hosting.
|
||||
$wmufs_check_zip_extension_status = wmufs_check_zip_extension() != '1' ? 0 : '1';
|
||||
|
||||
// Check MBstring extension from hsoting.
|
||||
$wmufs_check_mbstring_extension_status = wmufs_check_mbstring_extension() != '1' ? 0 : '1';
|
||||
|
||||
// Check dom extension.
|
||||
$wmufs_check_dom_extension_status = wmufs_check_dom_extension() != '1' ? 0 : '1';
|
||||
|
||||
$system_status = array(
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'PHP Version', 'wp-maximum-upload-file-size' ),
|
||||
'version' => esc_html__('Current Version : ', 'wp-maximum-upload-file-size') . $wmufs_current_php_version,
|
||||
'status' => $wmufs_php_version_status,
|
||||
'success_message' => esc_html__( '- ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend Version : ', 'wp-maximum-upload-file-size' ) . $wmufs_minimum_php_version,//phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'WordPress Version', 'wp-maximum-upload-file-size' ),
|
||||
'version' => $wmufs_wp_current_version,
|
||||
'status' => $wmufs_wp_version_status,
|
||||
'success_message' => esc_html__( '- ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend : ', 'wp-maximum-upload-file-size') . $wmufs_minimum_wp_version , //phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'Woocommerce Version', 'wp-maximum-upload-file-size' ),
|
||||
'version' => $wmufs_wc_current_version,
|
||||
'status' => $wmufs_wc_status,
|
||||
'success_message' => esc_html__( '- ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend : ', 'wp-maximum-upload-file-size') . $wmufs_minimum_wc_version, //phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'Maximum Upload Limit set by WordPress', 'wp-maximum-upload-file-size' ),
|
||||
'version' => wmufs_wp_minimum_upload_file_size(),
|
||||
'status' => $wmufs_wp_upload_size_status,
|
||||
'success_message' => esc_html__( '- ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend : ', 'wp-maximum-upload-file-size' ) . $wmufs_wp_minimum_upload_file_size, //phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'Maximum Upload Limit Set By Hosting Provider', 'wp-maximum-upload-file-size' ),
|
||||
'version' => wmufs_wp_upload_size_by_from_hosting(),
|
||||
'status' => $wmufs_wp_upload_size_status_from_hosting,
|
||||
'success_message' => esc_html__( '- ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend : ', 'wp-maximum-upload-file-size' ) . $wmufs_wp_minimum_upload_file_size, //phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'PHP Limit Time', 'wp-maximum-upload-file-size' ),
|
||||
'version' => esc_html__('Current Limit Time: ', 'wp-maximum-upload-file-size') . $wmufs_php_current_limit_time,
|
||||
'status' => $wmufs_php_limit_time_status,
|
||||
'success_message' => esc_html__( '- Ok', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Recommend : ', 'wp-maximum-upload-file-size' ) . $wmufs_php_minimum_limit_time, //phpcs:ignore
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'zipArchive Extension', 'wp-maximum-upload-file-size' ),
|
||||
'version' => '',
|
||||
'status' => $wmufs_check_zip_extension_status,
|
||||
'success_message' => esc_html__( 'Enable', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Please enable zip extension from hosting.', 'wp-maximum-upload-file-size' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'MBString extension', 'wp-maximum-upload-file-size' ),
|
||||
'version' => '',
|
||||
'status' => $wmufs_check_mbstring_extension_status,
|
||||
'success_message' => esc_html__( 'Enable', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Please enable MBString extension from hosting.', 'wp-maximum-upload-file-size' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => esc_html__( 'Dom extension', 'wp-maximum-upload-file-size' ),
|
||||
'version' => '',
|
||||
'status' => $wmufs_check_dom_extension_status,
|
||||
'success_message' => esc_html__( 'Enable', 'wp-maximum-upload-file-size' ),
|
||||
'error_message' => esc_html__( 'Dom extension is not enable from hosting.', 'wp-maximum-upload-file-size' ),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
class Wmufs_I18n
|
||||
{
|
||||
/**
|
||||
* Intialize text domain.
|
||||
*
|
||||
* @since 1.0.7
|
||||
*/
|
||||
function __construct(){
|
||||
add_action( 'plugins_loaded', [ $this, 'load_plugin_textdomain' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the plugin text domain for translation.
|
||||
*
|
||||
* @since 1.0.7
|
||||
*/
|
||||
public function load_plugin_textdomain() {
|
||||
load_plugin_textdomain(
|
||||
'wp-maximum-upload-file-size',
|
||||
false,
|
||||
dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
new Wmufs_I18n();
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class Class_Wmufs_Loader
|
||||
*/
|
||||
class Class_Wmufs_Loader{
|
||||
// Autoload dependency.
|
||||
public function __construct(){
|
||||
$this->load_dependency();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all Plugin FIle.
|
||||
*/
|
||||
public function load_dependency(){
|
||||
|
||||
include_once(WMUFS_PLUGIN_PATH. 'inc/class-wmufs-i18n.php');
|
||||
include_once(WMUFS_PLUGIN_PATH. 'inc/codepopular-plugin-suggest.php');
|
||||
include_once(WMUFS_PLUGIN_PATH. 'inc/hooks.php');
|
||||
include_once(WMUFS_PLUGIN_PATH. 'inc/codepopular-promotion.php');
|
||||
include_once(WMUFS_PLUGIN_PATH. 'admin/class-wmufs-admin.php');
|
||||
include_once(WMUFS_PLUGIN_PATH. 'inc/class-wmufs-chunk-files.php');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize load class .
|
||||
*/
|
||||
function wmufs_run(){
|
||||
if ( class_exists( 'Class_Wmufs_Loader' ) ) {
|
||||
new Class_Wmufs_Loader();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class CodePopular_Plugin_Suggest
|
||||
*/
|
||||
class CodePopular_Plugin_Suggest{
|
||||
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* @return CodePopular_Plugin_Suggest|null
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! self::$instance )
|
||||
self::$instance = new self();
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize global hooks.
|
||||
*/
|
||||
public function init(){
|
||||
add_filter('install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ));
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function for adding plugins to fav list.
|
||||
* @param $args
|
||||
* @return mixed
|
||||
*/
|
||||
static function featured_plugins_tab( $args ) {
|
||||
add_filter('plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3);
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* add our plugins to recommended list
|
||||
* @param $res
|
||||
* @param $action
|
||||
* @param $args
|
||||
* @return mixed
|
||||
*/
|
||||
static function plugins_api_result( $res, $action, $args ) {
|
||||
remove_filter('plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3);
|
||||
$res = self::add_plugin_favs('unlimited-theme-addons', $res);
|
||||
return $res;
|
||||
} // plugins_api_result
|
||||
|
||||
|
||||
/**
|
||||
* add single plugin to list of favs
|
||||
* @param $plugin_slug
|
||||
* @param $res
|
||||
* @return mixed
|
||||
*/
|
||||
static function add_plugin_favs( $plugin_slug, $res ) {
|
||||
if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
|
||||
foreach ( $res->plugins as $plugin ) {
|
||||
if ( is_object($plugin) && ! empty($plugin->slug) && $plugin->slug == $plugin_slug ) {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $plugin_info = get_transient('wf-plugin-info-' . $plugin_slug) ) {
|
||||
array_unshift($res->plugins, $plugin_info);
|
||||
} else {
|
||||
$plugin_info = plugins_api('plugin_information', array(
|
||||
'slug' => $plugin_slug,
|
||||
'is_ssl' => is_ssl(),
|
||||
'fields' => array(
|
||||
'banners' => true,
|
||||
'reviews' => true,
|
||||
'downloaded' => true,
|
||||
'active_installs' => true,
|
||||
'icons' => true,
|
||||
'short_description' => true,
|
||||
),
|
||||
));
|
||||
if ( ! is_wp_error($plugin_info) ) {
|
||||
$res->plugins[] = $plugin_info;
|
||||
set_transient('wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CodePopular_Plugin_Suggest::get_instance()->init();
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
if ( ! function_exists( 'codepopular_add_dashboard_widgets' ) ) {
|
||||
/**
|
||||
* Add a widget to the dashboard.
|
||||
*
|
||||
* This function is hooked into the 'wp_dashboard_setup' action below.
|
||||
*/
|
||||
function codepopular_add_dashboard_widgets() {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
add_meta_box( 'codepopular_latest_news_dashboard_widget', __( 'CodePopular Latest News from Blog', 'wp-maximum-upload-file-size' ), 'codepopular_dashboard_widget_render', 'dashboard', 'side', 'high' );
|
||||
|
||||
}
|
||||
add_action( 'wp_dashboard_setup', 'codepopular_add_dashboard_widgets', 1 );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'codepopular_dashboard_widget_render' ) ) {
|
||||
/**
|
||||
* Function to get dashboard widget data.
|
||||
*/
|
||||
function codepopular_dashboard_widget_render() {
|
||||
|
||||
// Enter the name of your blog here followed by /wp-json/wp/v2/posts and add filters like this one that limits the result to 2 posts.
|
||||
$response = wp_remote_get( 'https://codepopular.com/wp-json/wp/v2/posts?per_page=5&categories=19' );
|
||||
|
||||
// Exit if error.
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the body.
|
||||
$posts = json_decode( wp_remote_retrieve_body( $response ) );
|
||||
|
||||
// Exit if nothing is returned.
|
||||
if ( empty( $posts ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// If there are posts.
|
||||
if ( ! empty( $posts ) ) {
|
||||
// For each post.
|
||||
foreach ( $posts as $post ) {
|
||||
$fordate = gmdate( 'M j, Y', strtotime( $post->modified ) ); ?>
|
||||
<p class="codepopular-blog-feeds"> <a style="text-decoration: none;font-weight: bold" href="<?php echo esc_url( $post->link ); ?>?utm_source=wp-dashboard-feed" target=_balnk><?php echo esc_html( $post->title->rendered ); ?></a> - <?php echo esc_html( $fordate ); ?></p>
|
||||
<span><?php echo wp_trim_words( $post->content->rendered, 25, '...' ); //phpcs:ignore ?></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<hr>
|
||||
<p> <a style="text-decoration: none;font-weight: bold" href="<?php echo esc_url( 'https://codepopular.com/blog/' ); ?>?utm_source=wp-dashboard-feed" target=_balnk><?php echo esc_html__( 'Get more WordPress tips & news on our blog...', 'wp-maximum-upload-file-size' ); ?></a></p>
|
||||
<a style="text-decoration: none; font-weight: bold; color: #fff; border: 1px solid #ccc; padding: 6px 10px; border-radius: 4px; background: #39b54a; " href="<?php echo esc_url_raw('https://codepopular.com/contact');?>?utm_source=wp-dashboard-feed" target="_balnk"><?php echo esc_html('Talk with WordPress Expert');?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( time() > get_option('wmufs_notice_disable_time') ) {
|
||||
add_action(
|
||||
'load-index.php',
|
||||
function () {
|
||||
add_action('admin_notices', 'codepopular_wmufs_promotions');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ( ! function_exists('codepopular_wmufs_promotions') ) {
|
||||
|
||||
/**
|
||||
* Function to get dashboard widget data.
|
||||
*/
|
||||
function codepopular_wmufs_promotions() { ?>
|
||||
<div class="notice notice-success is-dismissible hideWmufsNotice">
|
||||
<div class="codepopular_notice">
|
||||
<h4>Thank you for using our Plugin to Increase Upload Size!</h4>
|
||||
<p>We are glad that you are using our plugin and we hope you are satisfied with it. If you want, you can support us in the development of the plugin by buying us a coffee and adding a plugin review. This is very important and gives us the opportunity to create even better tools for you. Thank you to everyone. </p>
|
||||
<div class="codepopular__buttons">
|
||||
<a href="https://ko-fi.com/codepopular" target="_blank" class="codepopular__button btn__green dashicons-heart">
|
||||
Buy me a coffee </a>
|
||||
<a href="https://wordpress.org/support/plugin/wp-maximum-upload-file-size/reviews/#new-post" target="_blank" class="codepopular__button btn__yellow dashicons-star-filled">
|
||||
Add a Plugin review </a>
|
||||
|
||||
<a href="https://codepopular.com/contact?utm_source=wp-dashboard-feed" target="_blank" class="codepopular__button btn__dark dashicons-email">Contact Us</a>
|
||||
<button type="button" id="hideWmufsNotice" class="codepopular__button btn__blue dashicons-no">Hide for 6 month</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
|
||||
add_action('wp_ajax_wmufs_admin_notice_ajax_object_save', 'wmufs_admin_notice_ajax_object_callback');
|
||||
|
||||
/**
|
||||
* Save option after clicking hide button in WP dashboard.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wmufs_admin_notice_ajax_object_callback() {
|
||||
|
||||
$data = isset($_POST['data']) ? sanitize_text_field(wp_unslash($_POST['data'])) : array();
|
||||
|
||||
if ( $data ) {
|
||||
|
||||
// Check valid request form user.
|
||||
check_ajax_referer('wmufs_notice_status');
|
||||
|
||||
update_option('wmufs_notice_disable_time', strtotime("+6 Months"));
|
||||
|
||||
$response['message'] = 'success';
|
||||
wp_send_json_success($response);
|
||||
}
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
=== Increase Maximum Upload File Size | Increase Execution Time ===
|
||||
Contributors: codepopular, shamimtpi
|
||||
Tags: max upload file size, increase upload limit, increase file size limit, upload limit, post max size, upload file size, upload_max_filesize, Increase Maximum Execution Time
|
||||
Donate link: https://ko-fi.com/codepopular
|
||||
Requires at least: 3.0
|
||||
Requires PHP: 5.6
|
||||
Tested up to: 6.2
|
||||
Stable tag: 1.1.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Increase maximum upload file size limit to any value. Increase upload limit - upload large files.
|
||||
|
||||
|
||||
== Description==
|
||||
|
||||
### **Increase upload file size limit to any value with one click.**
|
||||
Plugin automatically detects upload limits set by WordPress and by the server / hosting provider, and displays them.
|
||||
|
||||
Access plugin's settings from the main WP admin menu.
|
||||
|
||||
You can easily increase maximum upload file size. And also you can increase WordPress maximum execution time. some time extended maximum execution time when upload any attachment. From now with this plugin you can simply avoid this problem.
|
||||
|
||||
### **Where to find Option to Increase Upload Limit.**
|
||||
Ok, After install the plugin then activate it. After activate the plugin go to your dashboard and go to media> Increase Upload Limit.
|
||||
|
||||
### **Increase Maximum Execution Time.**
|
||||
Some time WordPress user can't upload new file with media due to extended execution time. With this plugin you can increase the execution time to avoid these issue. You need to set the execution time in input filed to set your own execution time according to your need.
|
||||
|
||||
= Necessary Elementor Plugin for your store =
|
||||
|
||||
> * [Unlimited Theme Addons](https://wordpress.org/plugins/unlimited-theme-addons/)
|
||||
|
||||
|
||||
= Necessary WooCommerce Plugin for your store =
|
||||
|
||||
> * [Variation Price Display Range for WooCommerce](https://wordpress.org/plugins/variation-price-display/)
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
The usual, automatic way;
|
||||
|
||||
1. Open WordPress admin, go to Plugins, click Add New
|
||||
2. Enter "increase maximum upload" in search and hit Enter
|
||||
3. Plugin will show up as the first on the list, click "Install Now"
|
||||
4. Activate & open plugin's settings page located in the main admin menu
|
||||
|
||||
Or if needed, install manually;
|
||||
|
||||
1. Download the plugin.
|
||||
2. Unzip it and upload to _/wp-content/plugins/_
|
||||
3. Open WordPress admin - Plugins and click "Activate" next to the plugin
|
||||
4. Activate & open plugin's settings from Media>Increase Upload Size.
|
||||
|
||||
|
||||
== Screenshots ==
|
||||
1. Admin Panel for maximum upload file size.
|
||||
|
||||
|
||||
== Changelog ==
|
||||
|
||||
1.1.0
|
||||
-------------
|
||||
* WordPress latest version 6 compatibility checked.
|
||||
* Allow to Upload File Size 3GB,4GB,5GB.
|
||||
|
||||
1.0.9
|
||||
-------------
|
||||
* WordPress latest version 6 compatibility checked.
|
||||
|
||||
1.0.8
|
||||
-------------
|
||||
* Footer text issue fixed in admin page.
|
||||
* Header Notification remove from plugin setting page.
|
||||
|
||||
1.0.7
|
||||
-------------
|
||||
* WordPress latest versoin 5.9 compatibility added.
|
||||
* New value added in dropdown to upload maximum 2GB.
|
||||
|
||||
1.0.6
|
||||
-------------
|
||||
* WordPress latest versoin 5.8 compatibility added.
|
||||
|
||||
1.0.5
|
||||
-------------
|
||||
* Maximum Execution Time Increase Option Added.
|
||||
|
||||
1.0.4
|
||||
-------------
|
||||
* System Status Added.
|
||||
* WordPress latest version 5.7 compatibility checked.
|
||||
|
||||
1.0.3
|
||||
-------------
|
||||
* WordPress latest version 5.6 compatibility checked.
|
||||
|
||||
1.0.2
|
||||
-------------
|
||||
* WordPress latest version 5.5 compatibility checked.
|
||||
|
||||
1.0.1
|
||||
-------------
|
||||
* Test upto wordpress 5.4 latest version
|
||||
|
||||
1.0.0
|
||||
-------------
|
||||
* Not Changelog yet. will are still working for update version
|
||||
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Does this plugin work with all servers and hosting providers? =
|
||||
|
||||
Yes, it works with all servers. But, please know that server adjusted limits can't be changed from a WordPress plugin. If the server set limit is 16MB you can't increase it to 128MB via WordPress. You have to email your hosting provider and ask them to increase the limit. Install the plugin and it'll tell you what the limits are and what to do.
|
||||
|
||||
= Increase upload file size but still not working? =
|
||||
If minimum upload limit set by hosting provider then its will not work. Ask your hositng provider to increase upload size.
|
||||
|
||||
= Increase maximum excecution time but not working? =
|
||||
If minimum execution time set by hosting provider then its will not work. Ask your hositng provider to increase excecution time limit.
|
||||
19
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.editorconfig
vendored
Normal file
19
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.editorconfig
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{.jshintrc,*.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.txt,wp-config-sample.php}]
|
||||
end_of_line = lf
|
||||
38
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.github/workflows/wpcs.yml
vendored
Normal file
38
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.github/workflows/wpcs.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
on: pull_request
|
||||
|
||||
name: Inspections
|
||||
jobs:
|
||||
runPHPCSInspection:
|
||||
name: Run PHPCS inspection
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "7.3"
|
||||
coverage: none
|
||||
tools: composer, cs2pr
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Setup cache
|
||||
uses: pat-s/always-upload-cache@v1.1.4
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-suggest --no-progress
|
||||
|
||||
- id: changes
|
||||
run: |
|
||||
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
|
||||
FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename' | xargs)
|
||||
echo "::set-output name=files::$FILES"
|
||||
- name: Detect coding standard violations
|
||||
run: vendor/bin/phpcs ${{ steps.changes.outputs.files }} -q --report=checkstyle | cs2pr --graceful-warnings
|
||||
18
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.gitignore
vendored
Normal file
18
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/.idea
|
||||
/.vscode
|
||||
/nbproject
|
||||
/.vagrant
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
.DS_Store
|
||||
phpcs.xml
|
||||
phpcs-report.txt
|
||||
27
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.php-cs-fixer.dist.php
vendored
Normal file
27
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/.php-cs-fixer.dist.php
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/tareq1988/wp-php-cs-fixer/loader.php';
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude( 'node_modules' )
|
||||
->exclude( 'vendors' )
|
||||
->exclude( 'assets' )
|
||||
->exclude( 'languages' )
|
||||
->exclude( 'src' )
|
||||
->exclude( 'bin' )
|
||||
->in( __DIR__ )
|
||||
;
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
$config
|
||||
->registerCustomFixers( [
|
||||
new WeDevs\Fixer\SpaceInsideParenthesisFixer(),
|
||||
new WeDevs\Fixer\BlankLineAfterClassOpeningFixer(),
|
||||
] )
|
||||
->setRiskyAllowed( true )
|
||||
->setUsingCache( false )
|
||||
->setRules( WeDevs\Fixer\Fixer::rules() )
|
||||
->setFinder( $finder )
|
||||
;
|
||||
|
||||
return $config;
|
||||
45
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/composer.json
vendored
Normal file
45
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/composer.json
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "appsero/client",
|
||||
"description": "Appsero Client",
|
||||
"keywords": [
|
||||
"analytics",
|
||||
"wordpress",
|
||||
"plugin",
|
||||
"theme"
|
||||
],
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tareq Hasan",
|
||||
"email": "tareq@appsero.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Appsero\\": "src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"wp-coding-standards/wpcs": "dev-develop",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
|
||||
"phpcompatibility/phpcompatibility-wp": "dev-master",
|
||||
"phpunit/phpunit": "^8.5.31",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"tareq1988/wp-php-cs-fixer": "dev-master"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": [
|
||||
"vendor/bin/phpcs -p -s"
|
||||
],
|
||||
"phpcs:report": [
|
||||
"vendor/bin/phpcs --report-file='phpcs-report.txt'"
|
||||
],
|
||||
"phpcbf": [
|
||||
"vendor/bin/phpcbf -p"
|
||||
]
|
||||
}
|
||||
}
|
||||
1973
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/composer.lock
generated
vendored
Normal file
1973
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
112
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/phpcs.xml.dist
vendored
Normal file
112
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/phpcs.xml.dist
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name="WordPress Coding Standards for Appsero Client">
|
||||
<description>Generally-applicable sniffs for WordPress plugins.</description>
|
||||
|
||||
<!-- What to scan -->
|
||||
<file>src</file>
|
||||
|
||||
<!-- How to scan -->
|
||||
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
|
||||
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
|
||||
<arg value="sp"/> <!-- Show sniff and progress -->
|
||||
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php"/>
|
||||
<arg name="parallel" value="12"/><!-- Enables parallel processing when available for faster results. -->
|
||||
|
||||
<!-- Rules: Check PHP version compatibility -->
|
||||
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
|
||||
<config name="testVersion" value="5.6"/>
|
||||
|
||||
<!-- Rules: Check PHP version compatibility-->
|
||||
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
|
||||
<rule ref="PHPCompatibilityWP"/>
|
||||
|
||||
<!-- Rules: WordPress Coding Standards -->
|
||||
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
|
||||
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
|
||||
<config name="minimum_supported_wp_version" value="5.6"/>
|
||||
<rule ref="WordPress-Extra"/>
|
||||
<rule ref="WordPress">
|
||||
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
|
||||
</rule>
|
||||
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
|
||||
<properties>
|
||||
<property name="blank_line_check" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<rule ref="Squiz.Commenting">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.MultipleArguments">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Generic.Commenting.DocComment.SpacingBeforeTags">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.Files.FileName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.PHP.DevelopmentFunctions">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Generic.Commenting.DocComment.MissingShort">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.PHP.YodaConditions.NotYoda">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound">
|
||||
<type>warning</type>
|
||||
</rule>
|
||||
<rule ref="WordPress.DB.DirectDatabaseQuery.NoCaching">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">
|
||||
<type>error</type>
|
||||
</rule>
|
||||
<rule ref="Universal.Operators.StrictComparisons">
|
||||
<type>error</type>
|
||||
</rule>
|
||||
<rule ref="WordPress.DB.DirectDatabaseQuery.DirectQuery">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
|
||||
<type>warning</type>
|
||||
</rule>
|
||||
<rule ref="WordPress.Security.EscapeOutput.OutputNotEscaped">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.PHP.DevelopmentFunctions.error_log_var_export">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Universal.Arrays.DisallowShortArraySyntax">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="WordPress.Security.ValidatedSanitizedInput">
|
||||
<properties>
|
||||
<property name="customSanitizingFunctions" type="array">
|
||||
<element value="wc_clean"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Squiz.PHP.CommentedOutCode.Found">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
</ruleset>
|
||||
337
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/readme.md
vendored
Normal file
337
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/readme.md
vendored
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
# AppSero Client
|
||||
### Version 1.2.3
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Insights](#insights)
|
||||
- [Dynamic Usage](#dynamic-usage)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
You can install AppSero Client in two ways, via composer and manually.
|
||||
|
||||
### 1. Composer Installation
|
||||
|
||||
Add dependency in your project (theme/plugin):
|
||||
|
||||
```
|
||||
composer require appsero/client
|
||||
```
|
||||
|
||||
Now add `autoload.php` in your file if you haven't done already.
|
||||
|
||||
```php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
```
|
||||
|
||||
### 2. Manual Installation
|
||||
|
||||
Clone the repository in your project.
|
||||
|
||||
```bash
|
||||
cd /path/to/your/project/folder
|
||||
git clone https://github.com/AppSero/client.git appsero
|
||||
```
|
||||
|
||||
Now include the dependencies in your plugin/theme.
|
||||
|
||||
```php
|
||||
if( !class_exists('Appsero\Client') ) {
|
||||
require __DIR__ . '/appsero/src/Client.php';
|
||||
}
|
||||
```
|
||||
|
||||
## Insights
|
||||
|
||||
AppSero can be used in both themes and plugins.
|
||||
|
||||
The `Appsero\Client` class has *three* parameters:
|
||||
|
||||
```php
|
||||
$client = new Appsero\Client( $hash, $name, $file );
|
||||
```
|
||||
|
||||
- **hash** (*string*, *required*) - The unique identifier for a plugin or theme.
|
||||
- **name** (*string*, *required*) - The name of the plugin or theme.
|
||||
- **file** (*string*, *required*) - The **main file** path of the plugin. For theme, path to `functions.php`
|
||||
|
||||
### Usage Example
|
||||
|
||||
Please refer to the **installation** step before start using the class.
|
||||
|
||||
You can obtain the **hash** for your plugin for the [Appsero Dashboard](https://dashboard.appsero.com). The 3rd parameter **must** have to be the main file of the plugin.
|
||||
|
||||
```php
|
||||
/**
|
||||
* Initialize the tracker
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function appsero_init_tracker_appsero_test() {
|
||||
|
||||
if ( ! class_exists( 'Appsero\Client' ) ) {
|
||||
require_once __DIR__ . '/appsero/src/Client.php';
|
||||
}
|
||||
|
||||
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044891', 'Akismet', __FILE__ );
|
||||
|
||||
// Active insights
|
||||
$client->insights()->init();
|
||||
|
||||
// Active automatic updater
|
||||
$client->updater();
|
||||
|
||||
// Active license page and checker
|
||||
$args = array(
|
||||
'type' => 'options',
|
||||
'menu_title' => 'Akismet',
|
||||
'page_title' => 'Akismet License Settings',
|
||||
'menu_slug' => 'akismet_settings',
|
||||
);
|
||||
$client->license()->add_settings_page( $args );
|
||||
}
|
||||
|
||||
appsero_init_tracker_appsero_test();
|
||||
```
|
||||
|
||||
Make sure you call this function directly, never use any action hook to call this function.
|
||||
|
||||
> For plugins example code that needs to be used on your main plugin file.
|
||||
> For themes example code that needs to be used on your themes `functions.php` file.
|
||||
|
||||
## More Usage
|
||||
|
||||
```php
|
||||
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );
|
||||
```
|
||||
|
||||
#### 1. Hiding the notice
|
||||
|
||||
Sometimes you wouldn't want to show the notice, or want to customize the notice message. You can do that as well.
|
||||
|
||||
```php
|
||||
$client->insights()
|
||||
->hide_notice()
|
||||
->init();
|
||||
```
|
||||
|
||||
#### 2. Customizing the notice message
|
||||
|
||||
```php
|
||||
$client->insights()
|
||||
->notice( 'My Custom Notice Message' )
|
||||
->init();
|
||||
```
|
||||
|
||||
#### 3. Adding extra data
|
||||
|
||||
You can add extra metadata from your theme or plugin. In that case, the **keys** has to be whitelisted from the Appsero dashboard.
|
||||
`add_extra` method also support callback as parameter, If you need database call then callback is best for you.
|
||||
|
||||
```php
|
||||
$metadata = array(
|
||||
'key' => 'value',
|
||||
'another' => 'another_value'
|
||||
);
|
||||
$client->insights()
|
||||
->add_extra( $metadata )
|
||||
->init();
|
||||
```
|
||||
|
||||
Or if you want to run a query then pass callback, we will call the function when it is necessary.
|
||||
|
||||
```php
|
||||
$metadata = function () {
|
||||
$total_posts = wp_count_posts();
|
||||
|
||||
return array(
|
||||
'total_posts' => $total_posts,
|
||||
'another' => 'another_value'
|
||||
);
|
||||
};
|
||||
$client->insights()
|
||||
->add_extra( $metadata )
|
||||
->init();
|
||||
```
|
||||
|
||||
#### 4. Set textdomain
|
||||
|
||||
You may set your own textdomain to translate text.
|
||||
|
||||
```php
|
||||
$client->set_textdomain( 'your-project-textdomain' );
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
#### 5. Get Plugin Data
|
||||
If you want to get the most used plugins with your plugin or theme, send the active plugins' data to Appsero.
|
||||
```php
|
||||
$client->insights()
|
||||
->add_plugin_data()
|
||||
->init();
|
||||
```
|
||||
---
|
||||
|
||||
#### 6. Set Notice Message
|
||||
Change opt-in message text
|
||||
```php
|
||||
$client->insights()
|
||||
->notice("Your custom notice text")
|
||||
->init();
|
||||
```
|
||||
---
|
||||
|
||||
### Check License Validity
|
||||
|
||||
Check your plugin/theme is using with valid license or not, First create a global variable of `License` object then use it anywhere in your code.
|
||||
If you are using it outside of same function make sure you global the variable before using the condition.
|
||||
|
||||
```php
|
||||
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );
|
||||
|
||||
$args = array(
|
||||
'type' => 'submenu',
|
||||
'menu_title' => 'Twenty Twelve License',
|
||||
'page_title' => 'Twenty Twelve License Settings',
|
||||
'menu_slug' => 'twenty_twelve_settings',
|
||||
'parent_slug' => 'themes.php',
|
||||
);
|
||||
|
||||
global $twenty_twelve_license;
|
||||
$twenty_twelve_license = $client->license();
|
||||
$twenty_twelve_license->add_settings_page( $args );
|
||||
|
||||
if ( $twenty_twelve_license->is_valid() ) {
|
||||
// Your special code here
|
||||
}
|
||||
|
||||
Or check by pricing plan title
|
||||
|
||||
if ( $twenty_twelve_license->is_valid_by( 'title', 'Business' ) ) {
|
||||
// Your special code here
|
||||
}
|
||||
|
||||
// Set custom options key for storing the license info
|
||||
$twenty_twelve_license->set_option_key( 'my_plugin_license' );
|
||||
```
|
||||
|
||||
### Use your own license form
|
||||
|
||||
You can easily manage license by creating a form using HTTP request. Call `license_form_submit` method from License object.
|
||||
|
||||
```php
|
||||
global $twenty_twelve_license; // License object
|
||||
$twenty_twelve_license->license_form_submit([
|
||||
'_nonce' => wp_create_nonce( 'Twenty Twelve' ), // create a nonce with name
|
||||
'_action' => 'active', // active, deactive
|
||||
'license_key' => 'random-license-key', // no need to provide if you want to deactive
|
||||
]);
|
||||
if ( ! $twenty_twelve_license->error ) {
|
||||
// license activated
|
||||
$twenty_twelve_license->success; // Success message is here
|
||||
} else {
|
||||
$twenty_twelve_license->error; // has error message here
|
||||
}
|
||||
```
|
||||
|
||||
### Set Custom Deactivation Reasons
|
||||
|
||||
First set your deactivation reasons in Appsero dashboard then map them in your plugin/theme using filter hook.
|
||||
|
||||
- **id** is the deactivation slug
|
||||
- **text** is the deactivation title
|
||||
- **placeholder** will show on textarea field
|
||||
- **icon** You can set SVG icon with 23x23 size
|
||||
|
||||
```php
|
||||
add_filter( 'appsero_custom_deactivation_reasons', function () {
|
||||
return [
|
||||
[
|
||||
'id' => 'looks-buggy',
|
||||
'text' => 'Looks buggy',
|
||||
'placeholder' => 'Can you please tell which feature looks buggy?',
|
||||
'icon' => '',
|
||||
],
|
||||
[
|
||||
'id' => 'bad-ui',
|
||||
'text' => 'Bad UI',
|
||||
'placeholder' => 'Could you tell us a bit more?',
|
||||
'icon' => '',
|
||||
],
|
||||
];
|
||||
} );
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
# Extended Actions
|
||||
|
||||
#### 1. After allowing tracking permission
|
||||
|
||||
```php
|
||||
// Fires after tracking permission allowed (optin)
|
||||
function sample_tracker_optin(array $data){
|
||||
// use data, as it's now permitted to send anywhere
|
||||
// Like FLuentCRM
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_tracker_optin', 'sample_tracker_optin', 10);
|
||||
```
|
||||
|
||||
#### 2. After dening tracking permission
|
||||
```php
|
||||
// Fires after tracking permission denied (optout)
|
||||
function sample_tracker_optout(){
|
||||
// Don't ask for further permission, respect user's decision
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_tracker_optout', 'sample_tracker_optout', 10);
|
||||
```
|
||||
|
||||
#### 3. After license is activated
|
||||
```php
|
||||
// Fires after license is activated successfully
|
||||
function sample_license_activated(array $response){
|
||||
// use response
|
||||
// response has license information
|
||||
// Like FLuentCRM
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_license_activated', 'sample_license_activated', 10);
|
||||
```
|
||||
|
||||
|
||||
#### 4. After license is deactivated
|
||||
```php
|
||||
// Fires after license deactivated successfully
|
||||
function sample_license_deactivated(array $response){
|
||||
// use response
|
||||
// response has license information
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_license_deactivated', 'sample_license_deactivated', 10);
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 5. After license is refreshed
|
||||
```php
|
||||
// Fires after license refreshed successfully
|
||||
function sample_license_refreshed(){
|
||||
// license just refreshed
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_license_refreshed', 'sample_license_refreshed', 10);
|
||||
```
|
||||
|
||||
#### 6. After uninstall reason is submitted
|
||||
```php
|
||||
// Fires after uninstall reason submitted
|
||||
function sample_uninstall_reason_submitted(array $data){
|
||||
// use the data
|
||||
// Like FLuentCRM
|
||||
}
|
||||
add_action('PLUGIN_OR_THEME_SLUG_uninstall_reason_submitted', 'sample_uninstall_reason_submitted', 10);
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Created and maintained by [Appsero](https://appsero.com).
|
||||
285
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Client.php
vendored
Normal file
285
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Client.php
vendored
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
<?php
|
||||
|
||||
namespace Appsero;
|
||||
|
||||
/**
|
||||
* Appsero Client
|
||||
*
|
||||
* This class is necessary to set project data
|
||||
*/
|
||||
class Client {
|
||||
|
||||
/**
|
||||
* The client version
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $version = '1.2.3';
|
||||
|
||||
/**
|
||||
* Hash identifier of the plugin
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $hash;
|
||||
|
||||
/**
|
||||
* Name of the plugin
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The plugin/theme file path
|
||||
*
|
||||
* @example .../wp-content/plugins/test-slug/test-slug.php
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $file;
|
||||
|
||||
/**
|
||||
* Main plugin file
|
||||
*
|
||||
* @example test-slug/test-slug.php
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $basename;
|
||||
|
||||
/**
|
||||
* Slug of the plugin
|
||||
*
|
||||
* @example test-slug
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $slug;
|
||||
|
||||
/**
|
||||
* The project version
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $project_version;
|
||||
|
||||
/**
|
||||
* The project type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Textdomain
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $textdomain;
|
||||
|
||||
/**
|
||||
* The Object of Insights Class
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $insights;
|
||||
|
||||
/**
|
||||
* The Object of Updater Class
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $updater;
|
||||
|
||||
/**
|
||||
* The Object of License Class
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $license;
|
||||
|
||||
/**
|
||||
* Initialize the class
|
||||
*
|
||||
* @param string $hash hash of the plugin
|
||||
* @param string $name readable name of the plugin
|
||||
* @param string $file main plugin file path
|
||||
*/
|
||||
public function __construct( $hash, $name, $file ) {
|
||||
$this->hash = $hash;
|
||||
$this->name = $name;
|
||||
$this->file = $file;
|
||||
|
||||
$this->set_basename_and_slug();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize insights class
|
||||
*
|
||||
* @return Appsero\Insights
|
||||
*/
|
||||
public function insights() {
|
||||
if ( ! class_exists( __NAMESPACE__ . '\Insights' ) ) {
|
||||
require_once __DIR__ . '/Insights.php';
|
||||
}
|
||||
|
||||
// if already instantiated, return the cached one
|
||||
if ( $this->insights ) {
|
||||
return $this->insights;
|
||||
}
|
||||
|
||||
$this->insights = new Insights( $this );
|
||||
|
||||
return $this->insights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize plugin/theme updater
|
||||
*
|
||||
* @return Appsero\Updater
|
||||
*/
|
||||
public function updater() {
|
||||
if ( ! class_exists( __NAMESPACE__ . '\Updater' ) ) {
|
||||
require_once __DIR__ . '/Updater.php';
|
||||
}
|
||||
|
||||
// if already instantiated, return the cached one
|
||||
if ( $this->updater ) {
|
||||
return $this->updater;
|
||||
}
|
||||
|
||||
$this->updater = new Updater( $this );
|
||||
|
||||
return $this->updater;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize license checker
|
||||
*
|
||||
* @return Appsero\License
|
||||
*/
|
||||
public function license() {
|
||||
if ( ! class_exists( __NAMESPACE__ . '\License' ) ) {
|
||||
require_once __DIR__ . '/License.php';
|
||||
}
|
||||
|
||||
// if already instantiated, return the cached one
|
||||
if ( $this->license ) {
|
||||
return $this->license;
|
||||
}
|
||||
|
||||
$this->license = new License( $this );
|
||||
|
||||
return $this->license;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Endpoint
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function endpoint() {
|
||||
$endpoint = apply_filters( 'appsero_endpoint', 'https://api.appsero.com' );
|
||||
|
||||
return trailingslashit( $endpoint );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set project basename, slug and version
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_basename_and_slug() {
|
||||
if ( strpos( $this->file, WP_CONTENT_DIR . '/themes/' ) === false ) {
|
||||
$this->basename = plugin_basename( $this->file );
|
||||
|
||||
list( $this->slug, $mainfile ) = explode( '/', $this->basename );
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
|
||||
$plugin_data = get_plugin_data( $this->file );
|
||||
|
||||
$this->project_version = $plugin_data['Version'];
|
||||
$this->type = 'plugin';
|
||||
} else {
|
||||
$this->basename = str_replace( WP_CONTENT_DIR . '/themes/', '', $this->file );
|
||||
|
||||
list( $this->slug, $mainfile ) = explode( '/', $this->basename );
|
||||
|
||||
$theme = wp_get_theme( $this->slug );
|
||||
|
||||
$this->project_version = $theme->version;
|
||||
$this->type = 'theme';
|
||||
}
|
||||
|
||||
$this->textdomain = $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send request to remote endpoint
|
||||
*
|
||||
* @param array $params
|
||||
* @param string $route
|
||||
*
|
||||
* @return array|WP_Error array of results including HTTP headers or WP_Error if the request failed
|
||||
*/
|
||||
public function send_request( $params, $route, $blocking = false ) {
|
||||
$url = $this->endpoint() . $route;
|
||||
|
||||
$headers = [
|
||||
'user-agent' => 'Appsero/' . md5( esc_url( home_url() ) ) . ';',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
|
||||
$response = wp_remote_post(
|
||||
$url,
|
||||
[
|
||||
'method' => 'POST',
|
||||
'timeout' => 30,
|
||||
'redirection' => 5,
|
||||
'httpversion' => '1.0',
|
||||
'blocking' => $blocking,
|
||||
'headers' => $headers,
|
||||
'body' => array_merge( $params, [ 'client' => $this->version ] ),
|
||||
'cookies' => [],
|
||||
]
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current server is localhost
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_local_server() {
|
||||
$is_local = isset( $_SERVER['REMOTE_ADDR'] ) && in_array( $_SERVER['REMOTE_ADDR'], [ '127.0.0.1', '::1' ], true );
|
||||
|
||||
return apply_filters( 'appsero_is_local', $is_local );
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate function _e()
|
||||
*/
|
||||
// phpcs:ignore
|
||||
public function _etrans( $text ) {
|
||||
call_user_func( '_e', $text, $this->textdomain );
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate function __()
|
||||
*/
|
||||
// phpcs:ignore
|
||||
public function __trans( $text ) {
|
||||
return call_user_func( '__', $text, $this->textdomain );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set project textdomain
|
||||
*/
|
||||
public function set_textdomain( $textdomain ) {
|
||||
$this->textdomain = $textdomain;
|
||||
}
|
||||
}
|
||||
1221
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Insights.php
vendored
Normal file
1221
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Insights.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
802
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/License.php
vendored
Normal file
802
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/License.php
vendored
Normal file
|
|
@ -0,0 +1,802 @@
|
|||
<?php
|
||||
|
||||
namespace Appsero;
|
||||
|
||||
/**
|
||||
* Appsero License Checker
|
||||
*
|
||||
* This class will check, active and deactive license
|
||||
*/
|
||||
class License {
|
||||
|
||||
/**
|
||||
* AppSero\Client
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Arguments of create menu
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $menu_args;
|
||||
|
||||
/**
|
||||
* `option_name` of `wp_options` table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $option_key;
|
||||
|
||||
/**
|
||||
* Error message of HTTP request
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $error;
|
||||
|
||||
/**
|
||||
* Success message on form submit
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $success;
|
||||
|
||||
/**
|
||||
* Corn schedule hook name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $schedule_hook;
|
||||
|
||||
/**
|
||||
* Set value for valid license
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $is_valid_license = null;
|
||||
|
||||
/**
|
||||
* Initialize the class
|
||||
*
|
||||
* @param Appsero\Client
|
||||
*/
|
||||
public function __construct( Client $client ) {
|
||||
$this->client = $client;
|
||||
|
||||
$this->option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license';
|
||||
|
||||
$this->schedule_hook = $this->client->slug . '_license_check_event';
|
||||
|
||||
// Creating WP Ajax Endpoint to refresh license remotely
|
||||
add_action( 'wp_ajax_appsero_refresh_license_' . $this->client->hash, [ $this, 'refresh_license_api' ] );
|
||||
|
||||
// Run hook to check license status daily
|
||||
add_action( $this->schedule_hook, [ $this, 'check_license_status' ] );
|
||||
|
||||
// Active/Deactive corn schedule
|
||||
$this->run_schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the license option key.
|
||||
*
|
||||
* If someone wants to override the default generated key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @since 1.3.0
|
||||
*
|
||||
* @return License
|
||||
*/
|
||||
public function set_option_key( $key ) {
|
||||
$this->option_key = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the license key
|
||||
*
|
||||
* @since 1.3.0
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_license() {
|
||||
return get_option( $this->option_key, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check license
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check( $license_key ) {
|
||||
$route = 'public/license/' . $this->client->hash . '/check';
|
||||
|
||||
return $this->send_request( $license_key, $route );
|
||||
}
|
||||
|
||||
/**
|
||||
* Active a license
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function activate( $license_key ) {
|
||||
$route = 'public/license/' . $this->client->hash . '/activate';
|
||||
|
||||
return $this->send_request( $license_key, $route );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate a license
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deactivate( $license_key ) {
|
||||
$route = 'public/license/' . $this->client->hash . '/deactivate';
|
||||
|
||||
return $this->send_request( $license_key, $route );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send common request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function send_request( $license_key, $route ) {
|
||||
$params = [
|
||||
'license_key' => $license_key,
|
||||
'url' => esc_url( home_url() ),
|
||||
'is_local' => $this->client->is_local_server(),
|
||||
];
|
||||
|
||||
$response = $this->client->send_request( $params, $route, true );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => $response->get_error_message(),
|
||||
];
|
||||
}
|
||||
|
||||
$response = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
if ( empty( $response ) || isset( $response['exception'] ) ) {
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => $this->client->__trans( 'Unknown error occurred, Please try again.' ),
|
||||
];
|
||||
}
|
||||
|
||||
if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) {
|
||||
$response = [
|
||||
'success' => false,
|
||||
'error' => $response['errors']['license_key'][0],
|
||||
];
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* License Refresh Endpoint
|
||||
*/
|
||||
public function refresh_license_api() {
|
||||
$this->check_license_status();
|
||||
|
||||
return wp_send_json(
|
||||
[
|
||||
'message' => 'License refreshed successfully.',
|
||||
],
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings page for license
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_settings_page( $args = [] ) {
|
||||
$defaults = [
|
||||
'type' => 'menu', // Can be: menu, options, submenu
|
||||
'page_title' => 'Manage License',
|
||||
'menu_title' => 'Manage License',
|
||||
'capability' => 'manage_options',
|
||||
'menu_slug' => $this->client->slug . '-manage-license',
|
||||
'icon_url' => '',
|
||||
'position' => null,
|
||||
'parent_slug' => '',
|
||||
];
|
||||
|
||||
$this->menu_args = wp_parse_args( $args, $defaults );
|
||||
|
||||
add_action( 'admin_menu', [ $this, 'admin_menu' ], 99 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Menu hook
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_menu() {
|
||||
switch ( $this->menu_args['type'] ) {
|
||||
case 'menu':
|
||||
$this->create_menu_page();
|
||||
break;
|
||||
|
||||
case 'submenu':
|
||||
$this->create_submenu_page();
|
||||
break;
|
||||
|
||||
case 'options':
|
||||
$this->create_options_page();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* License menu output
|
||||
*/
|
||||
public function menu_output() {
|
||||
// process form data is submitted
|
||||
$this->license_form_submit();
|
||||
|
||||
$license = $this->get_license();
|
||||
$action = ( $license && isset( $license['status'] ) && 'activate' === $license['status'] ) ? 'deactive' : 'active';
|
||||
$this->licenses_style();
|
||||
?>
|
||||
|
||||
<div class="wrap appsero-license-settings-wrapper">
|
||||
<h1>License Settings</h1>
|
||||
|
||||
<?php
|
||||
$this->show_license_page_notices();
|
||||
do_action( 'before_appsero_license_section' );
|
||||
?>
|
||||
|
||||
<div class="appsero-license-settings appsero-license-section">
|
||||
<?php $this->show_license_page_card_header( $license ); ?>
|
||||
|
||||
<div class="appsero-license-details">
|
||||
<p>
|
||||
<?php printf( $this->client->__trans( 'Activate <strong>%s</strong> by your license key to get professional support and automatic update from your WordPress dashboard.' ), $this->client->name ); ?>
|
||||
</p>
|
||||
<form method="post" novalidate="novalidate" spellcheck="false">
|
||||
<input type="hidden" name="_action" value="<?php echo $action; ?>">
|
||||
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
|
||||
<div class="license-input-fields">
|
||||
<div class="license-input-key">
|
||||
<svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
|
||||
</svg>
|
||||
<input type="text" value="<?php echo $this->get_input_license_value( $action, $license ); ?>"
|
||||
placeholder="<?php echo esc_attr( $this->client->__trans( 'Enter your license key to activate' ) ); ?>" name="license_key"
|
||||
<?php echo ( 'deactive' === $action ) ? 'readonly="readonly"' : ''; ?>
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" name="submit" class="<?php echo 'deactive' === $action ? 'deactive-button' : ''; ?>">
|
||||
<?php echo $action === 'active' ? $this->client->__trans( 'Activate License' ) : $this->client->__trans( 'Deactivate License' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if ( 'deactive' === $action && isset( $license['remaining'] ) ) {
|
||||
$this->show_active_license_info( $license );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div> <!-- /.appsero-license-settings -->
|
||||
|
||||
<?php do_action( 'after_appsero_license_section' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* License form submit
|
||||
*/
|
||||
public function license_form_submit() {
|
||||
if ( ! isset( $_POST['_nonce'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_nonce'] ) ), $this->client->name ) ) {
|
||||
$this->error = $this->client->__trans( 'Nonce vefification failed.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
$this->error = $this->client->__trans( 'You don\'t have permission to manage license.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$license_key = isset( $_POST['license_key'] ) ? sanitize_text_field( wp_unslash( $_POST['license_key'] ) ) : '';
|
||||
$action = isset( $_POST['_action'] ) ? sanitize_text_field( wp_unslash( $_POST['_action'] ) ) : '';
|
||||
|
||||
switch ( $action ) {
|
||||
case 'active':
|
||||
$this->active_client_license( $license_key );
|
||||
break;
|
||||
|
||||
case 'deactive':
|
||||
$this->deactive_client_license();
|
||||
break;
|
||||
|
||||
case 'refresh':
|
||||
$this->refresh_client_license();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check license status on schedule
|
||||
*/
|
||||
public function check_license_status() {
|
||||
$license = $this->get_license();
|
||||
|
||||
if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
|
||||
$response = $this->check( $license['key'] );
|
||||
|
||||
if ( isset( $response['success'] ) && $response['success'] ) {
|
||||
$license['status'] = 'activate';
|
||||
$license['remaining'] = $response['remaining'];
|
||||
$license['activation_limit'] = $response['activation_limit'];
|
||||
$license['expiry_days'] = $response['expiry_days'];
|
||||
$license['title'] = $response['title'];
|
||||
$license['source_id'] = $response['source_identifier'];
|
||||
$license['recurring'] = $response['recurring'];
|
||||
} else {
|
||||
$license['status'] = 'deactivate';
|
||||
$license['expiry_days'] = 0;
|
||||
}
|
||||
|
||||
update_option( $this->option_key, $license, false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check this is a valid license
|
||||
*/
|
||||
public function is_valid() {
|
||||
if ( null !== $this->is_valid_license ) {
|
||||
return $this->is_valid_license;
|
||||
}
|
||||
|
||||
$license = $this->get_license();
|
||||
|
||||
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] === 'activate' ) {
|
||||
$this->is_valid_license = true;
|
||||
} else {
|
||||
$this->is_valid_license = false;
|
||||
}
|
||||
|
||||
return $this->is_valid_license;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check this is a valid license
|
||||
*/
|
||||
public function is_valid_by( $option, $value ) {
|
||||
$license = $this->get_license();
|
||||
|
||||
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] === 'activate' ) {
|
||||
if ( isset( $license[ $option ] ) && $license[ $option ] === $value ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Styles for licenses page
|
||||
*/
|
||||
private function licenses_style() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.appsero-license-section {
|
||||
width: 100%;
|
||||
max-width: 1100px;
|
||||
min-height: 1px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.appsero-license-settings {
|
||||
background-color: #fff;
|
||||
box-shadow: 0px 3px 10px rgba(16, 16, 16, 0.05);
|
||||
}
|
||||
.appsero-license-settings * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.appsero-license-title {
|
||||
background-color: #F8FAFB;
|
||||
border-bottom: 2px solid #EAEAEA;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
.appsero-license-title svg {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
fill: #0082BF;
|
||||
}
|
||||
.appsero-license-title span {
|
||||
font-size: 17px;
|
||||
color: #444444;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.appsero-license-details {
|
||||
padding: 20px;
|
||||
}
|
||||
.appsero-license-details p {
|
||||
font-size: 15px;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
.license-input-key {
|
||||
position: relative;
|
||||
flex: 0 0 72%;
|
||||
max-width: 72%;
|
||||
}
|
||||
.license-input-key input {
|
||||
background-color: #F9F9F9;
|
||||
padding: 10px 15px 10px 48px;
|
||||
border: 1px solid #E8E5E5;
|
||||
border-radius: 3px;
|
||||
height: 45px;
|
||||
font-size: 16px;
|
||||
color: #71777D;
|
||||
width: 100%;
|
||||
box-shadow: 0 0 0 transparent;
|
||||
}
|
||||
.license-input-key input:focus {
|
||||
outline: 0 none;
|
||||
border: 1px solid #E8E5E5;
|
||||
box-shadow: 0 0 0 transparent;
|
||||
}
|
||||
.license-input-key svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
fill: #0082BF;
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 13px;
|
||||
}
|
||||
.license-input-fields {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
max-width: 850px;
|
||||
width: 100%;
|
||||
}
|
||||
.license-input-fields button {
|
||||
color: #fff;
|
||||
font-size: 17px;
|
||||
padding: 8px;
|
||||
height: 46px;
|
||||
background-color: #0082BF;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
border: 1px solid #0082BF;
|
||||
}
|
||||
.license-input-fields button.deactive-button {
|
||||
background-color: #E40055;
|
||||
border-color: #E40055;
|
||||
}
|
||||
.license-input-fields button:focus {
|
||||
outline: 0 none;
|
||||
}
|
||||
.active-license-info {
|
||||
display: flex;
|
||||
}
|
||||
.single-license-info {
|
||||
min-width: 220px;
|
||||
flex: 0 0 30%;
|
||||
}
|
||||
.single-license-info h3 {
|
||||
font-size: 18px;
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
.single-license-info p {
|
||||
margin: 0;
|
||||
color: #00C000;
|
||||
}
|
||||
.single-license-info p.occupied {
|
||||
color: #E40055;
|
||||
}
|
||||
.appsero-license-right-form {
|
||||
margin-left: auto;
|
||||
}
|
||||
.appsero-license-refresh-button {
|
||||
padding: 6px 10px 4px 10px;
|
||||
border: 1px solid #0082BF;
|
||||
border-radius: 3px;
|
||||
margin-left: auto;
|
||||
background-color: #0082BF;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.appsero-license-refresh-button .dashicons {
|
||||
color: #fff;
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Show active license information
|
||||
*/
|
||||
private function show_active_license_info( $license ) {
|
||||
?>
|
||||
<div class="active-license-info">
|
||||
<div class="single-license-info">
|
||||
<h3><?php $this->client->_etrans( 'Activations Remaining' ); ?></h3>
|
||||
<?php if ( empty( $license['activation_limit'] ) ) { ?>
|
||||
<p><?php $this->client->_etrans( 'Unlimited' ); ?></p>
|
||||
<?php } else { ?>
|
||||
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
|
||||
<?php printf( $this->client->__trans( '%1$d out of %2$d' ), $license['remaining'], $license['activation_limit'] ); ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="single-license-info">
|
||||
<h3><?php $this->client->_etrans( 'Expires in' ); ?></h3>
|
||||
<?php
|
||||
if ( false !== $license['expiry_days'] ) {
|
||||
$occupied = $license['expiry_days'] > 21 ? '' : 'occupied';
|
||||
echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
|
||||
} else {
|
||||
echo '<p>' . $this->client->__trans( 'Never' ) . '</p>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Show license settings page notices
|
||||
*/
|
||||
private function show_license_page_notices() {
|
||||
if ( ! empty( $this->error ) ) {
|
||||
?>
|
||||
<div class="notice notice-error is-dismissible appsero-license-section">
|
||||
<p><?php echo $this->error; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( ! empty( $this->success ) ) {
|
||||
?>
|
||||
<div class="notice notice-success is-dismissible appsero-license-section">
|
||||
<p><?php echo $this->success; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Card header
|
||||
*/
|
||||
private function show_license_page_card_header( $license ) {
|
||||
?>
|
||||
<div class="appsero-license-title">
|
||||
<svg enable-background="new 0 0 299.995 299.995" version="1.1" viewBox="0 0 300 300" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m150 161.48c-8.613 0-15.598 6.982-15.598 15.598 0 5.776 3.149 10.807 7.817 13.505v17.341h15.562v-17.341c4.668-2.697 7.817-7.729 7.817-13.505 0-8.616-6.984-15.598-15.598-15.598z"/>
|
||||
<path d="m150 85.849c-13.111 0-23.775 10.665-23.775 23.775v25.319h47.548v-25.319c-1e-3 -13.108-10.665-23.775-23.773-23.775z"/>
|
||||
<path d="m150 1e-3c-82.839 0-150 67.158-150 150 0 82.837 67.156 150 150 150s150-67.161 150-150c0-82.839-67.161-150-150-150zm46.09 227.12h-92.173c-9.734 0-17.626-7.892-17.626-17.629v-56.919c0-8.491 6.007-15.582 14.003-17.25v-25.697c0-27.409 22.3-49.711 49.711-49.711 27.409 0 49.709 22.3 49.709 49.711v25.697c7.993 1.673 14 8.759 14 17.25v56.919h2e-3c0 9.736-7.892 17.629-17.626 17.629z"/>
|
||||
</svg>
|
||||
<span><?php echo $this->client->__trans( 'Activate License' ); ?></span>
|
||||
|
||||
<?php if ( $license && $license['key'] ) { ?>
|
||||
<form method="post" class="appsero-license-right-form" novalidate="novalidate" spellcheck="false">
|
||||
<input type="hidden" name="_action" value="refresh">
|
||||
<input type="hidden" name="_appsero_license_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
|
||||
<button type="submit" name="submit" class="appsero-license-refresh-button">
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<?php echo $this->client->__trans( 'Refresh License' ); ?>
|
||||
</button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Active client license
|
||||
*/
|
||||
private function active_client_license( $license_key ) {
|
||||
if ( empty( $license_key ) ) {
|
||||
$this->error = $this->client->__trans( 'The license key field is required.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$response = $this->activate( $license_key );
|
||||
|
||||
if ( ! $response['success'] ) {
|
||||
$this->error = $response['error'] ? $response['error'] : $this->client->__trans( 'Unknown error occurred.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'key' => $license_key,
|
||||
'status' => 'activate',
|
||||
'remaining' => $response['remaining'],
|
||||
'activation_limit' => $response['activation_limit'],
|
||||
'expiry_days' => $response['expiry_days'],
|
||||
'title' => $response['title'],
|
||||
'source_id' => $response['source_identifier'],
|
||||
'recurring' => $response['recurring'],
|
||||
];
|
||||
|
||||
update_option( $this->option_key, $data, false );
|
||||
|
||||
$this->success = $this->client->__trans( 'License activated successfully.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactive client license
|
||||
*/
|
||||
private function deactive_client_license() {
|
||||
$license = $this->get_license();
|
||||
|
||||
if ( empty( $license['key'] ) ) {
|
||||
$this->error = $this->client->__trans( 'License key not found.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$response = $this->deactivate( $license['key'] );
|
||||
|
||||
$data = [
|
||||
'key' => '',
|
||||
'status' => 'deactivate',
|
||||
];
|
||||
|
||||
update_option( $this->option_key, $data, false );
|
||||
|
||||
if ( ! $response['success'] ) {
|
||||
$this->error = $response['error'] ? $response['error'] : $this->client->__trans( 'Unknown error occurred.' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->success = $this->client->__trans( 'License deactivated successfully.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh Client License
|
||||
*/
|
||||
private function refresh_client_license() {
|
||||
$license = $this->get_license();
|
||||
|
||||
if ( ! $license || ! isset( $license['key'] ) || empty( $license['key'] ) ) {
|
||||
$this->error = $this->client->__trans( 'License key not found' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->check_license_status();
|
||||
|
||||
$this->success = $this->client->__trans( 'License refreshed successfully.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add license menu page
|
||||
*/
|
||||
private function create_menu_page() {
|
||||
call_user_func(
|
||||
'add_menu_page',
|
||||
$this->menu_args['page_title'],
|
||||
$this->menu_args['menu_title'],
|
||||
$this->menu_args['capability'],
|
||||
$this->menu_args['menu_slug'],
|
||||
[ $this, 'menu_output' ],
|
||||
$this->menu_args['icon_url'],
|
||||
$this->menu_args['position']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add submenu page
|
||||
*/
|
||||
private function create_submenu_page() {
|
||||
call_user_func(
|
||||
'add_submenu_page',
|
||||
$this->menu_args['parent_slug'],
|
||||
$this->menu_args['page_title'],
|
||||
$this->menu_args['menu_title'],
|
||||
$this->menu_args['capability'],
|
||||
$this->menu_args['menu_slug'],
|
||||
[ $this, 'menu_output' ],
|
||||
$this->menu_args['position']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add submenu page
|
||||
*/
|
||||
private function create_options_page() {
|
||||
call_user_func(
|
||||
'add_options_page',
|
||||
$this->menu_args['page_title'],
|
||||
$this->menu_args['menu_title'],
|
||||
$this->menu_args['capability'],
|
||||
$this->menu_args['menu_slug'],
|
||||
[ $this, 'menu_output' ],
|
||||
$this->menu_args['position']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule daily sicense checker event
|
||||
*/
|
||||
public function schedule_cron_event() {
|
||||
if ( ! wp_next_scheduled( $this->schedule_hook ) ) {
|
||||
wp_schedule_event( time(), 'daily', $this->schedule_hook );
|
||||
|
||||
wp_schedule_single_event( time() + 20, $this->schedule_hook );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear any scheduled hook
|
||||
*/
|
||||
public function clear_scheduler() {
|
||||
wp_clear_scheduled_hook( $this->schedule_hook );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable schedule
|
||||
*/
|
||||
private function run_schedule() {
|
||||
switch ( $this->client->type ) {
|
||||
case 'plugin':
|
||||
register_activation_hook( $this->client->file, [ $this, 'schedule_cron_event' ] );
|
||||
register_deactivation_hook( $this->client->file, [ $this, 'clear_scheduler' ] );
|
||||
break;
|
||||
|
||||
case 'theme':
|
||||
add_action( 'after_switch_theme', [ $this, 'schedule_cron_event' ] );
|
||||
add_action( 'switch_theme', [ $this, 'clear_scheduler' ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get input license key
|
||||
*
|
||||
* @return $license
|
||||
*/
|
||||
private function get_input_license_value( $action, $license ) {
|
||||
if ( 'active' === $action ) {
|
||||
return isset( $license['key'] ) ? $license['key'] : '';
|
||||
}
|
||||
|
||||
if ( 'deactive' === $action ) {
|
||||
$key_length = strlen( $license['key'] );
|
||||
|
||||
return str_pad(
|
||||
substr( $license['key'], 0, $key_length / 2 ),
|
||||
$key_length,
|
||||
'*'
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
262
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Updater.php
vendored
Normal file
262
wp-content/plugins/wp-maximum-upload-file-size/vendor/appsero/client/src/Updater.php
vendored
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
<?php
|
||||
|
||||
namespace Appsero;
|
||||
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Appsero Updater
|
||||
*
|
||||
* This class will show new updates project
|
||||
*/
|
||||
class Updater {
|
||||
|
||||
/**
|
||||
* Appsero\Client
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Cache key
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $cache_key;
|
||||
|
||||
/**
|
||||
* Initialize the class
|
||||
*
|
||||
* @param Appsero\Client
|
||||
*/
|
||||
public function __construct( Client $client ) {
|
||||
$this->client = $client;
|
||||
$this->cache_key = 'appsero_' . md5( $this->client->slug ) . '_version_info';
|
||||
|
||||
// Run hooks.
|
||||
if ( $this->client->type === 'plugin' ) {
|
||||
$this->run_plugin_hooks();
|
||||
} elseif ( $this->client->type === 'theme' ) {
|
||||
$this->run_theme_hooks();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up WordPress filter to hooks to get update.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run_plugin_hooks() {
|
||||
add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_plugin_update' ] );
|
||||
add_filter( 'plugins_api', [ $this, 'plugins_api_filter' ], 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up WordPress filter to hooks to get update.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run_theme_hooks() {
|
||||
add_filter( 'pre_set_site_transient_update_themes', [ $this, 'check_theme_update' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Update for this specific project
|
||||
*/
|
||||
public function check_plugin_update( $transient_data ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( ! is_object( $transient_data ) ) {
|
||||
$transient_data = new stdClass();
|
||||
}
|
||||
|
||||
if ( 'plugins.php' === $pagenow && is_multisite() ) {
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) {
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
$version_info = $this->get_version_info();
|
||||
|
||||
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
||||
unset( $version_info->sections );
|
||||
|
||||
// If new version available then set to `response`
|
||||
if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
|
||||
$transient_data->response[ $this->client->basename ] = $version_info;
|
||||
} else {
|
||||
// If new version is not available then set to `no_update`
|
||||
$transient_data->no_update[ $this->client->basename ] = $version_info;
|
||||
}
|
||||
|
||||
$transient_data->last_checked = time();
|
||||
$transient_data->checked[ $this->client->basename ] = $this->client->project_version;
|
||||
}
|
||||
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get version info from database
|
||||
*
|
||||
* @return object or Boolean
|
||||
*/
|
||||
private function get_cached_version_info() {
|
||||
global $pagenow;
|
||||
|
||||
// If updater page then fetch from API now
|
||||
if ( 'update-core.php' === $pagenow ) {
|
||||
return false; // Force to fetch data
|
||||
}
|
||||
|
||||
$value = get_transient( $this->cache_key );
|
||||
|
||||
if ( ! $value && ! isset( $value->name ) ) {
|
||||
return false; // Cache is expired
|
||||
}
|
||||
|
||||
// We need to turn the icons into an array
|
||||
if ( isset( $value->icons ) ) {
|
||||
$value->icons = (array) $value->icons;
|
||||
}
|
||||
|
||||
// We need to turn the banners into an array
|
||||
if ( isset( $value->banners ) ) {
|
||||
$value->banners = (array) $value->banners;
|
||||
}
|
||||
|
||||
if ( isset( $value->sections ) ) {
|
||||
$value->sections = (array) $value->sections;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set version info to database
|
||||
*/
|
||||
private function set_cached_version_info( $value ) {
|
||||
if ( ! $value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plugin info from Appsero
|
||||
*/
|
||||
private function get_project_latest_version() {
|
||||
$license = $this->client->license()->get_license();
|
||||
|
||||
$params = [
|
||||
'version' => $this->client->project_version,
|
||||
'name' => $this->client->name,
|
||||
'slug' => $this->client->slug,
|
||||
'basename' => $this->client->basename,
|
||||
'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '',
|
||||
];
|
||||
|
||||
$route = 'update/' . $this->client->hash . '/check';
|
||||
|
||||
$response = $this->client->send_request( $params, $route, true );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
||||
|
||||
if ( ! isset( $response->slug ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset( $response->icons ) ) {
|
||||
$response->icons = (array) $response->icons;
|
||||
}
|
||||
|
||||
if ( isset( $response->banners ) ) {
|
||||
$response->banners = (array) $response->banners;
|
||||
}
|
||||
|
||||
if ( isset( $response->sections ) ) {
|
||||
$response->sections = (array) $response->sections;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates information on the "View version x.x details" page with custom data.
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param string $action
|
||||
* @param object $args
|
||||
*
|
||||
* @return object $data
|
||||
*/
|
||||
public function plugins_api_filter( $data, $action = '', $args = null ) {
|
||||
if ( $action !== 'plugin_information' ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( ! isset( $args->slug ) || ( $args->slug !== $this->client->slug ) ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
return $this->get_version_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check theme upate
|
||||
*/
|
||||
public function check_theme_update( $transient_data ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( ! is_object( $transient_data ) ) {
|
||||
$transient_data = new stdClass();
|
||||
}
|
||||
|
||||
if ( 'themes.php' === $pagenow && is_multisite() ) {
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) {
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
$version_info = $this->get_version_info();
|
||||
|
||||
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
||||
// If new version available then set to `response`
|
||||
if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
|
||||
$transient_data->response[ $this->client->slug ] = (array) $version_info;
|
||||
} else {
|
||||
// If new version is not available then set to `no_update`
|
||||
$transient_data->no_update[ $this->client->slug ] = (array) $version_info;
|
||||
}
|
||||
|
||||
$transient_data->last_checked = time();
|
||||
$transient_data->checked[ $this->client->slug ] = $this->client->project_version;
|
||||
}
|
||||
|
||||
return $transient_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get version information
|
||||
*/
|
||||
private function get_version_info() {
|
||||
$version_info = $this->get_cached_version_info();
|
||||
|
||||
if ( false === $version_info ) {
|
||||
$version_info = $this->get_project_latest_version();
|
||||
$this->set_cached_version_info( $version_info );
|
||||
}
|
||||
|
||||
return $version_info;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit8db570ab87ce615f114a63d89119a946::getLoader();
|
||||
479
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/ClassLoader.php
vendored
Normal file
479
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/ClassLoader.php
vendored
Normal file
|
|
@ -0,0 +1,479 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
}
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
292
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/InstalledVersions.php
vendored
Normal file
292
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/InstalledVersions.php
vendored
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class InstalledVersions
|
||||
{
|
||||
private static $installed = array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8effd05ba13f3411cb829e3b02d47298763fd3d3',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8effd05ba13f3411cb829e3b02d47298763fd3d3',
|
||||
),
|
||||
'appsero/client' =>
|
||||
array (
|
||||
'pretty_version' => 'v1.2.3',
|
||||
'version' => '1.2.3.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'ddfaa9ce62618e0aee4f95ddeb37a27ebd9a3508',
|
||||
),
|
||||
),
|
||||
);
|
||||
private static $canGetVendors;
|
||||
private static $installedByVendor = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function isInstalled($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRawData()
|
||||
{
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$installed[] = self::$installed;
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
10
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_classmap.php
vendored
Normal file
10
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_classmap.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
);
|
||||
9
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_namespaces.php
vendored
Normal file
9
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_namespaces.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
10
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_psr4.php
vendored
Normal file
10
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_psr4.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Appsero\\' => array($vendorDir . '/appsero/client/src'),
|
||||
);
|
||||
57
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_real.php
vendored
Normal file
57
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_real.php
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit8db570ab87ce615f114a63d89119a946
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8db570ab87ce615f114a63d89119a946', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8db570ab87ce615f114a63d89119a946', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8db570ab87ce615f114a63d89119a946::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
36
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_static.php
vendored
Normal file
36
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/autoload_static.php
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit8db570ab87ce615f114a63d89119a946
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'A' =>
|
||||
array (
|
||||
'Appsero\\' => 8,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Appsero\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/appsero/client/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8db570ab87ce615f114a63d89119a946::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8db570ab87ce615f114a63d89119a946::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8db570ab87ce615f114a63d89119a946::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
63
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/installed.json
vendored
Normal file
63
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/installed.json
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "appsero/client",
|
||||
"version": "v1.2.3",
|
||||
"version_normalized": "1.2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Appsero/client.git",
|
||||
"reference": "ddfaa9ce62618e0aee4f95ddeb37a27ebd9a3508"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Appsero/client/zipball/ddfaa9ce62618e0aee4f95ddeb37a27ebd9a3508",
|
||||
"reference": "ddfaa9ce62618e0aee4f95ddeb37a27ebd9a3508",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
|
||||
"phpcompatibility/phpcompatibility-wp": "dev-master",
|
||||
"phpunit/phpunit": "^8.5.31",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"tareq1988/wp-php-cs-fixer": "dev-master",
|
||||
"wp-coding-standards/wpcs": "dev-develop"
|
||||
},
|
||||
"time": "2023-03-27T14:48:43+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Appsero\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tareq Hasan",
|
||||
"email": "tareq@appsero.com"
|
||||
}
|
||||
],
|
||||
"description": "Appsero Client",
|
||||
"keywords": [
|
||||
"analytics",
|
||||
"plugin",
|
||||
"theme",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Appsero/client/issues",
|
||||
"source": "https://github.com/Appsero/client/tree/v1.2.3"
|
||||
},
|
||||
"install-path": "../appsero/client"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": []
|
||||
}
|
||||
33
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/installed.php
vendored
Normal file
33
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/installed.php
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php return array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8effd05ba13f3411cb829e3b02d47298763fd3d3',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8effd05ba13f3411cb829e3b02d47298763fd3d3',
|
||||
),
|
||||
'appsero/client' =>
|
||||
array (
|
||||
'pretty_version' => 'v1.2.3',
|
||||
'version' => '1.2.3.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'ddfaa9ce62618e0aee4f95ddeb37a27ebd9a3508',
|
||||
),
|
||||
),
|
||||
);
|
||||
26
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/platform_check.php
vendored
Normal file
26
wp-content/plugins/wp-maximum-upload-file-size/vendor/composer/platform_check.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 50600)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Wp Maximum Upload File Size
|
||||
* Description: Wp Maximum Upload File Size will increase upload limit with one click. you can easily increase upload file size according to your need.
|
||||
* Author: CodePopular
|
||||
* Author URI: https://codepopular.com
|
||||
* Plugin URI: https://wordpress.org/plugins/wp-maximum-upload-file-size/
|
||||
* Version: 1.1.0
|
||||
* License: GPL2
|
||||
* Text Domain: wp-maximum-upload-file-size
|
||||
* Requires at least: 4.0
|
||||
* Tested up to: 6.2
|
||||
* Requires PHP: 5.6
|
||||
* @coypright: -2021 CodePopular (support: info@codepopular.com)
|
||||
*/
|
||||
|
||||
define('WMUFS_PLUGIN_FILE', __FILE__);
|
||||
define('WMUFS_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
||||
define('WMUFS_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
|
||||
define('WMUFS_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
|
||||
define('WMUFS_PLUGIN_VERSION', '1.1.0');
|
||||
|
||||
/**
|
||||
* Increase maximum execution time.
|
||||
* Default 600.
|
||||
*/
|
||||
|
||||
$wmufs_get_max_execution_time = get_option('wmufs_maximum_execution_time') != '' ? get_option('wmufs_maximum_execution_time') : ini_get('max_execution_time');
|
||||
set_time_limit($wmufs_get_max_execution_time);
|
||||
|
||||
|
||||
/**----------------------------------------------------------------*/
|
||||
/* Include all file
|
||||
/*-----------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Load all required files.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
include_once(WMUFS_PLUGIN_PATH . 'inc/class-wmufs-loader.php');
|
||||
|
||||
if ( function_exists( 'wmufs_run' ) ) {
|
||||
wmufs_run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the plugin tracker
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function appsero_init_tracker_wp_maximum_upload_file_size() {
|
||||
|
||||
$client = new Appsero\Client( 'a9151e1a-bc01-4c13-a117-d74263a219d7', 'WP Increase Upload Filesize | Increase Maximum Execution Time', __FILE__ );
|
||||
|
||||
// Active insights
|
||||
$client->insights()->init();
|
||||
|
||||
}
|
||||
|
||||
appsero_init_tracker_wp_maximum_upload_file_size();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
Loading…
Reference in New Issue