| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version 1.0 |
| 4 |
* @package Booking Calendar |
| 5 |
* @subpackage Translations Functions |
| 6 |
* @category Functions |
| 7 |
* |
| 8 |
* @author wpdevelop |
| 9 |
* @link https://wpbookingcalendar.com/ |
| 10 |
* @email info@wpbookingcalendar.com |
| 11 |
* |
| 12 |
* @modified 29.09.2015 |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} // Exit if accessed directly. |
| 18 |
|
| 19 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 20 |
|
| 21 |
class WPBC_Upgrader_Translation_Skin extends WP_Upgrader_Skin { |
| 22 |
|
| 23 |
function __construct( $args = array() ) { |
| 24 |
$defaults = array( |
| 25 |
'url' => '', |
| 26 |
'nonce' => '', |
| 27 |
'title' => '', |
| 28 |
'context' => false, |
| 29 |
); |
| 30 |
$this->options = wp_parse_args( $args, $defaults ); |
| 31 |
} |
| 32 |
|
| 33 |
function header() {} |
| 34 |
|
| 35 |
function footer() {} |
| 36 |
|
| 37 |
function error( $error ) { |
| 38 |
$this->installer_error = $error; |
| 39 |
} |
| 40 |
|
| 41 |
function add_strings() { |
| 42 |
$this->upgrader->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.', 'booking' ); |
| 43 |
$this->upgrader->strings['up_to_date'] = __( 'Your translations are all up to date.', 'booking' ); |
| 44 |
$this->upgrader->strings['no_package'] = __( 'Update package not available.', 'booking' ); |
| 45 |
/* translators: %s: Package URL. */ |
| 46 |
$this->upgrader->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s…', 'booking' ), '<span class="code">%s</span>' ); |
| 47 |
$this->upgrader->strings['unpack_package'] = __( 'Unpacking the update…', 'booking' ); |
| 48 |
$this->upgrader->strings['process_failed'] = __( 'Translation update failed.', 'booking' ); |
| 49 |
$this->upgrader->strings['process_success'] = __( 'Translation updated successfully.', 'booking' ); |
| 50 |
$this->upgrader->strings['remove_old'] = __( 'Removing the old version of the translation…', 'booking' ); |
| 51 |
$this->upgrader->strings['remove_old_failed'] = __( 'Could not remove the old translation.', 'booking' ); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
public function set_upgrader( &$upgrader ) { |
| 56 |
if ( is_object( $upgrader ) ) { |
| 57 |
$this->upgrader =& $upgrader; |
| 58 |
} |
| 59 |
$this->add_strings(); |
| 60 |
} |
| 61 |
|
| 62 |
function before() {} |
| 63 |
|
| 64 |
function after() { |
| 65 |
if ( ! empty( $this->installer_error ) ) { |
| 66 |
if ( is_wp_error( $this->installer_error ) ) { |
| 67 |
$message = $this->installer_error->get_error_message() . ' (' . $this->installer_error->get_error_data() . ')'; |
| 68 |
|
| 69 |
echo wp_kses_post( $message ); |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
} |
| 74 |
|