Skip to content

Instantly share code, notes, and snippets.

View mohsinrasool's full-sized avatar
💪

Mohsin Rasool mohsinrasool

💪
View GitHub Profile
@mohsinrasool
mohsinrasool / WPML Slug Fixed
Last active August 29, 2015 14:12
WPML Slug Fixed
/**
* This script adds a bulk action on post listing screen. When applied, it updates the slugs of selected translations with
* the slugs of corresponding english translations. Whole idea is to have same slugs for every translation with only difference
* of /language. For example
* /test
* /fr/test
* /de/test
*
* @author mohsinrasool
*/
@mohsinrasool
mohsinrasool / WPML: Minor edit checked by default
Created December 23, 2014 18:26
Enable the "Minor edit - dont'update translation" by WPML checkbox by default on post editing screen
/**
* Javascript added in admin screens
* 1. Enable the "Minor edit - dont'update translation" by WPML checkbox by default on post editing screen
*
* @return void
* @author mohsinrasool
**/
add_action('admin_footer', 'mr_admin_footer');
function mr_admin_footer()
@mohsinrasool
mohsinrasool / ftp-delete-files.php
Created February 4, 2015 15:27
This script deletes all the provided files from FTP server. It helps when server is being compromised and several malicious files has been detected. It happend to one of my hosting on iPage
<?php
/**
* This script deletes all the provided files from FTP server.
*
* Application: This script helps when server is being compromised and several malicious files has detected. Some common spams are
*
* HG.PHP.Shell.25968.UNOFFICIAL
* JCDEF.Obfus.CreateFunc.BackDoorEval-23
* JCDEF.Obfus.CreateFunc.BackDoorEval-26
* JCDEF.Obfus.CreateFunc.BackDoorEval-21
@mohsinrasool
mohsinrasool / Cleverness-Todos-in-WP-Full-Calendar
Created March 27, 2015 12:39
Displays Assigned Cleverness todos in WP Full Calendar
/**
* Displays Assigned Cleverness todos in WP Full Calendar
*
* @return $items
* @author Mohsin Rasool
**/
add_filter( 'wpfc_events', 'wpfc_add_tasks' );
add_filter( 'wpfc_ajax', 'wpfc_add_tasks' );
@mohsinrasool
mohsinrasool / MultiDimArrayPost.class.php
Last active February 27, 2024 19:57
Post multi-dimensional array using PHP Curl.
/**
* Post multi-dimensional array to a URL using PHP Curl.
* Usage:
* $req = new MultiDimArrayPost();
* $req->postToURL('http://xyz.com/post',$_POST);
*
* @package default
* @author Mohsin Rasool
*
**/
@mohsinrasool
mohsinrasool / file_auto_loader.php
Created July 9, 2015 12:32
Function recursively includes all the files in the specified directory $dir and skips the ones in $skipFiles array
<?php
/**
* It recursively includes all the files in the specified directory $dir and skips the ones in $skipFiles array
* Usage:
* include_files(dirname(__FILE__)."/models", $skipFiles);
*
* @return void
* @author Mohsin Rasool
*
@mohsinrasool
mohsinrasool / year-directive.js
Created July 9, 2015 12:38
An AngularJS directive to create a dropdown of years
/**
* Usage: <year-select offset=0 range=10 />
*
*/
app.directive('yearSelect',function(){
var currentYear = new Date().getFullYear();
return {
restrict: 'AE',
replace: true,
@mohsinrasool
mohsinrasool / month-directive.js
Created July 9, 2015 12:40
An AngularJS directive to generate dropdown of months
/**
* Usage <year-select range=10 offset=0 />
*
*
*/
app.directive('monthSelect',function(){
return {
@mohsinrasool
mohsinrasool / wp-db-fix-weird-chars.sql
Last active August 29, 2015 14:24
WP Queries to fix weird characters (i.e., – = em dash, and — = en dash) in posts and pages
-- Try 1:
-- Change DB_CHARSET from utf-8 to latin1 in wp-config.php
-- define('DB_CHARSET', 'latin1');
-- Try 2:
-- Clean up post_content
UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
/** Angular JS datepicker fix for mssql dates
*
*/
app.directive('datepickerLocaldate', ['$parse', function ($parse) {
var directive = {
restrict: 'A',
require: ['ngModel'],
link: link
};