Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • i have the same question D:

    iformas

    (@iformas)

    i want localization option plz

    Thread Starter iformas

    (@iformas)

    i want to display a mtgox value ex:

    <?php
    
    //Get MTGOX VALUES
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18");
    	curl_setopt($ch, CURLOPT_URL, 'https://mtgox.com/code/data/ticker.php');
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    	$mtgoxjson = curl_exec($ch);
    	curl_close($ch);
    
    		// Decode from an object to array
    		$output_mtgox = json_decode($mtgoxjson);
    		$output_mtgox_1 = get_object_vars($output_mtgox);
    		$mtgox_array = get_object_vars($output_mtgox_1['ticker']);
    
    		// MTGOX USD
    		$mtgox_last_USD = $mtgox_array['last'];
    		$mtgox_high_USD = $mtgox_array['high'];
    		$mtgox_low_USD = $mtgox_array['low'];
    		$mtgox_avg_USD = $mtgox_array['avg'];
    		$mtgox_vol_USD = $mtgox_array['vol'];
    
    // GCalc	
    
    	function conversor_monedas($moneda_origen,$moneda_destino,$cantidad) {
        $cantidad = urlencode($cantidad);
        $moneda_origen = urlencode($moneda_origen);
        $moneda_destino = urlencode($moneda_destino);
        $url = "https://www.google.com/ig/calculator?hl=en&q=$cantidad$moneda_origen=?$moneda_destino";
        $ch = curl_init();
        $timeout = 0;
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch,  CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $rawdata = curl_exec($ch);
        curl_close($ch);
        $data = explode('"', $rawdata);
        $data = explode(' ', $data['3']);
        $var = $data['0'];
        return round($var,10);
    	}	
    
     //GCalc 1 USD-CLP
     $currencyCLP = conversor_monedas("USD","CLP",1);
    
     //MTGOX CLP
    $mtgox_last_CLP = ($currencyCLP) * ($mtgox_last_USD);
    $mtgox_high_CLP = ($currencyCLP) * ($mtgox_high_USD);
    $mtgox_low_CLP = ($currencyCLP) * ($mtgox_low_USD);
    $mtgox_avg_CLP = ($currencyCLP) * ($mtgox_avg_USD);
    $mtgox_vol_CLP = ($currencyCLP) * ($mtgox_vol_USD);
    echo round($mtgox_last_CLP,0);
      ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

    Thread Starter iformas

    (@iformas)

    im too noob for do it D:
    can you explain it step by step?

    in wp-topbar.php y found this

    wptb::wptb_inject_specific_TopBar_html_js($wptbOptions);

    } // end function wptb_inject_TopBar_html_js

    //=========================================================================
    // Inject specific TopBar HTML– used also on the admin (debug) pages
    //=========================================================================

    function wptb_inject_specific_TopBar_html_js($wptbOptions) {

    if ( $wptbOptions[‘enable_topbar’] == ‘false’ ) { return; }

    global $wp_query;
    $thePostID = $wp_query->post->ID;

    if ( is_home() && ( $wptbOptions[‘show_homepage’] == “never” ) ) { return; }

    if ( ! ( is_home() && ( $wptbOptions[‘show_homepage’] == “always” ) ) ) {
    if ( $wptbOptions[‘include_pages’] == 0 )
    $page_id_found = true;
    else {
    $page_id_found = false;
    if ( $wptbOptions[‘include_logic’] != ‘cat_only’ ) { //skip this logic if we are only checking categories
    if ( in_array( $thePostID, explode( ‘,’, $wptbOptions[‘include_pages’] ) ) )
    $page_id_found = true;
    if ( $wptbOptions[‘invert_include’] == ‘yes’ )
    $page_id_found = ! $page_id_found;
    }
    }

    if ( $wptbOptions[‘include_categories’] == 0 )
    $category_id_found = true;
    else {
    $category_id_found = false;
    if ( $wptbOptions[‘include_logic’] != ‘page_only’ ) { //skip this logic if we are only checking pages
    foreach((get_the_category($thePostID)) as $category) {
    if ( in_array( $category->cat_ID, explode( ‘,’, $wptbOptions[‘include_categories’] ) ) ) {
    $category_id_found = true;
    break;
    }
    }
    if ( $wptbOptions[‘invert_categories’] == ‘yes’ )
    $category_id_found = ! $category_id_found;
    }
    }
    // check the logic the user selected if not on debug page

    if ( ! ( isset( $_GET[‘page’] ) && $_GET[‘page’] == ‘wp-topbar.php’) )
    switch ( $wptbOptions[‘include_logic’] ) {

    case ‘page_only’:

    if ( ! $page_id_found ) {return;}
    break;

    case ‘cat_only’:

    if ( ! $category_id_found ) {return;}
    break;

    case ‘boolean_and’:

    if ( ( ! $page_id_found ) || ( ! $category_id_found ) ) {return;}
    break;

    case ‘boolean_or’:

    if ( ( ! $page_id_found ) && ( ! $category_id_found ) ) {return;}

    }
    }

    $wptb_cookie = “wptopbar_”.COOKIEHASH;

    if ( ( $wptbOptions[‘allow_close’] == ‘yes’ ) AND
    ( $wptbOptions[‘respect_cookie’] == ‘always’ ) AND
    ( $_COOKIE[$wptb_cookie] == $wptbOptions[‘cookie_value’]) ) {
    echo ‘<!– WP-TopBar Valid Cookie Present – not showing TopBar –>
    ‘;
    return;
    }

    // use javascript to force the HTML to just before body tag if the topbar is at the top of the page
    if ( $wptbOptions[‘topbar_pos’] == ‘header’ ) {
    echo ‘
    ‘;
    echo “<script type=’text/javascript’>”;
    echo ‘
    ‘;
    echo “jQuery(document).ready(function() {“;
    echo “jQuery(‘body’).prepend(‘”;
    }

    echo ‘<div id=”topbar” style=”‘,$wptbOptions[‘div_css’],'”>’;

    self::wptb_display_TopBar(‘visibility:hidden;’,$wptbOptions, true);

    echo ‘</div>’;

    if ( $wptbOptions[‘topbar_pos’] == ‘header’ )
    echo “‘);} );
    “;

    if ( $wptbOptions[‘topbar_pos’] == ‘footer’ ) {
    echo ‘
    ‘;
    echo “<script type=’text/javascript’>”;

    }

    if ($wptbOptions[‘respect_cookie’] == ‘ignore’) { // destroy cookie
    echo ‘
    ‘;
    echo ‘document.cookie=”‘.$wptb_cookie.'”‘.”+’=;expires=Thu, 01-Jan-70 00:00:01 GMT;’;”;
    }
    if ($wptbOptions[‘allow_close’] == ‘yes’) {
    echo ‘
    ‘;
    echo ‘function close_wptobar() { document.getElementById(“wptbheadline”).style.visibility = “hidden”;’;
    if ($wptbOptions[‘respect_cookie’] == ‘always’) {

    echo ‘var now= new Date();’;
    echo ‘var expDate = new Date();’;
    echo ‘expDate.setTime(now.getTime() + 3600000*24*30);’;
    echo ‘document.cookie=”‘.$wptb_cookie.'”+”=”+escape(‘.$wptbOptions[‘cookie_value’].’)+”;expires=”+expDate.toUTCString();’;
    }
    echo ‘ };’;
    }

    echo ‘
    ‘;
    echo ‘jQuery(document).ready(function() {‘,”jQuery(‘#wptbheadline’).hide().delay(“,$wptbOptions[‘delay_time’],”).css(‘visibility’,’visible’).slideDown(“,$wptbOptions[‘slide_time’],”).fadeIn(1000).show(‘slow’);”;

    if (($wptbOptions[‘display_time’]+0) != 0) {
    echo “jQuery(‘#wptbheadline’).delay(“,$wptbOptions[‘display_time’],’).slideUp(‘,$wptbOptions[‘slide_time’],’).fadeOut(1000).hide();’;
    }
    echo ‘});
    ‘;
    echo ‘</script>’;

    } // end function wptb_inject_TopBar_html_js

    Thread Starter iformas

    (@iformas)

    emailed

    Thread Starter iformas

    (@iformas)

    i want es-cl i can hep you to translate it

Viewing 6 replies - 1 through 6 (of 6 total)