Example #1
0
                    $button_class = 'bsf-install-button';
                } elseif (($plugin->licence_require || $plugin->licence_require === 'true') && $status !== 'registered') {
                    if (is_multisite()) {
                        $link = network_admin_url('index.php?page=bsf-registration&id=' . $product_id);
                    } else {
                        if (defined('BSF_REG_MENU_TO_SETTINGS') && (BSF_REG_MENU_TO_SETTINGS == true || BSF_REG_MENU_TO_SETTINGS == 'true')) {
                            $link = admin_url('options-general.php?page=bsf-registration&id=' . $product_id);
                        } else {
                            $link = admin_url('index.php?page=bsf-registration&id=' . $product_id);
                        }
                    }
                    $button = __('Validate Purchase', 'bsf');
                    $button_class = 'bsf-validate-licence-button';
                }
            } else {
                $current_name = strtolower(bsf_get_current_name($plugin->init, $plugin->type));
                $current_name = preg_replace("![^a-z0-9]+!i", "-", $current_name);
                if (is_multisite()) {
                    $link = network_admin_url('plugins.php#' . $current_name);
                } else {
                    $link = admin_url('plugins.php#' . $current_name);
                }
                $button = __('Installed', 'bsf');
            }
            ?>
                                <a class="button button-primary extension-button <?php 
            echo $button_class;
            ?>
" href="<?php 
            echo $link;
            ?>
 function bsf_update_all_product_version()
 {
     $brainstrom_products = get_option('brainstrom_products') ? get_option('brainstrom_products') : array();
     $brainstrom_bundled_products = get_option('brainstrom_bundled_products') ? get_option('brainstrom_bundled_products') : array();
     $mix_products = $update_ready = $bsf_product_plugins = $bsf_product_themes = array();
     if (!empty($brainstrom_products)) {
         $bsf_product_plugins = isset($brainstrom_products['plugins']) ? $brainstrom_products['plugins'] : array();
         $bsf_product_themes = isset($brainstrom_products['themes']) ? $brainstrom_products['themes'] : array();
     }
     $product_updated = $bundled_product_updated = false;
     if (!empty($bsf_product_plugins)) {
         foreach ($bsf_product_plugins as $key => $plugin) {
             if (!isset($plugin['id']) || empty($plugin['id'])) {
                 continue;
             }
             if (!isset($plugin['template']) || empty($plugin['template'])) {
                 continue;
             }
             if (!isset($plugin['type']) || empty($plugin['type'])) {
                 continue;
             }
             $version = isset($plugin['version']) ? $plugin['version'] : '';
             $current_version = bsf_get_current_version($plugin['template'], $plugin['type']);
             $name = bsf_get_current_name($plugin['template'], $plugin['type']);
             if ($name !== '') {
                 $brainstrom_products['plugins'][$key]['product_name'] = $name;
             }
             if ($current_version !== '') {
                 if (version_compare($version, $current_version) === -1 || version_compare($version, $current_version) === 1) {
                     $brainstrom_products['plugins'][$key]['version'] = $current_version;
                     $product_updated = true;
                 }
             }
         }
     }
     if (!empty($bsf_product_themes)) {
         foreach ($bsf_product_themes as $key => $theme) {
             //if(!isset($theme['id']))
             //unset($brainstrom_products[$key]);
             if (!isset($theme['id']) || empty($theme['id'])) {
                 continue;
             }
             if (!isset($theme['template']) || empty($theme['template'])) {
                 continue;
             }
             if (!isset($theme['type']) || empty($theme['type'])) {
                 continue;
             }
             $version = isset($theme['version']) ? $theme['version'] : '';
             $current_version = bsf_get_current_version($theme['template'], $theme['type']);
             $name = bsf_get_current_name($theme['template'], $theme['type']);
             if ($name !== '') {
                 $brainstrom_products['themes'][$key]['product_name'] = $name;
             }
             if ($current_version !== '' || $current_version !== false) {
                 if (version_compare($version, $current_version) === -1 || version_compare($version, $current_version) === 1) {
                     $brainstrom_products['themes'][$key]['version'] = $current_version;
                     $product_updated = true;
                 }
             }
         }
     }
     if (!empty($brainstrom_bundled_products)) {
         foreach ($brainstrom_bundled_products as $key => $bp) {
             $version = $bp->version;
             $current_version = bsf_get_current_version($bp->init, $bp->type);
             if ($current_version !== '' || $current_version !== false) {
                 if (version_compare($version, $current_version) === -1 || version_compare($version, $current_version) === 1) {
                     $brainstrom_bundled_products[$key]->version = $current_version;
                     $bundled_product_updated = true;
                 }
             }
         }
     }
     //if($product_updated)
     update_option('brainstrom_products', $brainstrom_products);
     if ($bundled_product_updated) {
         update_option('brainstrom_bundled_products', $brainstrom_bundled_products);
     }
 }
Example #3
0
 $template = isset($info['template']) ? $info['template'] : $plugin;
 $id = isset($info['id']) ? $info['id'] : '';
 if ($request_product_id != '') {
     $init_single_product_show = true;
 } else {
     $init_single_product_show = false;
 }
 if ($init_single_product_show && $request_product_id !== $id) {
     continue;
 }
 $constant = 'BSF_REMOVE_' . $id . '_FROM_REGISTRATION';
 if (defined($constant) && ($constant == 'true' || $constant == true)) {
     continue;
 }
 $version = bsf_get_current_version($template, $type);
 $name = bsf_get_current_name($template, $type);
 $step = isset($theme_data['step']) && $theme_data['step'] != '' ? $theme_data['step'] : 'step-product-registration';
 $common_data = ' data-product-id="' . $id . '" ';
 $common_data .= ' data-bsf_username="******" ';
 $common_data .= ' data-bsf_useremail="' . $bsf_useremail . '" ';
 $common_data .= ' data-product-type="' . $type . '" ';
 $common_data .= ' data-template="' . $template . '" ';
 $common_data .= ' data-version="' . $version . '" ';
 $common_data .= ' data-step="' . $step . '" ';
 $common_data .= ' data-product-name="' . $name . '" ';
 $mod = $count % 2;
 $alternate = $mod ? 'alternate' : '';
 $row_id = 'bsf-row-' . $count;
 if ($status === 'registered') {
     $readonly = ' readonly="readonly" ';
     $common_data .= ' data-action="bsf_deregister_product" ';