Skip to content

Instantly share code, notes, and snippets.

@demisang
demisang / AesCipher.java
Last active December 16, 2022 02:16
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
import android.support.annotation.Nullable;
import android.util.Base64;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@thefuxia
thefuxia / whereami.php
Created July 4, 2015 08:21
Where am I?
<?php
/* Plugin Name: Where am I?
* Description: Adds the current server name and WordPress path to the admin footer.
* Version: 2015.07.04
* Author: toscho
* Author URI: http://wpkrauts.com/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
*/
add_filter( 'admin_footer_text', function( $text ) {
@johnbillion
johnbillion / hierarchy.php
Last active June 22, 2023 23:05
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
@ultimatemember
ultimatemember / gist:8cdaf61e7bd9de35512c
Last active April 19, 2021 20:35
Extending Ultimate Member Profile Menu using Hooks
/* First we need to extend main profile tabs */
add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
function add_custom_profile_tab( $tabs ) {
$tabs['mycustomtab'] = array(
'name' => 'My custom tab',
'icon' => 'um-faicon-comments',
);
@k0nsl
k0nsl / php-ping.php
Created January 21, 2015 17:19
PHP ping script
<?php
/*
*
* Use the examples below to add your own servers. Coded by clone1018 [?]
*
*/
$title = "Simple Server Status"; // website's title
$servers = array(
'Google Web Search' => array(
@Rarst
Rarst / WordPress.xml
Last active August 5, 2021 04:14
WordPress Live Templates for PhpStorm
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@mrwweb
mrwweb / truncate_html_string.php
Created July 3, 2014 18:08
Improved version of text-truncating html string function to improve character count accuracy. Code found on oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/.
<?
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* See: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/
* See also: wpengineer.com/2410/dont-use-strlen/
* See also also: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/#comment-1467093876
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
@suvozy
suvozy / Setup.md
Last active December 28, 2022 07:43
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@thefuxia
thefuxia / t5-ajax-editor.php
Created January 20, 2014 05:05
Fetch TinyMCE per AJAX. Media upload doesn’t work yet.
<?php
/**
* Plugin Name: T5 AJAX Editor
*/
namespace T5AjaxEditor;
class Controller implements Event_Handler
{