Skip to content

Instantly share code, notes, and snippets.

@nextend
nextend / trackerdata.php
Created March 7, 2018 06:38
Nextend Social Login - TrackerData
<?php
add_action('nsl_register_new_user', function ($user_id) {
if (NextendSocialLogin::getTrackerData() == 'editor') {
$user = new WP_User($user_id);
$user->set_role('editor');
}
});
<?php
/*
Plugin Name: Test
*/
function test() {
return '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 120" preserveAspectRatio="none">
<g class="n2-ss-divider-start">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z" duration="1" delay="0" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z" duration="1" delay="0.2" data-original="M1920,0 0,0 0,0z"></path>
<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 120" preserveAspectRatio="none"><br />
<g class="n2-ss-divider-start">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z" duration="1" delay="0" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z" duration="1" delay="0.2" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" d="M1920,0 0,40 0,0z" duration="1" delay="0.4" data-original="M1920,0 0,0 0,0z"></path>
</g><br />
<g class="n2-ss-divider-end">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z"></path>
<path fill="RGBA(255,255,255,1)" d="M1920,0 0,40 0,0z"></path>
<?php
/*
Plugin Name: Nextend Social Login - Username length
*/
add_filter('nsl_validate_username', function ($isValid, $username, $errors) {
if (strlen($username) < 6) {
$errors->add('invalid_username', '<strong>' . __('ERROR') . '</strong>:' . __('Sorry, username must contain at least 6 characters.'));
$isValid = false;
}
<?php
//Original
function zeo_final_title(){
// Use object to avoid namespace collisions
$zeo_rewrite_title = new zeo_rewrite_title();
// We want to act when the page is 99% complete
add_action('wp_footer', array(&$zeo_rewrite_title, 'wpzeo_footer'));
@nextend
nextend / fix.php
Created June 8, 2018 05:46
Fix for
<?php
add_action('plugins_loaded', 'fix_insert_php_code_snippet');
function fix_insert_php_code_snippet() {
add_shortcode('xyz-ips', 'mod_xyz_ips_display_content');
}
function mod_xyz_ips_display_content($xyz_snippet_name) {
global $wpdb;
if (is_array($xyz_snippet_name)) {
@nextend
nextend / fix-insert-php-code-snippet.php
Last active June 8, 2018 06:06
Fix for Insert PHP Code Snippet output buffer issue
<?php
/*
Plugin Name: Fix: Insert PHP Code Snippet output buffer issue
Author: nextendweb
Version: 1.0.0
Requires at least: 4.1
Tested up to: 4.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@nextend
nextend / test.php
Last active June 15, 2018 11:38
Curl verbose Facebook api test
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/v2.12/oauth/access_token");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3");
curl_setopt($ch, CURLOPT_VERBOSE, true);
@nextend
nextend / block.php
Created November 9, 2018 08:15
Gutenberg block.php Smart Slider 3
<?php
defined('ABSPATH') || exit;
class NextendSmartSlider3Gutenberg {
public function __construct() {
add_action('enqueue_block_editor_assets', array(
$this,
'enqueue_block_editor_assets'
@nextend
nextend / block.js
Created November 9, 2018 08:17
Gutenberg block.js Smart Slider 3
(function (blocks, editor, i18n, element, components, _) {
var el = element.createElement;
blocks.registerBlockType('nextend/smartslider3', {
title: 'Smart Slider 3',
icon: 'welcome-learn-more',
category: 'common',
attributes: {
slider: {
type: 'string'