Plugin Directory

Changeset 154198


Ignore:
Timestamp:
09/12/2009 10:40:13 PM (16 years ago)
Author:
bernabauer
Message:

versão 3.3

Location:
vitrine-submarino
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • vitrine-submarino/trunk/readme.txt

    r118584 r154198  
    11=== Vitrine Submarino ===
    2 Contributors: Bernardo Bauer
    3 Donate link: http://bernabauer.com/wp-plugins
     2Contributors: bernabauer
     3Donate link: http://bernabauer.com/
    44Tags: brasil, monetização, submarino, vitrine
    5 Requires at least: 2.7
    6 Tested up to: 2.7
    7 Stable tag: 3.2
     5Requires at least: 2.8
     6Tested up to: 2.8.4
     7Stable tag: 3.3
    88
    99Mostra vitrine de produtos do Submarino.com.
     
    1111== Description ==
    1212
    13 Mostre produtos do Submarino de acordo com as fontes RSS que o Submarino oferece. Você pode mostrar Mais Vendidos, Lançamentos e Promoções. Os produtos são coletados através do RSS e mostrados de maneira aleatória nas vitrines. É possível escolher uma categoria para cada tipo de vitrine de produtos.
     13Mostre produtos do Submarino baseados em palavras chaves. A funcionalidade de pegar produtos através do feed RSS foi retirado nesta versão por que o Submarino deixou de atualizar os produtos desta maneira e não comunicou ou avisou as mudanças.
    1414
    1515São duas funcionalidades distintas para o plugin. Widget e Vitrine Simples/Contextual.
     
    1919Requer tema compatível com Widgets e mostra produtos baseados na escolha de uma palavra chave definida na página de administração.
    2020
    21 **Vitrine Simples/Contextual**
     21**Vitrine Contextual**
    2222
    23 Vitrine Simples é vitrine que mostra produtos oriundos do RSS do Submarino. Já a Vitrine Contextual busca palavras cadastradas através do plugin Palavras de Monetização para mostrar produtos contextuais que estão na loja do Submarino.
     23Busca palavras cadastradas através do plugin Palavras de Monetização para mostrar produtos contextuais que estão na loja do Submarino.
    2424
    25 A novidade na versão 3.2 é que os produtos da Vitrine Contextual ficam armazenados localmente na base de dados do seu blog. O cache de produtos sempre é descartado a cada 24 horas pegando os produtos com suas descrições e preços a cada primeira visita que a palavra é pedida e não está na base de dados. Na página de administração do plugin é possível ver quantos produtos e palavras compõe o cache.
    26 
    27 Com este cache local o Submarino não vai mais bloquear o seu blog para fazer a pesquisa de produtos em suas páginas.
     25Os produtos da Vitrine Contextual e do widget ficam armazenados localmente na base de dados do seu blog. O cache de produtos sempre é descartado a cada 24 horas pegando os produtos com suas descrições e preços a cada primeira visita que a palavra é pedida e não está na base de dados. Na página de administração do plugin é possível ver quantos produtos e palavras compõe o cache.
    2826
    2927== Installation ==
     
    6260O plugin **requer PHP 5** ou superior para funcionar. Se o seu blog está usando a versão 4, não tem como o plugin mostrar a vitrine. Sorry! :-(
    6361
    64 = Meu hospedeiro é a GoDaddy, e o plugin não funciona!!! =
    65 
    66 A GoDaddy é um tanto restritiva quanto ao que roda em seus sevidores. Apesar de ter criado um código especifico para a GoDaddy, a vitrine ainda assim parece não funcionar.
    67 
    6862= Como faço um reset nas configurações do plugin? Como removo o plugin totalmente? =
    6963
    7064Basta habilitar a opção `Remover opções ao desativar`, atualizar as opções e depois desativar o plugin. Se quiser reabilitar o plugin, as configurações voltarão ao estado "de fábrica".
     65
     66== Changelog ==
     67
     68= 3.3 =
     69* plugin agora entende as páginas de resultado de pesquisa para determinados produtos.
     70* consertado problema do link de afiliado que não aparecia na sintaxe correta.
     71* melhoria no tratamento da vitrine.
     72* introdução do primeiro slot diferenciado para pesquisa de preços. Slot diferenciado só aparece se existirem palavras cadastradas através do Palavras de Monetização.
     73* remoção das fontes de produtos via RSS (culpa do submarino que parou de atualizar o RSS com produtos novos.)
     74
  • vitrine-submarino/trunk/vitrinesubmarino.php

    r118584 r154198  
    44Plugin URI: http://www.bernabauer.com/wp-plugins/
    55Description: Mostre vitrines de produtos do Submarino em seu blog. Com o <a href="http://wordpress.org/extend/plugins/palavras-de-monetizacao/">Palavras de Monetização</a> você pode contextualizar manualmente os produtos. Para usar widgets é neecessário um tema compatível.
    6 Version: 3.2
     6Version: 3.3
    77Author: Bernardo Bauer
    88Author URI: http://www.bernabauer.com/
     
    2525*/
    2626
     27
    2728global $wpdb;
    2829global $vs_options;
    2930global $vs_version;
    3031
    31 $vs_version = "3.2";
     32$vs_version = "3.3";
    3233$vs_options = get_option('vs_options');
    3334
     
    5253add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'vs_plugin_actions' );
    5354
    54 /***************************************************************************************************
     55/**************************************************************************************************
    5556 *  Coisas para serem feitas na instalacao do plugin
    5657 */
     
    7677            'version'=>         $vs_version,
    7778            'remover'=>         'nao',
     79            'wid_title'=>       'Ofertas Submarino',
     80            'wid_word'=>        'celular',
    7881            'wid_show'=>        '3',
    7982            'wid_fontcolor'=>   '#000000',
     
    8184            'wid_brdcolor'=>    '#DDDDDD',
    8285            'wid_prcolor'=>     '#3982C6',
    83             'wid_title'=>       'Ofertas Submarino',
    8486            'wid_track'=>       'nao',
    85             'wid_rss_source'=>  'lan_Geral',
    8687            'wid_altcode'=>     'BVD',
     88            'ctx_titulo'=>      '<h3>Ofertas Submarino</h3>',
     89            'ctx_word'=>        'notebook',
     90            'ctx_show'=>        '4',
     91            'ctx_exib_auto'=>   'auto',
     92            'ctx_slot1'=>       'normal',
     93            'ctx_tipo'=>            'horizontal',
     94            'ctx_local'=>       'depois',
    8795            'ctx_prcolor'=>     '#3982C6',
    88             'ctx_tipo'=>        'horizontal',
    89             'ctx_local'=>       'depois',
    90             'ctx_show'=>        '4',
    91             'ctx_word'=>        'notebook',
    92             'ctx_exib_auto'=>   'auto',
    93             'ctx_titulo'=>      '<h3>Ofertas Submarino</h3>',
    9496            'ctx_track'=>       'nao',
    95             'ctx_rss_source'=>  'lan_Geral',
    9697            'ctx_altcode'=>     'ctx_FBD',
    9798        );
    9899        add_option('vs_options', $vs_options);
    99100       
    100         $sql = 'CREATE TABLE wp_vitrinesubmarino (
    101                 nomep varchar(255) NOT NULL,
    102                 linkp varchar(255) NOT NULL,
    103                 imagemp varchar(255) NOT NULL,
    104                 precop varchar(15) NOT NULL,
    105                 rss_source varchar(15) NOT NULL
    106                 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;';
    107 
    108         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    109         dbDelta($sql);
     101            $sql = 'CREATE TABLE wp_vitrinesubmarino (
     102                    nomep varchar(255) NOT NULL,
     103                    linkp varchar(255) NOT NULL,
     104                    imagemp varchar(255) NOT NULL,
     105                    precop varchar(15) NOT NULL,
     106                    rss_source varchar(255) NOT NULL
     107                    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;';
     108   
     109            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     110            dbDelta($sql);
    110111       
    111112    } else {
    112113        if ($vs_options['version'] != $vs_version) {
    113             $vs_options['version'] = $vs_version;
     114            $vs_options = get_option('vs_options');
     115            $vs_options[    'version'] = $vs_version;
     116            $vs_options[    'wid_word'] = 'celular';
     117            $vs_options[    'ctx_word'] = 'notebook';
     118            $vs_options[    'ctx_slot1'] = 'normal';
    114119            update_option('vs_options', $vs_options);
    115120        }
     
    221226} //
    222227
     228/**************************************************************************************************
     229 * Cria banners dos produtos @@@
     230 */
     231function vs_banner ($bannershow) {
     232
     233    global $vs_options;
     234
     235    $vs_options = get_option('vs_options');
     236
     237    $banner = vs_core(1, 'celular', $bannershow, $vs_options['ctx_bgcolor'], $vs_options['ctx_brdcolor'], $vs_options['ctx_fontcolor'], $vs_options['ctx_prcolor']);
     238
     239    echo $banner;
     240}
     241
     242
     243
    223244/***************************************************************************************************
    224245 * Função para chamada manual da vitrine. Não permite abas.
     
    231252
    232253    $current_plugins = get_option('active_plugins');
    233 
    234254    if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins)) {
    235255        $words_array = pm_get_words();
     
    254274}
    255275
    256 
    257276/***************************************************************************************************
    258277 * Vitrine Automatica
     
    263282
    264283    $vs_options = get_option('vs_options');
    265 
     284//
     285    $current_plugins = get_option('active_plugins');
     286    if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins)) {
     287        $words_array = pm_get_words();
     288       
     289        if (count($words_array) == 0)
     290            $word = $vs_options['ctx_word'];
     291        else
     292            $word = $words_array[rand(0, count($words_array)-1)];
     293    } else {
     294        $word = $vs_options['ctx_word'];
     295    }
     296//
    266297    if ((is_single()) AND ($vs_options["ctx_exib_auto"] == 'auto')) {
    267298
     
    281312
    282313
    283 /**
    284  * xml2array() will convert the given XML text to an array in the XML structure.
    285  * Link: http://www.bin-co.com/php/scripts/xml2array/
    286  * Arguments : $contents - The XML text
    287  *                $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.
    288  *                $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance.
    289  * Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.
    290  * Examples: $array =  xml2array(file_get_contents('feed.xml'));
    291  *              $array =  xml2array(file_get_contents('feed.xml', 1, 'attribute'));
     314/**************************************************************************************************
     315 *  pega produtos da base de dados
    292316 */
    293 function vs_xml2array($contents, $get_attributes=1, $priority = 'tag') {
    294     if(!$contents) return array();
    295 
    296     if(!function_exists('xml_parser_create')) {
    297         //print "'xml_parser_create()' function not found!";
    298         return array();
    299     }
    300 
    301     //Get the XML parser of PHP - PHP must have this module for the parser to work
    302     $parser = xml_parser_create('');
    303     xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
    304     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    305     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    306     xml_parse_into_struct($parser, trim($contents), $xml_values);
    307     xml_parser_free($parser);
    308 
    309     if(!$xml_values) return;//Hmm...
    310 
    311     //Initializations
    312     $xml_array = array();
    313     $parents = array();
    314     $opened_tags = array();
    315     $arr = array();
    316 
    317     $current = &$xml_array; //Refference
    318 
    319     //Go through the tags.
    320     $repeated_tag_index = array();//Multiple tags with same name will be turned into an array
    321     foreach($xml_values as $data) {
    322         unset($attributes,$value);//Remove existing values, or there will be trouble
    323 
    324         //This command will extract these variables into the foreach scope
    325         // tag(string), type(string), level(int), attributes(array).
    326         extract($data);//We could use the array by itself, but this cooler.
    327 
    328         $result = array();
    329         $attributes_data = array();
    330        
    331         if(isset($value)) {
    332             if($priority == 'tag') $result = $value;
    333             else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode
    334         }
    335 
    336         //Set the attributes too.
    337         if(isset($attributes) and $get_attributes) {
    338             foreach($attributes as $attr => $val) {
    339                 if($priority == 'tag') $attributes_data[$attr] = $val;
    340                 else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
    341             }
    342         }
    343 
    344         //See tag status and do the needed.
    345         if($type == "open") {//The starting of the tag '<tag>'
    346             $parent[$level-1] = &$current;
    347             if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
    348                 $current[$tag] = $result;
    349                 if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
    350                 $repeated_tag_index[$tag.'_'.$level] = 1;
    351 
    352                 $current = &$current[$tag];
    353 
    354             } else { //There was another element with the same tag name
    355 
    356                 if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
    357                     $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
    358                     $repeated_tag_index[$tag.'_'.$level]++;
    359                 } else {//This section will make the value an array if multiple tags with the same name appear together
    360                     $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
    361                     $repeated_tag_index[$tag.'_'.$level] = 2;
    362                    
    363                     if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
    364                         $current[$tag]['0_attr'] = $current[$tag.'_attr'];
    365                         unset($current[$tag.'_attr']);
    366                     }
    367 
    368                 }
    369                 $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
    370                 $current = &$current[$tag][$last_item_index];
    371             }
    372 
    373         } elseif($type == "complete") { //Tags that ends in 1 line '<tag />'
    374             //See if the key is already taken.
    375             if(!isset($current[$tag])) { //New Key
    376                 $current[$tag] = $result;
    377                 $repeated_tag_index[$tag.'_'.$level] = 1;
    378                 if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data;
    379 
    380             } else { //If taken, put all things inside a list(array)
    381                 if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array...
    382 
    383                     // ...push the new element into that array.
    384                     $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
    385                    
    386                     if($priority == 'tag' and $get_attributes and $attributes_data) {
    387                         $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
    388                     }
    389                     $repeated_tag_index[$tag.'_'.$level]++;
    390 
    391                 } else { //If it is not an array...
    392                     $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
    393                     $repeated_tag_index[$tag.'_'.$level] = 1;
    394                     if($priority == 'tag' and $get_attributes) {
    395                         if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
    396                            
    397                             $current[$tag]['0_attr'] = $current[$tag.'_attr'];
    398                             unset($current[$tag.'_attr']);
    399                         }
    400                        
    401                         if($attributes_data) {
    402                             $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
    403                         }
    404                     }
    405                     $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
    406                 }
    407             }
    408 
    409         } elseif($type == 'close') { //End of tag '</tag>'
    410             $current = &$parent[$level-1];
    411         }
    412     }
    413    
    414     return($xml_array);
    415 
    416 
    417 /***************************************************************************************************
    418  *  http://www.sourcerally.net/Scripts/39-Convert-HTML-Entities-to-XML-Entities
    419  */
    420 
    421 function vs_xmlEntities($str)
    422 {
    423     $xml = array('&#34;','&#38;','&#38;','&#60;','&#62;','&#160;','&#161;','&#162;','&#163;','&#164;','&#165;','&#166;','&#167;','&#168;','&#169;','&#170;','&#171;','&#172;','&#173;','&#174;','&#175;','&#176;','&#177;','&#178;','&#179;','&#180;','&#181;','&#182;','&#183;','&#184;','&#185;','&#186;','&#187;','&#188;','&#189;','&#190;','&#191;','&#192;','&#193;','&#194;','&#195;','&#196;','&#197;','&#198;','&#199;','&#200;','&#201;','&#202;','&#203;','&#204;','&#205;','&#206;','&#207;','&#208;','&#209;','&#210;','&#211;','&#212;','&#213;','&#214;','&#215;','&#216;','&#217;','&#218;','&#219;','&#220;','&#221;','&#222;','&#223;','&#224;','&#225;','&#226;','&#227;','&#228;','&#229;','&#230;','&#231;','&#232;','&#233;','&#234;','&#235;','&#236;','&#237;','&#238;','&#239;','&#240;','&#241;','&#242;','&#243;','&#244;','&#245;','&#246;','&#247;','&#248;','&#249;','&#250;','&#251;','&#252;','&#253;','&#254;','&#255;');
    424     $html = array('&quot;','&amp;','&amp;','&lt;','&gt;','&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;');
    425     $str = str_replace($html,$xml,$str);
    426     $str = str_ireplace($html,$xml,$str);
    427     return $str;
    428 }
    429 
    430 
    431 /***************************************************************************************************
    432  *  Funcao principal
    433  */
    434 function vs_pegaprodutos_rss($rss_source) {
     317function vs_pegaprodutos($palavra){
    435318
    436319    global $wpdb;
    437320    global $vs_options;
    438321
    439     switch ($rss_source) {
    440    
    441         case "mv_Bebes":
    442             $rss_link = "/rss/rss-mais-vendidos?rss=30";
    443             break;
    444         case "mv_Beleza":
    445             $rss_link = "/rss/rss-mais-vendidos?rss=24";
    446             break;
    447         case "mv_Brinquedos":
    448             $rss_link = "/rss/rss-mais-vendidos?rss=3";
    449             break;
    450         case "mv_Cama":
    451             $rss_link = "/rss/rss-mais-vendidos?rss=36";
    452             break;
    453         case "mv_Cameras":
    454             $rss_link = "/rss/rss-mais-vendidos?rss=26";
    455             break;
    456         case "mv_Celulares":
    457             $rss_link = "/rss/rss-mais-vendidos?rss=11";
    458             break;
    459         case "mv_CDs":
    460             $rss_link = "/rss/rss-mais-vendidos?rss=2";
    461             break;
    462         case "mv_DVD":
    463             $rss_link = "/rss/rss-mais-vendidos?rss=6";
    464             break;
    465         case "mv_Esporte":
    466             $rss_link = "/rss/rss-mais-vendidos?rss=28";
    467             break;
    468         case "mv_Eletrodomesticos":
    469             $rss_link = "/rss/rss-mais-vendidos?rss=27";
    470             break;
    471         case "mv_Eletronicos":
    472             $rss_link = "/rss/rss-mais-vendidos?rss=13";
    473             break;
    474         case "mv_Eletroportateis":
    475             $rss_link = "/rss/rss-mais-vendidos?rss=34";
    476             break;
    477         case "mv_Ferramentas":
    478             $rss_link = "/rss/rss-mais-vendidos?rss=15";
    479             break;
    480         case "mv_Games":
    481             $rss_link = "/rss/rss-mais-vendidos?rss=12";
    482             break;
    483         case "mv_Informatica":
    484             $rss_link = "/rss/rss-mais-vendidos?rss=10";
    485             break;
    486         case "mv_Instrumentos":
    487             $rss_link = "/rss/rss-mais-vendidos?rss=32";
    488             break;
    489         case "mv_Livros":
    490             $rss_link = "/rss/rss-mais-vendidos?rss=1";
    491             break;
    492         case "mv_livrosImportados":
    493             $rss_link = "/rss/rss-mais-vendidos?rss=9";
    494             break;
    495         case "mv_Papelaria":
    496             $rss_link = "/rss/rss-mais-vendidos?rss=37";
    497             break;
    498         case "mv_Perfumaria":
    499             $rss_link = "/rss/rss-mais-vendidos?rss=33";
    500             break;
    501         case "mv_Relogios":
    502             $rss_link = "/rss/rss-mais-vendidos?rss=25";
    503             break;
    504         case "mv_Utilidades":
    505             $rss_link = "/rss/rss-mais-vendidos?rss=18";
    506             break;
    507         case "mv_Vestuario":
    508             $rss_link = "/rss/rss-mais-vendidos?rss=31";
    509             break;
    510         case "mv_vinhos":
    511             $rss_link = "/rss/rss-mais-vendidos?rss=35";
    512             break;
    513         case "lan_Geral":
    514             $rss_link = "/rss/rss-lancamentos";
    515             break;
    516         case "lan_Bebes":
    517             $rss_link = "/rss/rss-lancamentos?rss=30";
    518             break;
    519         case "lan_Beleza":
    520             $rss_link = "/rss/rss-lancamentos?rss=24";
    521             break;
    522         case "lan_Brinquedos":
    523             $rss_link = "/rss/rss-lancamentos?rss=3";
    524             break;
    525         case "lan_Cama":
    526             $rss_link = "/rss/rss-lancamentos?rss=36";
    527             break;
    528         case "lan_Cameras":
    529             $rss_link = "/rss/rss-lancamentos?rss=26";
    530             break;
    531         case "lan_Celulares":
    532             $rss_link = "/rss/rss-lancamentos?rss=11";
    533             break;
    534         case "lan_CDs":
    535             $rss_link = "/rss/rss-lancamentos?rss=2";
    536             break;
    537         case "lan_DVD":
    538             $rss_link = "/rss/rss-lancamentos?rss=6";
    539             break;
    540         case "lan_Esporte":
    541             $rss_link = "/rss/rss-lancamentos?rss=28";
    542             break;
    543         case "lan_Eletrodomesticos":
    544             $rss_link = "/rss/rss-lancamentos?rss=27";
    545             break;
    546         case "lan_Eletronicos":
    547             $rss_link = "/rss/rss-lancamentos?rss=13";
    548             break;
    549         case "lan_Eletroportateis":
    550             $rss_link = "/rss/rss-lancamentos?rss=34";
    551             break;
    552         case "lan_Ferramentas":
    553             $rss_link = "/rss/rss-lancamentos?rss=15";
    554             break;
    555         case "lan_Games":
    556             $rss_link = "/rss/rss-lancamentos?rss=12";
    557             break;
    558         case "lan_Informatica":
    559             $rss_link = "/rss/rss-lancamentos?rss=10";
    560             break;
    561         case "lan_Instrumentos":
    562             $rss_link = "/rss/rss-lancamentos?rss=32";
    563             break;
    564         case "lan_Livros":
    565             $rss_link = "/rss/rss-lancamentos?rss=1";
    566             break;
    567         case "lan_livrosImportados":
    568             $rss_link = "/rss/rss-lancamentos?rss=9";
    569             break;
    570         case "lan_Papelaria":
    571             $rss_link = "/rss/rss-lancamentos?rss=37";
    572             break;
    573         case "lan_Perfumaria":
    574             $rss_link = "/rss/rss-lancamentos?rss=33";
    575             break;
    576         case "lan_Relogios":
    577             $rss_link = "/rss/rss-lancamentos?rss=25";
    578             break;
    579         case "lan_Utilidades":
    580             $rss_link = "/rss/rss-lancamentos?rss=18";
    581             break;
    582         case "lan_Vestuario":
    583             $rss_link = "/rss/rss-lancamentos?rss=31";
    584             break;
    585         case "lan_vinhos":
    586             $rss_link = "/rss/rss-lancamentos?rss=35";
    587             break;
    588         case "prom_Geral":
    589             $rss_link = "/rss/rss-base";
    590             break;
    591         case "prom_Bebes":
    592             $rss_link = "/rss/rss-base?rss=30";
    593             break;
    594         case "prom_Beleza":
    595             $rss_link = "/rss/rss-base?rss=24";
    596             break;
    597         case "prom_Brinquedos":
    598             $rss_link = "/rss/rss-base?rss=3";
    599             break;
    600         case "prom_Cama":
    601             $rss_link = "/rss/rss-base?rss=36";
    602             break;
    603         case "prom_Cameras":
    604             $rss_link = "/rss/rss-base?rss=26";
    605             break;
    606         case "prom_Celulares":
    607             $rss_link = "/rss/rss-base?rss=11";
    608             break;
    609         case "prom_CDs":
    610             $rss_link = "/rss/rss-base?rss=2";
    611             break;
    612         case "prom_DVD":
    613             $rss_link = "/rss/rss-base?rss=6";
    614             break;
    615         case "prom_Esporte":
    616             $rss_link = "/rss/rss-base?rss=28";
    617             break;
    618         case "prom_Eletrodomesticos":
    619             $rss_link = "/rss/rss-base?rss=27";
    620             break;
    621         case "prom_Eletronicos":
    622             $rss_link = "/rss/rss-base?rss=13";
    623             break;
    624         case "prom_Eletroportateis":
    625             $rss_link = "/rss/rss-base?rss=34";
    626             break;
    627         case "prom_Ferramentas":
    628             $rss_link = "/rss/rss-base?rss=15";
    629             break;
    630         case "prom_Games":
    631             $rss_link = "/rss/rss-base?rss=12";
    632             break;
    633         case "prom_Informatica":
    634             $rss_link = "/rss/rss-base?rss=10";
    635             break;
    636         case "prom_Instrumentos":
    637             $rss_link = "/rss/rss-base?rss=32";
    638             break;
    639         case "prom_Livros":
    640             $rss_link = "/rss/rss-base?rss=1";
    641             break;
    642         case "prom_livrosImportados":
    643             $rss_link = "/rss/rss-base?rss=9";
    644             break;
    645         case "prom_Papelaria":
    646             $rss_link = "/rss/rss-base?rss=37";
    647             break;
    648         case "prom_Perfumaria":
    649             $rss_link = "/rss/rss-base?rss=33";
    650             break;
    651         case "prom_Relogios":
    652             $rss_link = "/rss/rss-base?rss=25";
    653             break;
    654         case "prom_Utilidades":
    655             $rss_link = "/rss/rss-base?rss=18";
    656             break;
    657         case "prom_Vestuario":
    658             $rss_link = "/rss/rss-base?rss=31";
    659             break;
    660         case "prom_vinhos":
    661             $rss_link = "/rss/rss-base?rss=35";
    662             break;
    663     }
    664 
    665     $response = vs_http_get($request, "www.submarino.com.br", $rss_link);
    666     $data = vs_xmlEntities($response[1]);
    667 
    668     $produtos = vs_xml2array($data,0);
    669 
    670     $produtos2 = $produtos["rss"]["channel"]['item'];
    671 
    672     if (count($produtos2) > 0) {
    673 
    674         foreach ($produtos2 as $produto) {
    675    
    676             $nome = $produto["title"];
    677             if (is_array($nome))
    678                 $nome = "";
    679 
    680             $diz = $produto["description"];
    681    
    682             if (stripos($produto["link"], "?") === FALSE) {
    683                 $link_prod = $produto["link"]."?franq=".$vs_options['codafil'];
    684             } else {
    685                 $link_prod = $produto["link"]."&franq=".$vs_options['codafil'];
    686             }
    687            
    688             preg_match_all('/<img[^>]+>/i',$diz, $result);
    689             $imagem = $result[0][0];
    690    
    691             $preco = strip_tags("R".strrchr($diz, "$"));
    692 
    693             if ($preco == "R")
    694                 $preco = '';
    695    
    696             $lprod .= "('" . $wpdb->escape($nome) . "','" . $wpdb->escape($link_prod) . "','" . $wpdb->escape($imagem) . "','" . $wpdb->escape($preco) . "', '". $wpdb->escape($rss_source) ."'), ";
    697         } //foreach
    698        
    699             //inclui $nome $link_prod $imagem e $preco no BD
    700             $insert = "INSERT INTO wp_vitrinesubmarino (nomep, linkp, imagemp, precop, rss_source) VALUES " . rtrim($lprod, ", ");
    701             $results = $wpdb->query( $insert );
    702     }
    703 }
    704 
    705 /***************************************************************************************************
    706  *  pega produtos da base de dados
    707  */
    708 function vs_pegaprodutos($vitrine){
    709 
    710     global $wpdb;
    711     global $vs_options;
    712     $word = "";
    713 
    714     if ($vitrine != "widget") {
    715         $rss_source = $vs_options['ctx_rss_source'];
    716         if ($rss_source == "ctx_contextual") {
    717             $current_plugins = get_option('active_plugins');
    718             if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins)) {
    719                 $words_array = pm_get_words();
    720                 if (count($words_array) == 0)
    721                     $word = $vs_options['ctx_word'];
    722                 else
    723                     $word = $words_array[rand(0, count($words_array)-1)];
    724             } else {
    725                 $word = $vs_options['ctx_word'];
    726             }
    727             $rss_source = $word;
     322    $select = "SELECT * FROM wp_vitrinesubmarino WHERE rss_source = '". $palavra ."'";
     323
     324    $results = $wpdb->get_results( $wpdb->prepare($select) , ARRAY_A);
     325
     326    if ($results == "") {
     327        $results = vs_pesquisaprodutos($palavra);
     328    }
     329
     330    echo "<!-- Produtos do Vitrine Submarino com a palavra: $palavra -->";
     331
     332    return $results;
     333}
     334
     335/*******************************************************************
     336* safe_mode and open_basedir workaround by http://www.edmondscommerce.co.uk/blog/curl/php-curl-curlopt_followlocation-and-open_basedir-or-safe-mode/
     337*/
     338//follow on location problems workaround
     339function curl_redir_exec($ch) {
     340    static $curl_loops = 0;
     341    static $curl_max_loops = 20;
     342    if ($curl_loops++>= $curl_max_loops) {
     343        $curl_loops = 0;
     344        return FALSE;
     345    }
     346    curl_setopt($ch, CURLOPT_HEADER, true);
     347    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     348    $data = curl_exec($ch);
     349    list($header, $data) = explode("\n\n", $data, 2);
     350    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     351    if ($http_code == 301 || $http_code == 302) {
     352        $matches = array();
     353        preg_match('/Location:(.*?)\n/', $header, $matches);
     354        $url = @parse_url(trim(array_pop($matches)));
     355        if (!$url) {
     356            //couldn't process the url to redirect to
     357            $curl_loops = 0;
     358            return $data;
    728359        }
     360        $last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
     361        if (!$url['scheme'])
     362            $url['scheme'] = $last_url['scheme'];
     363        if (!$url['host'])
     364            $url['host'] = $last_url['host'];
     365        if (!$url['path'])
     366            $url['path'] = $last_url['path'];
     367        $new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query']?'?'.$url['query']:'');
     368        curl_setopt($ch, CURLOPT_URL, $new_url);
     369        return curl_redir_exec($ch);
    729370    } else {
    730         $rss_source = $vs_options['wid_rss_source'];
    731     }
    732 
    733     $select = "SELECT * FROM wp_vitrinesubmarino WHERE rss_source = '". $rss_source ."'";
    734     $results = $wpdb->get_results( $select , ARRAY_A);
    735 
    736     if (($results == "") AND ($word != "")) {
    737         $results = vs_pesquisaprodutos($word);
    738     }
    739 
    740     return $results;
    741 }
    742 
    743 /***************************************************************************************************
     371    $curl_loops=0;
     372    return $data;
     373    }
     374}
     375function curl($url){
     376    $go = curl_init($url);
     377    curl_setopt ($go, CURLOPT_URL, $url);
     378    //follow on location problems
     379    if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')){
     380        curl_setopt ($go, CURLOPT_FOLLOWLOCATION, $l);
     381        $syn = curl_exec($go);
     382    }else{
     383        $syn = curl_redir_exec($go);
     384    }
     385    curl_close($go);
     386    return $syn;
     387}
     388
     389/**************************************************************************************************
    744390 *  pega produtos da base de dados
    745391 */
     
    756402
    757403    // Pego a pagina do produto procurado
     404/*
    758405    if(function_exists(curl_init)) {
    759    
    760406        $ch = curl_init();
    761407        // informar URL e outras funcoes ao CURL
     
    763409
    764410        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     411        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    765412        // Acessar a URL e retornar a saida
    766413        $buffer = curl_exec($ch);
     414
    767415        // liberar
    768416        curl_close($ch);
    769    
     417
    770418    } else {
    771419   
     
    773421   
    774422    }
    775 
     423*/
     424
     425    $buffer = curl($urlaserlida);
    776426    $doc = new DOMDocument();
    777427
     
    807457            $teste = $img->getAttribute("class");
    808458   
    809             if($teste == 'name entry-title') {
     459            if($teste == 'name entry-title' OR $teste == 'name') {
    810460                $titulo[$i] = $img->nodeValue;
    811461                $i++;
     
    828478   
    829479            if($teste == 'link') {
    830                     $link[$i] = "http://www.submarino.com.br".$img->getAttribute("href").'&franq='.$vs_options['codafil'];
     480                    $link[$i] = "http://www.submarino.com.br".$img->getAttribute("href").'?franq='.$vs_options['codafil'];
    831481                    $i++;
    832482            }
     
    842492    if ($lprod != '') {
    843493        $insert = "INSERT INTO wp_vitrinesubmarino (nomep, linkp, imagemp, precop, rss_source) VALUES " . rtrim($lprod, ", ");
    844         $results = $wpdb->query( $insert );
     494
     495        $results = $wpdb->query( $wpdb->prepare($insert) );
    845496    }
    846497
    847498    $select = "SELECT * FROM wp_vitrinesubmarino WHERE rss_source = '". $palavra ."'";
    848     $produtos = $wpdb->get_results( $select , ARRAY_A);
     499    $produtos = $wpdb->get_results( $wpdb->prepare($select) , ARRAY_A);
    849500
    850501    return $produtos;
     
    852503
    853504
    854 /***************************************************************************************************
     505/**************************************************************************************************
    855506 *  atualiza o cache
    856507 */
     
    862513    #cache vai pras cucuias
    863514    $truncate = "TRUNCATE TABLE wp_vitrinesubmarino";
    864     $results = $wpdb->query( $truncate );
     515    $results = $wpdb->query( $wpdb->prepare($truncate) );
    865516
    866517    #atualiza palavra padrão da vitrine contextual
    867518    vs_pesquisaprodutos($vs_options['ctx_word']);
    868 
    869     #atualiza produtos do RSS para vitrine simples
    870     vs_pegaprodutos_rss($vs_options['ctx_rss_source']);
    871 
    872     #atualiza produtos do RSS para vitrine widget se for diferente da vitrine simples
    873     if ($vs_options['ctx_rss_source'] != $vs_options['wid_rss_source'])
    874         vs_pegaprodutos_rss($vs_options['wid_rss_source']);
    875 }
    876 
    877 /***************************************************************************************************
     519    vs_pesquisaprodutos($vs_options['wid_word']);
     520
     521}
     522
     523/**************************************************************************************************
    878524 *  Funcao principal
    879525 */
     
    886532    global $vs_options;
    887533    global $vs_version;
     534    $i=1;
    888535   
    889536    if ($vs_options['codafil'] == '')
     
    896543
    897544    //pega produtos da BD (devolve um array)
    898     $produtos = vs_pegaprodutos($vitrine);
     545
     546    $produtos = vs_pegaprodutos($word);
    899547
    900548    shuffle($produtos);
    901549
    902550    if (is_array($produtos)) {
    903    
     551
    904552        foreach ($produtos as $produto) {
    905    
    906553   
    907554            $nome = $produto['nomep'];
     
    911558   
    912559            $tc = '';
     560   
     561            //código de tracking do Google Analytics dos links de comparação de preços
     562            $tccp = 'onclick="javascript: pageTracker._trackPageview (\'/out/sub/compare/'.$vs_options['PCP'].'/'.$nome.'/\');"';
    913563       
    914             $texto = $nome;
    915             $texto = str_replace( " com ", " ", $texto );
    916             $texto = str_replace( " de ", " ", $texto );
    917             $texto = str_replace( " do ", " ", $texto );
    918             $texto = str_replace( " da ", " ", $texto );
    919             $texto = str_replace( " para ", " ", $texto );
    920             $texto = str_replace( " por ", " ", $texto );
    921             $pal = explode(" ", $texto);
    922             $busca = $pal[0]." ".$pal[1]." ".$pal[2]." ".$pal[3];
    923        
    924             $tccp = 'onclick="javascript: pageTracker._trackPageview (\'/out/sub/compare/uol/'.$nome.'/\');"';
    925        
    926             //código de tracking do Google Analytics
     564            //código de tracking do Google Analytics dos produtos da vitrine
    927565            $tc = 'onclick="javascript: pageTracker._trackPageview (\'/out/sub/'.$vitrine.'/'.$nome.'\');"';
    928566   
     
    933571                $tc = '';
    934572            }
    935            
    936             //FIM do código de tracking
    937        
     573
    938574            switch ($vs_options['PCP']) {
    939575                case "BP":
     
    959595                    // vitrine contextual
    960596                    if ($vs_options['ctx_tipo'] == "horizontal") {
    961                         $td = 100 / $vs_options['ctx_show'];
     597                        $td = 92 / $vs_options['ctx_show'];
     598                        $imagem = str_replace("<img ", "<img width=90px height=90px alt=\"".$nome."\"", $imagem);
     599                        $imagem = rtrim($imagem,".");
     600
    962601                        //mostra vitrine com produtos em uma unica linha (VITRINE HORIZONTAL)
    963                         $lista_de_produtos .= '<div style="width:'. $td.'%;background-color:white;text-align:center;padding:0px;font-size:12px;border:0px;float:left;"><a href="'.$link_prod.'" '.$tc.'  target="_blank">'.$imagem.'</a><br />'.$nome.'<br /><div style="color:'.$corprec.';">'.$preco.'</div>'.$compare_precos.'</div>';
    964                     } else {
     602#                       $lista_de_produtos .= "<div onMouseover=\"ddrivetip('".$nome."', '#EFEFEF')\";=\"\" onMouseout=\"hideddrivetip()\">";
     603                        $lista_de_produtos[] = '<div style="width:'. $td.'%;background-color:white;text-align:center; line-height:120%;padding-right: 10px;font-size:12px;border:0px;float:left;overflow: hidden;"><a href="'.$link_prod.'" '.$tc.'  target="_blank"><span style="width:90px;height:90px;position:relative;">'.$imagem.'</span></a><br />'.$nome.'<br /><span style="color:'.$corprec.';">&nbsp;'.$preco.'&nbsp;</span><br /><a href="'.$link_prod.'" '.$tc.'  target="_blank"><strong>Veja mais</strong></a>'.$compare_precos.'</div>';
     604                       
     605                    } elseif ($vs_options['ctx_tipo'] == "vertical") {
    965606                        $imagem = str_replace("<img ", "<img style=\" display: inline; float: left; margin: 0 10px 10px 0;\" alt=\"".$nome."\"", $imagem);
    966607                        //mostra vitrine com um produto por linha (VITRINE VERTICAL)
    967                         $lista_de_produtos .= '<div style="height:130px;background-color:white;padding:3px;"><a href="'.$link_prod.'" '.$tc.'  target="_blank">'.$imagem.'</a><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$nome.'</a><br /><div style="color:'.$corprec.';">'.$preco.'</div>'.$compare_precos.'</div>';
     608                        $lista_de_produtos[] = '<div style="height:130px;background-color:white;padding:3px;"><a href="'.$link_prod.'" '.$tc.'  target="_blank">'.$imagem.'</a><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$nome.'</a><br /><div style="color:'.$corprec.';">'.$preco.'</div>'.$compare_precos.'</div>';
     609                                               
     610                    } elseif ($vs_options['ctx_tipo'] == "banner-468") {
     611                        $credits='<div style="position:absolute;bottom:0px;right:0px;"><small><a href="http://www.bernabauer.com/wp-plugins/">Vitrine Submarino '.$vs_options['version'].'</a></small></div>';
     612                        $imagem = rtrim(str_replace("<img ", "<img style=\" display: inline; float: left; margin: 0 10px 0px 10px;height:60px;\" alt=\"".$nome."\"", $imagem), ".");
     613                        $lista_de_produtos[] = '<div style="border: 1px solid #ccc;color:'.$desc.';background-color:white;padding:3px;text-decoration: none ! important;width:468px;height:60px;position:relative;"><a href="http://www.submarino.com.br?franq='.$vs_options['codafil'].'" target="_blank"><img style=" display: inline; float: right; margin: 0 10px 0px 10px;" src="http://i.s8.com.br/images/affiliates/selos/70x70_selo.gif" WIDTH=40 HEIGHT=40 ></a><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$imagem.'<font size="+1">'.$nome.'</font></a><br /><div style="color:'.$corprec.';font-size: 100%;">'.$preco.'</div>'.$compare_precos.''.$credits.'</div>';
     614                        $i = $show;
     615                       
     616                    } elseif ($vs_options['ctx_tipo'] == "box-250") {
     617                        $imagem = rtrim(str_replace("<img ", "<img width=90px height=90px alt=\"".$nome."\"", $imagem),".");
     618#                       $lista_de_produtos .= "<div onMouseover=\"ddrivetip('".$nome."', '#EFEFEF')\";=\"\" onMouseout=\"hideddrivetip()\">";
     619                        $lista_de_produtos[] = "<div style=\"width:110px;height:125px;background-color:white;text-align:center; line-height:120%;padding-left: 10px;font-size:12px;border:0px;float:left;overflow: hidden;\"><a href=\"".$link_prod.'" '.$tc.'  target="_blank"><span style="width:90px;height:90px;position:relative;">'.$imagem.'<div style="color:'.$corprec.';font-size: 120%;background-color:white;position: absolute; bottom: 65px; right: 0px;">&nbsp;'.$preco.'&nbsp;</div></span></a><br />'.$nome.''.$compare_precos.'</div></div>';
    968620                    }
    969621                    break;
    970        
     622   
    971623                case "widget":
    972                     $lista_de_produtos .= '<div style="color:'.$desc.';background-color:'.$fundo.';text-align:center;padding:3px;text-decoration: none ! important;"><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$imagem.'<br />'.$nome.'</a><br /><div style="color:'.$corprec.';">'.$preco.'</div>'.$compare_precos.'</div>';
    973                     break;
    974        
     624#                   $imagem = rtrim(str_replace("<img ", "<img name=image".$i." onload=\"resizeimage('image".$i."');\"", $imagem), ".");
     625                    $lista_de_produtos[] = '<div style="color:'.$desc.';background-color:'.$fundo.';text-align:center;padding:3px;text-decoration: none ! important;"><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$imagem.'<br />'.$nome.'</a><br /><div style="color:'.$corprec.';">'.$preco.'</div>'.$compare_precos.'</div>';
     626                    break;
     627                case "banner-728-1":
     628                    $credits='<div style="position:absolute;bottom:0px;right:0px;"><small><a href="http://www.bernabauer.com/wp-plugins/">Vitrine Submarino '.$vs_options['version'].'</a></small></div>';
     629                    $imagem = rtrim(str_replace("<img ", "<img style=\" display: inline; float: left; margin: 0 10px 0px 10px;height:90px;\" alt=\"".$nome."\"", $imagem), ".");
     630                    $lista_de_produtos[] = '<div style="border: 1px solid #ccc;color:'.$desc.';background-color:white;padding:3px;text-decoration: none ! important;width:728px;height:90px;position:relative;"><a href="http://www.submarino.com.br?franq='.$vs_options['codafil'].'" target="_blank"><img style=" display: inline; float: right; margin: 0 10px 0px 10px;" src="http://i.s8.com.br/images/affiliates/selos/70x70_selo.gif"></a><a href="'.$link_prod.'" '.$tc.' target="_blank">'.$imagem.'<div style="font-size: 200%;">'.$nome.'</div></a><br /><div style="color:'.$corprec.';font-size: 150%;">'.$preco.'</div>'.$compare_precos.''.$credits.'</div>';
     631                    $i = $show;
     632                    break;
     633                       
     634                case "banner-728-2":
     635                    $imagem = str_replace("<img ", "<img style=\" display: inline; margin: 0 10px 0px 10px;height:90px;\" alt=\"".$nome."\"", $imagem);
     636                    $lista_de_produtos[] = '<span style="position:relative;"><a href="'.$link_prod.'" '.$tc.' target="_blank" title="'.$nome.'">'.$imagem.'</a><div style="color:'.$corprec.';font-size: 100%;position: absolute; top: 0px; left: 10px;">'.$preco.'</div></span>';
     637                    break;
     638
    975639            } //switch
    976         if ($i == $show-1)
     640
     641#       if ($vs_options['ctx_slot1'] != "normal" AND $i == $show-1)
     642#           break;
     643
     644        if ($i >= $show)
    977645            break;
    978646        else
    979647            $i++;
    980648        } //foreach
    981    
    982    
     649
     650        #mostra primeiro slot diferenciado (adsense ou link de comparação de preços)
     651        $current_plugins = get_option('active_plugins');
     652        if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins)) {
     653            $words_array = pm_get_words();
     654       
     655            if ($vs_options['ctx_rss_source'] == "ctx_contextual" AND $words_array != '' AND $vs_options['ctx_slot1'] != "normal" AND $vitrine == "contextual" AND $vs_options['ctx_tipo'] == "horizontal" || $vs_options['ctx_tipo'] == "box-250") {
     656           
     657                if (count($lista_de_produtos) >= $show)
     658                    $lixo = array_pop($lista_de_produtos);
     659               
     660                foreach ($lista_de_produtos as $produto) {
     661                    $lista_final_de_produtos .= $produto;
     662                }
     663
     664                $current_plugins = get_option('active_plugins');
     665                if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins))
     666                    $words_array = pm_get_words();
     667           
     668                shuffle($words_array);
     669           
     670                $compareprecoshead = '<strong>Compare Preços</strong><br />';
     671           
     672                switch($vs_options['ctx_slot1']) {
     673                    case "adsense":
     674                        $lista_final_de_produtos = '<div style="width:120px;height:125px;background-color:white;border:0px;float:left;"><div style="float:center; " align="center" >'.stripslashes($vs_options['adsense_code']).'</div></div>'.$lista_final_de_produtos;
     675                        break;
     676                    case "compareBP":
     677                        foreach ($words_array as $word) {
     678                            $compare_precos = "<a href=\"http://busca.buscape.com.br/cprocura?lkout=1&amp;site_origem=".$cod_BP."&produto=".urlencode(utf8_decode($word))."\" ".$tccp." target='_blank'>".$word."</a><br />";
     679                            $comparacao .= $compare_precos;
     680                            if ($u == 3)
     681                                break;
     682                            else
     683                                $u++;
     684                        }
     685                        $lista_final_de_produtos = '<div style="width:'. $td.'%;height:125px;background-color:white;border:0px;float:left;"><div style="float:center; " align="center" >'.$compareprecoshead.' '.rtrim($comparacao,"<br />").'</div></div>'.$lista_final_de_produtos;
     686                        break;
     687                    case "compareML":
     688                        foreach ($words_array as $word) {
     689                            $compare_precos = "<a href=\"http://pmstrk.mercadolivre.com.br/jm/PmsTrk?tool=".$cod_ML."&amp;go=http://lista.mercadolivre.com.br/".urlencode($word)."\"  ".$tccp." target='_blank'>".$word."</a><br />";
     690                            $comparacao .= $compare_precos;
     691                            if ($u == 3)
     692                                break;
     693                            else
     694                                $u++;
     695                        }
     696                        $lista_final_de_produtos = '<div style="width:'. $td.'%;height:125px;background-color:white;border:0px;float:left;"><div style="float:center; " align="center" >'.$compareprecoshead.' '.rtrim($comparacao,"<br />").'</div></div>'.$lista_final_de_produtos;
     697                        break;
     698                    case "compareJC":
     699                        foreach ($words_array as $word) {
     700                            $compare_precos = "<a href=\"http://www.jacotei.com.br/mod.php?module=jacotei.pesquisa&amp;texto=".urlencode($word)."&amp;precomin=&amp;precomax=&amp;af=".$cod_JC."\" ".$tccp." target='_blank'>".$word."</a><br />"; 
     701                            $comparacao .= $compare_precos;
     702                            if ($u == 3)
     703                                break;
     704                            else
     705                                $u++;
     706                        }
     707                        $lista_final_de_produtos = '<div style="width:'. $td.'%;height:125px;background-color:white;border:0px;float:left;"><div style="float:center; " align="center" >'.$compareprecoshead.' '.rtrim($comparacao,"<br />").'</div></div>'.$lista_final_de_produtos;
     708                        break;
     709                    case "compareBB":
     710                        foreach ($words_array as $word) {
     711                            $compare_precos = "<a href=\"http://bernabauer.shopping.busca.uol.com.br/busca.html?q=".urlencode(utf8_decode($word))."\" " .$tccp." target='_blank'>".$word."</a><br />";
     712                            $comparacao .= $compare_precos;
     713                            if ($u == 3)
     714                                break;
     715                            else
     716                                $u++;
     717                        }
     718                        $lista_final_de_produtos = '<div style="width:'. $td.'%;height:125px;background-color:white;border:0px;float:left;"><div style="float:center; " align="center" >'.$compareprecoshead.' '.rtrim($comparacao,"<br />").'</div></div>'.$lista_final_de_produtos;
     719                        break;
     720           
     721                } //switch
     722                    $show = $show-1;
     723            } else { //if
     724                foreach ($lista_de_produtos as $produto) {
     725                    $lista_final_de_produtos .= $produto;
     726                }
     727            }
     728        } else { //if   
     729            foreach ($lista_de_produtos as $produto) {
     730                $lista_final_de_produtos .= $produto;
     731            }
     732        }
     733
     734    $lista_de_produtos = $lista_final_de_produtos; 
     735
    983736    } else {
    984737        if ($vitrine == "contextual") {
    985738            // anuncio alternativo contextual
    986            
     739
    987740            switch ($vs_options['ctx_altcode']) {
    988741                case "ctx_FBD":
     
    997750                case "ctx_SBG":
    998751                    $altcode = '<script language="JavaScript1.1" type="text/javascript" src=http://www.submarino.com.br/afiliados/get_banner.asp?tipo=super2&amp;franq='.$vs_options['codafil'].'></script>';
     752                    break;
     753                case "ctx_BVD":
     754                    $altcode = '<script language="JavaScript1.1" type="text/javascript" src=http://www.submarino.com.br/afiliados/get_banner.asp?tipo=vertical&amp;franq='.$vs_options['codafil'].'></script>';
     755                    break;
     756                case "ctx_BVG":
     757                    $altcode = '<script language="JavaScript1.1" type="text/javascript" src=http://www.submarino.com.br/afiliados/get_banner.asp?tipo=vertical2&amp;franq='.$vs_options['codafil'].'></script>';
    999758                    break;
    1000759                case "ctx_SKYD":
     
    1035794                    $altcode = '<script language="JavaScript1.1" type="text/javascript" src=http://www.submarino.com.br/afiliados/get_banner.asp?tipo=vertical&amp;franq='.$vs_options['codafil'].'></script>';
    1036795                    break;
    1037                 case "BVD":
     796                case "BVG":
    1038797                    $altcode = '<script language="JavaScript1.1" type="text/javascript" src=http://www.submarino.com.br/afiliados/get_banner.asp?tipo=vertical2&amp;franq='.$vs_options['codafil'].'></script>';
    1039798                    break;
     
    1058817            } //switch
    1059818        } //if
    1060         return "<br clear=both /><div style=\"float:center;\" align=\"center\" border=\"0\">
     819        return "<br /><div style=\"float:center;\" align=\"center\" border=\"0\">
    1061820".$altcode."</div>";
    1062821    }# else {
    1063822   
    1064     $credits = "<br clear=both /><div style=\"text-align:right;\"><small><a href='http://www.bernabauer.com/wp-plugins/'>Vitrine Submarino ".$vs_options['version']."</a></small></div>";
     823    $credits = "<br /><div style=\"text-align:right;\"><small><a href='http://www.bernabauer.com/wp-plugins/'>Vitrine Submarino ".$vs_options['version']."</a></small></div>";
    1065824
    1066825    if (($vitrine == "contextual") AND ($vs_options['ctx_exib_auto'] == 'auto'))
     
    1069828        $titulo = '';
    1070829
     830    if (strstr($vs_options['ctx_tipo'], "banner") != FALSE OR strstr($vitrine, "banner") != FALSE) {
     831        $credits = "<br />";
     832    }
     833
     834    if (($vitrine == "contextual") AND ($vs_options['ctx_tipo'] == "box-250")) {
     835        $box_antes = '<div style="width:250px;">';
     836        $box_depois = "</div>";
     837    }
     838
     839   
     840
    1071841    if ($vitrine == "widget") {
     842        $widgetid = "id=\"vswi\"";
    1072843        $combordas = "border:2px solid ".$borda.";background-color:".$fundo.";";
    1073844    } else
    1074845        $combordas = '';
    1075846
    1076     return "<br clear=both />".$titulo."<div style=\"".$combordas."\">".$lista_de_produtos."</div>".$credits;
     847    return "<br />".$box_antes.''.$titulo."<div ".$widgetid." style=\"".$combordas."\">".$lista_de_produtos."</div>".$credits.''.$box_depois;
    1077848    #}
    1078849}
    1079850
    1080851
    1081 /***************************************************************************************************
     852/**************************************************************************************************
    1082853 *  Menu de configuracao
    1083854 */
     
    1088859}
    1089860
    1090 /***************************************************************************************************
     861/**************************************************************************************************
    1091862 *  Pagina de opcoes
    1092863 */
     
    1138909            $vs_options['wid_prcolor'] = strip_tags(stripslashes($_POST['wid_prcolor']));
    1139910
    1140         $vs_options['wid_rss_source'] = strip_tags(stripslashes($_POST['wid_rss_source']));
     911        $vs_options['wid_word'] = strip_tags(stripslashes($_POST['wid_word']));
    1141912        $vs_options['wid_altcode'] = strip_tags(stripslashes($_POST['wid_altcode']));
    1142913        $vs_options['wid_track'] = strip_tags(stripslashes($_POST['wid_track']));
     
    1154925
    1155926        $vs_options['ctx_word'] = strip_tags(stripslashes($_POST['ctx_word']));
    1156         $vs_options['ctx_rss_source'] = strip_tags(stripslashes($_POST['ctx_rss_source']));
    1157927        $vs_options['ctx_altcode'] = strip_tags(stripslashes($_POST['ctx_altcode']));
    1158928        $vs_options['ctx_exib_auto'] = strip_tags(stripslashes($_POST['ctx_exib_auto']));
     929        $vs_options['ctx_slot1'] = strip_tags(stripslashes($_POST['ctx_slot1']));
    1159930        $vs_options['ctx_local'] = strip_tags(stripslashes($_POST['ctx_local']));
    1160931        $vs_options['ctx_track'] = strip_tags(stripslashes($_POST['ctx_track']));
     
    1162933        $vs_options['ctx_style'] = strip_tags(stripslashes($_POST['ctx_style']));
    1163934        $vs_options['ctx_alt'] = strip_tags(stripslashes($_POST['ctx_alt']));
     935        $vs_options['adsense_code'] = $_POST['adsense_code'];
    1164936
    1165937        //atualiza base de dados com informacaoes do formulario     
     
    1168940        //atualiza o cache local de produtos com a nova configuracao
    1169941        vs_atualiza_produtos();
    1170         vs_pesquisaprodutos($vs_options['ctx_word']);
     942#       vs_pesquisaprodutos($vs_options['ctx_word']);
    1171943    }
    1172944   
     
    1195967    }
    1196968
    1197     if ( $vs_options['ctx_tipo'] == 'horizontal') {
    1198         $horizontal = 'checked=\"checked\"';
    1199     } else {
    1200         $vertical = 'checked=\"checked\"';
     969    switch ( $vs_options['ctx_tipo'] ) {
     970        case 'horizontal':
     971            $horizontal = 'checked=\"checked\"';
     972            break;
     973        case 'vertical':
     974            $vertical = 'checked=\"checked\"';
     975            break;
     976        case 'banner-468':
     977            $banner468 = 'checked=\"checked\"';
     978            break;
     979        case 'banner-728-1':
     980            $banner7281 = 'checked=\"checked\"';
     981            break;
     982        case 'box-250':
     983            $banner250 = 'checked=\"checked\"';
     984            break;
    1201985    }
    1202986
     
    1206990        $remover_sim = 'checked=\"checked\"';
    1207991    }
     992
     993    switch ($vs_options['ctx_slot1']) {
     994        case "adsense":
     995            $slot1_adsense = 'checked=\"checked\"';
     996            break;
     997        case "compareBP":
     998            $slot1_compareBP = 'checked=\"checked\"';
     999            break;
     1000        case "compareML":
     1001            $slot1_compareML = 'checked=\"checked\"';
     1002            break;
     1003        case "compareJC":
     1004            $slot1_compareJC = 'checked=\"checked\"';
     1005            break;
     1006        case "compareBB":
     1007            $slot1_compareBB = 'checked=\"checked\"';
     1008            break;
     1009        case "normal":
     1010            $slot1_normal = 'checked=\"checked\"';
     1011            break;
     1012    }
    12081013   
    12091014    switch ($vs_options['wid_altcode']) {
     
    13031108    }       
    13041109
    1305     switch ($vs_options['wid_rss_source']) {
    1306    
    1307         case "mv_Bebes":
    1308             $wid_mv_Bebes = 'checked=\"checked\"';
    1309             break;
    1310         case "mv_Beleza":
    1311             $wid_mv_Beleza = 'checked=\"checked\"';
    1312             break;
    1313         case "mv_Brinquedos":
    1314             $wid_mv_Brinquedos = 'checked=\"checked\"';
    1315             break;
    1316         case "mv_Cama":
    1317             $wid_mv_Cama = 'checked=\"checked\"';
    1318             break;
    1319         case "mv_Cameras":
    1320             $wid_mv_Cameras = 'checked=\"checked\"';
    1321             break;
    1322         case "mv_Celulares":
    1323             $wid_mv_Celulares = 'checked=\"checked\"';
    1324             break;
    1325         case "mv_CDs":
    1326             $wid_mv_CDs = 'checked=\"checked\"';
    1327             break;
    1328         case "mv_DVD":
    1329             $wid_mv_DVD = 'checked=\"checked\"';
    1330             break;
    1331         case "mv_Esporte":
    1332             $wid_mv_Esporte = 'checked=\"checked\"';
    1333             break;
    1334         case "mv_Eletrodomesticos":
    1335             $wid_mv_Eletrodomesticos = 'checked=\"checked\"';
    1336             break;
    1337         case "mv_Eletronicos":
    1338             $wid_mv_Eletronicos = 'checked=\"checked\"';
    1339             break;
    1340         case "mv_Eletroportateis":
    1341             $wid_mv_Eletroportateis = 'checked=\"checked\"';
    1342             break;
    1343         case "mv_Ferramentas":
    1344             $wid_mv_Ferramentas = 'checked=\"checked\"';
    1345             break;
    1346         case "mv_Games":
    1347             $wid_mv_Games = 'checked=\"checked\"';
    1348             break;
    1349         case "mv_Informatica":
    1350             $wid_mv_Informatica = 'checked=\"checked\"';
    1351             break;
    1352         case "mv_Instrumentos":
    1353             $wid_mv_Instrumentos = 'checked=\"checked\"';
    1354             break;
    1355         case "mv_Livros":
    1356             $wid_mv_Livros = 'checked=\"checked\"';
    1357             break;
    1358         case "mv_livrosImportados":
    1359             $wid_mv_livrosImportados = 'checked=\"checked\"';
    1360             break;
    1361         case "mv_Papelaria":
    1362             $wid_mv_Papelaria = 'checked=\"checked\"';
    1363             break;
    1364         case "mv_Perfumaria":
    1365             $wid_mv_Perfumaria = 'checked=\"checked\"';
    1366             break;
    1367         case "mv_Relogios":
    1368             $wid_mv_Relogios = 'checked=\"checked\"';
    1369             break;
    1370         case "mv_Utilidades":
    1371             $wid_mv_Utilidades = 'checked=\"checked\"';
    1372             break;
    1373         case "mv_Vestuario":
    1374             $wid_mv_Vestuario = 'checked=\"checked\"';
    1375             break;
    1376         case "mv_vinhos":
    1377             $wid_mv_vinhos = 'checked=\"checked\"';
    1378             break;
    1379         case "lan_Geral":
    1380             $wid_lan_Geral = 'checked=\"checked\"';
    1381             break;
    1382         case "lan_Bebes":
    1383             $wid_lan_Bebes = 'checked=\"checked\"';
    1384             break;
    1385         case "lan_Beleza":
    1386             $wid_lan_Beleza = 'checked=\"checked\"';
    1387             break;
    1388         case "lan_Brinquedos":
    1389             $wid_lan_Brinquedos = 'checked=\"checked\"';
    1390             break;
    1391         case "lan_Cama":
    1392             $wid_lan_Cama = 'checked=\"checked\"';
    1393             break;
    1394         case "lan_Cameras":
    1395             $wid_lan_Cameras = 'checked=\"checked\"';
    1396             break;
    1397         case "lan_Celulares":
    1398             $wid_lan_Celulares = 'checked=\"checked\"';
    1399             break;
    1400         case "lan_CDs":
    1401             $wid_lan_CDs = 'checked=\"checked\"';
    1402             break;
    1403         case "lan_DVD":
    1404             $wid_lan_DVD = 'checked=\"checked\"';
    1405             break;
    1406         case "lan_Esporte":
    1407             $wid_lan_Esporte = 'checked=\"checked\"';
    1408             break;
    1409         case "lan_Eletrodomesticos":
    1410             $wid_lan_Eletrodomesticos = 'checked=\"checked\"';
    1411             break;
    1412         case "lan_Eletronicos":
    1413             $wid_lan_Eletronicos = 'checked=\"checked\"';
    1414             break;
    1415         case "lan_Eletroportateis":
    1416             $wid_lan_Eletroportateis = 'checked=\"checked\"';
    1417             break;
    1418         case "lan_Ferramentas":
    1419             $wid_lan_Ferramentas = 'checked=\"checked\"';
    1420             break;
    1421         case "lan_Games":
    1422             $wid_lan_Games = 'checked=\"checked\"';
    1423             break;
    1424         case "lan_Informatica":
    1425             $wid_lan_Informatica = 'checked=\"checked\"';
    1426             break;
    1427         case "lan_Instrumentos":
    1428             $wid_lan_Instrumentos = 'checked=\"checked\"';
    1429             break;
    1430         case "lan_Livros":
    1431             $wid_lan_Livros = 'checked=\"checked\"';
    1432             break;
    1433         case "lan_Papelaria":
    1434             $wid_lan_Papelaria = 'checked=\"checked\"';
    1435             break;
    1436         case "lan_Perfumaria":
    1437             $wid_lan_Perfumaria = 'checked=\"checked\"';
    1438             break;
    1439         case "lan_Relogios":
    1440             $wid_lan_Relogios = 'checked=\"checked\"';
    1441             break;
    1442         case "lan_Utilidades":
    1443             $wid_lan_Utilidades = 'checked=\"checked\"';
    1444             break;
    1445         case "lan_vinhos":
    1446             $wid_lan_vinhos = 'checked=\"checked\"';
    1447             break;
    1448         case "prom_Geral":
    1449             $wid_prom_Geral = 'checked=\"checked\"';
    1450             break;
    1451         case "prom_Beleza":
    1452             $wid_prom_Beleza = 'checked=\"checked\"';
    1453             break;
    1454         case "prom_Brinquedos":
    1455             $wid_prom_Brinquedos = 'checked=\"checked\"';
    1456             break;
    1457         case "prom_Cameras":
    1458             $wid_prom_Cameras = 'checked=\"checked\"';
    1459             break;
    1460         case "prom_Celulares":
    1461             $wid_prom_Celulares = 'checked=\"checked\"';
    1462             break;
    1463         case "prom_CDs":
    1464             $wid_prom_CDs = 'checked=\"checked\"';
    1465             break;
    1466         case "prom_DVD":
    1467             $wid_prom_DVD = 'checked=\"checked\"';
    1468             break;
    1469         case "prom_Esporte":
    1470             $wid_prom_Esporte = 'checked=\"checked\"';
    1471             break;
    1472         case "prom_Eletrodomesticos":
    1473             $wid_prom_Eletrodomesticos = 'checked=\"checked\"';
    1474             break;
    1475         case "prom_Eletronicos":
    1476             $wid_prom_Eletronicos = 'checked=\"checked\"';
    1477             break;
    1478         case "prom_Games":
    1479             $wid_prom_Games = 'checked=\"checked\"';
    1480             break;
    1481         case "prom_Livros":
    1482             $wid_prom_Livros = 'checked=\"checked\"';
    1483             break;
    1484     }
    1485    
    1486     switch ($vs_options['ctx_rss_source']) {
    1487    
    1488         case "ctx_contextual":
    1489             $ctx_contextual = 'checked=\"checked\"';
    1490             break;
    1491         case "mv_Bebes":
    1492             $ctx_mv_Bebes = 'checked=\"checked\"';
    1493             break;
    1494         case "mv_Beleza":
    1495             $ctx_mv_Beleza = 'checked=\"checked\"';
    1496             break;
    1497         case "mv_Brinquedos":
    1498             $ctx_mv_Brinquedos = 'checked=\"checked\"';
    1499             break;
    1500         case "mv_Cama":
    1501             $ctx_mv_Cama = 'checked=\"checked\"';
    1502             break;
    1503         case "mv_Cameras":
    1504             $ctx_mv_Cameras = 'checked=\"checked\"';
    1505             break;
    1506         case "mv_Celulares":
    1507             $ctx_mv_Celulares = 'checked=\"checked\"';
    1508             break;
    1509         case "mv_CDs":
    1510             $ctx_mv_CDs = 'checked=\"checked\"';
    1511             break;
    1512         case "mv_DVD":
    1513             $ctx_mv_DVD = 'checked=\"checked\"';
    1514             break;
    1515         case "mv_Esporte":
    1516             $ctx_mv_Esporte = 'checked=\"checked\"';
    1517             break;
    1518         case "mv_Eletrodomesticos":
    1519             $ctx_mv_Eletrodomesticos = 'checked=\"checked\"';
    1520             break;
    1521         case "mv_Eletronicos":
    1522             $ctx_mv_Eletronicos = 'checked=\"checked\"';
    1523             break;
    1524         case "mv_Eletroportateis":
    1525             $ctx_mv_Eletroportateis = 'checked=\"checked\"';
    1526             break;
    1527         case "mv_Ferramentas":
    1528             $ctx_mv_Ferramentas = 'checked=\"checked\"';
    1529             break;
    1530         case "mv_Games":
    1531             $ctx_mv_Games = 'checked=\"checked\"';
    1532             break;
    1533         case "mv_Informatica":
    1534             $ctx_mv_Informatica = 'checked=\"checked\"';
    1535             break;
    1536         case "mv_Instrumentos":
    1537             $ctx_mv_Instrumentos = 'checked=\"checked\"';
    1538             break;
    1539         case "mv_Livros":
    1540             $ctx_mv_Livros = 'checked=\"checked\"';
    1541             break;
    1542         case "mv_livrosImportados":
    1543             $ctx_mv_livrosImportados = 'checked=\"checked\"';
    1544             break;
    1545         case "mv_Papelaria":
    1546             $ctx_mv_Papelaria = 'checked=\"checked\"';
    1547             break;
    1548         case "mv_Perfumaria":
    1549             $ctx_mv_Perfumaria = 'checked=\"checked\"';
    1550             break;
    1551         case "mv_Relogios":
    1552             $ctx_mv_Relogios = 'checked=\"checked\"';
    1553             break;
    1554         case "mv_Utilidades":
    1555             $ctx_mv_Utilidades = 'checked=\"checked\"';
    1556             break;
    1557         case "mv_Vestuario":
    1558             $ctx_mv_Vestuario = 'checked=\"checked\"';
    1559             break;
    1560         case "mv_vinhos":
    1561             $ctx_mv_vinhos = 'checked=\"checked\"';
    1562             break;
    1563         case "lan_Geral":
    1564             $ctx_lan_Geral = 'checked=\"checked\"';
    1565             break;
    1566         case "lan_Bebes":
    1567             $ctx_lan_Bebes = 'checked=\"checked\"';
    1568             break;
    1569         case "lan_Beleza":
    1570             $ctx_lan_Beleza = 'checked=\"checked\"';
    1571             break;
    1572         case "lan_Brinquedos":
    1573             $ctx_lan_Brinquedos = 'checked=\"checked\"';
    1574             break;
    1575         case "lan_Cama":
    1576             $ctx_lan_Cama = 'checked=\"checked\"';
    1577             break;
    1578         case "lan_Cameras":
    1579             $ctx_lan_Cameras = 'checked=\"checked\"';
    1580             break;
    1581         case "lan_Celulares":
    1582             $ctx_lan_Celulares = 'checked=\"checked\"';
    1583             break;
    1584         case "lan_CDs":
    1585             $ctx_lan_CDs = 'checked=\"checked\"';
    1586             break;
    1587         case "lan_DVD":
    1588             $ctx_lan_DVD = 'checked=\"checked\"';
    1589             break;
    1590         case "lan_Esporte":
    1591             $ctx_lan_Esporte = 'checked=\"checked\"';
    1592             break;
    1593         case "lan_Eletrodomesticos":
    1594             $ctx_lan_Eletrodomesticos = 'checked=\"checked\"';
    1595             break;
    1596         case "lan_Eletronicos":
    1597             $ctx_lan_Eletronicos = 'checked=\"checked\"';
    1598             break;
    1599         case "lan_Eletroportateis":
    1600             $ctx_lan_Eletroportateis = 'checked=\"checked\"';
    1601             break;
    1602         case "lan_Ferramentas":
    1603             $ctx_lan_Ferramentas = 'checked=\"checked\"';
    1604             break;
    1605         case "lan_Games":
    1606             $ctx_lan_Games = 'checked=\"checked\"';
    1607             break;
    1608         case "lan_Informatica":
    1609             $ctx_lan_Informatica = 'checked=\"checked\"';
    1610             break;
    1611         case "lan_Instrumentos":
    1612             $ctx_lan_Instrumentos = 'checked=\"checked\"';
    1613             break;
    1614         case "lan_Livros":
    1615             $ctx_lan_Livros = 'checked=\"checked\"';
    1616             break;
    1617         case "lan_Papelaria":
    1618             $ctx_lan_Papelaria = 'checked=\"checked\"';
    1619             break;
    1620         case "lan_Perfumaria":
    1621             $ctx_lan_Perfumaria = 'checked=\"checked\"';
    1622             break;
    1623         case "lan_Relogios":
    1624             $ctx_lan_Relogios = 'checked=\"checked\"';
    1625             break;
    1626         case "lan_Utilidades":
    1627             $ctx_lan_Utilidades = 'checked=\"checked\"';
    1628             break;
    1629         case "lan_vinhos":
    1630             $ctx_lan_vinhos = 'checked=\"checked\"';
    1631             break;
    1632         case "prom_Geral":
    1633             $ctx_prom_Geral = 'checked=\"checked\"';
    1634             break;
    1635         case "prom_Beleza":
    1636             $ctx_prom_Beleza = 'checked=\"checked\"';
    1637             break;
    1638         case "prom_Brinquedos":
    1639             $ctx_prom_Brinquedos = 'checked=\"checked\"';
    1640             break;
    1641         case "prom_Cameras":
    1642             $ctx_prom_Cameras = 'checked=\"checked\"';
    1643             break;
    1644         case "prom_Celulares":
    1645             $ctx_prom_Celulares = 'checked=\"checked\"';
    1646             break;
    1647         case "prom_CDs":
    1648             $ctx_prom_CDs = 'checked=\"checked\"';
    1649             break;
    1650         case "prom_DVD":
    1651             $ctx_prom_DVD = 'checked=\"checked\"';
    1652             break;
    1653         case "prom_Esporte":
    1654             $ctx_prom_Esporte = 'checked=\"checked\"';
    1655             break;
    1656         case "prom_Eletrodomesticos":
    1657             $ctx_prom_Eletrodomesticos = 'checked=\"checked\"';
    1658             break;
    1659         case "prom_Eletronicos":
    1660             $ctx_prom_Eletronicos = 'checked=\"checked\"';
    1661             break;
    1662         case "prom_Games":
    1663             $ctx_prom_Games = 'checked=\"checked\"';
    1664             break;
    1665         case "prom_Livros":
    1666             $ctx_prom_Livros = 'checked=\"checked\"';
    1667             break;
    1668     }
    1669 
    16701110
    16711111?>
     
    16781118    <table class="form-table">
    16791119     <tr>
    1680         <th scope="row" valign="top">Aviso</th>
    1681         <td>
    1682              Este plugin pega os produtos para serem mostrados em seu blog fornecidos através da <a href="http://www.submarino.com.br/portal/central-rss/?WT.mc_id=rss_left&WT.mc_ev=click" target=_blank>fonte de RSS que o Submarino fornece</a>. Para mostrar os produtos nas vitrines contextual e widget o plugin efetua um cache local que é atualizado uma vez por dia. Fique atento ao seguinte: A página de configuração do plugin pode demorar um pouco para carregar quando as configurações são alteradas. Isto ocorre por que neste momento é forçada uma atualização do cache local a partir da fonte RSS.<br />
    1683             <br />
    1684             <strong>Estatística do cache</strong><br />
     1120        <th scope="row" valign="top">Estatística</th>
     1121        <td>
    16851122            Produtos :
    16861123            <?php
    1687             $sql = "SELECT count( nomep ) as count FROM wp_vitrinesubmarino";
    1688             $results = $wpdb->get_results( $sql , ARRAY_A);
     1124            $sql = "SELECT count( linkp ) as count FROM wp_vitrinesubmarino";
     1125            $results = $wpdb->get_results( $wpdb->prepare($sql) , ARRAY_A);
    16891126            echo $results['0']['count'];
    16901127             ?>
     
    16931130            <?php
    16941131            $sql = "SELECT count(distinct rss_source ) as count FROM wp_vitrinesubmarino";
    1695             $results = $wpdb->get_results( $sql , ARRAY_A);
     1132            $results = $wpdb->get_results( $wpdb->prepare($sql) , ARRAY_A);
    16961133            echo $results['0']['count'];
    16971134           
    16981135            ?>
    1699             <br />Próxima atualização do cache de produtos via RSS:
     1136            <br />Próxima limpeza do cache de produtos :
    17001137             <?php
    17011138             
     
    17601197
    17611198<br />
    1762     <h2>Vitrine Simples/Contextual</h2>
    1763 <?php
    1764 
    1765 $current_plugins = get_option('active_plugins');
    1766 if (!in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins))
    1767     $PMdisabled = "DISABLED";
    1768 
    1769 ?>
     1199    <h2>Vitrine Contextual</h2>
    17701200    <table class="form-table">
    17711201     <tr>
     
    17801210    <table class="form-table">
    17811211     <tr>
     1212        <th scope="row" valign="top">Palavra de pesquisa da vitrine</th>
     1213        <td>
     1214            <input style="width: 60px;" id="ctx_word" name="ctx_word" type="text" value="<?php echo $vs_options['ctx_word']; ?>" <?php echo " ".$PM_Present; ?> /><label for="ctx_word"> Palavra padrão</label><br />
     1215            <br />
     1216        </td>
     1217     </tr>
     1218    </table>
     1219
     1220    <table class="form-table">
     1221     <tr>
    17821222        <th scope="row" valign="top">Quant. Produtos</th>
    17831223        <td>
     
    17981238            Para mostrar a vitrine manualmente basta usar o código abaixo. As configurações são feitas nesta página.<br />
    17991239             <code>&lt;?php if(function_exists('vs_vitrine')) { vs_vitrine (); } ?&gt;</code><br />
    1800              O código deve ser inserido dentro do <a href="http://codex.wordpress.org/The_Loop" target="_blank">Loop</a>.
    1801         </td>
     1240             O código deve ser inserido dentro do <a href="http://codex.wordpress.org/The_Loop" target="_blank">Loop</a>.<br /><br />
     1241        </td>
     1242     </tr>
     1243    </table>
     1244
     1245    <table class="form-table">
     1246     <tr>
     1247        <th scope="row" valign="top">Configuração da Vitrine</th>
     1248        <td VALIGN="TOP">
     1249            Primeiro slot de produto deve ser diferenciado com <br />
     1250<!--
     1251            <input type="radio" id="vitslot1a" name="ctx_slot1" value="adsense" <?php echo $slot1_adsense; ?> /> <label for="vitslot1a">Adsense</label>
     1252-->         
     1253            <br />
     1254            <input type="radio" id="vitslot1cBP" name="ctx_slot1" value="compareBP" <?php echo $slot1_compareBP; ?> /> <label for="vitslot1cBP">Comparação de Preços BuscaPé</label>
     1255            <br />
     1256            <input type="radio" id="vitslot1cML" name="ctx_slot1" value="compareML" <?php echo $slot1_compareML; ?> /> <label for="vitslot1cML">Comparação de Preços Mercado Livre</label>
     1257            <br />
     1258            <input type="radio" id="vitslot1cJC" name="ctx_slot1" value="compareJC" <?php echo $slot1_compareJC; ?> /> <label for="vitslot1cJC">Comparação de Preços Jacotei</label>
     1259            <br />
     1260            <input type="radio" id="vitslot1cBB" name="ctx_slot1" value="compareBB" <?php echo $slot1_compareBB; ?> /> <label for="vitslot1cBB">Comparação de Preços Shopping bernabauer.com</label>
     1261            <br />
     1262            <input type="radio" id="vitslot1n" name="ctx_slot1" value="normal" <?php echo $slot1_normal; ?> /> <label for="vitslot1n">Nada</label>
     1263            <br />
     1264        </td>
     1265<!--
     1266        <td VALIGN="TOP">
     1267            <label for="adsense">Código Adsense</label><br /><textarea name="adsense_code" rows="5" cols="40" id="adsense"><?php echo stripslashes($vs_options['adsense_code']); ?></textarea>
     1268        </td>
     1269-->
    18021270     </tr>
    18031271    </table>
     
    18101278            <br />
    18111279            <input type="radio" id="vitver" name="ctx_tipo" value="vertical" <?php echo $vertical; ?> /> <label for="vitver">Vertical (um produto por linha)</label>
     1280            <br />
     1281<!--
     1282            <input type="radio" id="box-250" name="ctx_tipo" value="box-250" <?php echo $banner250; ?> /> <label for="box-250">Box 250x250 (até 4 produtos em 2 linhas)</label>
     1283            <br />
     1284            <input type="radio" id="banner-468" name="ctx_tipo" value="banner-468" <?php echo $banner468; ?> /> <label for="banner-468">Banner 468x60</label>
     1285            <br />
     1286            <input type="radio" id="banner-728-1" name="ctx_tipo" value="banner-728-1" <?php echo $banner7281; ?> /> <label for="banner-728-1">Banner 728x90</label>
     1287            <br />
     1288-->
     1289        </td>
     1290     </tr>
     1291    </table>
     1292
     1293    <table class="form-table">
     1294     <tr>
     1295        <th scope="row" valign="top">Localização da Vitrine</th>
     1296        <td>
     1297            Estas opções só funcionam caso a exibição da vitrine esteja configurada para automática.<br />
     1298            <input type="radio" name="ctx_local" id="vant" value="antes" <?php echo $antes; ?> /> <label for="vant">Antes do artigo</label>
     1299            <br />
     1300            <input type="radio" name="ctx_local" id="vdep" value="depois" <?php echo $depois; ?> /> <label for="vdep">Depois do artigo</label>
    18121301            <br />
    18131302        </td>
     
    18271316    <table class="form-table">
    18281317     <tr>
    1829         <th scope="row" valign="top">Fonte de Produtos<br />Veja mais informações sobre a fonte de produtos em RSS <a href="http://www.submarino.com.br/portal/central-rss/">aqui</a>.</th>
    1830         <td VALIGN="TOP">
    1831         <?php
    1832             if (in_array('palavras-de-monetizacao/palavrasmonetizacao.php', $current_plugins)) {
    1833                 $PM_Present = "";
    1834                 $PM_msg = '';
    1835             } else {
    1836                 $PM_Present = "DISABLED";
    1837                 $PM_msg = '<center>** Requer plugin <br /><a href="http://wordpress.org/extend/plugins/palavras-de-monetizacao/">Palavras de Monetização</a> <br />instalado e ativado. **</center>';
    1838             }
    1839         ?>
    1840             <input type="radio" name="ctx_rss_source" value="ctx_contextual" id="ctx_contextual" <?php echo $ctx_contextual; echo " ".$PM_Present; ?> /> <label for="ctx_contextual">Contextual</label>
    1841             <br />
    1842             <input style="width: 60px;" id="ctx_word" name="ctx_word" type="text" value="<?php echo $vs_options['ctx_word']; ?>" <?php echo " ".$PM_Present; ?> /><label for="ctx_word"> Palavra padrão</label><br />
    1843             <br />
    1844             <?php echo " ".$PM_msg; ?>
    1845         </td>
    1846         <td VALIGN="TOP">
    1847             <strong>Mais Vendidos RSS</strong><br />
    1848             <input type="radio" name="ctx_rss_source" value="mv_Bebes" id="ctx_mv_Bebes" <?php echo $ctx_mv_Bebes; ?> /> <label for="ctx_mv_Bebes">Bebês</label>
    1849             <br />
    1850             <input type="radio" name="ctx_rss_source" value="mv_Beleza" id="ctx_mv_Beleza" <?php echo $ctx_mv_Beleza; ?> /> <label for="ctx_mv_Beleza">Beleza & Saúde</label>
    1851             <br />
    1852             <input type="radio" name="ctx_rss_source" value="mv_Brinquedos" id="ctx_mv_Brinquedos" <?php echo $ctx_mv_Brinquedos; ?> /> <label for="ctx_mv_Brinquedos">Brinquedos</label>
    1853             <br />
    1854             <input type="radio" name="ctx_rss_source" value="mv_Cama" id="ctx_mv_Cama" <?php echo $ctx_mv_Cama; ?> /> <label for="ctx_mv_Cama">Cama, Mesa & banho</label>
    1855             <br />
    1856             <input type="radio" name="ctx_rss_source" value="mv_Cameras" id="ctx_mv_Cameras" <?php echo $ctx_mv_Cameras; ?> /> <label for="ctx_mv_Cameras">Câmeras Digitais & Filmadoras</label>
    1857             <br />
    1858             <input type="radio" name="ctx_rss_source" value="mv_Celulares" id="ctx_mv_Celulares" <?php echo $ctx_mv_Celulares; ?> /> <label for="ctx_mv_Celulares">Celulares & Telefonia Fixa</label>
    1859             <br />
    1860             <input type="radio" name="ctx_rss_source" value="mv_CDs" id="ctx_mv_CDs" <?php echo $ctx_mv_CDs; ?> /> <label for="ctx_mv_CDs">CDs</label>
    1861             <br />
    1862             <input type="radio" name="ctx_rss_source" value="mv_DVD" id="ctx_mv_DVD" <?php echo $ctx_mv_DVD; ?> /> <label for="ctx_mv_DVD">DVDs & Blu-ray</label>
    1863             <br />
    1864             <input type="radio" name="ctx_rss_source" value="mv_Esporte" id="ctx_mv_Esporte" <?php echo $ctx_mv_Esporte; ?> /> <label for="ctx_mv_Esporte">Esporte & Lazer</label>
    1865             <br />
    1866             <input type="radio" name="ctx_rss_source" value="mv_Eletrodomesticos" id="ctx_mv_Eletrodomesticos" <?php echo $ctx_mv_Eletrodomesticos; ?> /> <label for="ctx_mv_Eletrodomesticos">Eletrodomésticos</label>
    1867             <br />
    1868             <input type="radio" name="ctx_rss_source" value="mv_Eletronicos" id="ctx_mv_Eletronicos" <?php echo $ctx_mv_Eletronicos; ?> /> <label for="ctx_mv_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    1869             <br />
    1870             <input type="radio" name="ctx_rss_source" value="mv_Eletroportateis" id="ctx_mv_Eletroportateis" <?php echo $ctx_mv_Eletroportateis; ?> /> <label for="ctx_mv_Eletroportateis">Eletroportáteis</label>
    1871             <br />
    1872             <input type="radio" name="ctx_rss_source" value="mv_Ferramentas" id="ctx_mv_Ferramentas" <?php echo $ctx_mv_Ferramentas; ?> /> <label for="ctx_mv_Ferramentas">Ferramentas</label>
    1873             <br />
    1874             <input type="radio" name="ctx_rss_source" value="mv_Games" id="ctx_mv_Games" <?php echo $ctx_mv_Games; ?> /> <label for="ctx_mv_Games">Games</label>
    1875             <br />
    1876             <input type="radio" name="ctx_rss_source" value="mv_Informatica" id="ctx_mv_Informatica" <?php echo $ctx_mv_Informatica; ?> /> <label for="ctx_mv_Informatica">Informática & Acessórios</label>
    1877             <br />
    1878             <input type="radio" name="ctx_rss_source" value="mv_Instrumentos" id="ctx_mv_Instrumentos" <?php echo $ctx_mv_Instrumentos; ?> /> <label for="ctx_mv_Instrumentos">Instrumentos Musicais</label>
    1879             <br />
    1880             <input type="radio" name="ctx_rss_source" value="mv_Livros" id="ctx_mv_Livros" <?php echo $ctx_mv_Livros; ?> /> <label for="ctx_mv_Livros">Livros</label>
    1881             <br />
    1882             <input type="radio" name="ctx_rss_source" value="mv_livrosImportados" id="ctx_mv_livrosImportados" <?php echo $ctx_mv_livrosImportados; ?> /> <label for="ctx_mv_livrosImportados">Livros Importados</label>
    1883             <br />
    1884             <input type="radio" name="ctx_rss_source" value="mv_Papelaria" id="ctx_mv_Papelaria" <?php echo $ctx_mv_Papelaria; ?> /> <label for="ctx_mv_Papelaria">Papelaria</label>
    1885             <br />
    1886             <input type="radio" name="ctx_rss_source" value="mv_Perfumaria" id="ctx_mv_Perfumaria" <?php echo $ctx_mv_Perfumaria; ?> /> <label for="ctx_mv_Perfumaria">Perfumaria</label>
    1887             <br />
    1888             <input type="radio" name="ctx_rss_source" value="mv_Relogios" id="ctx_mv_Relogios" <?php echo $ctx_mv_Relogios; ?> /> <label for="ctx_mv_Relogios">Relógios & Presentes</label>
    1889             <br />
    1890             <input type="radio" name="ctx_rss_source" value="mv_Utilidades" id="ctx_mv_Utilidades" <?php echo $ctx_mv_Utilidades; ?> /> <label for="ctx_mv_Utilidades">Utilidades Domésticas</label>
    1891             <br />
    1892             <input type="radio" name="ctx_rss_source" value="mv_Vestuario" id="ctx_mv_Vestuario" <?php echo $ctx_mv_Vestuario; ?> /> <label for="ctx_mv_Vestuario">Vestuário</label>
    1893             <br />
    1894             <input type="radio" name="ctx_rss_source" value="mv_vinhos" id="ctx_mv_vinhos" <?php echo $ctx_mv_vinhos; ?> /> <label for="ctx_mv_vinhos">Vinhos & Bebidas</label>
    1895             <br />
    1896         </td>
    1897         <td VALIGN="TOP">
    1898             <strong>Lançamento RSS</strong><br />
    1899             <input type="radio" name="ctx_rss_source" value="lan_Geral" id="ctx_lan_Geral" <?php echo $ctx_lan_Geral; ?> /> <label for="ctx_lan_Geral">Geral (Todo o Site)</label>
    1900             <br />
    1901             <input type="radio" name="ctx_rss_source" value="lan_Bebes" id="ctx_lan_Bebes" <?php echo $ctx_lan_Bebes; ?> /> <label for="ctx_lan_Bebes">Bebês</label>
    1902             <br />
    1903             <input type="radio" name="ctx_rss_source" value="lan_Beleza" id="ctx_lan_Beleza" <?php echo $ctx_lan_Beleza; ?> /> <label for="ctx_lan_Beleza">Beleza & Saúde</label>
    1904             <br />
    1905             <input type="radio" name="ctx_rss_source" value="lan_Brinquedos" id="ctx_lan_Brinquedos" <?php echo $ctx_lan_Brinquedos; ?> /> <label for="ctx_lan_Brinquedos">Brinquedos</label>
    1906             <br />
    1907             <input type="radio" name="ctx_rss_source" value="lan_Cama" id="ctx_lan_Cama" <?php echo $ctx_lan_Cama; ?> /> <label for="ctx_lan_Cama">Cama, Mesa & banho</label>
    1908             <br />
    1909             <input type="radio" name="ctx_rss_source" value="lan_Cameras" id="ctx_lan_Cameras" <?php echo $ctx_lan_Cameras; ?> /> <label for="ctx_lan_Cameras">Câmeras Digitais & Filmadoras</label>
    1910             <br />
    1911             <input type="radio" name="ctx_rss_source" value="lan_Celulares" id="ctx_lan_Celulares" <?php echo $ctx_lan_Celulares; ?> /> <label for="ctx_lan_Celulares">Celulares & Telefonia Fixa</label>
    1912             <br />
    1913             <input type="radio" name="ctx_rss_source" value="lan_CDs" id="ctx_lan_CDs" <?php echo $ctx_lan_CDs; ?> /> <label for="ctx_lan_CDs">CDs</label>
    1914             <br />
    1915             <input type="radio" name="ctx_rss_source" value="lan_DVD" id="ctx_lan_DVD" <?php echo $ctx_lan_DVD; ?> /> <label for="ctx_lan_DVD">DVDs & Blu-ray</label>
    1916             <br />
    1917             <input type="radio" name="ctx_rss_source" value="lan_Esporte" id="ctx_lan_Esporte" <?php echo $ctx_lan_Esporte; ?> /> <label for="ctx_lan_Esporte">Esporte & Lazer</label>
    1918             <br />
    1919             <input type="radio" name="ctx_rss_source" value="lan_Eletrodomesticos" id="ctx_lan_Eletrodomesticos" <?php echo $ctx_lan_Eletrodomesticos; ?> /> <label for="ctx_lan_Eletrodomesticos">Eletrodomésticos</label>
    1920             <br />
    1921             <input type="radio" name="ctx_rss_source" value="lan_Eletronicos" id="ctx_lan_Eletronicos" <?php echo $ctx_lan_Eletronicos; ?> /> <label for="ctx_lan_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    1922             <br />
    1923             <input type="radio" name="ctx_rss_source" value="lan_Eletroportateis" id="ctx_lan_Eletroportateis" <?php echo $ctx_lan_Eletroportateis; ?> /> <label for="ctx_lan_Eletroportateis">Eletroportáteis</label>
    1924             <br />
    1925             <input type="radio" name="ctx_rss_source" value="lan_Ferramentas" id="ctx_lan_Ferramentas" <?php echo $ctx_lan_Ferramentas; ?> /> <label for="ctx_lan_Ferramentas">Ferramentas</label>
    1926             <br />
    1927             <input type="radio" name="ctx_rss_source" value="lan_Games" id="ctx_lan_Games" <?php echo $ctx_lan_Games; ?> /> <label for="ctx_lan_Games">Games</label>
    1928             <br />
    1929             <input type="radio" name="ctx_rss_source" value="lan_Informatica" id="ctx_lan_Informatica" <?php echo $ctx_lan_Informatica; ?> /> <label for="ctx_lan_Informatica">Informática & Acessórios</label>
    1930             <br />
    1931             <input type="radio" name="ctx_rss_source" value="lan_Instrumentos" id="ctx_lan_Instrumentos" <?php echo $ctx_lan_Instrumentos; ?> /> <label for="ctx_lan_Instrumentos">Instrumentos Musicais</label>
    1932             <br />
    1933             <input type="radio" name="ctx_rss_source" value="lan_Livros" id="ctx_lan_Livros" <?php echo $ctx_lan_Livros; ?> /> <label for="ctx_lan_Livros">Livros</label>
    1934             <br />
    1935             <input type="radio" name="ctx_rss_source" value="lan_Papelaria" id="ctx_lan_Papelaria" <?php echo $ctx_lan_Papelaria; ?> /> <label for="ctx_lan_Papelaria">Papelaria</label>
    1936             <br />
    1937             <input type="radio" name="ctx_rss_source" value="lan_Perfumaria" id="ctx_lan_Perfumaria" <?php echo $ctx_lan_Perfumaria; ?> /> <label for="ctx_lan_Perfumaria">Perfumaria</label>
    1938             <br />
    1939             <input type="radio" name="ctx_rss_source" value="lan_Relogios" id="ctx_lan_Relogios" <?php echo $ctx_lan_Relogios; ?> /> <label for="ctx_lan_Relogios">Relógios & Presentes</label>
    1940             <br />
    1941             <input type="radio" name="ctx_rss_source" value="lan_Utilidades" id="ctx_lan_Utilidades" <?php echo $ctx_lan_Utilidades; ?> /> <label for="ctx_lan_Utilidades">Utilidades Domésticas</label>
    1942             <br />
    1943             <input type="radio" name="ctx_rss_source" value="lan_vinhos" id="ctx_lan_vinhos" <?php echo $ctx_lan_vinhos; ?> /> <label for="ctx_lan_vinhos">Vinhos & Bebidas</label>
    1944             <br />
    1945         </td>
    1946         <td VALIGN="TOP">
    1947             <strong>Promoção RSS</strong><br />
    1948             <input type="radio" name="ctx_rss_source" value="prom_Geral" id="ctx_prom_Geral" <?php echo $ctx_prom_Geral; ?> /> <label for="ctx_prom_Geral">Geral (Todo o Site)</label>
    1949             <br />
    1950             <input type="radio" name="ctx_rss_source" value="prom_Beleza" id="ctx_prom_Beleza" <?php echo $ctx_prom_Beleza; ?> /> <label for="ctx_prom_Beleza">Beleza & Saúde</label>
    1951             <br />
    1952             <input type="radio" name="ctx_rss_source" value="prom_Brinquedos" id="ctx_prom_Brinquedos" <?php echo $ctx_prom_Brinquedos; ?> /> <label for="ctx_prom_Brinquedos">Brinquedos</label>
    1953             <br />
    1954             <input type="radio" name="ctx_rss_source" value="prom_Cameras" id="ctx_prom_Cameras" <?php echo $ctx_prom_Cameras; ?> /> <label for="ctx_prom_Cameras">Câmeras Digitais & Filmadoras</label>
    1955             <br />
    1956             <input type="radio" name="ctx_rss_source" value="prom_Celulares" id="ctx_prom_Celulares" <?php echo $ctx_prom_Celulares; ?> /> <label for="ctx_prom_Celulares">Celulares & Telefonia Fixa</label>
    1957             <br />
    1958             <input type="radio" name="ctx_rss_source" value="prom_CDs" id="ctx_prom_CDs" <?php echo $ctx_prom_CDs; ?> /> <label for="ctx_prom_CDs">CDs</label>
    1959             <br />
    1960             <input type="radio" name="ctx_rss_source" value="prom_DVD" id="ctx_prom_DVD" <?php echo $ctx_prom_DVD; ?> /> <label for="ctx_prom_DVD">DVDs & Blu-ray</label>
    1961             <br />
    1962             <input type="radio" name="ctx_rss_source" value="prom_Esporte" id="ctx_prom_Esporte" <?php echo $ctx_prom_Esporte; ?> /> <label for="ctx_prom_Esporte">Esporte & Lazer</label>
    1963             <br />
    1964             <input type="radio" name="ctx_rss_source" value="prom_Eletrodomesticos" id="ctx_prom_Eletrodomesticos" <?php echo $ctx_prom_Eletrodomesticos; ?> /> <label for="ctx_prom_Eletrodomesticos">Eletrodomésticos</label>
    1965             <br />
    1966             <input type="radio" name="ctx_rss_source" value="prom_Eletronicos" id="ctx_prom_Eletronicos" <?php echo $ctx_prom_Eletronicos; ?> /> <label for="ctx_prom_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    1967             <br />
    1968             <input type="radio" name="ctx_rss_source" value="prom_Games" id="ctx_prom_Games" <?php echo $ctx_prom_Games; ?> /> <label for="ctx_prom_Games">Games</label>
    1969             <br />
    1970             <input type="radio" name="ctx_rss_source" value="prom_Livros" id="ctx_prom_Livros" <?php echo $ctx_prom_Livros; ?> /> <label for="ctx_prom_Livros">Livros</label>
    1971             <br />
    1972         </td>
    1973      </tr>
    1974     </table>
    1975 <br />
    1976 
    1977     <table class="form-table">
    1978      <tr>
    19791318        <th scope="row" valign="top">Rastrear Cliques</th>
    19801319        <td>
     
    20211360
    20221361
    2023     <table class="form-table">
    2024      <tr>
    2025         <th scope="row" valign="top">Localização da Vitrine</th>
    2026         <td>
    2027             Estas opções só funcionam caso a exibição da vitrine esteja configurada para automática.<br />
    2028             <input type="radio" name="ctx_local" id="vant" value="antes" <?php echo $antes; ?> /> <label for="vant">Antes do artigo</label>
    2029             <br />
    2030             <input type="radio" name="ctx_local" id="vdep" value="depois" <?php echo $depois; ?> /> <label for="vdep">Depois do artigo</label>
    2031             <br />
    2032         </td>
    2033      </tr>
    2034     </table>
    2035 
    20361362
    20371363<br />
     
    20451371                <input id="wid_title" name="wid_title" type="text" value="<?php echo $vs_options['wid_title']; ?>" /><br />
    20461372                <label for="wid_title">Este é o texto que será mostrado acima da vitrine.</label><br />
     1373        </td>
     1374     </tr>
     1375    </table>
     1376
     1377    <table class="form-table">
     1378     <tr>
     1379        <th scope="row" valign="top">Palavra de pesquisa da vitrine</th>
     1380        <td>
     1381            <input style="width: 60px;" id="wid_word" name="wid_word" type="text" value="<?php echo $vs_options['wid_word']; ?>" /><label for="wid_word"> Palavra padrão</label><br />
     1382            <br />
    20471383        </td>
    20481384     </tr>
     
    20721408     </tr>
    20731409    </table>
    2074 
    2075     <table class="form-table">
    2076      <tr>
    2077         <th scope="row" valign="top">Fonte RSS de Produtos<br />Veja mais informações <a href="http://www.submarino.com.br/portal/central-rss/">aqui</a>.</th>
    2078         <td VALIGN="TOP">
    2079             <strong>Mais Vendidos</strong><br />
    2080             <input type="radio" name="wid_rss_source" value="mv_Bebes" id="wid_mv_Bebes" <?php echo $wid_mv_Bebes; ?> /> <label for="wid_mv_Bebes">Bebês</label>
    2081             <br />
    2082             <input type="radio" name="wid_rss_source" value="mv_Beleza" id="wid_mv_Beleza" <?php echo $wid_mv_Beleza; ?> /> <label for="wid_mv_Beleza">Beleza & Saúde</label>
    2083             <br />
    2084             <input type="radio" name="wid_rss_source" value="mv_Brinquedos" id="wid_mv_Brinquedos" <?php echo $wid_mv_Brinquedos; ?> /> <label for="wid_mv_Brinquedos">Brinquedos</label>
    2085             <br />
    2086             <input type="radio" name="wid_rss_source" value="mv_Cama" id="wid_mv_Cama" <?php echo $wid_mv_Cama; ?> /> <label for="wid_mv_Cama">Cama, Mesa & banho</label>
    2087             <br />
    2088             <input type="radio" name="wid_rss_source" value="mv_Cameras" id="wid_mv_Cameras" <?php echo $wid_mv_Cameras; ?> /> <label for="wid_mv_Cameras">Câmeras Digitais & Filmadoras</label>
    2089             <br />
    2090             <input type="radio" name="wid_rss_source" value="mv_Celulares" id="wid_mv_Celulares" <?php echo $wid_mv_Celulares; ?> /> <label for="wid_mv_Celulares">Celulares & Telefonia Fixa</label>
    2091             <br />
    2092             <input type="radio" name="wid_rss_source" value="mv_CDs" id="wid_mv_CDs" <?php echo $wid_mv_CDs; ?> /> <label for="wid_mv_CDs">CDs</label>
    2093             <br />
    2094             <input type="radio" name="wid_rss_source" value="mv_DVD" id="wid_mv_DVD" <?php echo $wid_mv_DVD; ?> /> <label for="wid_mv_DVD">DVDs & Blu-ray</label>
    2095             <br />
    2096             <input type="radio" name="wid_rss_source" value="mv_Esporte" id="wid_mv_Esporte" <?php echo $wid_mv_Esporte; ?> /> <label for="wid_mv_Esporte">Esporte & Lazer</label>
    2097             <br />
    2098             <input type="radio" name="wid_rss_source" value="mv_Eletrodomesticos" id="wid_mv_Eletrodomesticos" <?php echo $wid_mv_Eletrodomesticos; ?> /> <label for="wid_mv_Eletrodomesticos">Eletrodomésticos</label>
    2099             <br />
    2100             <input type="radio" name="wid_rss_source" value="mv_Eletronicos" id="wid_mv_Eletronicos" <?php echo $wid_mv_Eletronicos; ?> /> <label for="wid_mv_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    2101             <br />
    2102             <input type="radio" name="wid_rss_source" value="mv_Eletroportateis" id="wid_mv_Eletroportateis" <?php echo $wid_mv_Eletroportateis; ?> /> <label for="wid_mv_Eletroportateis">Eletroportáteis</label>
    2103             <br />
    2104             <input type="radio" name="wid_rss_source" value="mv_Ferramentas" id="wid_mv_Ferramentas" <?php echo $wid_mv_Ferramentas; ?> /> <label for="wid_mv_Ferramentas">Ferramentas</label>
    2105             <br />
    2106             <input type="radio" name="wid_rss_source" value="mv_Games" id="wid_mv_Games" <?php echo $wid_mv_Games; ?> /> <label for="wid_mv_Games">Games</label>
    2107             <br />
    2108             <input type="radio" name="wid_rss_source" value="mv_Informatica" id="wid_mv_Informatica" <?php echo $wid_mv_Informatica; ?> /> <label for="wid_mv_Informatica">Informática & Acessórios</label>
    2109             <br />
    2110             <input type="radio" name="wid_rss_source" value="mv_Instrumentos" id="wid_mv_Instrumentos" <?php echo $wid_mv_Instrumentos; ?> /> <label for="wid_mv_Instrumentos">Instrumentos Musicais</label>
    2111             <br />
    2112             <input type="radio" name="wid_rss_source" value="mv_Livros" id="wid_mv_Livros" <?php echo $wid_mv_Livros; ?> /> <label for="wid_mv_Livros">Livros</label>
    2113             <br />
    2114             <input type="radio" name="wid_rss_source" value="mv_livrosImportados" id="wid_mv_livrosImportados" <?php echo $wid_mv_livrosImportados; ?> /> <label for="wid_mv_livrosImportados">Livros Importados</label>
    2115             <br />
    2116             <input type="radio" name="wid_rss_source" value="mv_Papelaria" id="wid_mv_Papelaria" <?php echo $wid_mv_Papelaria; ?> /> <label for="wid_mv_Papelaria">Papelaria</label>
    2117             <br />
    2118             <input type="radio" name="wid_rss_source" value="mv_Perfumaria" id="wid_mv_Perfumaria" <?php echo $wid_mv_Perfumaria; ?> /> <label for="wid_mv_Perfumaria">Perfumaria</label>
    2119             <br />
    2120             <input type="radio" name="wid_rss_source" value="mv_Relogios" id="wid_mv_Relogios" <?php echo $wid_mv_Relogios; ?> /> <label for="wid_mv_Relogios">Relógios & Presentes</label>
    2121             <br />
    2122             <input type="radio" name="wid_rss_source" value="mv_Utilidades" id="wid_mv_Utilidades" <?php echo $wid_mv_Utilidades; ?> /> <label for="wid_mv_Utilidades">Utilidades Domésticas</label>
    2123             <br />
    2124             <input type="radio" name="wid_rss_source" value="mv_Vestuario" id="wid_mv_Vestuario" <?php echo $wid_mv_Vestuario; ?> /> <label for="wid_mv_Vestuario">Vestuário</label>
    2125             <br />
    2126             <input type="radio" name="wid_rss_source" value="mv_vinhos" id="wid_mv_vinhos" <?php echo $wid_mv_vinhos; ?> /> <label for="wid_mv_vinhos">Vinhos & Bebidas</label>
    2127             <br />
    2128             </td>
    2129             <td VALIGN="TOP">
    2130             <strong>Lançamento</strong><br />
    2131             <input type="radio" name="wid_rss_source" value="lan_Geral" id="wid_lan_Geral" <?php echo $wid_lan_Geral; ?> /> <label for="wid_lan_Geral">Geral (Todo o Site)</label>
    2132             <br />
    2133             <input type="radio" name="wid_rss_source" value="lan_Bebes" id="wid_lan_Bebes" <?php echo $wid_lan_Bebes; ?> /> <label for="wid_lan_Bebes">Bebês</label>
    2134             <br />
    2135             <input type="radio" name="wid_rss_source" value="lan_Beleza" id="wid_lan_Beleza" <?php echo $wid_lan_Beleza; ?> /> <label for="wid_lan_Beleza">Beleza & Saúde</label>
    2136             <br />
    2137             <input type="radio" name="wid_rss_source" value="lan_Brinquedos" id="wid_lan_Brinquedos" <?php echo $wid_lan_Brinquedos; ?> /> <label for="wid_lan_Brinquedos">Brinquedos</label>
    2138             <br />
    2139             <input type="radio" name="wid_rss_source" value="lan_Cama" id="wid_lan_Cama" <?php echo $wid_lan_Cama; ?> /> <label for="wid_lan_Cama">Cama, Mesa & banho</label>
    2140             <br />
    2141             <input type="radio" name="wid_rss_source" value="lan_Cameras" id="wid_lan_Cameras" <?php echo $wid_lan_Cameras; ?> /> <label for="wid_lan_Cameras">Câmeras Digitais & Filmadoras</label>
    2142             <br />
    2143             <input type="radio" name="wid_rss_source" value="lan_Celulares" id="wid_lan_Celulares" <?php echo $wid_lan_Celulares; ?> /> <label for="wid_lan_Celulares">Celulares & Telefonia Fixa</label>
    2144             <br />
    2145             <input type="radio" name="wid_rss_source" value="lan_CDs" id="wid_lan_CDs" <?php echo $wid_lan_CDs; ?> /> <label for="wid_lan_CDs">CDs</label>
    2146             <br />
    2147             <input type="radio" name="wid_rss_source" value="lan_DVD" id="wid_lan_DVD" <?php echo $wid_lan_DVD; ?> /> <label for="wid_lan_DVD">DVDs & Blu-ray</label>
    2148             <br />
    2149             <input type="radio" name="wid_rss_source" value="lan_Esporte" id="wid_lan_Esporte" <?php echo $wid_lan_Esporte; ?> /> <label for="wid_lan_Esporte">Esporte & Lazer</label>
    2150             <br />
    2151             <input type="radio" name="wid_rss_source" value="lan_Eletrodomesticos" id="wid_lan_Eletrodomesticos" <?php echo $wid_lan_Eletrodomesticos; ?> /> <label for="wid_lan_Eletrodomesticos">Eletrodomésticos</label>
    2152             <br />
    2153             <input type="radio" name="wid_rss_source" value="lan_Eletronicos" id="wid_lan_Eletronicos" <?php echo $wid_lan_Eletronicos; ?> /> <label for="wid_lan_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    2154             <br />
    2155             <input type="radio" name="wid_rss_source" value="lan_Eletroportateis" id="wid_lan_Eletroportateis" <?php echo $wid_lan_Eletroportateis; ?> /> <label for="wid_lan_Eletroportateis">Eletroportáteis</label>
    2156             <br />
    2157             <input type="radio" name="wid_rss_source" value="lan_Ferramentas" id="wid_lan_Ferramentas" <?php echo $wid_lan_Ferramentas; ?> /> <label for="wid_lan_Ferramentas">Ferramentas</label>
    2158             <br />
    2159             <input type="radio" name="wid_rss_source" value="lan_Games" id="wid_lan_Games" <?php echo $wid_lan_Games; ?> /> <label for="wid_lan_Games">Games</label>
    2160             <br />
    2161             <input type="radio" name="wid_rss_source" value="lan_Informatica" id="wid_lan_Informatica" <?php echo $wid_lan_Informatica; ?> /> <label for="wid_lan_Informatica">Informática & Acessórios</label>
    2162             <br />
    2163             <input type="radio" name="wid_rss_source" value="lan_Instrumentos" id="wid_lan_Instrumentos" <?php echo $wid_lan_Instrumentos; ?> /> <label for="wid_lan_Instrumentos">Instrumentos Musicais</label>
    2164             <br />
    2165             <input type="radio" name="wid_rss_source" value="lan_Livros" id="wid_lan_Livros" <?php echo $wid_lan_Livros; ?> /> <label for="wid_lan_Livros">Livros</label>
    2166             <br />
    2167             <input type="radio" name="wid_rss_source" value="lan_Papelaria" id="wid_lan_Papelaria" <?php echo $wid_lan_Papelaria; ?> /> <label for="wid_lan_Papelaria">Papelaria</label>
    2168             <br />
    2169             <input type="radio" name="wid_rss_source" value="lan_Perfumaria" id="wid_lan_Perfumaria" <?php echo $wid_lan_Perfumaria; ?> /> <label for="wid_lan_Perfumaria">Perfumaria</label>
    2170             <br />
    2171             <input type="radio" name="wid_rss_source" value="lan_Relogios" id="wid_lan_Relogios" <?php echo $wid_lan_Relogios; ?> /> <label for="wid_lan_Relogios">Relógios & Presentes</label>
    2172             <br />
    2173             <input type="radio" name="wid_rss_source" value="lan_Utilidades" id="wid_lan_Utilidades" <?php echo $wid_lan_Utilidades; ?> /> <label for="wid_lan_Utilidades">Utilidades Domésticas</label>
    2174             <br />
    2175             <input type="radio" name="wid_rss_source" value="lan_vinhos" id="wid_lan_vinhos" <?php echo $wid_lan_vinhos; ?> /> <label for="wid_lan_vinhos">Vinhos & Bebidas</label>
    2176             <br />
    2177             </td>
    2178             <td VALIGN="TOP">
    2179             <strong>Promoção</strong><br />
    2180             <input type="radio" name="wid_rss_source" value="prom_Geral" id="wid_prom_Geral" <?php echo $wid_prom_Geral; ?> /> <label for="wid_prom_Geral">Geral (Todo o Site)</label>
    2181             <br />
    2182             <input type="radio" name="wid_rss_source" value="prom_Beleza" id="wid_prom_Beleza" <?php echo $wid_prom_Beleza; ?> /> <label for="wid_prom_Beleza">Beleza & Saúde</label>
    2183             <br />
    2184             <input type="radio" name="wid_rss_source" value="prom_Brinquedos" id="wid_prom_Brinquedos" <?php echo $wid_prom_Brinquedos; ?> /> <label for="wid_prom_Brinquedos">Brinquedos</label>
    2185             <br />
    2186             <input type="radio" name="wid_rss_source" value="prom_Cameras" id="wid_prom_Cameras" <?php echo $wid_prom_Cameras; ?> /> <label for="wid_prom_Cameras">Câmeras Digitais & Filmadoras</label>
    2187             <br />
    2188             <input type="radio" name="wid_rss_source" value="prom_Celulares" id="wid_prom_Celulares" <?php echo $wid_prom_Celulares; ?> /> <label for="wid_prom_Celulares">Celulares & Telefonia Fixa</label>
    2189             <br />
    2190             <input type="radio" name="wid_rss_source" value="prom_CDs" id="wid_prom_CDs" <?php echo $wid_prom_CDs; ?> /> <label for="wid_prom_CDs">CDs</label>
    2191             <br />
    2192             <input type="radio" name="wid_rss_source" value="prom_DVD" id="wid_prom_DVD" <?php echo $wid_prom_DVD; ?> /> <label for="wid_prom_DVD">DVDs & Blu-ray</label>
    2193             <br />
    2194             <input type="radio" name="wid_rss_source" value="prom_Esporte" id="wid_prom_Esporte" <?php echo $wid_prom_Esporte; ?> /> <label for="wid_prom_Esporte">Esporte & Lazer</label>
    2195             <br />
    2196             <input type="radio" name="wid_rss_source" value="prom_Eletrodomesticos" id="wid_prom_Eletrodomesticos" <?php echo $wid_prom_Eletrodomesticos; ?> /> <label for="wid_prom_Eletrodomesticos">Eletrodomésticos</label>
    2197             <br />
    2198             <input type="radio" name="wid_rss_source" value="prom_Eletronicos" id="wid_prom_Eletronicos" <?php echo $wid_prom_Eletronicos; ?> /> <label for="wid_prom_Eletronicos">Eletrônicos Áudio & Vídeo</label>
    2199             <br />
    2200             <input type="radio" name="wid_rss_source" value="prom_Games" id="wid_prom_Games" <?php echo $wid_prom_Games; ?> /> <label for="wid_prom_Games">Games</label>
    2201             <br />
    2202             <input type="radio" name="wid_rss_source" value="prom_Livros" id="wid_prom_Livros" <?php echo $wid_prom_Livros; ?> /> <label for="wid_prom_Livros">Livros</label>
    2203             <br />
    2204         </td>
    2205      </tr>
    2206     </table>
    2207 <br />
    2208 
    22091410    <table class="form-table">
    22101411     <tr>
     
    22611462}
    22621463
    2263 /***************************************************************************************************
     1464/**************************************************************************************************
    22641465 * Link para configuração do plugin na página de administração de plugins
    22651466 */
     
    22711472    return $links;
    22721473}
    2273 /***************************************************************************************************
     1474/**************************************************************************************************
    22741475 *  Configuracao do widget
    22751476 */
     
    22971498            // start list
    22981499            echo '<ul>';
     1500           
    22991501                // were there any posts found?
    23001502                $prod = vs_core ( $vs_options['wid_show'], $vs_options['wid_word'], "widget", $vs_options['wid_bgcolor'], $vs_options['wid_brdcolor'], $vs_options['wid_fontcolor'], $vs_options['wid_prcolor'], $vs_options['wid_procolor'], $vs_options['wid_prccolor']) ;
     
    23131515    wp_register_sidebar_widget('vitrine-submarino', 'Vitrine Submarino', 'widget_Submarino', $widget_ops);
    23141516}
    2315 function vs_http_get($request, $host, $path, $port = 80) {
    2316 
    2317     global $wp_version;
    2318     global $vs_options;
    2319 
    2320     $http_request  = "GET $path HTTP/1.0\r\n";
    2321     $http_request .= "Host: $host\r\n";
    2322     $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
    2323     $http_request .= "Content-Length: " . strlen($request) . "\r\n";
    2324     $http_request .= "User-Agent: WordPress/$wp_version | vitrine-submarino/".$vs_options['version']."\r\n";
    2325     $http_request .= "\r\n";
    2326     $http_request .= $request;
    2327 
    2328     $response = '';
    2329     if( false != ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
    2330         fwrite($fs, $http_request);
    2331 
    2332         while ( !feof($fs) )
    2333             $response .= fgets($fs, 1160); // One TCP-IP packet
    2334         fclose($fs);
    2335         $response = explode("\r\n\r\n", $response, 2);
    2336     }
    2337     return $response;
    2338 }
     1517
    23391518?>
Note: See TracChangeset for help on using the changeset viewer.