first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<div class="installer-channel-selector-wrap">
<label>
<?php esc_html_e('Updates channel:', 'installer'); ?>
<select class="installer-channel-selector" data-repository-id="<?php echo $repository_id ?>"<?php if( !$can_switch ): ?> disabled<?php endif ?>>
<?php foreach( $channels as $channel_id => $channel_name ): ?>
<option value="<?php echo $channel_id ?>" <?php
if( $channel_id == $current_channel ): ?>selected="selected"<?php
endif; ?>><?php echo $channel_name ?></option>
<?php endforeach ?>
</select>
<span class="installer-status-note" <?php if( $can_switch ): ?>style="display:none" <?php endif; ?>>
<?php _e("To select different update channels (beta, development) you must update your existing products to their most recent stable versions.", 'installer') ?>
</span>
<span class="spinner spinner-with-text">
<?php _e( "Updating the plugins on your site. Please don't close this page or navigate away.", 'installer' ); ?>
</span>
<span class="installer-channel-update-ok" data-text="<?php
esc_attr_e( sprintf("Update completed. You are now using the %s channel of %s.",
'%CHANNEL%', WP_Installer()->get_generic_product_name( $repository_id ) ) ) ?>">
</span>
<span class="installer-channel-update-fail" data-text-unstable="<?php
$support_url = $repository_id ==='toolset' ? 'https://toolset.com/forums/forum/professional-support/' : 'https://wpml.org/forums/forum/english-support/';
$download_url = $repository_id ==='toolset' ? 'https://toolset.com/account/downloads/' : 'https://wpml.org/account/downloads/';
echo esc_attr( sprintf(
__( "Something went wrong and we could not install all updates from the %s channel. Click here to %stry again%s. If the errors persist, please switch back to the Production channel and contact the %s%s support%s.", 'installer' ),
'%CHANNEL%',
'<a href="#" class="installer-channel-retry"><strong>',
'</strong></a>',
'<a href="' . $support_url . '">', WP_Installer()->get_generic_product_name( $repository_id ), '</a>'
) );
?>" data-text-stable="<?php
echo esc_attr( sprintf(
esc_attr__( "There was a problem switching to the %s channel. You can %sretry%s. If the problem continues, please %sdownload %s%s and install again manually", 'installer' ),
'%CHANNEL%',
'<a href="#" class="installer-channel-retry"><strong>',
'</strong></a>',
'<a href="' . $download_url . '">', WP_Installer()->get_generic_product_name( $repository_id ), '</a>'
) );
?>">
</span>
<input type="hidden" class="nonce" value="<?php echo $nonce ?>" />
</label>
<?php if( !$no_prompt ): ?>
<div class="installer-warn-box installer-switch-confirmation" style="margin-top: 10px; display: none">
<p class="alignright">
<button class="button-secondary js-cancel"><?php _e("Cancel", 'installer') ?></button>
<button class="button-primary js-proceed"><?php _e("Switch", 'installer') ?></button>
</p>
<p>
<?php _e( 'The plugins will update to the most recent version in the channel that you selected.', 'installer') ?>
</p>
<label>
<input type="checkbox" value="1" class="js-remember"/>
&nbsp;<?php _e( 'Remember my preference.', 'installer') ?><br />
</label>
</div>
<?php endif; ?>
<div class="installer-warn-text" <?php if( WP_Installer_Channels()->get_channel( $repository_id ) === WP_Installer_Channels::CHANNEL_PRODUCTION ): ?>style="display:none" <?php endif; ?>>
<?php printf(
__("You are using a potentially less stable channel for %s. If you didn't enable this on purpose, you should switch to the 'Production' channel.", 'installer'),
WP_Installer()->get_generic_product_name( $repository_id )
);
?>
</div>
</div>

View File

@@ -0,0 +1,80 @@
<form method="post" class="otgsi_downloads_form">
<table class="installer-plugins-list-compact">
<thead>
<tr>
<th>&nbsp;</th>
<th><?php _e('Plugin', 'installer') ?></th>
<th><img src="<?php echo $this->plugin_url() ?>/res/img/globe.png" alt="<?php esc_attr_e('Available', 'installer') ?>" width="16" height="16"></th>
<th><img src="<?php echo $this->plugin_url() ?>/res/img/computer.png" alt="<?php esc_attr_e('Installed', 'installer') ?>" width="16" height="16"></th>
<th><img src="<?php echo $this->plugin_url() ?>/res/img/dn2.gif" alt="<?php esc_attr_e('Downloading', 'installer') ?>" width="16" height="16"></th>
<th><img src="<?php echo $this->plugin_url() ?>/res/img/on.png" alt="<?php esc_attr_e('Activate', 'installer') ?>" width="16" height="16"></th>
</tr>
</thead>
<tbody>
<?php foreach($product['downloads'] as $download): ?>
<?php if(empty($tr_oddeven) || $tr_oddeven == 'even') $tr_oddeven = 'odd'; else $tr_oddeven = 'even'; ?>
<tr class="<?php echo $tr_oddeven ?>">
<td>
<label>
<?php
$url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id );
$download_data = array(
'url' => $url,
'slug' => $download['slug'],
'nonce' => wp_create_nonce('install_plugin_' . $url),
'repository_id' => $repository_id
);
$disabled = $expired ||
(
$this->plugin_is_installed($download['name'], $download['slug'], $download['version']) &&
!$this->plugin_is_embedded_version($download['name'], $download['slug'])
) || WP_Installer()->dependencies->cant_download( $repository_id );
?>
<input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode($download_data)); ?>" <?php
if($disabled): ?>disabled="disabled"<?php endif; ?> />&nbsp;
</label>
</td>
<td class="installer_plugin_name"><?php echo $download['name'] ?></td>
<td><?php echo $download['version'] ?></td>
<td class="installer_version_installed">
<?php if($v = $this->plugin_is_installed($download['name'], $download['slug'])):
$class = version_compare($v, $download['version'], '>=') ? 'installer-green-text' : 'installer-red-text'; ?>
<span class="<?php echo $class ?>"><?php echo $v; ?></span>
<?php endif; ?>
</td>
<td class="twelve">
<div class="installer-status-downloading"><?php _e('downloading...', 'installer') ?></div>
<div class="installer-status-downloaded" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('downloaded', 'installer') ?></div>
</td>
<td class="twelve">
<div class="installer-status-activating"><?php _e('activating', 'installer') ?></div>
<div class="installer-status-activated"><?php _e('activated', 'installer') ?></div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if( !WP_Installer()->dependencies->is_uploading_allowed() ): ?>
<p class="installer-error-box"><?php printf(__('Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer'),
'<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>') ?></p>
<?php elseif( WP_Installer()->dependencies->is_win_paths_exception($repository_id) ): ?>
<p><?php echo WP_Installer()->dependencies->win_paths_exception_message() ?></p>
<?php endif;?>
<br />
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Download', 'installer') ?>" disabled="disabled" />
&nbsp;
<label><input name="activate" type="checkbox" value="1" disabled="disabled" />&nbsp;<?php _e('Activate after download', 'installer') ?></label>
<div class="installer-download-progress-status"></div>
<div class="installer-status-success"><?php _e('Operation complete!', 'installer') ?></div>
<span class="installer-revalidate-message hidden"><?php _e("Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again.", 'installer') ?></span>
</form>

View File

@@ -0,0 +1,94 @@
<form method="post" class="otgsi_downloads_form">
<?php
use OTGS\Installer\CommercialTab\DownloadFilter;
use OTGS\Installer\CommercialTab\DownloadsList;
$sections = $this->get_plugins_sections( $repository_id, $package['downloads'] );
if ( count( $sections ) === 1 ) {
?>
<div class="installer-table-wrap">
<table class="widefat installer-plugins">
<thead>
<tr>
<th>&nbsp;</th>
<th><?php _e( 'Plugin', 'installer' ) ?></th>
<th><?php _e( 'Installed', 'installer' ) ?></th>
<th><?php _e( 'Current', 'installer' ) ?></th>
<th><?php _e( 'Released', 'installer' ) ?></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody><?php
foreach ( reset( $sections )['downloads'] as $download_id => $download ) {
if ( DownloadFilter::shouldDisplayRecord($download_id)) {
echo DownloadsList::getDownloadRow( $download_id, $download, $site_key, $repository_id );
}
}
?>
</tbody>
</table>
</div><?php
} else {
foreach ( $sections as $section ) {
if ( ! empty( $section['downloads'] ) ) {
?>
<div class="installer-table-wrap">
<table class="widefat installer-plugins">
<thead>
<tr>
<th colspan="9"><strong><?php echo $section['name'] ?></strong></th>
</tr>
<tr>
<th>&nbsp;</th>
<th><?php _e( 'Plugin', 'installer' ) ?></th>
<th><?php _e( 'Installed', 'installer' ) ?></th>
<th><?php _e( 'Current', 'installer' ) ?></th>
<th><?php _e( 'Released', 'installer' ) ?></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody><?php
foreach ( $section['downloads'] as $download_id => $download ) {
if ( DownloadFilter::shouldDisplayRecord($download_id)) {
echo DownloadsList::getDownloadRow( $download_id, $download, $site_key, $repository_id );
}
}
?>
</tbody>
</table>
</div><?php
}
}
}
?>
<br/>
<div class="installer-error-box">
<?php if ( ! WP_Installer()->dependencies->is_uploading_allowed() ): ?>
<p><?php printf( __( 'Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer' ),
'<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>' ) ?></p>
<?php elseif ( WP_Installer()->dependencies->is_win_paths_exception( $repository_id ) ): ?>
<p><?php echo WP_Installer()->dependencies->win_paths_exception_message() ?></p>
<?php endif; ?>
</div>
<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Download', 'installer' ) ?>"
disabled="disabled"/>
&nbsp;
<label><input name="activate" type="checkbox" value="1"
disabled="disabled"/>&nbsp;<?php _e( 'Activate after download', 'installer' ) ?></label>
<div class="installer-download-progress-status"></div>
<div class="installer-status-success"><?php _e( 'Operation complete!', 'installer' ) ?></div>
<span class="installer-revalidate-message hidden"><?php _e( "Download failed!\n\nPlease refresh the page and try again.", 'installer' ) ?></span>
</form>

View File

@@ -0,0 +1,9 @@
<tr class="<?php echo esc_attr( $model->css->tr_classes ); ?>">
<td colspan="<?php echo esc_attr( $model->col_count ); ?>" class="plugin-update colspanchange">
<div class="<?php echo esc_attr( $model->css->notice_classes ); ?>">
<p class="installer-q-icon">
<?php echo wp_kses_post( $model->strings->valid_subscription ); ?>
</p>
</div>
</td>
</tr>

View File

@@ -0,0 +1,71 @@
<div class="otgs-installer-component-setting" data-has-setting="<?php echo esc_attr( $model->has_setting ); ?>">
<span class="spinner otgs-components-report-setting-spinner"></span>
<ul>
<li>
<label for="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>-yes">
<input
type="radio"
<?php if ( $model->has_setting && $model->is_repo_allowed ) { ?>
checked="checked"
<?php } ?>
id="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>-yes"
class="js-otgs-components-report-user-choice"
value="1"
name="otgs-components-report-user-choice"
data-nonce-action="<?php echo esc_attr( $model->nonce->action ); ?>"
data-nonce-value="<?php echo esc_attr( $model->nonce->value ); ?>"
data-repo="<?php echo esc_attr( $model->repo ); ?>"
/>
<?php
if ( isset( $model->custom_radio_label_yes ) && $model->custom_radio_label_yes !== null ) {
echo wp_kses_post( $model->custom_radio_label_yes );
} else {
echo wp_kses_post( $model->strings->radio_report_yes );
}
?>
</label>
</li>
<li>
<label for="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>-no">
<input
type="radio"
<?php if ( $model->has_setting && ! $model->is_repo_allowed ) { ?>
checked="checked"
<?php } ?>
id="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>-no"
class="js-otgs-components-report-user-choice"
value="0"
name="otgs-components-report-user-choice"
data-nonce-action="<?php echo esc_attr( $model->nonce->action ); ?>"
data-nonce-value="<?php echo esc_attr( $model->nonce->value ); ?>"
data-repo="<?php echo esc_attr( $model->repo ); ?>"
/>
<?php
if ( isset( $model->custom_radio_label_no ) && $model->custom_radio_label_no !== null ) {
echo wp_kses_post( $model->custom_radio_label_no );
} else {
echo wp_kses_post( $model->strings->radio_report_no );
}
?>
</label>
</li>
</ul>
<p class="otgs-installer-component-privacy-policy">
<a
href="<?php echo esc_url( $model->privacy_policy_url ); ?>"
target="_blank"
rel="noopener"
class="otgs-external-link"
>
<?php
if ( isset( $model->custom_privacy_policy_text ) && $model->custom_privacy_policy_text !== null ) {
echo wp_kses_post( $model->custom_privacy_policy_text );
} else {
echo wp_kses_post( $model->privacy_policy_text );
}
?>
</a>
</p>
</div>

View File

@@ -0,0 +1,59 @@
<div class="otgs-installer-component-setting" data-has-setting="<?php echo esc_attr( $model->has_setting ); ?>">
<?php
if ( isset( $model->custom_raw_heading ) && $model->custom_raw_heading !== null ) {
echo wp_kses_post( $model->custom_raw_heading );
} else {
?>
<h4 class="heading"><?php echo wp_kses_post( $model->strings->heading ); ?>
<a
href="<?php echo esc_url( $model->company_url ); ?>"
target="_blank"
rel="noopener"
class="otgs-external-link"
><?php echo wp_kses_post( $model->company_site ); ?></a>
</h4>
<?php } ?>
<input
type="checkbox"
<?php if ( $model->is_repo_allowed ) { ?>
checked="checked"
<?php } ?>
id="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>"
class="js-otgs-components-report-user-choice otgs-switcher-input"
value="1"
data-nonce-action="<?php echo esc_attr( $model->nonce->action ); ?>"
data-nonce-value="<?php echo esc_attr( $model->nonce->value ); ?>"
data-repo="<?php echo esc_attr( $model->repo ); ?>"
/>
<label for="<?php echo esc_attr( $model->nonce->action . $model->nonce->value ); ?>"
class="otgs-switcher wpml-theme"
data-on="ON"
data-off="OFF"
>
<?php
if ( isset( $model->custom_raw_label ) && $model->custom_raw_label !== null ) {
echo wp_kses_post( $model->custom_raw_label );
} else {
echo wp_kses_post( $model->strings->report_to . ' ' . $model->company_site . ' ' . $model->strings->which_theme_and_plugins );
}
?>
</label>
<div class="spinner otgs-components-report-setting-spinner"></div>
<p>
<a
href="<?php echo esc_url( $model->privacy_policy_url ); ?>"
target="_blank"
rel="noopener"
class="otgs-external-link"
>
<?php
if ( isset( $model->custom_privacy_policy_text ) && $model->custom_privacy_policy_text !== null ) {
echo wp_kses_post( $model->custom_privacy_policy_text );
} else {
echo wp_kses_post( $model->privacy_policy_text );
}
?>
</a>
</p>
</div>

View File

@@ -0,0 +1,14 @@
<tr>
<th>
<span><?php echo wp_kses_post( $model->strings->instances->path ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->instances->version ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->instances->high_priority ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->instances->delegated ); ?></span>
</th>
</tr>

View File

@@ -0,0 +1,17 @@
<tr>
<th>
<span><?php echo wp_kses_post( $model->strings->log->request_url ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->log->request_arguments ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->log->response ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->log->component ); ?></span>
</th>
<th>
<span><?php echo wp_kses_post( $model->strings->log->time ); ?></span>
</th>
</tr>

View File

@@ -0,0 +1,116 @@
<div class="wrap">
<h1><?php echo wp_kses_post( $model->strings->page_title ); ?></h1>
<div class="otgs-installer-support-test-connection">
<h2><?php echo wp_kses_post( $model->strings->tester->title ); ?> <a class="button check-again"><?php echo wp_kses_post( $model->strings->tester->button_label ); ?></a></h2>
<ul><?php foreach ( $model->tester->endpoints as $endpoint ) { ?>
<li class="endpoint" data-repository="<?php echo esc_attr( $endpoint->repository ); ?>" data-type="<?php echo esc_attr( $endpoint->type ); ?>"><span class="dashicons dashicons-yes status"></span> <?php echo esc_attr( $endpoint->description ); ?></li>
<?php } ?>
</ul>
<?php echo wp_kses_post( $model->tester->nonce ); ?>
<span class="wp-clearfix"></span>
</div>
<hr>
<div class="otgs-installer-support-test-connection">
<h2><?php echo wp_kses_post( $model->strings->requirements->title ); ?></h1></h2>
<ul>
<?php foreach ( $model->requirements as $requirement ) {
$icon_class = $requirement->active ? 'dashicons-yes' : 'dashicons-no-alt';
?>
<li><span class="dashicons <?php echo esc_attr( $icon_class ); ?> status"></span> <?php echo wp_kses_post( $requirement->name ) ?></li>
<?php } ?>
</ul>
<span class="wp-clearfix"></span>
</div>
<hr>
<h2><?php echo wp_kses_post( $model->strings->instances->title ); ?></h2>
<table class="wp-list-table widefat striped installer-instances">
<thead>
<?php include 'header-instance.php'; ?>
</thead>
<tbody>
<?php foreach ( $model->instances as $instance ) { ?>
<tr <?php if ( $instance->delegated ) { ?> class="active" <?php } ?>>
<td>
<?php echo wp_kses_post( $instance->bootfile ); ?>
</td>
<td>
<?php echo wp_kses_post( $instance->version ); ?>
</td>
<td>
<?php echo wp_kses_post( $instance->high_priority ); ?>
</td>
<td>
<?php if ( $instance->delegated ) { ?> <span class="dashicons dashicons-yes"></span> <?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php include 'header-instance.php'; ?>
</tfoot>
</table>
<br>
<hr>
<h2><?php echo wp_kses_post( $model->strings->log->title ); ?></h2>
<table class="wp-list-table widefat fixed striped posts">
<thead>
<?php include 'header.php'; ?>
</thead>
<tbody id="the-list">
<?php foreach ( $model->log_entries as $log_entry ) { ?>
<tr>
<td class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( $log_entry->request_url ); ?>
</td>
<td class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( print_r( $log_entry->request_arguments, true ) ); ?>
</td>
<td class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( $log_entry->response ); ?>
</td>
<td class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( $log_entry->component ); ?>
</td>
<td class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( $log_entry->time ); ?>
</td>
</tr>
<?php } ?>
<?php if ( !$model->log_entries ) { ?>
<tr>
<td colspan="5" class="title column-title has-row-actions column-primary">
<?php echo wp_kses_post( $model->strings->log->empty_log ); ?>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php include 'header.php'; ?>
</tfoot>
</table>
</div>

View File

@@ -0,0 +1,11 @@
<div class="wrap otgs-installer-support-link">
<?php
if ( !$model->hide_title ) {
?>
<h2><?php echo wp_kses_post( $model->title ); ?></h2>
<?php
}
?>
<p><a href="<?php echo esc_url ($model->link->url ); ?>"><?php echo wp_kses_post( $model->link->text ); ?></a></p>
</div>

View File

@@ -0,0 +1,147 @@
<h3><?php echo $args['box_title'] ?></h3>
<?php
if(empty($args['repository']) || empty($args['package']) || empty($args['product'])){
echo __('Incorrect setup', 'installer');
return;
}
$product = false;
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package_idx => $package){
//pre 1.3 backwardds compatibility
if(!isset($package['id'])){
$package['id'] = sanitize_title_with_dashes($package['name']);
}
if($package['id'] == $args['package']){
$product = $this->settings['repositories'][$repository_id]['data']['packages'][$package_idx]['products'][$args['product']];
break;
}
}
if(!$product){
echo __('Invalid product', 'installer');
return;
}
if(isset($this->settings['repositories'][$repository_id])){
if(isset($this->settings['repositories'][$repository_id]['subscription']['key'])){
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
}else{
$site_key = false;
}
}else{
echo __('Unknown repository', 'installer');
return;
}
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
$expired = false;
if($subscription_type != $product['subscription_type'] && !$this->have_superior_subscription($subscription_type, $product) && $site_key){
$subscription_no_match = sprintf(__(' Your current site key (%s) does not match the selected product (%s).', 'installer'), $site_key, $product['name']);
}
if(!isset($args['product_name'])) $args['product_name'] = $product['name'];
?>
<div class="otgs_wp_installer_table otgs_wp_installer_table_compact">
<p><?php echo $args['box_description'] ?></p>
<?php if(!$this->repository_has_subscription($repository_id) || !empty($subscription_no_match)): ?>
<?php if(!empty($subscription_no_match)): ?>
<div class="installer-warn-box">
<?php echo $subscription_no_match; ?>
</div>
<br />
<?php endif; ?>
<a class="button-primary" href="<?php echo $this->append_parameters_to_buy_url($product['url'], $repository_id, $args) ?>"><?php printf(__('Buy %s', 'installer'), $args['product_name']) ?></a>
<div>
<br />
<?php printf(__('Already bought %s?', 'installer'), $args['product_name']) ?>
<a class="enter_site_key_js<?php if( WP_Installer::get_repository_hardcoded_site_key( $repository_id ) ): ?> disabled<?php endif ?>" href="#"
<?php if( WP_Installer::get_repository_hardcoded_site_key( $repository_id ) ): ?>
style="cursor: help"
disabled="disabled"
title="<?php printf( esc_attr__("Site-key was set by %s, most likely in wp-config.php. Please remove the constant before attempting to register.", 'installer'), 'OTGS_INSTALLER_SITE_KEY_' . strtoupper($repository_id) ) ?>"
<?php endif; ?>
>
<?php _e('Enter site key', 'installer') ?>
</a>&nbsp;&nbsp;
<form class="otgsi_site_key_form" method="post">
<input type="hidden" name="action" value="save_site_key" />
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
<input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
<input type="text" size="10" name="site_key_<?php echo $repository_id ?>" />
<input class="button-secondary" type="submit" value="<?php esc_attr_e('Add', 'installer') ?>" />
</form>
<div class="installer-error-box hidden" style="margin-top:10px;"></div>
</div>
<?php else: ?>
<?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
<div><p class="installer-warn-box"><?php _e('Subscription is expired.', 'installer') ?></p></div>
<?php else: ?>
<?php if($this->show_subscription_renew_warning($repository_id, $subscription_type)): ?>
<ul class="installer-products-list">
<?php foreach($product['renewals'] as $renewal): ?>
<li>
<a href="<?php echo $this->append_parameters_to_buy_url($renewal['url'], $repository_id, $args) ?>"><?php printf(__('Renew %s', 'installer'), $args['product_name']) ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
<center>
<a class="remove_site_key_js" href="#" data-repository=<?php echo $repository_id ?>
data-confirmation="<?php esc_attr_e('Are you sure you want to remove this site key?', 'installer') ?>"
data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"
<?php if( WP_Installer::get_repository_hardcoded_site_key( $repository_id ) ): ?>
style="cursor: help;color:#999999"
disabled="disabled"
title="<?php printf( esc_attr__("Site-key was set by %s, most likely in wp-config.php. Please remove the constant before attempting to unregister.", 'installer'), 'OTGS_INSTALLER_SITE_KEY_' . strtoupper($repository_id) ) ?>"
<?php endif; ?>
>
<?php printf(__("Remove current site key (%s)", 'installer'), $site_key) ?>
</a>
</center>
<br />
<?php include $this->plugin_path() . '/templates/downloads-list-compact.php'; ?>
<?php endif; ?>
<?php
if( isset( $args[ 'name' ] ) ):
$support_link = $this->get_support_tag_by_name($args['name'], $args['repository']); ?>
<?php if($support_link): ?>
<p><a href="<?php echo $support_link ?>" target="_blank"><?php printf(__('%s support on wpml.org', 'installer'), $args['name'] ) ?></a></p>
<?php endif; ?>
<?php
// compatibility for installer 1.1
elseif( isset( $args[ 'support_link' ] ) ): ?>
<p><?php echo $args[ 'support_link' ]; ?></p>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,99 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class EndUsers {
public static function render( $withProduct, $model ) {
$withSiteName = function ( $str ) use ( $model ) {
$siteUrl = $model->productName === 'WPML' ? 'wpml.org' : 'toolset.com';
return sprintf( $str, $siteUrl );
};
$withProductTwice = function ( $str ) use ( $model ) {
return sprintf( $str, $model->productName, $model->productName );
};
// translators: %s replaced with wpml.org or toolset.com
$accountQuestion = $withSiteName( __( 'Do you have an account on %s?', 'installer' ) );
$extendInfo = __( 'Great! You just need to extend your subscription.', 'installer' );
// translators: %s replaced with wpml.org or toolset.com
$extendAlternative = $withProduct( __( 'You have a %s account. You just need to extend your subscription.', 'installer' ) );
$extendButton = __( 'Extend Subscription', 'installer' );
// translators: %s replaced with wpml.org or toolset.com
$discountQuestion = $withProduct( __( 'OK. You need to set up renewal for %s.', 'installer' ) );
// translators: %1$s and %2$s replaced with wpml.org or toolset.com
$discountAlternative = $withProductTwice( __( 'You do not have a %1$s account yet. You need to set up a renewal for %2$s.', 'installer' ) );
// translators: %s replaced with wpml.org or toolset.com
$discountButton = $withProduct( __( 'Set Up Renewal For %s', 'installer' ) );
$findAccountInfo = __( 'No worries. We can check that for you.', 'installer' );
$findAccountButton = __( 'Check', 'installer' );
$findAccountPlaceholder = __( 'Your Email Address', 'installer' );
if ( $model->endUserRenewalUrl ): ?>
<div class="js-question">
<p class="otgs-installer-notice-status-item"><?php echo esc_html( $accountQuestion ); ?></p>
<a class="js-yes-button otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="">
<?php esc_html_e( 'Yes', 'installer' ); ?>
</a>
<a class="js-no-button otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="">
<?php esc_html_e( 'No', 'installer' ); ?>
</a>
<a class="js-dont-know otgs-installer-notice-status-item otgs-installer-notice-status-item-link"
href="">
<?php esc_html_e( 'I do not remember', 'installer' ); ?>
</a>
</div>
<div class="js-yes-section" style="display: none;">
<p class="otgs-installer-notice-status-item"
data-alternative="<?php echo esc_html( $extendAlternative ); ?>"
>
<?php echo esc_html( $extendInfo ); ?>
</p>
<a class="otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="<?php echo esc_url( $model->productUrl . '/account' ); ?>"
>
<?php echo esc_html( $extendButton ); ?>
</a>
</div>
<div class="js-no-section" style="display: none;">
<p class="otgs-installer-notice-status-item"
data-alternative="<?php echo esc_html( $discountAlternative ); ?>"
>
<?php echo esc_html( $discountQuestion ); ?>
</p>
<a class="otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="<?php echo esc_url( $model->endUserRenewalUrl . '&token=' . $model->siteKey ); ?>">
<?php echo esc_html( $discountButton ); ?>
</a>
</div>
<div class="js-find-account-section" style="display: none;">
<p class="otgs-installer-notice-status-item"><?php echo esc_html( $findAccountInfo ); ?></p>
<div class="otgs-installer-notice-status-item-wrapper">
<input type="text"
placeholder="<?php echo esc_attr( $findAccountPlaceholder ); ?>"/>
<a class="js-find-account otgs-installer-notice-status-item otgs-installer-notice-status-item-btn btn-disabled"
href=""
data-repository="<?php echo $model->repoId ?>"
data-nonce="<?php echo $model->findAccountNonce ?>"
>
<?php echo esc_html( $findAccountButton ); ?>
</a>
</div>
</div>
<?php else: ?>
<div class="js-yes-section">
<a class="otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="<?php echo esc_url( $model->productUrl . '/account' ); ?>"
>
<?php echo esc_html( $extendButton ); ?>
</a>
</div>
<?php
endif;
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class Expired {
public static function render( $model ) {
$withProduct = function ( $str ) use ( $model ) {
return sprintf( $str, $model->productName );
};
$title = $withProduct( __( 'You are using an expired account of %s.', 'installer' ) );
$into = __( 'It means you will not receive updates. This can lead to stability and even security issues.', 'installer' );
$renew = __( 'Have you already renewed your license?', 'installer' );
$refresh = __( 'Refresh account status', 'installer' );
?>
<div class="otgs-installer-registered otgs-installer-expired clearfix">
<div class="notice inline otgs-installer-notice otgs-installer-notice-expired otgs-installer-notice-expired-gd">
<div class="otgs-installer-notice-content">
<div class="otgs-installer-notice-content__one">
<h2><?php echo esc_html( $title ); ?></h2>
<p><?php echo esc_html( $into ); ?></p>
<div class="otgs-installer-notice-status">
<?php
EndUsers::render( $withProduct, $model );
RegisteredButtons::render( $model );
?>
</div>
</div>
<div class="otgs-installer-notice-content__two">
<h3><?php echo esc_html( $renew ); ?></h3>
<a class="update_site_key_js"
href="#"
data-repository="<?php echo $model->repoId ?>"
data-nonce="<?php echo $model->updateSiteKeyNonce ?>"
><?php echo esc_html( $refresh ); ?></a>
</div>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class LegacyFree {
public static function render( $model ) {
$url = $model->productUrl . '/buy/';
$linkMessage = __( 'Upgrade your account', 'installer' );
$link = '<a href="' . esc_url( $url ) . '">' . esc_html( $linkMessage ) . '</a>';
$message = sprintf( __( 'You have an old Types-free subscription, which doesn\'t provide automatic updates. %s', 'installer' ), $link );
?>
<div class="otgs-installer-registered wp-clearfix">
<div class="notice inline otgs-installer-notice otgs-installer-notice-registered otgs-installer-notice-<?php echo $model->repoId; ?>">
<div class="otgs-installer-notice-content">
<?php echo $message ?>
<?php \OTGS\Installer\Templates\Repository\RegisteredButtons::render( $model ); ?>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,151 @@
<?php if((!$this->repository_has_subscription($repository_id) && $match = $this->get_matching_cp($repository)) && $match['exp']): ?>
<p class="alignright installer_highlight"><strong><?php printf('Price offers available until %s', date_i18n(get_option( 'date_format' ), $match['exp'])) ?></strong></p>
<?php endif; ?>
<h3 id="repository-<?php echo $repository_id ?>"><?php echo $repository['data']['name'] ?></h3>
<?php
$getWhenSubscriptionExpires = function ( $repository ) { return $repository['subscription']['data']->expires; };
$model = (object) [
'repoId' => $repository_id,
'productName' => $repository['data']['product-name'],
'productUrl' => $repository['data']['url'],
'siteUrl' => $this->get_installer_site_url( $repository_id ),
'siteKeysManagementUrl' => $repository['data']['site_keys_management_url'],
'updateSiteKeyNonce' => wp_create_nonce( 'update_site_key_' . $repository_id ),
'saveSiteKeyNonce' => wp_create_nonce( 'save_site_key_' . $repository_id ),
'removeSiteKeyNonce' => wp_create_nonce( 'remove_site_key_' . $repository_id ),
'findAccountNonce' => wp_create_nonce( 'find_account_' . $repository_id ),
'whenExpires' => \OTGS\Installer\FP\partial( $getWhenSubscriptionExpires, $repository ),
'expired' => false,
'displayCheckForUpdates' => true,
'siteKey' => WP_Installer_API::get_site_key( $repository_id ),
'endUserRenewalUrl' => $this->get_end_user_renewal_url( $repository_id ),
];
?>
<table class="widefat otgs_wp_installer_table" id="installer_repo_<?php echo $repository_id ?>">
<tr>
<td class="otgsi_register_product_wrap" colspan="2">
<?php
if ( ! $this->repository_has_subscription( $repository_id ) ) {
\OTGS\Installer\Templates\Repository\Register::render( $model );
$site_key = false;
} else {
$site_key = $repository['subscription']['key'];
$subscription_type = $this->get_subscription_type_for_repository( $repository_id );
$upgrade_options = $this->get_upgrade_options( $repository_id );
if ( $this->repository_has_expired_subscription( $repository_id ) ) {
$model->expired = true;
\OTGS\Installer\Templates\Repository\Expired::render( $model );
} else if ( $this->repository_has_refunded_subscription( $repository_id ) ) {
$model->expired = true;
$model->shouldDisplayUnregisterLink = $this->should_display_unregister_link_on_refund_notice();
\OTGS\Installer\Templates\Repository\Refunded::render( $model );
} else if ( $this->repository_has_legacy_free_subscription( $repository_id ) ) {
$model->displayCheckForUpdates = false;
\OTGS\Installer\Templates\Repository\LegacyFree::render( $model );
} else {
$this->show_subscription_renew_warning( $repository_id, $subscription_type );
\OTGS\Installer\Templates\Repository\Registered::render( $model );
}
}
?>
</td>
</tr>
<?php
$subscription_type = isset($subscription_type) ? $subscription_type : null;
$upgrade_options = isset($upgrade_options) ? $upgrade_options : null;
$packages = $this->_render_product_packages($repository['data']['packages'], $subscription_type, $model->expired, $upgrade_options, $repository_id);
if(empty($subscription_type) || $model->expired){
$subpackages_expandable = true;
}else{
$subpackages_expandable = false;
}
?>
<?php foreach($packages as $package): ?>
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
<td class="installer-repository-image"><img width="140" src="<?php echo $package['image_url'] ?>" /></td>
<?php if ( ! $model->expired ): ?>
<td>
<p><strong><?php echo $package['name'] ?></strong></p>
<p><?php echo $package['description'] ?></p>
<?php if ( $package['products'] ): ?>
<?php foreach ( $package['products'] as $product ):
if ( $product['shouldDisplay'] ):?>
<ul class="installer-products-list" style="display:inline">
<li>
<a class="button-secondary"
href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
</li>
</ul>
<?php endif;
endforeach; ?>
<?php endif; ?>
<?php
if ( $package['downloads'] ) {
WP_Installer_Channels()->load_channel_selector( $repository_id, $package['downloads'] );
include $this->plugin_path() . '/templates/downloads-list.php';
}
?>
<?php if(!empty($package['sub-packages'])): ?>
<?php $subpackages = $this->_render_product_packages($package['sub-packages'], $subscription_type, $model->expired, $upgrade_options, $repository_id); ?>
<?php if($subpackages): ?>
<?php if($subpackages_expandable): ?>
<h5><a class="installer_expand_button" href="#" title="<?php esc_attr_e('Click to see individual components options.', 'installer') ?>"><?php _e('Individual components', 'installer') ?></a></h5>
<?php endif; ?>
<table class="otgs_wp_installer_subtable" style="<?php if($subpackages_expandable) echo 'display:none' ?>">
<?php foreach($subpackages as $package): ?>
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
<td><img width="70" height="70" src="<?php echo $package['image_url'] ?>" /></td>
<td>
<p><strong><?php echo $package['name'] ?></strong></p>
<p><?php echo $package['description'] ?></p>
<?php if($package['products']): ?>
<?php foreach($package['products'] as $product): ?>
<ul class="installer-products-list" style="display:inline">
<li>
<a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
</li>
</ul>
<?php endforeach; ?>
<?php endif; ?>
<?php if($package['downloads']): ?>
<?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
<p><i><?php printf(__('This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this.', 'installer'), '<a href="' . admin_url('plugins.php') . '">' , '</a>'); ?></i></p>
<br />

View File

@@ -0,0 +1,45 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class Refunded {
public static function render( $model ) {
$withProduct = function ( $str ) use ( $model ) {
return sprintf( $str, $model->productName );
};
$title = sprintf( __( 'Remember to remove %s from this website.', 'installer' ), $model->productName );
$into = sprintf( __( 'This site is using %s plugin, which is not paid for. After receiving a refund, you should remove this plugin from your sites. Using unregistered plugins means that you are not receiving stability and security updates and will ultimately lead to problems running the site.', 'installer' ), $model->productName );
$buyQuestion = __( 'Bought again?', 'installer' );
$buyButton = __( 'Check my order status', 'installer' );
?>
<div class="otgs-installer-registered otgs-installer-expired clearfix">
<div class="notice inline otgs-installer-notice otgs-installer-notice-refund">
<div class="otgs-installer-notice-content">
<h2><?php echo esc_html( $title ); ?></h2>
<p><?php echo esc_html( $into ); ?></p>
<div class="otgs-installer-notice-status">
<p class="otgs-installer-notice-status-item"><?php echo esc_html( $buyQuestion ); ?></p>
<a class="update_site_key_js otgs-installer-notice-status-item otgs-installer-notice-status-item-btn"
href="#"
data-repository="<?php echo $model->repoId ?>"
data-nonce="<?php echo $model->updateSiteKeyNonce ?>"
>
<?php echo esc_html( $buyButton ); ?>
</a>
</div>
<div class="otgs-installer-notice-status">
<?php
EndUsers::render( $withProduct, $model );
if ( $model->shouldDisplayUnregisterLink ) {
RegisteredButtons::render( $model );
}
?>
</div>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class Register {
public static function render( $model ) {
?>
<div class="otgs-installer-registered clearfix">
<div class="enter_site_key_wrap_js otgs-installer-notice-info inline otgs-installer-notice otgs-installer-notice-<?php echo $model->repoId; ?>"
xmlns="http://www.w3.org/1999/html">
<div class="otgs-installer-notice-content">
<h2>
<?php echo esc_html( sprintf( __( 'Already purchased %s?', 'installer' ), $model->productName ) ); ?>
<a class="enter_site_key_js otgs-installer-notice-link-register"
href="#"
<?php
if ( \WP_Installer::get_repository_hardcoded_site_key( $model->repoId ) ): ?>
disabled
title="<?php printf( esc_attr__( "Site-key was set by %s, most likely in wp-config.php. Please remove the constant before attempting to register.", 'installer' ), 'OTGS_INSTALLER_SITE_KEY_' . strtoupper( $model->repoId ) ) ?>"
<?php endif; ?>
>
<?php printf( __( 'Register %s', 'installer' ), $model->productName ); ?>
</a>
</h2>
</div>
</div>
</div>
<?php
echo self::getRegistrationForm($model);
}
private static function getRegistrationForm( $model ) {
$registrationText = sprintf(
__( 'Enter the site key, from your %1$s account, to receive automatic updates for %2$s.', 'installer' ),
self::removeScheme( $model->productUrl ),
$model->productName
);
return '<form class="otgsi_site_key_form" method="post">
<input type="hidden" name="action" value="save_site_key"/>
<input type="hidden" name="nonce" value="' . esc_attr( $model->saveSiteKeyNonce ) . '"/>
<input type="hidden" name="repository_id" value="' . esc_attr( $model->repoId ) . '">
<h3 class="otgs-installer-register-title">Register ' . esc_html( $model->productName ) . '</h3>
<p class="otgs-installer-register-info">' . esc_html( $registrationText ) . '</p>
<div class="otgs-installer-register-inputs">
<label for="site_key_' . esc_attr( $model->repoId ) . '">' . esc_html( __( 'Site key', 'installer' ) ) . '</label>
<input type="text" size="20" name="site_key_' . esc_attr( $model->repoId ) . '" id="site_key_' . esc_attr( $model->repoId ) . '"/>
<input class="button-primary" type="submit" value="' . esc_attr__( 'Register', 'installer' ) . '" />
</div>
<p class="otgs-installer-register-link"><a target="_blank" rel="nofollow" href="' . esc_url( self::getAccountUrl( $model ) ) . '">' . esc_html( __( 'Get a key for this site', 'installer' ) ) . '</a></p>
<div class="installer-error-box hidden"></div>
</form>';
}
private static function removeScheme( $str ) {
return str_replace( [ 'https://', 'http://' ], '', $str );
}
/**
* @param $model
*
* @return string
*/
private static function getAccountUrl( $model ) {
return apply_filters(
'otgs_installer_add_site_url',
$model->siteKeysManagementUrl . '?add=' . urlencode( $model->siteUrl ),
$model->repoId
);
}
/**
* @param $model
*
* @return string
*/
private static function getRegisterLink( $model ) {
$buttonText = sprintf( esc_attr( 'register on %s.', 'installer' ), self::removeScheme( $model->productUrl ) );
ob_start();
?>
<a target="_blank" rel="nofollow"
href="<?php echo esc_url( $model->productUrl ); ?>"><?php echo $buttonText ?></a>
<?php
return trim( ob_get_clean() );
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class RegisteredButtons {
public static function render( $model ) {
$disabled = '';
$title = '';
if ( \WP_Installer::get_repository_hardcoded_site_key( $model->repoId ) ) {
$disabled = 'disabled';
$title = 'title="' . sprintf( esc_attr__( "Site-key was set by %s, most likely in wp-config.php. Please remove the constant before attempting to unregister.", 'installer' ), 'OTGS_INSTALLER_SITE_KEY_' . strtoupper( $model->repoId ) ) . '"';
}
?>
<a class="remove_site_key_js otgs-installer-notice-status-item otgs-installer-notice-status-item-link-unregister"
data-repository="<?php echo $model->repoId ?>"
data-confirmation="<?php esc_attr_e( 'Are you sure you want to unregister?', 'installer' ) ?>"
data-nonce="<?php echo $model->removeSiteKeyNonce ?>"
<?php echo $disabled; ?>
<?php echo $title; ?>
>
<?php printf( __( "Unregister %s from this site", 'installer' ), $model->productName ) ?>
</a>&nbsp;
<?php if ( ! $model->expired && $model->displayCheckForUpdates ): ?>
<a class="update_site_key_js otgs-installer-notice-status-item-btn"
data-repository="<?php echo $model->repoId ?>"
data-nonce="<?php echo $model->updateSiteKeyNonce; ?>"
>
<?php _e( 'Check for updates', 'installer' ); ?>
</a>
<?php endif; ?>
<?php
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace OTGS\Installer\Templates\Repository;
class Registered {
public static function render( $model ) {
$expires = call_user_func( $model->whenExpires );
$message = $expires ?
sprintf( __( '%s is registered on this site. You will receive automatic updates until %s', 'installer' ), $model->productName, date_i18n( 'F j, Y', strtotime( $expires ) ) ) :
sprintf( __( '%s is registered on this site. Your Lifetime account gives you updates for life.', 'installer' ), $model->productName );
?>
<div class="otgs-installer-registered wp-clearfix">
<div class="inline otgs-installer-notice otgs-installer-notice-confirm otgs-installer-notice-<?php echo $model->repoId; ?>">
<div class="otgs-installer-notice-content">
<?php echo esc_html( $message ) ?>
<?php \OTGS\Installer\Templates\Repository\RegisteredButtons::render( $model ); ?>
</div>
</div>
</div>
<?php
}
}