Plugin Directory

Changeset 1209513


Ignore:
Timestamp:
07/30/2015 08:21:00 AM (11 years ago)
Author:
dtsolis
Message:

Fix slow admin area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • simple-parse-push-service/trunk/simpleParsePS.php

    r963086 r1209513  
    22/**
    33 * @package Simple_Parse_Push_Service
    4  * @version 1.3.1
     4 * @version 1.3.2
    55 */
    66/*
     
    99Description: This is a simple implementation for Parse.com Push Service (for iOS, Android, Windows, Windows Phone or any other devices may add). You can send a push notification via admin panel or with a post update/creation. In order to use this plugin you MUST have an account with Parse.com and cURL ENABLED.
    1010Author: Tsolis Dimitris - Sotiris
    11 Version: 1.3.1
     11Version: 1.3.2
    1212Author URI:
    1313License: GPLv2 or later
     
    2121$scheduledPosts = array();
    2222
    23 if (!defined('SPPS_VERSION')) define('SPPS_VERSION', '1.3.1');
     23if (!defined('SPPS_VERSION')) define('SPPS_VERSION', '1.3.2');
    2424
    2525/////////////////////////////////////////////////////////
     
    6363       
    6464        $savedPostTypes = get_option('simpar_metabox_pt');
    65         if ( count( $savedPostTypes ) ) {
     65
     66        if ( count( $savedPostTypes ) == 0) { // bug fix: admin area is really slow...
    6667            $savedPostTypes[] = 'post';
    6768            addOrUpdateOption('simpar_metabox_pt', $savedPostTypes);
    6869            $savedPostTypes = get_option('simpar_metabox_pt');
    69         }
     70        } else {
     71            // distincts the post-types array
     72            // remaining from the bug above that was filling the array with the same data
     73            $savedPostTypes = array_unique($savedPostTypes);
     74        }
     75
    7076        foreach ($savedPostTypes as $postType) {
    7177            add_meta_box(
     
    135141function addOrUpdateOption($option_name, $value) {
    136142    if ( get_option( $option_name ) !== false ) {
    137         update_option( $option_name, $value );
     143        if ( get_option( $option_name ) !== $value)
     144            update_option( $option_name, $value );
    138145    } else {
    139146        add_option( $option_name, $value );
     
    251258
    252259function simpar_save_post($new_status, $old_status, $post) {
     260    if ( $old_status == 'draft' && $new_status == 'publish' ) {
     261        simpar_send_post($post->ID);
     262    }
     263
    253264    if ( get_option('simpar_discardScheduledPosts') == 'true' )
    254265        return; // disabled by user
Note: See TracChangeset for help on using the changeset viewer.