Skip to content

Instantly share code, notes, and snippets.

View rajuahmmed's full-sized avatar
🏠
Working from home

Raju Ahmmed rajuahmmed

🏠
Working from home
View GitHub Profile
<?php
function minify_css($css_code)
{
// Remove comments
$css_code = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css_code);
// Remove space after colons
$css_code = str_replace(': ', ':', $css_code);
// Remove whitespace
@rajuahmmed
rajuahmmed / finding-unescape-translated-strings
Created August 31, 2016 13:49
Finding unescaped translated strings with Regular Expression by https://www.cantothemes.com/
// Finding __()
[^lr\(]__\(
// Finding _e()
[^lr\(]_e\(
@rajuahmmed
rajuahmmed / wp-escaping-translated-strings.php
Last active December 5, 2016 14:41
Escaping wordpress translated strings by https://www.cantothemes.com
<?php
/**
* Example of escaping __() function
*/
// Unescaped
echo __("Example String", "textdomain");
// Escaped from HTML : XSS safe
echo esc_html__("Example String", "textdomain");
@rajuahmmed
rajuahmmed / wp-comment-callback
Created May 29, 2016 15:20 — forked from georgiecel/wp-comment-callback
Custom callback for HTML5 friendly WordPress comment. Also includes schema.org microdata. To use, insert the following into comments.php: <?php wp_list_comments('callback=better_comment&end-callback=better_comment_close'); ?>
// awesome semantic comment
function better_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'article' == $args['style'] ) {
$tag = 'article';
$add_below = 'comment';
} else {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Ajax Contact with php by CantoThemes</title>
<!-- Bootstrap -->
@rajuahmmed
rajuahmmed / php-html-css-js-minifier.php
Created April 17, 2016 10:39 — 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/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {