Plugin Directory

Changeset 2619034


Ignore:
Timestamp:
10/24/2021 02:17:30 PM (4 years ago)
Author:
deios
Message:

A lot of changes and new features added:
*WARNING* Some tags had been changed you have to carefully check the changes in readme.txt.

  • Added historical end of day tag
  • Changed tag for the live data with 15-minutes delay
  • Added real-time tag with data feed 50ms.
Location:
live-stock-prices-for-wordpress/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • live-stock-prices-for-wordpress/trunk/admin/template/options.php

    r1931855 r2619034  
    88</div>
    99
    10 <h3>Documentation</h3>
    11 Default demo API key OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX provided with the plugin has only access to Apple Inc (AAPL.US) and Vanguard Total Stock Market ETF (VTI.US).
    12 To get the full coverage, you should subscribe to <a
    13         href="https://eodhistoricaldata.com/?utm_source=wordpress&utm_medium=link&utm_campaign=eodplugin">EOD Historical
    14     Data</a> service and get your API key.
     10<h3>Quick Start</h3>
     11Default demo API key OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX provided with the plugin has only access to Apple Inc (AAPL.US)<br/>
     12and Vanguard Total Stock Market ETF (VTI.US). To get the full coverage, you should subscribe to <a
     13        href="https://eodhistoricaldata.com/?utm_source=wordpress&utm_medium=link&utm_campaign=eodplugin">EOD Historical Data</a>
     14service and get your API key.
    1515<br/><br/>
    1616Here <a href="https://eodhistoricaldata.com/knowledgebase/?utm_source=wordpress&utm_medium=link&utm_campaign=eodplugin"
     
    1818with all available symbols and exchanges.
    1919<br/><br/>
    20 <h3>BENEFITS</h3>
     20<h4>BENEFITS</h4>
    2121<ul>
    2222    <li>NO CODING. Easy installation and use.
     
    2525    <li>We support 120+ CRYPTO currencies and 150+ FOREX pairs.
    2626</ul>
     27<br/><br/>
     28<h4>Possible tags for data feeds</h4>
     29There are 3 different data feeds supported now.
    2730
    28 <h3>Two ways of using the plugin</h3>
     31<pre><code>[eod_historical target="AAPL.US"]</code></pre>
     32With this code you will get the end of day price for the latest trading day. Recommended to display EOD prices.
     33
     34<pre><code>[eod_live target="AAPL.US"]</code></pre>
     35With this code you will get the 15-minutes delay price.
     36
     37<pre><code>[eod_realtime target="AAPL.US"]</code></pre>
     38With this code you will get the real-time price with delay 50ms.
     39<br/><br/>
     40<h4>Two ways of using the plugin</h4>
    2941<b>INlINE</b>. Just put the following code into your post: <b>[eod_ticker target="AAPL.US"]</b>
    3042and you will get an actual price for AAPL (Apple Inc) traded on NASDAQ each time someone requests the page.
     
    3951<br/><br/>
    4052
    41 <h3>More questions?</h3>
     53<h4>More questions?</h4>
    4254<p>
    4355    Still have any questions? Or need any other data for equities, funds or ETFs?
  • live-stock-prices-for-wordpress/trunk/css/eod-stock-prices.css

    r1931843 r2619034  
    3434
    3535.eod_ticker.minus [role='evolution']::after{
    36     content: '\f140';
    37     font-family: dashicons;
     36    content: '\2BC6';
    3837    color: #b92c28;
    3938}
    4039.eod_ticker.plus [role='evolution']::after{
    41     content: '\f142';
    42     font-family: dashicons;
     40    content: '\2BC5';
    4341    color: #27a644;
    4442}
  • live-stock-prices-for-wordpress/trunk/eod-stock-prices-plugin.php

    r2295567 r2619034  
    55Plugin URI: https://eodhistoricaldata.com/knowledgebase/plugins
    66Description: The stock prices plugin allows you to use a widget and a shortcode to display the ticker data you want.
    7 Version: 1.1.5
    8 Author: Eod Historical Data
     7Version: 1.2.0
     8Author: EOD Historical Data
    99Author URI: https://eodhistoricaldata.com
    1010*/
    11 
    12 require ('admin/eod-stock-prices-admin.php');
    13 require('widget/eod-stock-prices-widget.php');
     11require('admin/eod-stock-prices-admin.php');
     12require('widget/eod-live-widget.php');
     13require('widget/eod-historical-widget.php');
     14require('widget/eod-real-time-widget.php');
     15require('eod-ajax.php');
    1416
    1517if(!class_exists('EOD_Stock_Prices_Plugin'))
    1618{
    17     class EOD_Stock_Prices_Plugin
    18     {
     19    class EOD_Stock_Prices_Plugin{
     20        /**
     21         * Prepare plugin hooks / filters
     22         */
     23        public function __construct(){
     24            /* Runs when plugin is activated */
     25            register_activation_hook(__FILE__,array(&$this,'activate'));
     26            /* Runs on plugin deactivation*/
     27            register_deactivation_hook( __FILE__, array(&$this,'deactivate'));
     28
     29
     30            $plugin = plugin_basename( __FILE__ );
     31            add_filter( "plugin_action_links_$plugin", array(&$this, 'add_plugins_list_link') );
     32
     33            add_action('init', array(&$this, 'shortcodes_init'));
     34            add_action( 'widgets_init', array(&$this, 'widgets_init'));
     35            add_action( 'wp_enqueue_scripts',  array(EOD_Stock_Prices_Plugin::class, 'enqueue_scripts'));
     36
     37            $this->register_ajax_routes();
     38            $this->admin = new EOD_Stock_Prices_Admin();
     39        }
     40
     41
     42        /**
     43         * Called when the plugin is deactivated
     44         */
     45        public function activate(){
     46
     47        }
     48
     49        /**
     50         * Called when the plugin is deactivated
     51         */
     52        public function deactivate(){
     53
     54        }
     55
     56        /**
     57         *
     58         */
     59        public function widgets_init(){
     60            register_widget( 'EOD_Stock_Prices_Widget' );
     61            register_widget( 'EOD_Real_Time_Widget' );
     62            register_widget( 'EOD_Live_Widget' );
     63        }
     64
     65        /**
     66         *
     67         */
     68        protected function register_ajax_routes(){
     69            $ajaxRoutes = array(
     70              'eod_stock_prices_refresh'
     71            );
     72
     73            foreach($ajaxRoutes as $route){
     74                add_action('wp_ajax_'.$route, array(&$this,'ajax_'.$route));
     75                add_action('wp_ajax_nopriv_'.$route, array(&$this,'ajax_'.$route));
     76            }
     77
     78        }
     79
    1980        /**
    2081         * Static load template method
     
    3697
    3798        /**
    38          * Prepare plugin hooks / filters
    39          */
    40         public function __construct(){
    41             /* Runs when plugin is activated */
    42             register_activation_hook(__FILE__,array(&$this,'activate'));
    43             /* Runs on plugin deactivation*/
    44             register_deactivation_hook( __FILE__, array(&$this,'deactivate'));
    45 
    46 
    47             $plugin = plugin_basename( __FILE__ );
    48             add_filter( "plugin_action_links_$plugin", array(&$this, 'add_plugins_list_link') );
    49 
    50             add_action('init', array(&$this, 'shortcodes_init'));
    51             add_action( 'widgets_init', array(&$this, 'widgets_init'));
    52             add_action( 'wp_enqueue_scripts',  array(EOD_Stock_Prices_Plugin::class, 'enqueue_scripts'));
    53 
    54             $this->register_ajax_routes();
    55             $this->admin = new EOD_Stock_Prices_Admin();
    56         }
    57 
    58 
    59         /**
    60          * Called when the plugin is deactivated
    61          */
    62         public function activate(){
    63 
    64         }
    65 
    66         /**
    67          * Called when the plugin is deactivated
    68          */
    69         public function deactivate(){
    70 
    71         }
    72 
    73         /**
    74          *
    75          */
    76         public function widgets_init(){
    77             register_widget( 'EOD_Stock_Prices_Widget' );
    78         }
    79 
    80         /**
    81          *
    82          */
    83         protected function register_ajax_routes(){
    84             $ajaxRoutes = array(
    85               'eod_stock_prices_refresh'
    86             );
    87 
    88             foreach($ajaxRoutes as $route){
    89                 add_action('wp_ajax_'.$route, array(&$this,'ajax_'.$route));
    90                 add_action('wp_ajax_nopriv_'.$route, array(&$this,'ajax_'.$route));
    91             }
    92 
    93         }
    94 
    95         /**
    9699         * @param $links
    97100         * @return mixed
     
    106109        }
    107110
     111        /**
     112         * @return string
     113         */
     114        public function get_eod_api_key(){
     115            $plugin_options = get_option('eod_options');
     116           
     117            //Default token
     118            $apiKey = 'OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX';
     119            if(array_key_exists('api_key', $plugin_options)){
     120                $apiKey = $plugin_options['api_key'];
     121            }
     122            return($apiKey);
     123        }
     124
    108125
    109126        /**
    110127         * Shortcode initialization
    111128         */
    112         public function shortcodes_init()
    113         {
    114             //HTML rendering
    115             add_shortcode('eod_ticker', array(&$this,'eod_ticker'));
     129        public function shortcodes_init(){
     130            // HTML rendering
     131            add_shortcode('eod_historical', array(&$this,'eod_historical'));
     132            add_shortcode('eod_live', array(&$this,'eod_live'));
     133            add_shortcode('eod_realtime', array(&$this,'eod_realtime'));
    116134        }
    117135
     
    125143            }
    126144            global $post;
    127             if( has_shortcode( $post->post_content, 'eod_ticker')
    128                 || is_active_widget( false, false, $widget_base_id)
    129             ) {
     145            // if( has_shortcode( $post->post_content, 'eod_ticker')
     146                // || is_active_widget( false, false, $widget_base_id)
     147            // ) {
    130148                wp_enqueue_script( 'eod_stock-prices-plugin', plugins_url( '/js/eod-stock-prices.js', __FILE__ ), array('jquery') );
    131149
     
    143161                //Force not to cache page
    144162                //define( 'DONOTCACHEPAGE', true );
    145             }
     163            // }
    146164        }
    147165
     
    165183         * @return string
    166184         */
    167         public function eod_ticker($atts=[], $content = null, $tag = ''){
     185        public function eod_historical($atts=[], $content = null, $tag = ''){
    168186            $atts = array_change_key_case((array)$atts, CASE_LOWER);
    169187            // override default attributes with user attributes
    170188            $shortcode_atts = shortcode_atts([
    171                 'target' => 'SHORTCODE_NO_TARGET'
     189                'target' => 'SHORTCODE_NO_TARGET',
     190                'title'   => false
    172191            ], $atts, $tag);
    173192
    174             $tickerData = self::get_real_time_ticker($shortcode_atts['target']);
    175 
    176             return self::loadTemplate("template/ticker.php", array('tickerData' => $tickerData, 'target' => $shortcode_atts['target']));
     193            return self::loadTemplate("template/ticker.php", array(
     194                'type'       => 'eod_historical',
     195                'target'     => $shortcode_atts['target'],
     196                'title'       => $shortcode_atts['title'],
     197                'key'        => str_replace('.', '_', strtolower($shortcode_atts['target']))
     198            ));
     199        }
     200       
     201        /**
     202         * Shortcode EOD Live
     203         * @param array $atts
     204         * @param null $content
     205         * @param string $tag
     206         * @return string
     207         */
     208        public function eod_live($atts=[], $content = null, $tag = ''){
     209            $atts = array_change_key_case((array)$atts, CASE_LOWER);
     210            // override default attributes with user attributes
     211            $shortcode_atts = shortcode_atts([
     212                'target' => 'SHORTCODE_NO_TARGET',
     213                'title'   => false
     214            ], $atts, $tag);
     215
     216            return self::loadTemplate("template/ticker.php", array(
     217                'type'       => 'eod_live',
     218                'target'     => $shortcode_atts['target'],
     219                'title'       => $shortcode_atts['title'],
     220                'key'        => str_replace('.', '_', strtolower($shortcode_atts['target']))
     221            ));
     222        }
     223       
     224        /**
     225         * Shortcode EOD Realtime
     226         * @param array $atts
     227         * @param null $content
     228         * @param string $tag
     229         * @return string
     230         */
     231        public function eod_realtime($atts=[], $content = null, $tag = ''){
     232            $atts = array_change_key_case((array)$atts, CASE_LOWER);
     233            // override default attributes with user attributes
     234            $shortcode_atts = shortcode_atts([
     235                'target' => 'SHORTCODE_NO_TARGET',
     236                'title'   => false
     237            ], $atts, $tag);
     238           
     239            $error = false;
     240            $key_target = explode('.', strtolower($shortcode_atts['target']) );
     241            if(count($key_target) !== 2) $error = 'wrong target';
     242           
     243            return self::loadTemplate("template/realtime_ticker.php", array(
     244                'error'      => $error,
     245                'target'     => $shortcode_atts['target'],
     246                'title'       => $shortcode_atts['title'],
     247                'key'        => implode('_', $key_target)
     248            ));
    177249        }
    178250
     
    182254         * @return mixed
    183255         */
    184         public static function get_real_time_ticker($target){
    185 
    186             $tickerData = self::call_eod_real_time_api($target);
     256        public static function get_real_time_ticker($type = 'historical', $target){
     257            $tickerData = self::call_eod_real_time_api($type, $target);
    187258
    188259            if(!$tickerData){
     
    193264                return $tickerData;
    194265            }
    195 
    196             $tickerData['evolution'] =  round($tickerData['close'] - $tickerData['previousClose'],2);
    197             $tickerData['evolutionClass'] = $tickerData['evolution'] > 0 ? 'plus' : ($tickerData['evolution'] == 0 ? 'equal' : 'minus');
    198             $tickerData['evolutionSymbol'] = $tickerData['evolution'] > 0 ? '+' : '';
    199266
    200267            return $tickerData;
     
    206273         * @return mixed
    207274         */
    208         public static function call_eod_real_time_api ($targets) {
    209             if(is_array($targets)){
    210                 $target = $targets[0];
    211                 $extraTargets = array_slice($targets,1);
    212             }else{
    213                 $target = $targets;
    214                 $extraTargets = null;
    215             }
    216 
     275        public static function call_eod_real_time_api($type = 'historical', $targets) {
    217276            $plugin_options = get_option('eod_options');
    218 
    219277
    220278            //Default token
     
    224282            }
    225283
    226             //API Endpoint
    227             $apiUrl = 'https://eodhistoricaldata.com/api/real-time/'.$target.'?api_token='.$apiKey.'&fmt=json';
    228             //Extra target management.
    229             if($extraTargets && count($extraTargets) > 0){
    230                 $apiUrl .= '&s=';
    231                 foreach($extraTargets as $i => $extraTarget){
    232                     $apiUrl .= $extraTarget;
    233                     if($i + 1 < count($extraTarget)){
    234                         $apiUrl .= ',';
    235                     }
     284            if($type === 'historical'){
     285                if(!is_array($targets)){
     286                    $targets = array($targets);
    236287                }
     288                $apiUrl = "https://eodhistoricaldata.com/api/eod-bulk-last-day/US".
     289                            "?api_token=$apiKey".
     290                            "&fmt=json".
     291                            "&symbols=".strtoupper(implode(',', $targets));
     292            }else if($type === 'live'){
     293                if(!is_array($targets)){
     294                    $targets = array($targets[0]);
     295                }
     296                $extraTargets = strtoupper(implode(',', array_slice($targets,1)));
     297                $apiUrl = "https://eodhistoricaldata.com/api/real-time/".strtoupper($targets[0]).
     298                            "?api_token=$apiKey".
     299                            "&fmt=json";
     300                //Extra target management.
     301                if($extraTargets) $apiUrl .= "&s=$extraTargets";
     302            }else{
     303                return array('error' => 'wrong type');
    237304            }
    238305
  • live-stock-prices-for-wordpress/trunk/js/eod-stock-prices.js

    r1931079 r2619034  
    1 var EODRefreshTickerInterval;
    2 jQuery(document).ready(function ($) {
    3     console.log('EodStockPrices JS Loaded');
     1jQuery(async function($){
     2    const eod_api_token = await $.ajax({
     3        dataType: "json",
     4        method: "POST",
     5        url: eod_ajax_url,
     6        data: {
     7            'action': 'get_eod_token',
     8            'nonce_code': eod_ajax_noncerr,
     9        }
     10    });
     11    eod_display_all_live_tickers();
     12    eod_display_all_historical_tickers();
     13    eod_init_realtime_tickers()
     14   
     15    // Refresh tickers every minute. It will affect your daily API Limit!
     16    const EOD_refresh_common_tickers = false,
     17          EOD_refresh_interval = 60000;             // 60000 = 1 minute
     18    if(EOD_refresh_common_tickers){
     19        let EOD_refresh = setInterval(function () {
     20            console.log("EOD_refresh_common_tickers");
     21            eod_display_all_live_tickers();
     22        }, EOD_refresh_interval);
     23    }
    424
    5     function refreshTickers() {
    6         $('[role="eod_ticker"]').each(function () {
    7             var spanEl = $(this);
    8             getTickerInfo($(this).attr('target')).done(function (result) {
    9                 var data = JSON.parse(result);
     25    function get_eod_ticker(type = 'historical', list, callback){
     26        if(typeof callback !== 'function' || !$.isArray(list) || list.length < 1) return false;
    1027
    11                 spanEl.removeClass('plus').removeClass('minus').removeClass('equal');
     28        $.ajax({
     29            dataType: "json",
     30            method: "POST",
     31            url: eod_ajax_url,
     32            data: {
     33                'action': 'get_real_time_ticker',
     34                'nonce_code': eod_ajax_noncerr,
     35                'list': list,
     36                'type': type
     37            }
     38        }).always((data) => {})
     39        .done((data) => { callback(data); });
     40    }
    1241
    13                 spanEl.find('[role="close"]').text(data.close);
    14                 spanEl.find('[role="evolution"] [role="value"]').text(data.evolutionSymbol + data.evolution);
     42    function render_eod_ticker(type, target, value, prevValue = false){       
     43        if(!target) return false;
     44               
     45        // The ticker can be without the other half.
     46        let trg = target.toLowerCase().split('.'),
     47            full_t_class = '.'+type+'.eod_t_'+trg.join('_'),     // AAPL.US
     48            t_class = '.'+type+'.eod_t_'+trg[0];                 // AAPL
     49       
     50        // Display error
     51        if(!value || value === 'NA'){
     52            $(full_t_class+', '+t_class).text('no result from real time api').closest('.eod_ticker').addClass('error');
     53            return false;
     54        }
     55       
     56        // Close value
     57        value = parseFloat(value).toFixed(4);
     58        $(full_t_class+', '+t_class).text(value);
     59       
     60        // Evolution
     61        if(!prevValue || value == '-') return false;
     62        let evolution = parseFloat(value - prevValue).toFixed(2),
     63            evol_html = '(<span role="value">'+(evolution > 0 ? '+' : '')+evolution+'</span>)';
     64        $(full_t_class+' + [role=evolution], '+t_class+' + [role=evolution]').html(evol_html).closest('.eod_ticker')
     65            .toggleClass('plus', evolution > 0)
     66            .toggleClass('equal', evolution == 0)
     67            .toggleClass('minus', evolution < 0);
     68    }
     69   
     70   
     71    /* =========================================
     72         loading and displaying all live tickers
     73       ========================================= */
     74    function eod_display_all_live_tickers(){
     75        // Finding and prepare all tickers. Creating list.
     76        let eod_t_list = [];
    1577
    16                 spanEl.addClass(data.evolutionClass);
    17             });
     78        $(".eod_live").each(function(){
     79            let target = $(this).attr('data-target');
     80               
     81            // Common ticker
     82            if( eod_t_list.indexOf(target) === -1 )
     83                eod_t_list.push(target);
     84        });
     85       
     86        // Get and display close value
     87        get_eod_ticker('live', eod_t_list, function(data){
     88            if(!data || data.error) return false;
     89            if(data.code){
     90                render_eod_ticker('eod_live', data.code, data.close, data.previousClose);
     91            }else if(data['0']){
     92                for(const [key, item] of Object.entries(data)){
     93                    render_eod_ticker('eod_live', item.code, item.close, item.previousClose);
     94                }
     95            }
     96        });
     97    }
     98   
     99   
     100    /* =========================================
     101         loading and displaying all historical tickers
     102       ========================================= */
     103    function eod_display_all_historical_tickers(){
     104        // Finding and prepare all tickers. Creating list.
     105        let eod_t_list = [];
     106
     107        $(".eod_historical").each(function(){
     108            let target = $(this).attr('data-target');
     109               
     110            // Common ticker
     111            if( eod_t_list.indexOf(target) === -1 )
     112                eod_t_list.push(target);
     113        });
     114       
     115        // Get and display close value
     116        console.log(eod_t_list);
     117        get_eod_ticker('historical', eod_t_list, function(data){
     118            if(!data || data.error) return false;
     119            console.log(data);
     120            if(data.code){
     121                render_eod_ticker('eod_historical', data.code, data.close, data.previousClose);
     122            }else if(data['0']){
     123                for(const [key, item] of Object.entries(data)){
     124                    console.log(item.code+'.'+item.exchange_short_name, item.close, item.prev_close);
     125                    render_eod_ticker('eod_historical', item.code+'.'+item.exchange_short_name, item.close, item.prev_close);
     126                }
     127            }
    18128        });
    19129    }
    20130
    21     function getTickerInfo(target) {
    22         var data = {
    23             'action': "eod_stock_prices_refresh",
    24             'target': target,
     131    /* =========================================
     132         init display realtime tickers
     133       ========================================= */
     134    function eod_init_realtime_tickers(){
     135        // Finding and prepare all tickers. Creating list.
     136        let eod_rt_list = {
     137            'cc':     [],
     138            'forex':  [],
     139            'us':     []
     140        };
     141        $(".eod_realtime").each(function(){
     142            let target = $(this).attr('data-target'),
     143                [code, type] = target.toLowerCase().split('.');
     144               
     145            // Realtime ticker
     146            if(type && eod_rt_list[type] && eod_rt_list[type].indexOf( code ) === -1)
     147               eod_rt_list[type].push(code);
     148        });
     149       
     150        // Create websocket
     151        const ws_eod = {
     152            'cc':     new WebSocket('wss://ws.eodhistoricaldata.com/ws/crypto?api_token='+eod_api_token),
     153            'forex':  new WebSocket('wss://ws.eodhistoricaldata.com/ws/forex?api_token='+eod_api_token),
     154            'us':     new WebSocket('wss://ws.eodhistoricaldata.com/ws/us?api_token='+eod_api_token)
     155        };
     156        for(let type in eod_rt_list){
     157            if(eod_rt_list[type].length){
     158                ws_eod[type].addEventListener('open', function(event){
     159                    for(let q of eod_rt_list[type]){
     160                        ws_eod[type].send('{"action": "subscribe", "symbols": "'+q.toUpperCase()+'"}');
     161                    }
     162                });
     163            }
    25164        }
    26165
    27         return $.get(eod_params.ajaxurl, data);
    28     }
    29 
    30     // Refresh ticker every minute
    31     if (!EODRefreshTickerInterval) {
    32         EODRefreshTickerInterval = setInterval(function () {
    33             //console.log("EODRefreshTickerTimeout");
    34             //Uncomment this line if you want to refresh tickers every minute. It will affect your daily API Limit!
    35             //refreshTickers();
    36         }, 60000);
     166        ws_eod.cc.addEventListener('message', function(event){
     167            let res = JSON.parse(event.data);
     168            if(res.p) render_eod_ticker('eod_realtime', res.s+'.CC', res.p);
     169        });
     170        ws_eod.forex.addEventListener('message', function(event){
     171            let res = JSON.parse(event.data);
     172            if(res.a) render_eod_ticker('eod_realtime', res.s+'.FOREX', res.a);
     173        });
     174        ws_eod.us.addEventListener('message', function(event){
     175            let res = JSON.parse(event.data);
     176            if(res.p) render_eod_ticker('eod_realtime', res.s+'.US', res.p);
     177        });
    37178    }
    38179});
  • live-stock-prices-for-wordpress/trunk/readme.txt

    r2295567 r2619034  
    55Requires at least: 4.0
    66Tested up to: 5.4
    7 Stable tag: 1.1.5
     7Stable tag: 1.2.0
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    2929<br/><br/>
    3030The <a href="https://eodhistoricaldata.com/knowledgebase/?utm_source=wordpress&utm_medium=link&utm_campaign=eodplugin" target="_blank"> full documentation</a> for all available symbols, exchanges and API methods is provided as well as email support for all subscribers.<br/><br/>
     31
     32<h3>Possible tags for data feeds</h3>
     33There are 3 different data feeds supported now.
     34
     35<pre><code>[eod_historical target="AAPL.US"]</code></pre>
     36With this code you will get the end of day price for the latest trading day. Recommended to display EOD prices.
     37
     38<pre><code>[eod_live target="AAPL.US"]</code></pre>
     39With this code you will get the 15-minutes delay price.
     40
     41<pre><code>[eod_realtime target="AAPL.US"]</code></pre>
     42With this code you will get the real-time price with delay 50ms.
    3143
    3244There are two ways to use the plugin.
  • live-stock-prices-for-wordpress/trunk/template/ticker.php

    r1931079 r2619034  
    1 <span class="eod_ticker <?php echo $tickerData['error'] ? 'error' : $tickerData['evolutionClass'] ?>" role="eod_ticker"
    2       target="<?php echo $target ?>">
    3     <span role="name"><?php echo $target ?></span><span
    4             role="close"><?php echo $tickerData['error'] ? $tickerData['error'] : $tickerData['close'] ?></span>
     1<span class="eod_ticker" role="eod_ticker">
     2    <span role="name"><?= $title ? $title : $target ?></span>
     3    <span class="<?= $type ?> eod_t_<?= $key ?>" data-target="<?= $target ?>" role="close"></span>
    54    <?php if (!isset($tickerData['error'])) : ?>
    6         <span role="evolution">(<span
    7                     role="value"><?php echo $tickerData['evolutionSymbol'] . $tickerData['evolution'] ?></span>)</span>
     5        <span role="evolution" class="eod_t_<?= $key ?>_evol"></span>
    86    <?php endif; ?>
    97</span>
  • live-stock-prices-for-wordpress/trunk/widget/template/ticker_widget.php

    r1931079 r2619034  
    44<?php endif; ?>
    55<ul class="eod_widget_ticker_list">
    6 <?php foreach($targetList as $i => $targetElement):  ?>
     6<?php foreach($targetList as $i => $targetElement): ?>
    77    <li>
    8     <?php echo EOD_Stock_Prices_Plugin::loadTemplate('template/ticker.php', array('tickerData' => $targetElement['tickerData'], 'target' => $targetElement['target'])); ?>
     8    <?php echo EOD_Stock_Prices_Plugin::loadTemplate('template/'.$shortcode_template, array(
     9        'type'   => $type,
     10        'error'  => strpos($targetElement['target'], '.') === false ? 'wrong target' : false,
     11        'target' => $targetElement['target'],
     12        'key'    => str_replace('.', '_', strtolower($targetElement['target']))
     13    )); ?>
    914    </li>
    1015<?php endforeach; ?>
Note: See TracChangeset for help on using the changeset viewer.