This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once ('/path/SimpleShortcodes.php'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$simpleshortcodes = new SimpleShortcodes(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$shortcodes = array( | |
'[first_name]' => '{$first_name}', | |
'[last_name]' => '{$last_name}', | |
'[user_country]' => '{$country}' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SimpleShortcodes { | |
private $_shortcodes = array(); | |
public function __construct() { | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$simpleshortcodes->add($shortcodes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$first_name = 'Rehmat'; | |
$last_name = 'Alam'; | |
$country = 'Pakistan'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$message = 'Hello [first_name], do you live in [user_country]?'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $message; // Prints out Hello [first_name], do you live in [user_country]? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $simpleshortcodes->read($message); // Will print Hello Rehmat, do you live in Pakistan? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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...'; |
OlderNewer