Skip to main content

Posts

Showing posts from February, 2016

[php] slugify

1) return preg_replace(             '/[^a-z0-9]/',             '-',             strtolower(trim(strip_tags(                 Transliterator::create('NFD; [:Nonspacing Mark:] Remove; NFC')->transliterate($string)             )))         ); 2) return trim(preg_replace('/-{2,}/', '-', preg_replace('/[^a-z0-9]/', '-', strtolower(strip_tags($title)))), '-');

[php] Mailchimp simple api wrapper v3.0

// how to use $apikey = 'xxx'; $listId = 'xxx'; $mailChimp = new MailChimp($apikey); $result = $mailChimp->subscribe($listId, array(     'email_address' => $email_address,     'status' => 'subscribed',     'merge_fields' => array(         'NAME' => $name,         'STORE' => $store,         'RECEIPTNO' => $receipt_no,     ) )); // class class MailChimp {     private $api_key;     private $api_endpoint = 'https://<dc>.api.mailchimp.com/3.0';     public  $verify_ssl   = true;     /**      * Create a new instance      * @param string $api_key Your MailChimp API key      */     public function __construct($api_key)     {    ...