includes/class-freemius.php
function _sync_plans() {
            $plans = $this->_fetch_plugin_plans();

            if ( $this->is_array_instanceof( $plans, 'FS_Plugin_Plan' ) ) {
                $plans_map = array();
                foreach ( $plans as $plan ) {
                    $plans_map[ $plan->id ] = true;
                }

                $plans_ids_to_keep = $this->get_plans_ids_associated_with_installs();

                foreach ( $plans_ids_to_keep as $plan_id ) {
                    if ( isset( $plans_map[ $plan_id ] ) ) {
                        continue;
                    }

                    $missing_plan = self::_get_plan_by_id( $plan_id );

                    if ( is_object( $missing_plan ) ) {
                        $plans[] = $missing_plan;
                    }
                }

                $this->_plans = $plans;
                $this->_store_plans();
            }

            $this->do_action( 'after_plans_sync', $plans );

            return $this->_plans;
        }
function _sync_plans() {
            $plans = $this->_fetch_plugin_plans();

            if ( $this->is_array_instanceof( $plans, 'FS_Plugin_Plan' ) ) {
                $plans_map = array();
                foreach ( $plans as $plan ) {
                    $plans_map[ $plan->id ] = true;
                }

                $plans_ids_to_keep = $this->get_plans_ids_associated_with_installs();

                foreach ( $plans_ids_to_keep as $plan_id ) {
                    if ( isset( $plans_map[ $plan_id ] ) ) {
                        continue;
                    }

                    $missing_plan = self::_get_plan_by_id( $plan_id );

                    if ( is_object( $missing_plan ) ) {
                        $plans[] = $missing_plan;
                    }
                }

                $this->_plans = $plans;
                $this->_store_plans();
            }

            $this->do_action( 'after_plans_sync', $plans );

            return $this->_plans;
        }
function _sync_plans ( ) { $ plans = $ this -> _fetch_plugin_plans ( ) ; if ( $ this -> is_array_instanceof ( $ plans , 'FS_Plugin_Plan' ) ) { $ plans_map = array ( ) ; foreach ( $ plans as $ plan ) { $ plans_map [ $ plan -> id ] = true ; } $ plans_ids_to_keep = $ this -> get_plans_ids_associated_with_installs ( ) ; foreach ( $ plans_ids_to_keep as $ plan_id ) { if ( isset ( $ plans_map [ $ plan_id ] ) ) { continue ; } $ missing_plan = self :: _get_plan_by_id ( $ plan_id ) ; if ( is_object ( $ missing_plan ) ) { $ plans [ ] = $ missing_plan ; } } $ this -> _plans = $ plans ; $ this -> _store_plans ( ) ; } $ this -> do_action ( 'after_plans_sync' , $ plans ) ; return $ this -> _plans ; }
Sync local plugin plans with remote server.

IMPORTANT: If for some reason a site is associated with deleted plan, we'll preserve the plan's information and append it as the last plan. This means that if plan is deleted, the is_plan() method will ALWAYS return true for any given argument (it becomes the most inclusive plan).

@author Vova Feldman (@svovaf)
@since  1.0.5

@return FS_Plugin_Plan[]|object
Sync local plugin plans with remote server .