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 echo do_shortcode('[nomeDoSeuShortcode]'); ?> |
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
function get_youtube_channel_stat($stat = 'viewCount'){ | |
// o parâmetro $stat pode ser: viewCount, commentCount, subscriberCount ou videoCount | |
$key = "AIzaSyCTsbFFDGQdCD1xu3S99H1AzXdRpaALnr0"; // Sua API Key | |
$channel_id = "UC6BN1oSRAxcABupjn_bnT7g"; // a ID do seu canal | |
$content = file_get_contents("https://www.googleapis.com/youtube/v3/channels?key={$key}&part=statistics&id={$channel_id}"); | |
$json = json_decode($content, 1); |
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
echo get_youtube_channel_stat(); // retorna a quantidade de views totais do canal | |
echo get_youtube_channel_stat('subscriberCount'); // retorna a quantidade de inscritos no canal |
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
SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01'); | |
SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01'); | |
SELECT TIMESTAMPDIFF(DAY,'2003-02-01','2003-05-01'); | |
SELECT TIMESTAMPDIFF(MINUTE,'2003-02-01','2003-05-01 12:05:55'); |
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
SELECT ADDDATE(coluna_data, INTERVAL 12 MONTH) | |
FROM tabela |
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
UPDATE tabela | |
SET coluna_data = ADDDATE(coluna_data, INTERVAL 12 YEAR) | |
WHERE id = 15 | |
SELECT ADDDATE(coluna_data, INTERVAL 12 DAY) | |
FROM tabela |
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
function get_url(){ | |
return strtolower(preg_replace('/[^a-zA-Z]/','',$_SERVER['SERVER_PROTOCOL'])).'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; | |
} |
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
function data($data){ | |
return date("d/m/Y", strtotime($data)); | |
} | |
// exemplo de utilização: | |
echo data('2017-05-04'); | |
// vai retornar 04/05/2017 |
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 | |
$data1 = "25/02/2013"; | |
$data2 = "22/02/2013"; | |
// transforma a data do formato BR para o formato americano, ANO-MES-DIA | |
$data1 = implode('-', array_reverse(explode('/', $data1))); | |
$data2 = implode('-', array_reverse(explode('/', $data2))); | |
// converte as datas para o formato timestamp |
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
<meta charset="utf-8"> | |
<?php | |
function dominio_disponivel($dominio){ | |
if(checkdnsrr($dominio, 'ANY') && gethostbyname($dominio) != $dominio) | |
return false; | |
else | |
return true; | |
} |