/**
  * Class constructor
  */
 function __construct()
 {
     global $pagenow;
     inboundrocket_set_wpdb_tables();
     inboundrocket_set_mysql_timezone_offset();
     $this->power_ups = self::get_available_power_ups();
     if (is_user_logged_in() && is_admin()) {
         add_action('admin_bar_menu', array($this, 'add_inboundrocket_link_to_admin_bar'), 999);
     }
     if (is_admin()) {
         if (!defined('DOING_AJAX') || !DOING_AJAX) {
             $ir_wp_admin = new WPInboundRocketAdmin($this->power_ups);
         }
     } else {
         if (in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
             add_action('login_enqueue_scripts', array($this, 'add_inboundrocket_frontend_scripts'));
         } else {
             add_action('wp_enqueue_scripts', array($this, 'add_inboundrocket_frontend_scripts'));
         }
     }
     add_action('wp_ajax_ir_ec_callback', array($this, 'inboundrocket_ec_callback'));
     add_action('wp_ajax_nopriv_ir_ec_callback', array($this, 'inboundrocket_ec_callback'));
 }
예제 #2
0
    /**
     * Formats any timestamp to format like Feb 4 8:43pm
     *
     * @param   string
     * @return  string
     */
    function date_format_contact_stat($timestamp)
    {
        return date('M j, Y g:ia', strtotime($timestamp));
    }
}
/** Export functionality for the contacts list */
if (isset($_POST['export-all']) || isset($_POST['export-selected'])) {
    global $wpdb;
    inboundrocket_set_wpdb_tables();
    inboundrocket_set_mysql_timezone_offset();
    $sitename = sanitize_key(get_bloginfo('name'));
    if (!empty($sitename)) {
        $sitename .= '.';
    }
    $filename = $sitename . '.contacts.' . date('Y-m-d-H-i-s') . '.csv';
    header('Content-Description: File Transfer');
    header('Content-Disposition: attachment; filename=' . $filename);
    header('Content-Type: text/csv; charset=' . get_option('blog_charset'), TRUE);
    $column_headers = array('Email', 'First Name', 'Last Name', 'Original source', 'Visits', 'Page views', 'Forms', 'Shares', 'Last visit', 'Created on');
    $fields = array('lead_email', 'lead_first_name', 'lead_last_name', 'lead_source', 'visits', 'lead_pageviews', 'lead_form_submissions', 'lead_shares', 'last_visit', 'lead_date');
    $headers = array();
    foreach ($column_headers as $key => $field) {
        $headers[] = '"' . $field . '"';
    }
    echo implode(',', $headers) . "\n";