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 | |
class PagesController extends AppController { | |
public function beforeFilter() | |
{ | |
// habilita todas as actions | |
$this->Auth->allow(); | |
// habilita actions especificas |
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 | |
header('Content-Type: text/html; charset=utf-8'); | |
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | |
header ('Last-Modified: ' . gmdate("D,d M YH:i:s") . ' GMT'); | |
header ('Cache-Control: no-cache, must-revalidate'); | |
header ('Pragma: no-cache'); | |
header ('Content-type: application/x-msexcel'); | |
header ('Content-Disposition: attachment; filename="' . date('Y-m-d_H-i-s') . '.xls"'); | |
header ("Content-Description: PHP Generated Data" ); |
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 | |
$this->Filter->addFilters('Filtro', array('LIKE' => __('contendo', true))); | |
$this->Filter->setPaginate('limit', 6); // opcional | |
$this->Filter->setPaginate('group', 'Qname.queue'); | |
$this->Filter->setPaginate('fields', array('COUNT(QueueStat.qname) as Total', 'Qname.queue', 'Qevent.event', 'Qevent.event_id')); | |
$this->Filter->setPaginate('conditions', $this->Filter->getConditions()); | |
$this->QueueStat->recursive = 0; | |
$this->set('queuestats', $this->paginate()); |
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 | |
//Definindo a ordenação da paginação por dois itens | |
/** | |
* | |
* @param array $queryData | |
* @return array | |
*/ | |
public function beforeFind( $queryData ) |
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 | |
function get_posts_by_category( $category_name ) | |
{ | |
$args = array( | |
'posts_per_page' => 30, | |
'offset' => 0, | |
'category' => $category_name, | |
'orderby' => 'post_date', | |
'order' => 'DESC', |
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 | |
//Código | |
$terms = get_categories(array( | |
'type' => 'represent_map', | |
'taxonomy' => 'represent_map_type') | |
); | |
$categories = array(); |
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 | |
App::uses('AppController', 'Controller'); | |
App::import('Vendor', 'Facebook', array('file' => 'facebook-php-sdk/src/facebook.php')); | |
App::import('Network/Http', 'HttpSocket'); | |
/** | |
* Users Controller | |
* | |
* @property User $User | |
*/ |
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 | |
// AppController | |
// ... | |
public function beforeFilter() { | |
// Mecanismo de autenticação | |
$this->Auth->authenticate = array('Blowfish' => array( | |
// Configura o model e os campos |
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
Vou descrever as ações tomadas em um linha do tempo para que fique claro todos os passos que tomei até o momento. | |
04/11/2013 | |
Realizei a compra de uma bateria para o notebook z460 através do site da Lenovo. Comprei diretamente com a Lenovo porque no site prometia entrega em até 15 dias úteis. | |
06/11/2013 | |
Enviaram-me o boleto para pagamento o qual foi pago no mesmo dia. | |
12/11/2013 |
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 | |
// Exemplo de implementação recebendo um post sem tratamento, o que quero esclarescer é forma de realizar a condicional apenas | |
$itemRecebidoViaPost = $_POST['item']; | |
// Primeira forma | |
if ( $itemRecebidoViaPost == 'item-desejado' ) { |