Пример #1
0
 function initialize($config, $content)
 {
     // tables which will be used in generated content
     $output = array('arts' => array(), 'list' => array(), 'featured' => array());
     // Generating content
     $counter = 0;
     //
     for ($i = 0; $i < count($content); $i++) {
         if ($i < $config['news_column'] * $config['news_rows'] * $config['news_full_pages']) {
             // GENERATING NEWS CONTENT
             if ($config['use_own_article_format'] == 1) {
                 $generated_content = NSP_GK5_Article_Format::generateLayout($config, $content[$i]);
             } else {
                 // GENERATING HEADER
                 $news_header = NSP_GK5_com_virtuemart_View::header($config, $content[$i]);
                 // GENERATING IMAGE
                 $news_image = NSP_GK5_com_virtuemart_View::image($config, $content[$i]);
                 // GENERATING READMORE
                 $news_readmore = NSP_GK5_com_virtuemart_View::readMore($config, $content[$i]);
                 // GENERATING TEXT
                 $news_text = NSP_GK5_com_virtuemart_View::text($config, $content[$i], $news_readmore);
                 // GENERATE NEWS INFO
                 $news_info = NSP_GK5_com_virtuemart_View::info($config, $content[$i]);
                 // GENERATE NEWS INFO2
                 $news_info2 = NSP_GK5_com_virtuemart_View::info($config, $content[$i], 2);
                 // PARSING PLUGINS
                 if ($config['parse_plugins'] == TRUE) {
                     $news_text = JHtml::_('content.prepare', $news_text);
                 }
                 // CLEANING PLUGINS
                 if ($config['clean_plugins'] == TRUE) {
                     $news_text = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $news_text);
                 }
                 // GENERATE CONTENT FOR TAB
                 $generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 10; $j++) {
                     //
                     if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     //
                     if ($config['news_header_order'] == $j) {
                         $generated_content .= $news_header;
                     }
                     if ($config['news_image_order'] == $j) {
                         $generated_content .= $news_image;
                     }
                     if ($config['news_text_order'] == $j) {
                         $generated_content .= $news_text;
                     }
                     if ($config['news_info_order'] == $j) {
                         $generated_content .= $news_info;
                     }
                     if ($config['news_info2_order'] == $j) {
                         $generated_content .= $news_info2;
                     }
                 }
                 //
                 if ($config['news_content_readmore_pos'] != 'after') {
                     $generated_content .= $news_readmore;
                 }
                 //
                 if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                     $generated_content .= '</div>';
                 }
             }
             // creating table with news content
             array_push($output['arts'], $generated_content);
             array_push($output['featured'], $content[$i]['featured']);
         } else {
             array_push($output['list'], NSP_GK5_com_virtuemart_View::lists($config, $content[$i], $counter));
             //
             $counter++;
         }
     }
     // return the results array
     return $output;
 }
Пример #2
0
    function initialize($config, $content)
    {
        // tables which will be used in generated content
        NSP_GK5_com_virtuemart_Controller::$instances += 1;
        $output = array('arts' => array(), 'list' => array(), 'featured' => array());
        // Generating content
        $counter = 0;
        //
        for ($i = 0; $i < count($content); $i++) {
            if ($i < $config['news_column'] * $config['news_rows'] * $config['news_full_pages']) {
                // GENERATING NEWS CONTENT
                if ($config['use_own_article_format'] == 1) {
                    $generated_content = NSP_GK5_Article_Format::generateLayout($config, $content[$i]);
                } else {
                    // GENERATING HEADER
                    $news_header = NSP_GK5_com_virtuemart_View::header($config, $content[$i]);
                    // GENERATING IMAGE
                    $news_image = NSP_GK5_com_virtuemart_View::image($config, $content[$i]);
                    // GENERATING READMORE
                    $news_readmore = NSP_GK5_com_virtuemart_View::readMore($config, $content[$i]);
                    // GENERATING TEXT
                    $news_text = NSP_GK5_com_virtuemart_View::text($config, $content[$i], $news_readmore);
                    // GENERATE NEWS INFO
                    $news_info = NSP_GK5_com_virtuemart_View::info($config, $content[$i]);
                    // GENERATE NEWS INFO2
                    $news_info2 = NSP_GK5_com_virtuemart_View::info($config, $content[$i], 2);
                    // GENERATE CONTENT FOR TAB
                    $generated_content = '';
                    // initialize variable
                    //
                    for ($j = 1; $j < 10; $j++) {
                        //
                        if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                            if ($j == 2) {
                                $generated_content .= '<div class="gkArtContentWrap">';
                            }
                        }
                        //
                        if ($config['news_header_order'] == $j) {
                            $generated_content .= $news_header;
                        }
                        if ($config['news_image_order'] == $j) {
                            $generated_content .= $news_image;
                        }
                        if ($config['news_text_order'] == $j) {
                            $generated_content .= $news_text;
                        }
                        if ($config['news_info_order'] == $j) {
                            $generated_content .= $news_info;
                        }
                        if ($config['news_info2_order'] == $j) {
                            $generated_content .= $news_info2;
                        }
                    }
                    //
                    if ($config['news_content_readmore_pos'] != 'after') {
                        $generated_content .= $news_readmore;
                    }
                    //
                    if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                        $generated_content .= '</div>';
                    }
                }
                // creating table with news content
                array_push($output['arts'], $generated_content);
                array_push($output['featured'], $content[$i]['featured']);
            } else {
                array_push($output['list'], NSP_GK5_com_virtuemart_View::lists($config, $content[$i], $counter));
                //
                $counter++;
            }
        }
        //
        if ($config['vm_add_to_cart'] == 1 && NSP_GK5_com_virtuemart_Controller::$instances == 1) {
            $closeimage = JURI::root(TRUE) . '/components/com_virtuemart/assets/images/fancybox/fancy_close.png';
            $vmLangVar = '';
            if (!class_exists('VmConfig')) {
                require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            }
            if (VmConfig::get('vmlang_js', 1)) {
                $vmLangVar .= "vmLang = '&lang=" . substr(VmConfig::$vmlang, 0, 2) . "' ;\n";
            } else {
                $vmLangVar .= 'vmLang = "";' . "\n";
            }
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($vmLangVar . '
				vmSiteurl = \'' . JURI::root() . '\' ;
				window.Itemid = \'\';
				Virtuemart.addtocart_popup = \'' . VmConfig::get('addtocart_popup', 1) . '\' ; 
				vmCartText = \'' . addslashes(vmText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED')) . '\' ;
				vmCartError = \'' . addslashes(vmText::_('COM_VIRTUEMART_MINICART_ERROR_JS')) . '\' ;
				loadingImage = \'' . JURI::root(TRUE) . '/components/com_virtuemart/assets/images/facebox/loading.gif\' ;
				closeImage = \'' . $closeimage . '\' ; 
				usefancy = true;
				jQuery(document).ready(function() { Virtuemart.product(jQuery("form.product")); });');
        }
        // return the results array
        return $output;
    }