/home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php
if ($knuts >= $this->knutsToSickles) {
$sickles = floor($knuts / $this->knutsToSickles);
$knuts = $knuts - ($sickles * $this->knutsToSickles);
}
return [
'galleons' => $galleons,
'sickles' => $sickles,
'knuts' => $knuts,
];
}
public function wizardCurrencyString($currency)
{
$inflector = Inflector::get('en');
$stringParts = [];
if ($currency['galleons']) {
$galleonString = ($currency['galleons'] > 1)?$inflector->pluralize("Galleon"):"Galleon";
$stringParts[] = number_format($currency['galleons'], 0) . " {$galleonString}";
}
if ($currency['sickles']) {
$sickleString = ($currency['sickles'] > 1)?$inflector->pluralize("Sickle"):"Sickle";
$stringParts[] = number_format($currency['sickles'], 0) . " {$sickleString}";
}
if ($currency['knuts']) {
$knutString = ($currency['knuts'] > 1)?$inflector->pluralize("Knut"):"Knut";
$stringParts[] = number_format($currency['knuts'], 0) . " {$knutString}";
}
if (count($stringParts) > 1) {
$last = array_pop($stringParts);
if (count($stringParts) > 1) {
return implode(", ", $stringParts) . ", and " . $last;
}
return implode(", ", $stringParts) . " and " . $last;
}
return implode(", ", $stringParts);
}
public function convertCurrency($amount, $rates = null, $source = 'USD', $dest = 'GBP')
Arguments
"number_format(): Argument #1 ($num) must be of type int|float, string given"
/home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php
if ($knuts >= $this->knutsToSickles) {
$sickles = floor($knuts / $this->knutsToSickles);
$knuts = $knuts - ($sickles * $this->knutsToSickles);
}
return [
'galleons' => $galleons,
'sickles' => $sickles,
'knuts' => $knuts,
];
}
public function wizardCurrencyString($currency)
{
$inflector = Inflector::get('en');
$stringParts = [];
if ($currency['galleons']) {
$galleonString = ($currency['galleons'] > 1)?$inflector->pluralize("Galleon"):"Galleon";
$stringParts[] = number_format($currency['galleons'], 0) . " {$galleonString}";
}
if ($currency['sickles']) {
$sickleString = ($currency['sickles'] > 1)?$inflector->pluralize("Sickle"):"Sickle";
$stringParts[] = number_format($currency['sickles'], 0) . " {$sickleString}";
}
if ($currency['knuts']) {
$knutString = ($currency['knuts'] > 1)?$inflector->pluralize("Knut"):"Knut";
$stringParts[] = number_format($currency['knuts'], 0) . " {$knutString}";
}
if (count($stringParts) > 1) {
$last = array_pop($stringParts);
if (count($stringParts) > 1) {
return implode(", ", $stringParts) . ", and " . $last;
}
return implode(", ", $stringParts) . " and " . $last;
}
return implode(", ", $stringParts);
}
public function convertCurrency($amount, $rates = null, $source = 'USD', $dest = 'GBP')
/home/hplex/live/wp-content/themes/lexicon/currency.php
$context['current_currency'] = $converter->currencyForCountry();
if (data_get($_REQUEST, 'currency')) {
$context['current_currency'] = $_REQUEST['currency'];
}
if (data_get($_REQUEST, 'action') == 'muggle-to-wizard') {
$context['action'] = 'muggle-to-wizard';
$context['muggle'] = $_REQUEST['muggle'];
$context['results'] = $results = $converter->muggleToWizard($_REQUEST['muggle'], $context['current_currency'], $date);
$context['results_string'] = $converter->wizardCurrencyString($results);
$context['galleons'] = $results['galleons'];
$context['sickles'] = $results['sickles'];
$context['knuts'] = $results['knuts'];
} elseif (data_get($_REQUEST, 'action') == 'wizard-to-muggle') {
$context['action'] = 'wizard-to-muggle';
$context['galleons'] = data_get($_REQUEST, 'galleons');
$context['sickles'] = data_get($_REQUEST, 'sickles');
$context['knuts'] = data_get($_REQUEST, 'knuts');
$context['muggle'] = $converter->wizardToMuggle($context['galleons'], $context['sickles'], $context['knuts'], $context['current_currency'], $date);
$context['wizard_string'] = $converter->wizardCurrencyString([
'galleons' => $context['galleons'],
'sickles' => $context['sickles'],
'knuts' => $context['knuts']
]);
} elseif (data_get($_REQUEST, 'action') == 'general') {
$context['action'] = 'general';
try {
$context['muggle'] = $_REQUEST['muggle'];
$context['target_currency'] = $_REQUEST['target'];
if (!$converter->isWizardCurrency($context['current_currency']) && !$converter->isWizardCurrency($context['target_currency'])) {
throw new Exception("At least one of the currencies must be a Wizarding Currency.");
}
$context['result'] = $results = $converter->convertCurrency($context['muggle'], $context['rates'], $context['current_currency'], $context['target_currency']);
$context['target_currency_label'] = $currencies[$context['target_currency']];
if ($results != 1) {
$context['target_currency_label'] = $inflector->pluralize($currencies[$context['target_currency']]);
}
/home/hplex/live/www/wp-includes/template-loader.php
*/
$template = apply_filters( 'template_include', $template );
$is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
$template = $is_stringy ? realpath( (string) $template ) : null;
if (
is_string( $template ) &&
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&
is_file( $template ) &&
is_readable( $template )
) {
/**
* Fires immediately before including the template.
*
* @since 6.9.0
*
* @param string $template The path of the template about to be included.
*/
do_action( 'wp_before_include_template', $template );
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
Arguments
"/home/hplex/live/wp-content/themes/lexicon/currency.php"
/home/hplex/live/www/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
Arguments
"/home/hplex/live/www/wp-includes/template-loader.php"
/home/hplex/live/www/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
Arguments
"/home/hplex/live/www/wp-blog-header.php"