This file contains hidden or 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 | |
// Filter Results | |
$this->FilterResults->addFilters( | |
array( | |
'filter1' => array( | |
'User.name' => array( | |
'operator' => 'LIKE', | |
'beforeValue' => '%', | |
'afterValue' => '%' | |
), |
This file contains hidden or 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 $procurar = htmlspecialchars($_GET['procurar']); ?> |
This file contains hidden or 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 | |
/** | |
* Classe que contem os métodos que iram | |
* filtrar as entradas enviadas via GET e POST | |
* | |
* @filesource | |
* @author Pedro Elsner <[email protected]> | |
* @license http://creativecommons.org/licenses/by/3.0/br/ Creative Commons 3.0 | |
* @abstract | |
* @version 1.0 |
This file contains hidden or 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 | |
// Importa a classe necessária | |
require_once('sanitize.php'); | |
// Filtra HTML e SQL Injection em todos os campos | |
$_GET = Sanitize::filter($_GET); | |
$_POST = Sanitize::filter($_POST); | |
// Somente HTML Injection | |
$_POST = Sanitize::filter($_POST, array('html')); |
This file contains hidden or 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 | |
/* | |
Plugin Name: Hello World! Plugin | |
URI: http://pedroelsner.com/2011/06/hello-world-criando-um-plugin-para-wordpress/ | |
Description: Adiciona o texto "Hello World!" ao conteúdo do post | |
Version: 1 | |
Author: Pedro Elsner | |
URI: http://pedroelsner.com/ | |
*/ | |
?> |
This file contains hidden or 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 | |
/** | |
* Função que adiciona o texto "Hello World!" ao conteudo do post | |
* | |
* @param string $content | |
* @return string | |
*/ | |
function hello_world_content_filter ( $content ) { | |
$content .= '<strong>Hello World!</strong>'; | |
return $content; |
This file contains hidden or 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 | |
/** | |
* Função que exibe o conteúdo do quadro | |
*/ | |
function hello_world_meta_box() { | |
global $post; | |
echo '<input id="hello_world_nonce" name="hello_world_nonce" type="hidden" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; | |
echo '<input id="hello_world_opt_mostrar_mensagem" name="hello_world_opt_mostrar_mensagem" type="checkbox" />'; |
This file contains hidden or 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 | |
// Adiciona/Atualiza valor da variável | |
update_post_meta( $post_id, $meta_key, $meta_value, $prev_value ); | |
// Retorna o valor da variável | |
get_post_meta( $post_id, $meta_key, $single ) | |
// Apaga a variável | |
delete_post_meta( $post_id, $meta_key, $meta_value ); | |
?> |
This file contains hidden or 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 | |
/** | |
* Função que grava as opções do plugin | |
* | |
* @param int $post_id | |
* @return int | |
*/ | |
function hello_world_save_postdata( $post_id ) { | |
if ( ! wp_verify_nonce( $_POST['hello_world_nonce'], plugin_basename(__FILE__) ) ) { | |
return $post_id; |
OlderNewer