Plugin Directory

Changeset 1207255


Ignore:
Timestamp:
07/27/2015 07:38:38 AM (11 years ago)
Author:
baseapp
Message:

Update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wpbase-cache/trunk/trunk/wpbase-cache.php

    r1207245 r1207255  
    44  Plugin URI: https://github.com/baseapp/wpbase-cache
    55  Description: A wordpress plugin for using all caches on varnish, nginx, php-fpm stack with php-apc. This plugin includes db-cache-reloaded-fix for dbcache.
    6   Version: 2.1
     6  Version: 2.1.0
    77  Author: Vikrant Datta
    88  Author URI: http://blog.wpoven.com
     
    190190    }
    191191}
    192 
    193192$options = get_option('wpbase_cache_options');
    194193$send_as = $options['send_as'];
    195 if ($send_as != NULL) {
    196     add_filter('wp_mail_from', 'mail_from');
    197     add_filter('wp_mail_from_name', 'mail_from_name');
    198 }
    199 
    200 function mail_from($email) {
     194    if($send_as != NULL){
     195add_filter('wp_mail_from', 'mail_from');
     196add_filter('wp_mail_from_name', 'mail_from_name');
     197}
     198function mail_from($email){
    201199
    202200    $options = get_option('wpbase_cache_options');
    203201    $send_as = $options['send_as'];
    204    
    205         // $sitename = strtolower($_SERVER['SERVER_NAME']);
    206         // $sitename = str_replace('www.','',$sitename);
    207         global $wpdb;
     202    if($send_as != NULL){
     203       // $sitename = strtolower($_SERVER['SERVER_NAME']);
     204       // $sitename = str_replace('www.','',$sitename);
     205 global $wpdb;
    208206        $table_name = $wpdb->prefix . "options";
    209         $result = $wpdb->get_results('SELECT option_value FROM ' . $table_name . ' WHERE option_name = "siteurl";', ARRAY_N);
     207        $result = $wpdb->get_results('SELECT option_value FROM '.$table_name.' WHERE option_name = "siteurl";',ARRAY_N);
    210208        $sitename = parse_url($result[0][0]);
    211209        $host = $sitename['host'];
    212210        $domain = str_replace('www.', '', $host);
    213         if (strpos($domain, '8080') !== false) {
    214             $dom = explode('/', $_SERVER['REQUEST_URI']);
    215             return $send_as . '@' . $dom[1];
    216         } else {
    217             return $send_as . '@' . $domain;
     211if(strpos($domain,'8080')!==false){
     212            $dom = explode('/',$_SERVER['REQUEST_URI']);
     213            return $send_as.'@'.$dom[1];
     214        }
     215        else{
     216            return $send_as.'@'.$domain;
    218217        }
    219218
    220219        //$sitename = substr($sitename,0,4)=='www.' ? substr($sitename, 4) : $sitename;
    221    
    222 }
    223 
    224 function mail_from_name($name) {
     220    }
     221
     222}
     223function mail_from_name($name){
    225224    $options = get_option('wpbase_cache_options');
    226225    $send_as = $options['send_as'];
    227    
     226    if($send_as != NULL){
    228227        return $send_as;
    229 }
     228    }
     229    }
Note: See TracChangeset for help on using the changeset viewer.