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);
     }
 }
Exemplo n.º 2
0
 $type = isset($info['type']) ? $info['type'] : 'theme';
 $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" ';