WordPress Türkiye Forumları » Eklentiler

Pmetrics istatistik eklentisi (en iyisi)

(7 posts)
  • 1 yıl önce Eren tarafından başlatıldı
  • Eren tarafından son cevap
  • Bu konu çözülmüş

Etiketler:


  1. Eren
    Üye

    PMetrics isimli bir istatistik eklentisi olduğunu öğrendim. Bu eklenti Google Analytics benzeri çok sağlam bir eklentiymiş. Site istatistiklerini çok iyi tutuyormuş.

    Ancak üretici sitesinde eklentiyi bulamadım. Üretici sitesi wordpress eklentilerini kaldırmış. Bu eklentiyi wordpress son sürümü için nereden bulabilirim.

    Bu yok ise buna benzer bir eklenti var mı?

    Teşekkürler.

    Tarih: 1 yıl #
  2. Eren
    Üye

    Bu anladığım kadarıyla istatistiği site üzerinde tutuyor. Yani bir eklenti değil. Google istatistik gibi. Benim üstde verdiğim ise buna benzer bir eklentiymiş ve admin panelinde takip ediliyormuş. Yani başka bir site üzerinde veri kaydı tutmuyor.

    Tarih: 1 yıl #
  3. Doğrudur. Eklenti ise kolay bir kurulum verip sonuçları yönetim panelinde göstermeyi sağlıyor.

    Tarih: 1 yıl #
  4. Eren
    Üye

    Ama bulamıyorum işte o eklentiyi :)

    Tarih: 1 yıl #
  5. Aşağıdaki kodları gelişmiş bir text editörle pmetrics.php olarak kaydedin. Kurulum bilgileri eklentinin içinde yazıyor. Umarım çalışır.

    <?php
    /*
    WordPress Info
    ----------------------------------------------------------------------------
    Plugin Name: PMetrics
    Plugin URI: http://davereid.net/projects/wordpress/pmetrics/
    Description: Adds Performancing Metrics code to each blog page automatically.
    Version: 0.2
    Author: Dave Reid
    Author URI: http://davereid.net/

    Installation
    ---------------------------------------------------------------------------
    1. Upload/copy this file (pmetrics.php) into the plugins directory of your
    WordPress installation (wp-content/plugins).
    2. Log in to WordPress administration.
    3. Click Plugins from the main menu.
    4. Scroll to find PMetrics and click Activate to enable this plugin.

    Version History
    ---------------------------------------------------------------------------
    2006-03-15 0.1 First release
    2006-03-21 0.2 Added options page in the administration menu
    Added option to ignore when admin is logged in
    Added update check
    Added GPL license
    Code re-organized and cleaning

    License
    ---------------------------------------------------------------------------
    Copyright (C) 2006 Dave Reid (dave@davereid.net)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

    The license is also available at http://www.gnu.org/copyleft/gpl.html
    */

    class PMetrics {

    var $_name = 'pmetrics';
    var $_version = '0.2';
    var $_url_homepage = 'http://davereid.net/projects/wordpress/pmetrics/';
    var $_url_update = 'http://davereid.net/projects/wordpress/update.php';
    var $_url_metrics = 'http://performancing.com/metrics/start';
    var $_options = array();

    // ----------------------------------------------------------------------------
    function PMetrics() {
    //load_plugin_textdomain('pmetrics');
    $this->load_options();
    add_action('admin_menu', array(&$this, 'add_options_page'));
    add_action('wp_footer', array(&$this, 'add_code'));
    }

    // ----------------------------------------------------------------------------
    function load_options() {
    //First use default values
    $this->_options = array();
    $this->_options['pm_ignore_admin_b'] = true;

    // Then overwrite with stored vales, adding default values not already
    // present in stored vales.
    $stored_options = get_option('pmetrics_options');
    if ($stored_options && is_array($stored_options)) {
    foreach ($stored_options as $k => $v) {
    $this->_options[$k] = $v;
    }
    } else {
    update_option('pmetrics_options', $this->_options);
    }
    }

    // ----------------------------------------------------------------------------
    function get_option($key) {
    if (strpos($key, 'pm_') !== 0) {
    $key = 'pm_' . $key;
    }
    if (array_key_exists($key, $this->_options)) {
    return $this->_options[$key];
    } else {
    return null;
    }
    }

    // ----------------------------------------------------------------------------
    function set_option($key, $value) {
    if (strstr($key, 'pm_') != 0) {
    $key = 'pm_' . $key;
    }
    $this->_options[$key] = $value;
    }

    // ----------------------------------------------------------------------------
    function save_options() {
    return update_option('pmetrics_options', $this->_options);
    }

    // ----------------------------------------------------------------------------
    function get_version() {
    return $this->_version;
    }

    // ----------------------------------------------------------------------------
    function get_logo($link = 'http://performancing.com/') {
    return "";
    }

    // ----------------------------------------------------------------------------
    function get_link() {
    //preg_match('@^(?:http://)?([^/]+)@i', get_bloginfo('url'), $matches);
    //$host = $matches[1];
    $host = $_SERVER['HTTP_HOST'];
    return 'http://performancing.com/metrics/' . $host;
    }

    // ----------------------------------------------------------------------------
    function show_message($message = '', $type = 'updated') {
    echo "<div class=\"{$type}\">" . __($message, $this->_name) . "
    </div>";
    }

    // ----------------------------------------------------------------------------
    function update_check() {
    // Initiate cURL
    $ch = curl_init();

    // Grab some data such as WordPress version, PHP version, etc
    $curlv = curl_version();
    $pmetrics_update_data = array (
    'plugin' => $this->_name,
    'plugin_version' => $this->_version,
    'wp_version' => get_bloginfo('version'),
    //'wp_name' => get_bloginfo('name'),
    'wp_url' => get_bloginfo('url'),
    'php' => phpversion(),
    'server' => $_SERVER['SERVER_SOFTWARE'],
    //'curl' => curl_version(),
    'curl_version' => (is_array($curlv) ? $curlv['version'] : $curlv),
    );
    unset($curlv);

    // Encode data for POST form
    function data_encode($data, $keyprefix = '', $keypostfix = '') {
    assert(is_array($data));
    $vars = null;
    foreach ($data as $key => $value) {
    if (is_array($value)) {
    $vars .= data_encode($value, $keyprefix . $key . $keypostfix . urlencode('['), urlencode(']'));
    } else {
    $vars .= $keyprefix . $key . $keypostfix . '=' . urlencode($value) . '&';
    }
    }
    return $vars;
    }

    // Begin cURL session and send data, get response
    curl_setopt($ch, CURLOPT_URL, $this->_url_update);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, data_encode($pmetrics_update_data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    $curl_content = trim(curl_exec($ch));

    // If cURL Error
    if (curl_errno($ch) != CURLE_OK) {
    $this->show_message('cURL Error ' . curl_errno($ch) . ': ' . curl_error($ch) . '', 'error');
    return;
    }
    curl_close($ch);

    // Display response
    $message = '
    PRIVACY INFORMATION
    During this update, only the following information was sent to the update server:
    ' . print_r($pmetrics_update_data, true) . '
    Any questions or concerns about this data or the update process should be sent to dave@davereid.net.';
    if (empty($curl_content)) {
    $this->show_message('Error performing update check (probably server error).' . $message, 'error');
    } elseif (version_compare($curl_content, $this->_version, '>')) {
    $this->show_message('There is a new version available! _url .'" target="new">Visit the PMetrics page to download the new version (' . $curl_content . ').' . $message);
    } else {
    $this->show_message('You have the latest version (' . $this->_version . ').' . $message);
    }
    }

    // ----------------------------------------------------------------------------
    function get_code() {
    global $userdata;
    get_currentuserinfo();
    if ($this->get_option('pm_ignore_admin_b') && isset($userdata) && $userdata->user_level > 7 /*userdata->user_login = 'admin'*/) {
    $code = "<!-- Igorning Performancing Metrics while admin logged in -->n";
    } else {
    $code = "<script type=\"text/javascript\">n";
    if ($userdata) {
    $code .= "z_user_name=\"{$userdata->user_login}\";n";
    $code .= "z_user_email=\"{$userdata->user_email}\";n";
    }
    $pmetrics_post_category = '';
    $pmetrics_temp_title = trim(wp_title('', false));
    if (is_home()) {
    $pmetrics_post_title = 'Homepage';
    } elseif (is_archive()) {
    $pmetrics_post_title = 'Archives - ';
    //$pmetrics_post_category = 'Archives';
    if (is_category()) {
    $pmetrics_post_title .= 'Category - ' . $pmetrics_temp_title;
    //$pmetrics_post_category .= ' - Category';
    } elseif (is_author()) {
    $pmetrics_post_title .= 'Author - ' . $pmetrics_temp_title;
    //$pmetrics_post_category .= ' - Author';
    } elseif (is_date()) {
    $pmetrics_post_title .= 'Date - ';
    //$pmetrics_post_category .= ' - Date';
    if (is_day()) {
    $pmetrics_post_title .= the_date('F jS, Y', '', '', false);
    } elseif (is_month()) {
    $pmetrics_post_title .= the_date('F, Y', '', '', false);
    } elseif (is_year()) {
    $pmetrics_post_title .= the_date('Y', '', '', false);
    }
    } else {
    $pmetrics_post_title .= $pmetrics_temp_title;
    }
    } elseif (function_exists('is_tag') && function_exists('UTW_ShowCurrentTagSet') && is_tag()) {
    $pmetrics_post_title .= 'Tag - ';
    ob_start();
    UTW_ShowCurrentTagSet('tagsettextonly');
    $pmetrics_post_title .= ob_get_contents();
    ob_end_clean();
    //$pmetrics_post_category .= 'Tag';
    } elseif (is_page()) {
    $pmetrics_post_title = 'Page - ' . $pmetrics_temp_title;
    //$pmetrics_post_category = 'Page';
    } elseif (is_search()) {
    global $s;
    $pmetrics_post_title = 'Search - ' . $s; //htmlspecialchars?
    //$pmetrics_post_category = 'Search';
    } elseif (is_404()) {
    $pmetrics_post_title = 'Error - 404';
    //$pmetrics_post_cateogry = 'Error';
    } elseif (is_single()) {
    $c = get_the_category();
    $pmetrics_post_title = $pmetrics_temp_title;
    $pmetrics_post_category = $c[0]->cat_name;
    }
    $code .= "z_post_title=\"{$pmetrics_post_title}\";n";
    $code .= "z_post_category=\"{$pmetrics_post_category}\";n";
    $code .= "</script>n";
    $code .= "<script id=\"stats_script\" type=\"text/javascript\" src=\"http://metrics.performancing.com/wp.js\"></script>";
    }
    return $code;
    }

    // ----------------------------------------------------------------------------
    function add_code() {
    echo $this->get_code();
    }

    // ----------------------------------------------------------------------------
    function add_options_page() {
    if (function_exists('add_options_page')) {
    add_options_page(__('PMetrics Options', $this->_name), __('PMetrics', $this->_name), 8, basename(__FILE__), array(&$this, 'show_options_page'));
    }
    }

    // ----------------------------------------------------------------------------
    function option_checkbox($var, $label = '') {
    echo "<input type=\"checkbox\" name=\"{$var}\" id=\"{$var}\" value=\"true\"";
    if ((bool) $this->get_option($var)) {
    echo " checked=\"checked\"";
    }
    echo " />n";
    echo "<label for=\"{$var}\">" . __($label, $this->_name) . "</label>";
    }

    // ----------------------------------------------------------------------------
    function show_options_page() {
    ?>
    <?php
    if (isset($_POST['pmetrics_save'])) {
    unset($_POST['pmetrics_save']);
    foreach ($this->_options as $key => $v) {
    switch (substr($key, -2)) {
    case '_b':
    $this->set_option($key, (bool) $_POST[$key]);
    break;
    default:
    if (array_key_exists($key, $_POST)) {
    $this->set_option($key, $_POST[$key]);
    }
    break;
    }
    }
    $this->save_options();
    $this->show_message('Options saved.');
    }
    else if (isset($_POST['pmetrics_update']))
    {
    $this->update_check();
    }
    ?>
    <div class="wrap">
    <form name="pm-options" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
    <h2><?php _e('PMetrics Options', $this->_name) ?></h2>

    Plugin Homepage |
    get_link() ?>" target="_blank"><?php echo get_bloginfo('name') ?> Metrics |
    Performancing

    <fieldset id="pmetrics_logo" class="options">
    <legend><?php _e('Basic Options', $this->_name) ?></legend>

    * <?php $this->option_checkbox('pm_ignore_admin_b', 'Ignore admin visits') ?>

    </fieldset>

    <p class="submit">
    <input type="submit" name="pmetrics_save" value="<?php _e('Save Options', $this->_name) ?> »" />
    <?php if (function_exists('curl_init')) { ?><input type="submit" name="pmetrics_update" value="<?php _e('Check for updates', $this->_name) ?>" /><?php } ?>

    <h3><?php _e('Performancing Metrics Button', $this->_name) ?></h3>
    <?php _e('If you want to show a button image for Performancing on your blog, insert the following HTML code wherever you want in your template:', $this->_name) ?>

    <?php echo htmlspecialchars($this->get_logo()) ?>

    </form>
    </div>
    <?php
    }

    }

    $pmetrics =& new PMetrics();
    ?>

    Tarih: 1 yıl #
  6. Eren
    Üye

    Teşekkürler.

    Tarih: 1 yıl #

Bu konu için RSS beslemesi

Cevapla

Mesaj göndermek için giriş yapmalısınız.