Skip to content

Instantly share code, notes, and snippets.

@sareiodata
sareiodata / php-html-css-js-minifier.php
Created June 2, 2016 12:56 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/engine/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
javascript:(function(){var request=new XMLHttpRequest();request.open("GET",window.location.href.replace(/ro\//g,'hu/'),false);request.send(null);var hidden=document.body.appendChild(document.createElement("div"));hidden.style.display="none";hidden.innerHTML=request.responseText;price=hidden.querySelector('#schemaProductPrice');if(price){price=parseInt(hidden.querySelector('#schemaProductPrice').textContent.replace(/\./gm,''));price=(price*1.41/100).toFixed(2)+" lei ( "+price+" HUF )";}else{price="N/A";}price_hu=document.createElement("div");price_hu.innerHTML=price;refNode=document.querySelector('#price1');refNode.parentNode.insertBefore(price_hu,refNode.nextSibbling);})()
<?php
// add the following to your functions file or similar
define( 'FUBLO_GF_PROFILE', 1 ); // define the ID number of your profile form.
// ============================================================= PROFILE EDITING
/**
* These are the user metadata fields, with their names and the data about them.