This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
loader { | |
left: 50%; | |
top: 50%; | |
position: fixed; | |
-webkit-transform: translate(-50%, -50%); | |
transform: translate(-50%, -50%); } | |
.loader #spinner { | |
box-sizing: border-box; | |
stroke: #FB791A; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.brgweb.splashtest; | |
import android.content.Intent; | |
import android.support.v7.app.ActionBar; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.os.Handler; | |
public class SplashActivity extends AppCompatActivity { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_single_product_summary', 'woocommerce_total_product_price', 31 ); | |
function woocommerce_total_product_price() { | |
global $woocommerce, $product; | |
// let's setup our divs | |
echo sprintf('<div id="product_total_price" style="margin-bottom:20px;display:none">%s %s</div>','Total do Produto','<span class="price">'.$product->get_price().'</span>'); | |
echo sprintf('<div id="cart_total_price" style="margin-bottom:20px;display:none">%s %s</div>','Total do Carrinho','<span class="price">'.$product->get_price().'</span>'); | |
?> | |
<script> | |
jQuery(function($){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hide_admin_bar() { | |
//could check user role here | |
return false; | |
} | |
add_filter( 'show_admin_bar', 'hide_admin_bar' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'blockusers_init' ); | |
function blockusers_init() { | |
//check if user is administrator | |
if (! current_user_can( 'administrator' ) ){ | |
//check if it's wp-admin and not ajax calls | |
if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { | |
//redirect to home | |
wp_redirect( home_url() ); | |
//exit after redirect is required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isTelefone(String numeroTelefone) { | |
return numeroTelefone.matches(".((10)|([1-9][1-9]).)\\s[9][6-9][0-9]{3}-[0-9]{4}") || | |
numeroTelefone.matches(".((10)|([1-9][1-9]).)\\s[2-5][0-9]{3}-[0-9]{4}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.brgweb.utilsexample; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.ActivityNotFoundException; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.net.ConnectivityManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//cria o wp_cron para checar a cotação a cada hora | |
add_action('wp','brg_agenda_cotacao'); | |
function brg_agenda_cotacao() { | |
if (! wp_next_scheduled ( 'brg_atualiza_cotacao' )) { | |
wp_schedule_event(time(), 'hourly', 'brg_atualiza_cotacao'); | |
} | |
} | |
//função para atualizar a cotação no wp_options | |
add_action('brg_atualiza_cotacao', 'brg_cotacao_dolar'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* NOTICE | |
* This script imports SQL commands "as is". | |
* Double check the SQL commands before using it | |
* and BACKUP YOUR DATABASE. | |
* It needs some improvement to use wpdb->prepare. | |
*/ | |
class WPSQLImporter{ | |
/** | |
* Loads an SQL stream into the WordPress database one command at a time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//With term IDs | |
$categories = array('1','2','3','4','5'); | |
$cats_to_add = array_map ('intval', $categorias); //ALWAYS CHECK IF IDs ARE INTEGERS!! | |
//With term names | |
//$cats_to_add = ('categoria 1', 'categoria 2', 'categoria 3', 'Categoria 4','categoria Cinco'); | |
if(wp_exist_post_by_title($string['title'])){ | |
echo 'post exists'; | |
} else { | |
$my_post = array( |