function bizpanda_compability_note()
 {
     $count = 0;
     if (method_exists('BizPanda', 'getInstalledPlugins')) {
         $plugins = BizPanda::getInstalledPlugins();
         $count = count($plugins);
         $titles = array();
         foreach ($plugins as $plugin) {
             $titles[] = $plugin['plugin']->options['title'];
         }
         $titles = implode(',', $titles);
     } else {
         $count = 1;
         if (BizPanda::hasPlugin('optinpanda')) {
             $titles = 'Opt-In Panda';
         } else {
             $titles = 'Social Locker';
         }
     }
     global $bizpanda_issue_plugin;
     echo '<div id="message" class="error" style="padding: 10px;">';
     if ($count > 1) {
         printf(__('Unable to activate <strong>%s</strong>. Please make sure that the following plugins are updated to the latest versions: <strong>%s</strong>. Deactivate %s and try to update the specified plugins.'), $bizpanda_issue_plugin, $titles, $bizpanda_issue_plugin);
     } else {
         printf(__('Unable to activate <strong>%s</strong>. Please make sure that the following plugin is updated to the latest version: <strong>%s</strong>. Deactivate %s and try to update the specified plugin.'), $bizpanda_issue_plugin, $titles, $bizpanda_issue_plugin);
     }
     echo '</div>';
 }
Exemplo n.º 2
0
 public static function getSuggestions()
 {
     $added = array();
     $existingTags = array();
     $suggestions = array();
     // suggests premium version of free plugins
     $plugins = BizPanda::getInstalledPlugins();
     $hasPremium = false;
     foreach ($plugins as $plugin) {
         if ('premium' === $plugin['type']) {
             $hasPremium = true;
         }
         $pluginInfo = self::getPluginInfo($plugin['name'], $plugin['type']);
         if (!empty($pluginInfo) && isset($pluginInfo['tags'])) {
             $existingTags = array_merge($existingTags, $pluginInfo['tags']);
         }
         if ('free' !== $plugin['type']) {
             continue;
         }
         $pluginInfo = self::getPluginInfo($plugin['name'], 'premium');
         if (empty($pluginInfo)) {
             continue;
         }
         if (isset($pluginInfo['upgradeToPremium'])) {
             $pluginInfo['description'] = $pluginInfo['upgradeToPremium'];
         }
         $suggestions[] = $pluginInfo;
         $added[] = $plugin['name'];
     }
     // adds installed plugins
     foreach ($plugins as $plugin) {
         if (in_array($plugin['name'], $added)) {
             continue;
         }
         $added[] = $plugin['name'];
     }
     // suggests other extending plugins
     $all = self::getAll();
     foreach ($all as $item) {
         if ($hasPremium && 'premium' !== $item['type']) {
             continue;
         }
         if (in_array($item['name'], $added)) {
             continue;
         }
         if (!isset($item['tags'])) {
             continue;
         }
         $intersect = array_intersect($existingTags, $item['tags']);
         if (empty($intersect)) {
             continue;
         }
         $suggestions[] = $item;
         $added[] = $item['name'];
     }
     $suggestions = apply_filters('opanda_plugins_suggestions', $suggestions);
     return $suggestions;
 }