Skip to content

Instantly share code, notes, and snippets.

View adeel-raza's full-sized avatar

Adeel adeel-raza

View GitHub Profile
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@sudar
sudar / wp-increase-timeout.php
Created February 13, 2013 15:54
Increase the curl timeout in WordPress
<?php
Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/
//adjustments to wp-includes/http.php timeout values to workaround slow server responses
add_filter('http_request_args', 'bal_http_request_args', 100, 1);
function bal_http_request_args($r) //called on line 237
{
$r['timeout'] = 15;
return $r;
}
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@butlerblog
butlerblog / wp_config.php
Last active February 1, 2024 09:00
Configure WordPress #wp_mail function to send through #SMTP server https://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php.
* These should be added somewhere BEFORE the constant ABSPATH is defined.
*
* Author: Chad Butler
* Author URI: https://butlerblog.com
*
* For more information and instructions, see: https://b.utler.co/Y3
@chrisknepper
chrisknepper / gcal_link.php
Created July 18, 2014 03:51
PHP Google Calendar Link Generator
@vrushank-snippets
vrushank-snippets / PHP : Array To CSV - Download CSV File
Created December 13, 2012 06:21
PHP : Array To CSV - Download CSV File
$fileName = 'Billing-Summary.csv';
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$fileName}");
header("Expires: 0");
header("Pragma: public");
$fh = @fopen( 'php://output', 'w' );
@jarvys
jarvys / run-multiple-redis-instances.md
Last active September 27, 2022 13:02
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...
@kevinwhoffman
kevinwhoffman / plugin.php
Last active April 15, 2022 20:46 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@shyim
shyim / ShyimCron.php
Created October 4, 2016 12:09
Simple Cron in Shopware 5.2 Pluginsystem
<?php
namespace ShyimCron;
use Shopware\Components\Plugin;
use Shopware\Components\Plugin\Context\InstallContext;
use Shopware\Components\Plugin\Context\UninstallContext;
class ShyimCron extends Plugin {
public static function getSubscribedEvents()
@sabarasaba
sabarasaba / gist:1387550
Created November 23, 2011 00:36
Setting a timeout for the file_get_contents function
<?php
// Create the stream context
$context = stream_context_create(array(
'http' => array(
'timeout' => 3 // Timeout in seconds
)
));
// Fetch the URL's contents