PHP Classes

File: classes/ShortCode.php

Recommend this page to a friend!
  Classes of mohammad anzawi   Simple PHP Newsletter & Mailing System   classes/ShortCode.php   Download  
File: classes/ShortCode.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Simple PHP Newsletter & Mailing System
Send a newsletter to users stored in a database
Author: By
Last change:
Date: 2 years ago
Size: 1,881 bytes
 

Contents

Class file image Download
<?php

#---------------------------------------------------------------------------#
# this Project Created by Mohammad Anzawi #
# #
# This project is intended for beginners and learners #
# The main objective of this project is to see the way do something similar,#
# such as sending messages via e-mail, files Read the content and create #
# templates or other #
# and saved on the server within a specific folder. #
# Can anyone who want to modify or development (add some functions, styles),#
# and use it in his dite, or commercially. #
# #
# so if you have any question -> ask me on m.anzawi2013@gmail.com #
# or visit my blog on http://www.phptricks.org #
#---------------------------------------------------------------------------#

/**
 *
 * this class have one method only
 * to replace shortcode from emails templates .html to real information
 *
 */

class ShortCode
{

    public static function
convert($msg, $name, $email, $activation_key = '') {

       
// repalce [user_name] to $name
       
$msg = str_replace('[user_name]', $name, $msg);
       
// repalce [user_email] to $email
       
$msg = str_replace('[user_email]', $email, $msg);

       
// if isset $activation_key replace it
       
if($activation_key) {
           
$msg = str_replace('[activation_key_link]',
                   
'http://' . $_SERVER['HTTP_HOST'] . '/activate?key=' . $activation_key,
                   
$msg);
        }
       
       
// return $msg with real subscriber information
       
return $msg;
    }

}