Skip to content

Instantly share code, notes, and snippets.

View rehmatworks's full-sized avatar
👨‍💻
python manage.py domagic

Rehmat Alam rehmatworks

👨‍💻
python manage.py domagic
View GitHub Profile
require_once ('/path/SimpleShortcodes.php');
$simpleshortcodes = new SimpleShortcodes();
$shortcodes = array(
'[first_name]' => '{$first_name}',
'[last_name]' => '{$last_name}',
'[user_country]' => '{$country}'
);
<?php
class SimpleShortcodes {
private $_shortcodes = array();
public function __construct() {
/*
$simpleshortcodes->add($shortcodes);
$first_name = 'Rehmat';
$last_name = 'Alam';
$country = 'Pakistan';
$message = 'Hello [first_name], do you live in [user_country]?';
echo $message; // Prints out Hello [first_name], do you live in [user_country]?
require_once ('/path/SimpleShortcodes.php');
$simpleshortcodes = new SimpleShortcodes();
$shortcodes = array('[name]' => '{$name}');
$simpleshortcodes->add($shortcodes);
// An array that contains user information. You can use multidimensional arrays to include more details about the user
$users = array('User 1', 'User 2', 'User 3', 'User 4', 'User 5');
$message = 'Hello [name], we are here with the introduction to our newest product. Blah blah blah...';
echo $simpleshortcodes->read($message); // Will print Hello Rehmat, do you live in Pakistan?