Skip to content

Instantly share code, notes, and snippets.

View lonalore's full-sized avatar

Sándor Juhász lonalore

View GitHub Profile
function sc_bootstrap_languagelinks($parm = '')
{
if(!defined('LANGLINKS_SEPARATOR'))
{
define('LANGLINKS_SEPARATOR', '  ');
}
$tmp = explode('|', $parm, 2);
$parm = $tmp[0];
$parms = array();
@lonalore
lonalore / library_manager.php
Last active March 9, 2016 10:42
Library Manager with list of core libraries
<?php
/**
* @file
* External library handling for e107 plugins/themes.
*
* TODO:
* - Provide the ability to use third-party callbacks (are defined in e_library.php files) for groups:
* 'info', 'pre_detect', 'post_detect', 'pre_dependencies_load', 'pre_load', 'post_load'
*/
@lonalore
lonalore / meta.md
Created March 10, 2016 09:41
Meta-tag collection

General

  • title (Title) - The text to display in the title bar of a visitor's web browser when they view this page. This meta tag may also be used as the title of the page when a visitor bookmarks or favorites this page.
  • description (Description) - A brief and concise summary of the page's content, preferably 150 characters or less. The description meta tag may be used by search engines to display a snippet about the page in search results.
  • abstract (Abstract) - A brief and concise summary of the page's content, preferably 150 characters or less. The abstract meta tag may be used by search engines for archiving purposes.
  • keywords (Keywords) - A comma-separated list of keywords about the page. This meta tag is not supported by most search engines anymore.

Advanced tags

  • robots - Robots - Options: follow, index, noarchive, nofollow, noimageindex, noindex, noodp, nosnippet, notranslate, noydir
    • follow: Allow search engines to follow links on this page (assumed).
  • **i
@lonalore
lonalore / e107cli.md
Last active July 27, 2017 22:38
e107 command line interface (e107cli ??)
<?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';
<?php
namespace Drupal\paypal_roles\Form;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
/**

Installing an external library that is required by a contributed plugin

  • Download the library - The plugin that requires the external library should provide a link to the homepage of that library or, even better, directly to that library's download page. Sometimes the plugin will specify a version for you to download, otherwise just download the latest version.
  • Extract the files - If the file you downloaded is an archive, i.e. its file extension is .zip or .tar.gz, you will need to extract it first. On Windows, use a program like 7-zip to extract it. On the Mac, you can use Stuffit Expander. For *nix systems, use the command line: tar -zxvf filename.tar.gz. After extracting the file, you should see multiple files or a single folder with the library's name.
  • Upload the library - Inside the e107_web/lib/ directory create a new directory with the e107 machine name of the library. The machine name should be prov

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.
define("TPVLAN_83", "Automated download not possible. Please [x]");
define("TPVLAN_84", "Download Manually");
$tp = e107::getParser();
$mes = e107::getMessage();
$message = $tp->lanVars(TPVLAN_83, array(
'x' => '<a href="' . $remotefile . '">' . TPVLAN_84 . '</a>',
));

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

/**