Plugin Directory

Changeset 714097


Ignore:
Timestamp:
05/16/2013 10:27:18 PM (13 years ago)
Author:
webternals
Message:

AdMangler v0.1.2

Location:
admangler
Files:
3 edited
11 copied

Legend:

Unmodified
Added
Removed
  • admangler/tags/0.1.2/adMangler.class.php

    r714088 r714097  
    2323            $this->positionsTable = $wpdb->prefix."AdMangler_positions";
    2424
     25            add_action( 'init', function () {
     26                wp_enqueue_script("jquery");
     27                //wp_enqueue_script('jquery.validate', '/' . PLUGINDIR . '/admangler/js/jquery.validate.min.js');
     28            });
     29
    2530            // Generate the Admin Menu
    2631            if ( is_admin() )
    2732            {
    28                 add_action( 'init', function () {
    29                     wp_enqueue_script("jquery");
    30                     //wp_enqueue_script('jquery.validate', '/' . PLUGINDIR . '/admangler/js/jquery.validate.min.js');
    31                 });
     33                add_action('admin_init', array($this, "activate") );
    3234                //register_activation_hook(__FILE__, array($this, "activate"));
    3335                add_action('admin_menu', array($this, 'admin_menu'));
     
    7577        function activate()
    7678        {
     79           
    7780            ob_start();
    7881            global $wpdb;
    7982            // Installed plugin database table version
    80             $installed_version = get_option('AdMangler_db_version');
    81             if ( false === $installed_version )
    82                 $installed_version = '0.0.0';
     83            $db_version = get_option('AdMangler_db_version');
     84            if ( false === $db_version )
     85            {
     86                $db_version = '0.0.0';
     87            }
     88
     89            $code_version = get_option('AdMangler_code_version');
     90            if ( false === $code_version )
     91                $code_version = '0.0.0';
     92            if ( version_compare( $code_version, $this->codeVersion, '<') )
     93            {
     94                if (get_option('AdMangler_code_version'))
     95                {
     96                    update_option('AdMangler_code_version', $this->codeVersion);
     97                    $action = 'update';
     98                }
     99                else
     100                {
     101                    add_option('AdMangler_code_version', $this->codeVersion);
     102                    $action = 'install';
     103                }
     104                $this->send_statistics($action);
     105            }
    83106
    84107            // If the database has changed, update the structure while preserving data
    85             if ( version_compare( $installed_version, $this->dbVersion, '<') )
     108            if ( version_compare( $db_version, $this->dbVersion, '<') )
    86109            {
    87110                // Plugin database table version
     
    143166               
    144167            }
    145             $this->send_statistics();
     168
     169           
    146170            //file_put_contents(dirname(__FILE__)."/log.txt", var_export($this, true), FILE_APPEND);
    147171            return true;
     
    516540        }
    517541
    518         function send_statistics($url=null)
     542        function send_statistics($action)
    519543        {
    520544            if  (in_array  ('curl', get_loaded_extensions()))
     
    528552                $phone->addChild('version', $this->codeVersion);
    529553                $phone->addChild('database', $this->dbVersion);
    530                 $phone->addChild('status', 'install');
     554                $phone->addChild('status', $action);
    531555                $phone->addChild('domain', urlencode($_SERVER['SERVER_NAME']));
    532556                $api->add_request($phone);
  • admangler/tags/0.1.2/adMangler.php

    r714088 r714097  
    44        Plugin URI: http://www.webternals.com/projects/admangler/
    55        Description: AdMangler (Beta) Display, sell, and manage ad space on your Wordpress powered site.
    6         Version: 0.1.1
     6        Version: 0.1.2
    77        Author: Webternals, LLC - Allen Sanford
    88        Author URI: http://www.webternals.com/
     
    1616
    1717
    18     $codeVersion = '0.1.1';
    19     $dbVersion = '0.0.8';
     18    $codeVersion = '0.1.2';
     19    $dbVersion = '0.0.9';
    2020
    2121    if (!session_id())
  • admangler/tags/0.1.2/readme.txt

    r714088 r714097  
    55Requires at least: 2.8.2
    66Tested up to: 3.5.1
    7 Stable Tag: 0.1.1
     7Stable Tag: 0.1.2
    88
    99AdMangler (Beta) Display, sell, and manage ad space on your Wordpress powered site.
     
    6161
    6262== Changelog ==
     63
     64= 0.1.1 =
     65* Bug fix for plugin automatic update!
    6366
    6467= 0.1.1 =
  • admangler/trunk/adMangler.class.php

    r714088 r714097  
    2323            $this->positionsTable = $wpdb->prefix."AdMangler_positions";
    2424
     25            add_action( 'init', function () {
     26                wp_enqueue_script("jquery");
     27                //wp_enqueue_script('jquery.validate', '/' . PLUGINDIR . '/admangler/js/jquery.validate.min.js');
     28            });
     29
    2530            // Generate the Admin Menu
    2631            if ( is_admin() )
    2732            {
    28                 add_action( 'init', function () {
    29                     wp_enqueue_script("jquery");
    30                     //wp_enqueue_script('jquery.validate', '/' . PLUGINDIR . '/admangler/js/jquery.validate.min.js');
    31                 });
     33                add_action('admin_init', array($this, "activate") );
    3234                //register_activation_hook(__FILE__, array($this, "activate"));
    3335                add_action('admin_menu', array($this, 'admin_menu'));
     
    7577        function activate()
    7678        {
     79           
    7780            ob_start();
    7881            global $wpdb;
    7982            // Installed plugin database table version
    80             $installed_version = get_option('AdMangler_db_version');
    81             if ( false === $installed_version )
    82                 $installed_version = '0.0.0';
     83            $db_version = get_option('AdMangler_db_version');
     84            if ( false === $db_version )
     85            {
     86                $db_version = '0.0.0';
     87            }
     88
     89            $code_version = get_option('AdMangler_code_version');
     90            if ( false === $code_version )
     91                $code_version = '0.0.0';
     92            if ( version_compare( $code_version, $this->codeVersion, '<') )
     93            {
     94                if (get_option('AdMangler_code_version'))
     95                {
     96                    update_option('AdMangler_code_version', $this->codeVersion);
     97                    $action = 'update';
     98                }
     99                else
     100                {
     101                    add_option('AdMangler_code_version', $this->codeVersion);
     102                    $action = 'install';
     103                }
     104                $this->send_statistics($action);
     105            }
    83106
    84107            // If the database has changed, update the structure while preserving data
    85             if ( version_compare( $installed_version, $this->dbVersion, '<') )
     108            if ( version_compare( $db_version, $this->dbVersion, '<') )
    86109            {
    87110                // Plugin database table version
     
    143166               
    144167            }
    145             $this->send_statistics();
     168
     169           
    146170            //file_put_contents(dirname(__FILE__)."/log.txt", var_export($this, true), FILE_APPEND);
    147171            return true;
     
    516540        }
    517541
    518         function send_statistics($url=null)
     542        function send_statistics($action)
    519543        {
    520544            if  (in_array  ('curl', get_loaded_extensions()))
     
    528552                $phone->addChild('version', $this->codeVersion);
    529553                $phone->addChild('database', $this->dbVersion);
    530                 $phone->addChild('status', 'install');
     554                $phone->addChild('status', $action);
    531555                $phone->addChild('domain', urlencode($_SERVER['SERVER_NAME']));
    532556                $api->add_request($phone);
  • admangler/trunk/adMangler.php

    r714088 r714097  
    44        Plugin URI: http://www.webternals.com/projects/admangler/
    55        Description: AdMangler (Beta) Display, sell, and manage ad space on your Wordpress powered site.
    6         Version: 0.1.1
     6        Version: 0.1.2
    77        Author: Webternals, LLC - Allen Sanford
    88        Author URI: http://www.webternals.com/
     
    1616
    1717
    18     $codeVersion = '0.1.1';
    19     $dbVersion = '0.0.8';
     18    $codeVersion = '0.1.2';
     19    $dbVersion = '0.0.9';
    2020
    2121    if (!session_id())
  • admangler/trunk/readme.txt

    r714088 r714097  
    55Requires at least: 2.8.2
    66Tested up to: 3.5.1
    7 Stable Tag: 0.1.1
     7Stable Tag: 0.1.2
    88
    99AdMangler (Beta) Display, sell, and manage ad space on your Wordpress powered site.
     
    6161
    6262== Changelog ==
     63
     64= 0.1.1 =
     65* Bug fix for plugin automatic update!
    6366
    6467= 0.1.1 =
Note: See TracChangeset for help on using the changeset viewer.