Plugin Directory

Changeset 405265


Ignore:
Timestamp:
07/06/2011 09:11:07 AM (15 years ago)
Author:
Zamango
Message:

bugfix: fix duplicate entries
bugfix: fix long delay updates

Location:
zamango-money-extractor/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • zamango-money-extractor/trunk/readme.txt

    r268373 r405265  
    66Tested up to: 3.0
    77Donate link: http://www.zamango.com
    8 Version: 1.3
    9 Stable tag: 1.3
     8Version: 1.4
     9Stable tag: 1.4
    1010
    1111'Zamango Money Extractor' creates your own casual games storefront with content provided by top content publishers.
     
    9999
    100100== Changelog ==
     101
     102= 1.4 =
     103* Bugfix: Fix long update delays
     104* Bugfix: Fix duplicate entries in WP 3.1.3+
    101105
    102106= 1.3 =
  • zamango-money-extractor/trunk/zmg_admin.php

    r229447 r405265  
    224224            if (preg_match("/wp-admin\/plugins\.php/", $_SERVER['REQUEST_URI']))
    225225                register_deactivation_hook($this->filename,
    226                                          array($this, 'deactivate'));
     226                                           array($this, 'deactivate'));
    227227        }
    228228
     
    230230        function fetch_options()
    231231        {
    232             if (!$this->hook) return false;
     232            if (!$this->hook)
     233                return false;
    233234
    234235            $options = get_option($this->hook);
     
    243244        function save_options()
    244245        {
    245             if (!$this->hook) return false;
     246            if (!$this->hook)
     247                return false;
    246248
    247249            update_option($this->hook, $this->options);
     
    251253        function validate_params()
    252254        {
    253             if (!$this->hook) return false;
     255            if (!$this->hook)
     256                return false;
    254257
    255258            foreach ($this->default_options as $opt_name => $option)
    256259            {
    257                 $error = (isset($option["error"])) ?
    258                          __($option["error"], $this->hook) :
    259                          __("Not defined or invalid parameter",
    260                             $this->top_hook);
     260                $error = (isset($option["error"]))
     261                          ? __($option["error"], $this->hook)
     262                          : __("Not defined or invalid parameter",
     263                          $this->top_hook);
    261264
    262265                if (isset($option["stoper"]) && $option["stoper"]())
  • zamango-money-extractor/trunk/zmg_money_extractor.php

    r299254 r405265  
    55Description: Creates casual games storefront at your WordPress.
    66Author: Zamango
    7 Version: 1.3
     7Version: 1.4
    88Requires at least: 2.8
    99Author URI: http://www.zamango.com/
     
    1919    {
    2020        var $hook        = 'zmg-money-extractor';
    21         var $version     = '1.3';
     21        var $version     = '1.4';
    2222        var $page_title  = 'Money Extractor';
    2323        var $menu_title  = 'Money Extractor';
     
    3131            $this->chunk_size    = 20;
    3232            $this->max_realgames = 6;
    33             $this->update_period = 12;
    3433            $this->channels_root = 'http://account.zamango.com/channels/';
    3534            $this->zmg_cached_categories = array();
     
    110109            $this->options = get_option($this->hook);
    111110
    112             if ($this->options['clear_options']) delete_option($this->hook);
     111            if ($this->options['clear_options'])
     112                delete_option($this->hook);
    113113
    114114            wp_clear_scheduled_hook('zmg_auto_update');
     
    134134            add_action('the_excerpt', array($this, 'zmg_process_permalink'));
    135135            add_action('the_content', array($this, 'zmg_process_relgames'));
     136            add_action('the_excerpt_rss', array($this, 'zmg_process_permalink'));
    136137
    137138            add_action('zmg_auto_update', array($this, 'zmg_auto_update'));
     
    157158            $this->zmg_auto_update_posts();
    158159            $this->save_options();
    159 
    160             wp_schedule_single_event(time() +
    161                                      3600 * $this->options['update_period'],
    162                                      'zmg_auto_update');
    163160        }
    164161
     
    194191                {
    195192                    $item = $items[$i];
     193
     194                    $item['guid'] = 'http://' . $item['guid'];
    196195
    197196                    $this->zmg_update_last_pubdate($item);
     
    240239            $url .= '&limit=';
    241240            $url .= isset($_POST['zmg_chunk_size'])
    242                   ?     $_POST['zmg_chunk_size']
     241                  ? $_POST['zmg_chunk_size']
    243242                  : $this->chunk_size;
    244243
     
    293292                                                 : $item['guid']);
    294293            $post_meta['zmg_company']     = trim($item['zmg:company']);
    295             $post_meta['zmg_sysreq']      = trim($item['zmg:sysreq']);
     294            $post_meta['zmg_sysreq']      = $item['zmg:sysreq']
     295                                            ? trim($item['zmg:sysreq'])
     296                                            : '';
    296297            $post_meta['zmg_image50']     = $item['zmg:image50'];
    297298            $post_meta['zmg_image100']    = $item['zmg:image'];
     
    304305            $post_meta['zmg_small_screenshot3'] = $item['zmg:small_screenshot3'];
    305306            $post_meta['zmg_categories']  = $item['zmg:categories'];
    306             $post_meta['zmg_desc_80']     = $item['zmg:desc_80'] ?
    307                                             trim($item['zmg:desc_80']) : '';
    308             $post_meta['zmg_desc_250']    = $item['description'] ?
    309                                             trim($item['description']) : '';
    310             $post_meta['zmg_desc_2000']   = $item['zmg:desc_2000'] ?
    311                                             trim($item['zmg:desc_2000']) : '';
     307            $post_meta['zmg_desc_80']     = $item['zmg:desc_80']
     308                                            ? trim($item['zmg:desc_80'])
     309                                            : '';
     310            $post_meta['zmg_desc_250']    = $item['description']
     311                                            ? trim($item['description'])
     312                                            : '';
     313            $post_meta['zmg_desc_2000']   = $item['zmg:desc_2000']
     314                                            ? trim($item['zmg:desc_2000'])
     315                                            : '';
    312316            $post_meta['zmg_platform']    = $item['zmg:platform'];
    313317            $post_meta['zmg_visible']     = $item['zmg:visible'];
     
    369373                                                                  'excerpt');
    370374            if (!$post['ID'])
     375            {
    371376                $post['post_title'] = $this->zmg_process_template($post_meta,
    372377                                                                  'post_name');
     378            }
     379
    373380            $this->zmg_insert_post_custom($post);
    374381
     
    576583                }
    577584
     585                foreach ($guids as &$guid)
     586                {
     587                    $guid = 'http://' . $guid;
     588                }
     589
    578590                $in = implode("','", $guids);
    579591
     
    596608                    {
    597609                        $post = $posts[$i];
     610                        $post['guid'] = preg_replace('/^http:\/\//', '',
     611                                                     $post['guid']);
    598612
    599613                        $url = get_permalink($post['ID']);
     
    10211035        function plugin_option_page_content()
    10221036        {
    1023 
    10241037            if (isset($_POST['ZMG_UPDATE']))
    10251038            {
     
    10361049                else
    10371050                {
    1038                     wp_clear_scheduled_hook('zmg_auto_update');
    10391051                    $this->zmg_process_rss();
    10401052                    $this->save_options();
    1041                     wp_schedule_single_event(time() + 3600 *
    1042                                              $this->options['update_period'],
    1043                                              'zmg_auto_update');
    10441053                }
    10451054            }
     
    10561065                else
    10571066                {
    1058                     wp_clear_scheduled_hook('zmg_auto_update');
    1059                     wp_schedule_single_event(time() + 3600 *
    1060                                              $this->options['update_period'],
    1061                                              'zmg_auto_update');
    1062 
    10631067                    $this->save_options();
    10641068                    echo $this->disappearing_message(
     
    10701074            elseif (isset($_POST['ZMG_NEXT']))
    10711075            {
    1072                 wp_clear_scheduled_hook('zmg_auto_update');
    10731076                $this->zmg_process_rss();
    10741077                $this->save_options();
    1075                 wp_schedule_single_event(time() + 3600 *
    1076                                          $this->options['update_period'],
    1077                                          'zmg_auto_update');
    10781078            }
    10791079            elseif (isset($_POST['ZMG_DELETE']))
    10801080            {
    1081                 wp_clear_scheduled_hook('zmg_auto_update');
    10821081                $this->zmg_delete_posts(isset($_POST['except_modified']));
    1083                 wp_schedule_single_event(time() + 3600 *
    1084                                          $this->options['update_period'],
    1085                                          'zmg_auto_update');
    1086 
    10871082                $this->save_options();
    10881083                $this->zmg_show_options_page();
     
    11111106        function zmg_process_rss()
    11121107        {
     1108            wp_clear_scheduled_hook('zmg_auto_update');
     1109
     1110            wp_schedule_event(time() + 3600 * 12,
     1111                              'twicedaily',
     1112                              'zmg_auto_update');
     1113
    11131114            if (!defined('WP_IMPORTING'))
    11141115                define('WP_IMPORTING', true);
     
    11201121            if (!defined('DOING_AUTOSAVE'))
    11211122                define('DOING_AUTOSAVE', true);
    1122 
    1123             wp_clear_scheduled_hook('zmg_auto_update');
    11241123
    11251124            $start_time = microtime(1);
     
    12011200            {
    12021201                $item = $items[$i];
     1202
     1203                $item['guid'] = 'http://' . $item['guid'];
    12031204
    12041205                $this->zmg_update_last_pubdate($item);
     
    15391540            );
    15401541
    1541             $rows   = array();
    1542             $row    = array();
    1543 
    1544             $html = __('Autoupdate period (hours)', $this->hook);
    1545 
     1542            $rows  = array();
     1543            $row   = array();
     1544            $html  = __('Maximum related games number in post', $this->hook);
    15461545            $row[] = $this->elem($html);
    1547 
    1548             $html  = $this->text('update_period',
    1549                                  $this->options['update_period'], '',
    1550                                  'zmg_short');
    1551 
    1552             if ($this->errors['update_period'])
    1553                 $html .= $this->error_message(
    1554                     __($this->errors['update_period'], $this->hook));
    1555 
    1556             $row[]  = $this->elem($html);
    1557             $rows[] = $this->elem($row);
    1558             $row    = array();
    1559 
    1560             $html   = __('Maximum related games number in post', $this->hook);
    1561 
    1562             $row[] = $this->elem($html);
    1563 
    15641546            $html  = $this->text('max_relgames',
    15651547                                 $this->options['max_relgames'], '',
     
    19981980            $rows = array();
    19991981            $row  = array();
    2000             $html = __('Autoupdate period (hours)', $this->hook);
    2001 
    2002             $row[] = $this->elem($html);
    2003 
    2004             $html  = $this->text('update_period',
    2005                                  $this->options['update_period'], '',
    2006                                  'zmg_short');
    2007 
    2008             if ($this->errors['update_period'])
    2009                 $html .= $this->error_message(
    2010                     __($this->errors['update_period'], $this->hook));
    2011 
    2012             $row[]  = $this->elem($html);
    2013             $rows[] = $this->elem($row);
    2014             $row    = array();
    2015 
    2016             $html   = __('Maximum related games number in post', $this->hook);
    2017 
     1982
     1983            $html  = __('Maximum related games number in post', $this->hook);
    20181984            $row[] = $this->elem($html);
    20191985
  • zamango-money-extractor/trunk/zmg_money_extractor_defaults.php

    r229447 r405265  
    6161        "last_pubdate"     => array(
    6262            "default"      => 0
    63         ),
    64         "update_period"    => array(
    65             "default"      => $this->update_period,
    66             "min"          => 0
    6763        ),
    6864        "max_relgames"     => array(
Note: See TracChangeset for help on using the changeset viewer.