PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
← All changes | freemius/includes/managers/class-fs-plan-manager.php +40 -9 3.23.5.9 View file →
@@ -107,8 +107,9 @@
107 107 }
108 108
109 109 /**
110 110 * Find all plans that have trial.
111 + * Since 2.6.2 call get_filtered_plan
111 112 *
112 113 * @author Vova Feldman (@svovaf)
113 114 * @since 1.0.9
114 115 *
@@ -116,22 +117,52 @@
116 117 *
117 118 * @return FS_Plugin_Plan[]
118 119 */
119 120 function get_trial_plans( $plans ) {
120 - $trial_plans = array();
121 + return $this->get_filtered_plans( $plans, true );
122 + }
121 123
122 - if ( is_array( $plans ) && 0 < count( $plans ) ) {
123 - /**
124 - * @var FS_Plugin_Plan[] $plans
125 - */
126 - for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
127 - if ( $plans[ $i ]->has_trial() ) {
128 - $trial_plans[] = $plans[ $i ];
124 + /**
125 + * Find all plans that are not hidden and have trial.
126 + *
127 + * @author Daniele Alessandra (@danielealessandra)
128 + *
129 + * @param FS_Plugin_Plan[] $plans
130 + *
131 + * @return FS_Plugin_Plan[]
132 + * @since 2.6.3
133 + *
134 + */
135 + function get_visible_trial_plans( $plans ) {
136 + return $this->get_filtered_plans( $plans, true, true );
137 + }
138 +
139 + /**
140 + * Find all plans filtered by trial or visibility.
141 + *
142 + * @author Daniele Alessandra (@danielealessandra)
143 + *
144 + * @param FS_Plugin_Plan[] $plans
145 + * @param boolean $should_have_trials
146 + * @param boolean $should_be_visible
147 + *
148 + * @return FS_Plugin_Plan[]
149 + * @since 2.6.3
150 + *
151 + */
152 + function get_filtered_plans( $plans, $should_have_trials = false, $should_be_visible = false ) {
153 + $filtered_plans = array();
154 +
155 + if ( is_array( $plans ) && count( $plans ) > 0 ) {
156 + foreach ( $plans as $plan ) {
157 + if ( ( $should_have_trials && ! $plan->has_trial() ) || ( $should_be_visible && $plan->is_hidden ) ) {
158 + continue;
129 159 }
160 + $filtered_plans[] = $plan;
130 161 }
131 162 }
132 163
133 - return $trial_plans;
164 + return $filtered_plans;
134 165 }
135 166
136 167 /**
137 168 * Check if plugin has any trial plan.