Skip to content

Instantly share code, notes, and snippets.

@Jimmi08
Jimmi08 / Twitter_menu.php
Created June 14, 2017 10:37 — forked from Floryn/Twitter_menu.php
twitter menu for e107
<?php
if (!defined('e107_INIT')) { exit; }
$html = <<<END_OF_HTML
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 3,
interval: 30000,
<?php
define("e107_INIT", TRUE);
$chwd = realpath(dirname(__FILE__));
$e107_config = $chwd . '/e107_config.php';
include_once($e107_config);
$e107_version = $chwd . '/' . $ADMIN_DIRECTORY . 'ver.php';
@Jimmi08
Jimmi08 / e107_cpg15x.inc.php
Created June 14, 2017 12:26 — forked from chipviled/e107_cpg15x.inc.php
Bridge e107 (v 1.x and 2.x) and cpg (v1.5.x only)
<?php
/********************************************************************
Coppermine Photo Gallery
e107 bridge
************************
v1.01
Coppermine version: 1.4.9
$Source$
$Author: v3 <v3@sonic-world.ru>$

Using Newer Versions of jQuery in e107

You will often need a newer version of jQuery to use a certain jQuery plugin. There are two ways to achieve this.

Method 1: Using theme_library.php addon file in your theme folder

<?php

/**

Ajax API - Ajax Forms in e107

Ajax-enabled forms in e107 offer dynamic form behavior with no page reloads and are easy to create and manipulate. They are a simple extension of the e107 Form API.

What is dynamic behavior? Traditional web behavior has the user fill in a form, click a button, and the entire page is rebuilt and sent back to the browser. Ajax-enabled forms update or replace part of the page or part of the form without doing a full page reload - only the part that needs to be changed is changed. It's more responsive to the user and typically faster than the traditional page reload approach.

Some facts about Ajax:

  • Ajax forms provide dynamic form behavior without page reloads.
  • As a developer you don't use or touch any JavaScript to create an Ajax-enabled form. E107 does all the work for you.
  • Most of the time, Ajax-enabled forms are just dynamic replacement of an HTML region on the page, which is most often a piece of a rebuilt form.
<?php
// Configuration ---------------------- //
$repo = "e107inc/e107";
$branch = "master";
// ------------------------------------ //
$git = simplexml_load_file("https://github.com/".$repo."/commits/".$branch.".atom");
@Jimmi08
Jimmi08 / link_pdf_attachment.php
Created September 8, 2017 14:00 — forked from pommiegranit/link_pdf_attachment.php
Simple plugin to add a link to the top of a WordPress post to any PDF attachment
@Jimmi08
Jimmi08 / .htaccess
Created January 25, 2018 08:19 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Jimmi08
Jimmi08 / readme.md
Created November 1, 2018 15:59 — forked from nonsintetic/readme.md
PHP - Get YouTube subscriber count with Youtube API v3

How to:

Here's a 'simple' way to get the YouTube subscriber number from Google's Youtube API v3:

  1. Go to https://console.developers.google.com/apis/library
  2. Log in with your Google account.
  3. Next to the logo click on 'Project' and 'Create project'. Name it whatever you want and click on 'Create'.
  4. Wait until the project is created, the page will switch to it by itself, it will take a couple of seconds up to a minute. Once it's done it will be selected next to the logo.
  5. Once it's created and selected, click on 'Credentials' from the menu on the left.
  6. Click on 'Create Credentials' and choose 'API Key'. You can restrict it to specific IPs, or types of requests (website, android, ios etc.) if you want, it's safer that way.
@Jimmi08
Jimmi08 / regex.php
Created February 19, 2019 21:30 — forked from Moc/regex.php
<?php
$string1 = '<link href="/css/bs4-dynamic-fields-form-2.min.css" rel="stylesheet" media="screen">';
$string2 = '<script src="/cdn-cgi/apps/head/qx0HK83qWJ5I3r2xnETN-ETfo6s.js"></script>"';
$regex1 = '~<link(.*?)href="([^"]+)"(.*?)>~';
$regex2 = '/src=(["\'])(.*?)\1/';
$result1 = preg_match($regex1, $string1, $matches1);
$result2 = preg_match($regex2, $string2, $matches2);