コード例 #1
0
ファイル: class-leadin.php プロジェクト: AndyGCook/leadout
 /**
  * Class constructor
  */
 function __construct()
 {
     global $pagenow;
     leadout_set_wpdb_tables();
     leadout_set_mysql_timezone_offset();
     $this->power_ups = self::get_available_power_ups();
     add_action('admin_bar_menu', array($this, 'add_leadout_link_to_admin_bar'), 999);
     if (is_admin()) {
         if (!defined('DOING_AJAX') || !DOING_AJAX) {
             $li_wp_admin = new WPLeadInAdmin($this->power_ups);
         }
     } else {
         add_action('wp_footer', array($this, 'append_leadout_version_number'));
         // Adds the leadout-tracking script to wp-login.php page which doesnt hook into the enqueue logic
         if (in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
             add_action('login_enqueue_scripts', array($this, 'add_leadout_frontend_scripts'));
         } else {
             add_action('wp_enqueue_scripts', array($this, 'add_leadout_frontend_scripts'));
         }
     }
 }
コード例 #2
0
ファイル: contacts-admin.php プロジェクト: AndyGCook/leadout
     * 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;
    global $wp_version;
    leadout_set_wpdb_tables();
    leadout_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', 'Last visit', 'Created on');
    $fields = array('lead_email', 'lead_first_name', 'lead_last_name', 'lead_source', 'visits', 'lead_pageviews', 'lead_form_submissions', 'last_visit', 'lead_date');
    $headers = array();
    foreach ($column_headers as $key => $field) {
        $headers[] = '"' . $field . '"';
    }
    echo implode(',', $headers) . "\n";