Skip to content

Instantly share code, notes, and snippets.

View mgarciaebo's full-sized avatar

Manuel García Solipa mgarciaebo

View GitHub Profile
<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/
@mgarciaebo
mgarciaebo / build_tree.php
Last active August 27, 2015 17:32
Función recursiva para construir menú en arreglo mutlidimensional
<?php
function buildTree(array $elements, $parentId = NULL) {
$branch = array();
foreach ($elements as $key => $element) {
if ($element['parent'] == $parentId) {
$children = buildTree($elements, $element['id']);
if ($children) {
$element['children'] = $children;
@mgarciaebo
mgarciaebo / gist:0fe4c74f17f7de9a89de
Created April 27, 2015 12:00
[WORDPRESS] Snippet para mostrar TinyMCE en el cuadro excerpt
function lb_editor_remove_meta_box() {
global $post_type;
/**
* Check to see if the global $post_type variable exists
* and then check to see if the current post_type supports
* excerpts. If so, remove the default excerpt meta box
* provided by the WordPress core. If you would like to only
* change the excerpt meta box for certain post types replace
* $post_type with the post_type identifier.
*/