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 | |
/* | |
Instruções: Substituir as primeiras linhas do arquivo /wp-content/plugins/JSON-API/controllers/posts.php | |
Oque Faz: Usa o cookie gerado pelo generate_auth_cookie como parametro de testes para ver usuario | |
Controller Name: Posts | |
Controller Description: Data manipulation methods for posts with Authentication method added | |
Controller Author: Matt Berg | |
Controller Author Twitter: @mattberg | |
*/ |
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
app.run(function ($location,$rootScope,AuthenticationService, FlashService, $templateCache){ | |
var routesThatRequireAuth = ['/main']; | |
$rootScope.$on('$stateChangeStart', function(event,next,current){ | |
if(_(routesThatRequireAuth).contains($location.path()) && !AuthenticationService.isLoggedIn()) { | |
$location.path('/login'); | |
FlashService.info("Por favor efetue login para continuar."); | |
} | |
}); |
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
/** | |
* Implementação do algorítimo SoundEx em Javascript. | |
* @author João Batista Neto | |
* | |
* SoundEX é um algorítimo fonético para indexação de nomes pelo som segundo | |
* sua pronúncia. O algorítimo foi desenvolvido por Robert C. Russell e | |
* Margaret K. Odell e patenteado em 1918 e 1922. | |
* {@link http://en.wikipedia.org/wiki/Soundex} | |
* | |
* @return {String} |
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 json_api_prepare_post( $post_response, $post, $context ) { | |
$field = get_fields($post['ID']); | |
$post_response['custom-fields'] = $field; | |
return $post_response; | |
} | |
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 ); |
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 json_api_prepare_post( $post_response, $post, $context ) { | |
$field = get_post_custom($post['ID']); | |
$post_response['custom-fields'] = $field; | |
return $post_response; | |
} | |
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 ); |
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
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'usuario', MD5('senha'), 'SEU NOME', '[email protected]', 'http://www.urlDoUsuarior.com/', '2011-06-07 00:00:00', '', '0',' SEU NOME'); | |
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10'); | |
/* Original http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/) */ |
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 | |
//stuff... | |
function json_api_prepara_termo($data, $term, $context ) { | |
$termfield = get_field('arquivo_de_imagem', $term); //custom field inserido com plugin ACF | |
$data['customfields']['imagem'] = $termfield; //adiciona ele no array $data e o retorna | |
return $data; | |
} | |
add_filter( 'json_prepare_term', 'json_api_prepara_termo', 10, 3 ); |
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 | |
/* | |
Plugin Name: Custom Taxonomy filter in Wordpress Admin Post Listing | |
Plugin URI: http://codeboxr.com/product/custom-taxonomy-filter-in-wordpress-admin-post-listing | |
Description: This plugin adds custom taxonomy filter in wordpress admin post listing panel. | |
Author: Codeboxr Team | |
Version: 1.0._RCMOD | |
Author URI: http://codeboxr.com | |
Publisher Note (RC): This plugin is available on wordpress repo, but gives ' headers already sent' error. | |
Because this is only 1 file, I created this gist |
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
// When using angular-translate it's impossible to make two-way data binding translations yet, | |
// and this sometimes can be a headache. So I've developed this directive to save some time. | |
// The view goes like this: <TAG data-bind-translate="scopeObjToTranslate.item.text"></TAG>. | |
app.directive('bindTranslate', [ | |
'$translate', | |
'$parse', | |
function($translate, $parse) { |
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
Reset = "\x1b[0m" | |
Bright = "\x1b[1m" | |
Dim = "\x1b[2m" | |
Underscore = "\x1b[4m" | |
Blink = "\x1b[5m" | |
Reverse = "\x1b[7m" | |
Hidden = "\x1b[8m" | |
FgBlack = "\x1b[30m" | |
FgRed = "\x1b[31m" |
OlderNewer