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
| function parse_git_dirty { | |
| [[ "$(git status 2> /dev/null | tail -n1)" != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function bord_git_unpushed { | |
| branchinfo=$(git branch -v 2> /dev/null) | |
| if [[ $branchinfo != "" ]] | |
| then | |
| brinfo=$($branchinfo | grep $(bord_git_parse_branch) | egrep " \[ahead [[:digit:]]{1,}\] ") |
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 | |
| /** | |
| * Handle file uploading and add attachment. | |
| * | |
| * @return array Uploaded file's details on success, error message on failure | |
| */ | |
| function wp_import_handle_upload() { | |
| if ( !isset($_FILES['filefield_name']) ) { | |
| $file['error'] = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' ); | |
| return $file; |
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 | |
| global $wpdb; | |
| $possible_ids = $wpdb->get_col($wpdb->prepare("SELECT `post_parent` FROM {$wpdb->$posts} WHERE `post_parent`!=0 AND `post_type`='attachment' GROUP BY `post_parent`;")); | |
| $args = array( | |
| 'post__in' => $possible_ids, | |
| 'posts_per_page' => 4, | |
| 'category__in' => array(8), | |
| 'meta_query' => 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 | |
| // Safe Search and Replace on Database with Serialized Data v1.0.1 | |
| // This script is to solve the problem of doing database search and replace | |
| // when developers have only gone and used the non-relational concept of | |
| // serializing PHP arrays into single database columns. It will search for all | |
| // matching data on the database and change it, even if it's within a serialized | |
| // PHP 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 | |
| /** | |
| * Count the words in a string, remove all the html before counting | |
| * | |
| * @since 0.1a | |
| * @access public | |
| * | |
| * @param string $text (required) Any kind of string works, even with html | |
| * Default: 'null'. | |
| * @param string $type (required) The kind of return that you want, could be just an int or an 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 | |
| $_filter = function($title, $id) { | |
| if (in_category('nome-da-category', $id) && strpos($title, 'Receita de ')!==false) { | |
| return str_replace('Receita de ', '', $title); | |
| } | |
| return $title; | |
| }; | |
| add_filter('the_title', $_filter); |
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 | |
| // Add filter to plugin init function | |
| add_filter('post_type_link', function ($permalink, $post_id, $leavename) { | |
| $post = get_post($post_id); | |
| $rewritecode = array( | |
| $leavename? '' : '%cursos%', | |
| '%category%', | |
| ); |
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
| [qa.trii.com.br] Executing task 'deploy' | |
| [qa.trii.com.br] sudo: git fetch --all --recurse-submodules-default=yes --quiet --prune | |
| [qa.trii.com.br] sudo: git reset --hard origin/master && git submodule foreach git reset --hard origin/master | |
| [qa.trii.com.br] out: HEAD is now at 393c4a2 NGINX whitelist | |
| [qa.trii.com.br] out: Entering 'www/edumais' | |
| [qa.trii.com.br] out: HEAD is now at 9583526 Adicionado a pasta uploads | |
| [qa.trii.com.br] out: Entering 'www/institucional' | |
| [qa.trii.com.br] out: HEAD is now at cef1df2 Mudança de endereços | |
| [qa.trii.com.br] out: Entering 'www/plasticursos' | |
| [qa.trii.com.br] out: HEAD is now at a4f8dc6 Ajustes de server |
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 | |
| $role = 'subscriber'; | |
| if ( false === ( $userids = get_transient( "monthly_userids.{$role}" ) ) ) { // If the transient isn't set do it! | |
| global $wpdb; | |
| $start_date = date('Y-m-d H:i:s', strtotime('first day of this month')); | |
| $end_date = date('Y-m-d H:i:s', strtotime('first day of next month')); | |
| $userids = $wpdb->get_col( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS `user`.`ID` as `ID` FROM `{$wpdb->users}` AS `user`, `{$wpdb->usermeta}` AS `meta` WHERE 1=1 AND (`meta`.`user_id` = `user`.`ID` AND `meta`.`meta_key` = 'em_capabilities' AND `meta`.`meta_value` LIKE '%s') AND `user`.`user_registered` BETWEEN '%s' AND '%s' GROUP BY `user`.`ID`;", "%{$role}%", $start_date, $end_date ) ); | |
| set_transient( "monthly_userids.{$role}", $userids, 60*60*12 ); |
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 | |
| /** | |
| * WordPress Files Edition Security | |
| * Nobody can be able to edit files within the admin it self | |
| */ | |
| define( 'DISALLOW_FILE_EDIT', true ); | |
| define( 'DISALLOW_FILE_MODS', true ); |