PHP Classes

How to Show the Dollar Exchange Rate using WordPress Currency Plugin: Plugin to show the exchange rates from BCB

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 21 All time: 11,272 This week: 524Up
Version License PHP version Categories
wp-plugin-dollar-exc 1.0The PHP License5PHP 5, Content management, Web services, F..., B...
Description 

Author

This package is specific mainly for applications used in Brazil Brazil .

This package provides a WordPress plugin to show the exchange rates from the Brazilian Central Bank.

It registers a WordPress shortcode that allows publishers that create WordPress blog posts and pages to make the exchange rate between the United States dollar and the Real Brazilian currency appear.

The package accesses the Brazillian Central Bank API to retrieve exchange rates and store the values in the WordPress database.

Innovation Award
PHP Programming Innovation award nominee
October 2022
Number 3
WordPress is a popular content management system written in PHP that allows developers to extend the types of the content inserted into a page using plugins provided by any developer.

This package provides a WordPress plugin that allows site publishers to insert the currency exchange rate between the United States dollar and the Real currency of Brazil.

Manuel Lemos
Picture of adriano123456
  Performance   Level  
Name: adriano123456 <contact>
Classes: 5 packages by
Country: Brazil Brazil
Age: 36
All time rank: 3516276 in Brazil Brazil
Week rank: 47 Up3 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
/*
  Plugin Name: Dollar Exchange
  Description: Plugin para exibir a cotação do dolar atualizada
  Version: 1.0
  Author: AdrianoScpace
  Author URI: http://adriano.space/
 */
add_action('admin_menu', 'exchange_on_menu');
register_activation_hook(__FILE__, 'exchange_on_activation');
register_deactivation_hook(__FILE__, 'exchange_on_deactivation');
register_uninstall_hook(__FILE__, 'exchange_on_uninstall');

foreach (
glob(plugin_dir_path(__FILE__) . 'path/*.php') as $file) {
    include_once
$file;
}

function
exchange_on_menu()
{
 
add_menu_page(
   
Configuration::getTitlePage(),
   
Configuration::getTitleMenu(),
   
'manage_options',
   
Configuration::getPluginName(),
   
Configuration::getInitial(),
   
plugin_dir_url( __FILE__ ) . 'assets/images/dollar.png'
 
);
}

function
exchange_on_activation()
{
    global
$wpdb;

   
$orm = new Orm('dollar_exchange', $wpdb);
   
$rst = $orm->create();

   
$obj = new stdClass();
   
$obj->price_buy = '5.24';
   
$obj->price_sell = '5.24';
   
$obj->date = '2021-08-26';
   
$obj->type = 'Dollar';

   
$orm = new Orm('dollar_exchange', $wpdb);
   
$rst = $orm->insertDefault($obj);

}

function
exchange_on_deactivation()
{
   
//
}

function
exchange_on_uninstall()
{
    global
$wpdb;
   
$orm = new Orm('dollar_exchange', $wpdb);
   
$orm->drop();
}

 
/**
 * Configure admin view
 */
function dollar_exchange_init()
{
 
exchange_on_check_delete_item();

  global
$wpdb;
 
$options = bio_get_config();

 
$orm = new Orm('dollar_exchange', $wpdb);
 
$rst = $orm->select(["1 ORDER BY date DESC"]);

 
$structure = new Structure(new Configuration,'form', $rst);
  echo
$structure->render();

}

function
exchange_on_check_delete_item()
{
    global
$wpdb;
    if(
array_key_exists('id', $_GET)){
       
$orm = new Orm('dollar_exchange', $wpdb);
       
$orm->delete($_GET['id']);
    }
}

function
voucher_check_register($wpdb)
{
   
$orm = new Orm('dollar_exchange', $wpdb);
    return
$orm->select(["date = '".date('Y-m-d')."'"]);
}

/**
 * Configure public view
 */
function voucher_register_table_results()
{
    global
$wpdb;

    if(empty(
voucher_check_register($wpdb)))
    {
       
       
$model = new Soap();
       
$model->setDateBegin(date('m-d-Y'))
            ->
setDateEnd(date('m-d-Y'));

       
$obj = json_decode($model->build());
        if(
array_key_exists('value', $obj))
        {
           
$size = count($obj->value);
           
$id = $size > 0 ? $size -1 : $size;

            if(!empty(
$obj->value[$id]))
            {
               
$orm = new Orm('dollar_exchange', $wpdb);
               
$orm->insert($obj->value[$id]);
            }
           
        }

    }
   
   
$orm = new Orm('dollar_exchange', $wpdb);
   
$exchanges = $orm->select(["1 ORDER BY id desc limit 1"]);

   
$structure = new Structure(new Configuration, 'table', $exchanges);
    echo
$structure->render();

?>


<?php
}

add_shortcode('exchange_results', 'voucher_register_table_results');

?>


Details

WordPress Voucher Request Plugin

Plugin to show dollar exchange;

Configuration

Just insert [exchange_results] in widgets ou page!

> [exchange_results]


  Files folder image Files (10)  
File Role Description
Files folder imageassets (1 directory)
Files folder imagepath (5 files)
Files folder imageview (2 files)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files (10)  /  assets  
File Role Description
Files folder imageimages (1 file)

  Files folder image Files (10)  /  assets  /  images  
File Role Description
  Accessible without login Image file dollar.png Icon Icon image

  Files folder image Files (10)  /  path  
File Role Description
  Accessible without login Plain text file cacert.pem Data Auxiliary data
  Plain text file Configuration.php Class Class source
  Plain text file Orm.php Class Class source
  Plain text file Soap.php Class Class source
  Plain text file Structure.php Class Class source

  Files folder image Files (10)  /  view  
File Role Description
  Accessible without login Plain text file form.html Data HTML template
  Accessible without login Plain text file table.html Data HTML template

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:21
This week:0
All time:11,272
This week:524Up