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 hello_world_content_filter( $content ) { | |
global $post; | |
// Verifica a opção no banco de dados para este post ou página | |
if ( get_post_meta( $post->ID, 'hello_world_opt_mostrar_mensagem', true ) == '1' ) { | |
$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 | |
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" '; | |
if ( get_post_meta( $post->ID, 'hello_world_opt_mostrar_mensagem', true ) == '1' ) | |
echo ' checked="checked" '; |
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 | |
//Configure::write('Routing.prefixes', array('admin')); | |
?> |
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 | |
Router::connect( | |
'/admin', | |
array( | |
'controller' => 'pages', | |
'action' => 'index', | |
'admin' => true | |
) | |
); | |
?> |
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
CREATE TABLE users ( | |
id INT UNSIGNED NOT NULL AUTO_INCREMENT, | |
name VARCHAR(200) NOT NULL, | |
username VARCHAR(20) NOT NULL, | |
password VARCHAR(100) NOT NULL, | |
created DATETIME NULL, | |
modified DATETIME NULL, | |
active TINYINT(1) NOT NULL DEFAULT 1, | |
PRIMARY KEY(id), | |
UNIQUE(username) |
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
cake bake model user | |
cake bake controller user admin | |
cake bake view 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 | |
/** | |
* App Controller | |
* | |
* @use Controller | |
* @link http://book.cakephp.org/pt/view/957/A-classe-AppController | |
*/ | |
class AppController extends Controller | |
{ |
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 | |
/** | |
* Login | |
* | |
* @access public | |
*/ | |
function login() | |
{ | |
// Aqui é tudo automagic. | |
// O Auth Component se encarrega de fazer tudo sozinho. |
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
<h2>Login</h2> | |
<?php | |
echo $this->Form->create( | |
'User', | |
array( | |
'url' => array( | |
'controller' => 'users', | |
'action' => 'login' | |
) | |
) |
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 echo $this->Session->flash('auth'); ?> |