Skip to content

Instantly share code, notes, and snippets.

@mohamedsalehamin
mohamedsalehamin / Convert.php
Last active November 11, 2019 13:33
fix convert Arabic images names to webp through webp-express
// wp-content/plugins/webp-express/lib/classes/Convert.php
public static function convertFile($source, $config = null, $convertOptions = null, $converter = null)
{
try {
// fix arabic file names
$oldPath = pathinfo($source);
$basename = $oldPath['basename'];
copy($source, $oldPath['dirname'] . '/imageCopy.' . $oldPath['extension']);
$newPath = $oldPath['dirname'] . '/imageCopy.' . $oldPath['extension'];
@mohamedsalehamin
mohamedsalehamin / token_by_email_JWT.php
Created July 13, 2018 18:30
wordpress get token by email JWT
<?php
use \Firebase\JWT\JWT;
function social_token($request)
{
$user_name = $request['email'];
if( email_exists( $user_name ) == true )
{
@mohamedsalehamin
mohamedsalehamin / convert.php
Last active May 10, 2022 12:25
Convert image to base64 using curl
<?php
function curl_get_contents($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
@mohamedsalehamin
mohamedsalehamin / vc-rtl-fix.js
Created August 23, 2017 22:40 — forked from aliaghdam/visual-composer-rtl-fix.js
WordPress Visual Composer full width row ( stretche row ) fix for RTL
jQuery(document).ready(function() {
function bs_fix_vc_full_width_row(){
var $elements = jQuery('[data-vc-full-width="true"]');
jQuery.each($elements, function () {
var $el = jQuery(this);
$el.css('right', $el.css('left')).css('left', '');
});
}
@mohamedsalehamin
mohamedsalehamin / API.php
Last active September 14, 2021 23:46
Wp-Polls Rest Api Gist
<?php
/**********************************************************************
*
* Poll
*
**********************************************************************/
function get_poll_template_by_me($poll_id, $display_loading = true)
{
global $wpdb;
$data = array();
<?php
if (!class_exists('aduta_Category_Template')){
class aduta_Category_Template{
/*
* class constructor
*/
public function __construct()
{
/*