WordPress.org

Plugin Directory

Changeset 725258


Ignore:
Timestamp:
06/11/13 10:18:56 (4 years ago)
Author:
applh
Message:

v1.7.9 new webhook widgets mark2 adn csv2

Location:
wparty/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wparty/trunk/readme.txt

    r724832 r725258  
    22Contributors: applh 
    33Donate link: http://applh.com/ 
    4 Tags: widget, pages, post, sidebar, content, mix, multi loop, shortcode, posts, page, theme, builder, custom, layout, markdown 
     4Tags: widget, pages, post, sidebar, content, mix, multi loop, shortcode, posts, page, theme, builder, custom, layout, markdown, csv, speadsheet, google, docs, webhook 
    55Requires at least: 3.5 
    66Tested up to: 3.6.b3 
     
    4343 
    4444= Note =  
    45 The plugin also disables WordPress auto (P)(/P). 
     45* The plugin also disables WordPress auto (P)(/P). 
     46* The shortcode [part name="page-name"] can access to all public and private pages/articles (warning to multi-users site) 
     47* This choice allows to keep parts as private content 
    4648 
    4749= REDIRECT = 
     
    189191 
    190192= CSV = 
    191 * Need to include some CSV data in a Table? 
     193* Need to include some CSV data as a Table? 
    192194* Requirements: PHP5.3+ 
    193195* note: empty lines are ignored 
     
    210212` 
    211213 
     214= WEBHOOKS: MARK2 and CSV2 = 
     215* Need to fetch data from an URL ? 
     216* eg: Google SpreadSheet 
     217* Include some CSV external data as a Table 
     218* Include some Markdown external code 
     219* Requirements: PHP5.3+ 
     220 
     221` 
     222[part widget="mark2"] 
     223https://docs.google.com/spreadsheet/pub?key=0AhDBS7EaaokRdGQ5Z1g5cjE1YzRUS3NxRmZ4RGJYRGc&output=txt 
     224[/part] 
     225 
     226[part widget="csv2"] 
     227https://docs.google.com/spreadsheet/pub?key=0AhDBS7EaaokRdGFFRGNjam1HOEk2dU84d19IUGZlWVE&single=true&gid=0&output=csv 
     228[/part] 
     229` 
    212230 
    213231= PAGE TEMPLATE = 
     
    272290 
    273291== Changelog == 
     292= 1.7.9 = 
     293* new webhook widgets "csv2" "mark2": [part widget="csv2"]http://url-to-text-data[/part] 
     294 
    274295= 1.7.8 = 
    275296* new widget "csv": [part widget="csv"]col1,col2,col3[/part] 
     
    338359 
    339360== Upgrade Notice == 
     361= 1.7.9 = 
     362* new webhook widgets "csv2" "mark2": [part widget="csv2"]http://url-to-text-data[/part] 
     363 
    340364= 1.7.8 = 
    341365* new widget "csv": [part widget="csv"]col1,col2,col3[/part] 
  • wparty/trunk/wparty-widget-csv.php

    r724911 r725258  
    11<?php 
    22 
    3 if (!function_exists('wparty_widget_csv')) : 
    4 function wparty_widget_csv () { 
     3if (!function_exists('wparty_widget_csv_file')) : 
     4function wparty_widget_csv_file () { 
    55   global $WParty; 
    66 
    7    $content=trim($WParty['part.csv']); 
    8     
     7   $handle=$WParty['part.handle']; 
    98   $cut=trim($WParty['part.cut']); 
    109   $quote=trim($WParty['part.quote']); 
     
    1514   if (!$esc) $esc='\\'; 
    1615 
    17    $tabcsv=explode("\n", $content); 
    1816   $htmltable=''; 
    1917   $row2count=0; 
    20    foreach($tabcsv as $r => $rowdata) { 
    21       $rowdata=trim($rowdata); 
    22       if ($rowdata) { 
    23          $tabrow=str_getcsv($rowdata, $cut, $quote, $esc); 
    24  
     18   //ini_set('auto_detect_line_endings', '1'); 
     19   while (($tabrow = fgetcsv($handle, 0, $cut, $quote, $esc)) !== FALSE) { 
     20     if (is_array($tabrow)) { 
     21         $col2count=0; 
    2522         $htmlrow=''; 
    26          $col2count=0; 
    2723         foreach($tabrow as $c => $coldata) { 
    2824            $coldata=trim($coldata); 
    2925            $htmlrow.='<td class="col'.$col2count.' cell'.$row2count.'x'.$col2count.'">'.$coldata.'</td>'; 
    30               
     26            // multiline cells ? 
     27            $htmlrow=nl2br($htmlrow);  
    3128            $col2count++; 
    3229         } 
     
    3633      } 
    3734   } 
    38  
    3935   if ($htmltable) $htmltable='<table><tbody>'.$htmltable.'</tbody></table>'; 
    4036 
    4137   echo $htmltable; 
     38} 
     39endif; 
     40 
     41 
     42if (!function_exists('wparty_widget_csv')) : 
     43function wparty_widget_csv () { 
     44   global $WParty; 
     45 
     46   $content=trim($WParty['part.csv']); 
     47   if (($handle = fopen("php://memory", "w+")) !== FALSE) { 
     48      $WParty['part.handle']=$handle; 
     49      fwrite($handle, $content); 
     50      fseek($handle, 0); 
     51 
     52      wparty_widget_csv_file(); 
     53 
     54      $WParty['part.handle']=null; 
     55      fclose($handle); 
     56   } 
     57    
     58 
    4259} 
    4360 
     
    6784 
    6885 
    69  
    70  
    71  
  • wparty/trunk/wparty-widget-mark.php

    r723940 r725258  
    1818endif; 
    1919 
     20if (!function_exists('wparty_widget_mark2')) : 
     21function wparty_widget_mark2 () { 
     22   global $WParty; 
    2023 
     24   $data2src=trim($WParty['part.src']); 
     25   if ($data2src) { 
     26      $url2tab=parse_url($data2src); 
     27      $protocol=$url2tab['scheme']; 
     28      if (($protocol == "http") || ($protocol == "https")) { 
     29         // FIXME 
     30         $from=array("&#038;"); 
     31         $to=array("&"); 
     32         $data2src=str_replace($from, $to, $data2src); 
     33 
     34         $WParty['part.mark']=file_get_contents($data2src); 
     35         wparty_widget_mark(); 
     36      } 
     37   } 
     38 } 
     39 
     40endif; 
     41 
     42 
     43 
  • wparty/trunk/wparty.php

    r724911 r725258  
    44Plugin URI: http://applh.com/wordpress/plugins/wparty/ 
    55Description: WParty adds a shortcode [part name="page-name"] to easily mix content: pages/articles/media/widgets/menus. Read more... http://applh.com/wordpress/plugins/wparty/ 
    6 Version: 1.7.8 
     6Version: 1.7.9 
    77Author: Applh 
    88Author URI: http://Applh.com 
     
    155155            include_once("$curdir/wparty-widget-mark.php"); 
    156156            wparty_widget_mark(); 
    157         } 
     157         } 
     158         else if ($widget == 'mark2') { 
     159            $data2src=trim($content); 
     160            if ($data2src) { 
     161               $WParty['part.mark']='';             
     162               $WParty['part.src']=$data2src;             
     163               include_once("$curdir/wparty-widget-mark.php"); 
     164               wparty_widget_mark2(); 
     165            } 
     166         } 
    158167         else if ($widget == 'loop') { 
    159168            include_once("$curdir/wparty-widget-loop.php"); 
     
    207216         else if ($widget == 'redirect') { 
    208217            wp_redirect($instance); 
     218         } 
     219         else if ($widget == 'lorem') { 
     220            $WParty['part.max']=$max; 
     221            include_once("$curdir/wparty-widget-lorem.php"); 
     222            wparty_widget_lorem('', $instance, $args, $content); 
     223         } 
     224         else if ($widget == 'pdf') { 
     225            $WParty['part.pdf']=$content; 
     226            $WParty['part.width']=$width; 
     227            $WParty['part.height']=$height; 
     228            include_once("$curdir/wparty-widget-pdf.php"); 
     229            wparty_widget_pdf(); 
     230         } 
     231         else if ($widget == 'map') { 
     232            $WParty['part.map']=$content; 
     233            $WParty['part.width']=$width; 
     234            $WParty['part.height']=$height; 
     235            include_once("$curdir/wparty-widget-map.php"); 
     236            wparty_widget_map(); 
     237         } 
     238 
     239         else if ($widget == 'csv') { 
     240            $WParty['part.src']=''; 
     241            $WParty['part.csv']=$content; 
     242            $WParty['part.cut']=$cut; 
     243            $WParty['part.quote']=$quote; 
     244            $WParty['part.esc']=$esc; 
     245            include_once("$curdir/wparty-widget-csv.php"); 
     246            wparty_widget_csv(); 
    209247         } 
    210248         else if ($widget == 'csv2') { 
     
    219257               wparty_widget_csv2(); 
    220258            } 
    221           } 
    222           else if ($widget == 'csv') { 
    223             $WParty['part.src']=''; 
    224             $WParty['part.csv']=$content; 
    225             $WParty['part.cut']=$cut; 
    226             $WParty['part.quote']=$quote; 
    227             $WParty['part.esc']=$esc; 
    228             include_once("$curdir/wparty-widget-csv.php"); 
    229             wparty_widget_csv(); 
    230          } 
    231          else if ($widget == 'lorem') { 
    232             $WParty['part.max']=$max; 
    233             include_once("$curdir/wparty-widget-lorem.php"); 
    234             wparty_widget_lorem('', $instance, $args, $content); 
    235          } 
    236          else if ($widget == 'pdf') { 
    237             $WParty['part.pdf']=$content; 
    238             $WParty['part.width']=$width; 
    239             $WParty['part.height']=$height; 
    240             include_once("$curdir/wparty-widget-pdf.php"); 
    241             wparty_widget_pdf(); 
    242          } 
    243          else if ($widget == 'map') { 
    244             $WParty['part.map']=$content; 
    245             $WParty['part.width']=$width; 
    246             $WParty['part.height']=$height; 
    247             include_once("$curdir/wparty-widget-map.php"); 
    248             wparty_widget_map(); 
    249          } 
    250  
     259         } 
    251260 
    252261         $html_widget = ob_get_clean(); 
     
    261270 
    262271          if ($theme == "save") { 
    263             if (current_user_can('edit_themes')) { 
    264                wparty_save_option($var, $val); 
    265             } 
     272             if (current_user_can('edit_themes')) { 
     273                wparty_save_option($var, $val); 
     274             } 
    266275          } 
    267276       } 
Note: See TracChangeset for help on using the changeset viewer.