Plugin Directory

Changeset 1401262


Ignore:
Timestamp:
04/21/2016 12:53:24 PM (10 years ago)
Author:
baynado
Message:

New version

Location:
simple-google-news-de/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • simple-google-news-de/trunk/readme.txt

    r1322322 r1401262  
    1 === Simple Google News DE ===
    2 Contributors: (baynado)
    3 Donate link: http://internet-pr-beratung.de/
    4 Author URI: http://internet-pr-beratung.de/
    5 Plugin URI: http://internet-pr-beratung.de/simple-google-news-de
     1=== Simple Google News DE ===
     2Contributors: baynado, itserviceherzog
     3Donate link: https://internet-pr-beratung.de/
     4Author URI: https://internet-pr-beratung.de/
     5Plugin URI: https://internet-pr-beratung.de/simple-google-news-de
    66Tags: google, google news, rss, feed, news
    77Requires at least: 2.5
    8 Tested up to: 4.4
     8Tested up to: 4.5
    99Stable tag: 3.2.1
    1010License: GPLv2 or later
     
    104104= 1.5.4 =
    105105* Small SEO improvements for news images and check compatibility to WP 4.4
     106= 1.6=
     107*check compatibility to WP 4.5
     108* Percormance improvements Google news are beeing cached by the plugin to be prevents from Google News banned.
     109* Plugin returns error message, if there are no results in Google News
     110* Bugfix for the widget
    106111
    107112
     
    127132= 1.5.4 =
    128133* Small SEO improvements for news images and check compatibility to WP 4.4
     134= 1.6=
     135*check compatibility to WP 4.5
     136* Percormance improvements, news are beeing cached by the plugin. Prevents Google News banning für webiste with huge traffic and reduce load time.
     137* Plugin returns error message, if there are no results in Google News
     138* Bugfix for the widget
     139
    129140
    130141
  • simple-google-news-de/trunk/simple-google-news-de.php

    r1322322 r1401262  
    55 * Plugin URI: https://internet-pr-beratung.de/simple-google-news-de
    66 * Description: Binde mit diesem einfachen Plugin den Google News Stream zu einem bestimmten Thema in die Sidebar, Artikel oder Seite ein.
    7  * Version: 1.5.4
    8  * Author: Sammy Zimmermanns
    9  * Author URI: https://internet-pr-beratung.de
     7 * Version: 1.6
     8 * Author: <a href="https://internet-pr-beratung.de">Sammy Zimmermanns</a> & <a href="http://itservice-herzog.de">Matthias Herzog</a>
    109 * License: GPL2
    1110 */
     
    2827// Prohibit direct script loading.
    2928defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
     29define('WP_TEMP_DIR', ini_get('upload_tmp_dir'));
     30
    3031
    3132//we need this include to parse the Google News feed with MagPie later on
     
    8586//this function builds and returns the feed URL
    8687function build_feed_url($atts) {
    87     $url = 'http://news.google.com/news?q=' . $atts['query'] . '&topic=' . $atts['topic'] . '&ned=' . $atts['region'] . '&scoring=' . $atts['sort'];
     88    $url = 'http://news.google.com/news?q=' . urlencode($atts['query']) . '&topic=' . $atts['topic'] . '&ned=' . $atts['region'] . '&scoring=' . $atts['sort'];
    8889    return $url;
    8990}
     
    129130    $newsUrl = build_feed_url($atts);
    130131   
     132       
     133       
    131134    //call the build_feed function to parse the feed and return the results to us
    132135    $output = build_feed($atts, $newsUrl, $iswidget);
     
    138141function build_feed($atts, $newsUrl, $iswidget) {
    139142    //we're using WordPress' built in MagPie support for parsing the Google News feed
    140 
    141     $feed = fetch_rss($newsUrl . '&output=rss');
    142     if ($feed) $items = array_slice($feed->items, 0, $atts['limit']);
     143        $newsUrl.= '&output=rss';     
     144        $Path = __DIR__ ."/temp/";
     145        $FileName = $Path . $atts['query'];
     146       
     147       
     148        if(!is_dir( $Path ))
     149        {
     150         mkdir( $Path , "0755");
     151            chmod( $Path , 0755);
     152        }
     153       
     154        if(is_file( $FileName ))
     155        {
     156           
     157            $FileTime = filemtime( $FileName );
     158           /* echo $FileTime;
     159            var_dump( time() );
     160            var_dump( time() + 43200 );´
     161            exit();*/
     162            if( $FileTime < ( time() + 43200 ) ) // das ist die Cachezeit von 12 stunden in sekunden runter gerechnet
     163            {
     164                return file_get_contents( $FileName );
     165            }
     166        }
     167        //exit();
     168   
     169    $feed = fetch_rss( $newsUrl );
     170        //$feed = file_get_contents( $newsUrl );
     171    if (!$feed)
     172        {
     173            return "Keine News gefunden";
     174        }
     175       
     176        $items = array_slice( $feed->items, 0, $atts['limit']);
    143177   
    144178    //if there are results, loop through them
    145     if(!empty($items)) {
     179    if(!empty($items))
     180            {
    146181       
    147182        $output .= '<div id="googlenewscontainer">';       
     
    181216            //this attribution is required by the Google News terms of use
    182217            $output .= '</div>';
    183            
    184218        }
    185219   
     
    194228    $output .= '<div class="clear"></div>';
    195229    $output .= '</div>';
    196    
     230
     231       
     232        if( is_dir( $Path ))
     233        {
     234            @unlink($FileName); // datei entfernen
     235            file_put_contents($FileName, $output); // datei neu schreiben
     236        }
     237       
     238       
     239       
    197240    return $output;
    198     }
     241    }
     242    return "Keine News gefunden!";
    199243}
    200244
     
    315359        $iswidget = 'yes';
    316360        $myfeed = build_feed($instance, $newsUrl, $iswidget);
    317        
    318         echo $myfeed;
     361        echo "<h3>".$instance['title']."</h3>" . $myfeed;
     362        //echo $myfeed;
    319363       
    320364   //echo $after_widget;
     
    370414            <tbody>
    371415                <tr>
    372                     <th scope="row">Autor</th>
     416                    <th scope="row">Autoren</th>
    373417                    <td>
    374418                        <p>
     
    381425                        <p>
    382426                            E-Mail: <a href="mailto:[email protected]">[email protected]</a><br>Website: <a title="internet-pr-beratung.de" href="https://internet-pr-beratung.de">internet-pr-beratung.de</a>                        </p>
     427                       </td>
     428                       <td>                   
     429                       <p>
     430                            <a href="http://itservice-herzog.de/">
     431                                <img class="sgnde-about-logo" src="/wp-content/plugins/simple-google-news-de/images/it-service-herzog-logo.png" alt="IT-Service Herzog">
     432                            </a>
     433                        </p>
     434                        <p>
     435                            Matthias Herzog<br>Großenhainer Str. 17<br>01561 Schönfeld                      </p>
     436                        <p>
     437                            E-Mail: <a href="mailto:[email protected]">[email protected]</a><br>Website: <a title="IT-Service Herzog" href="http://itservice-herzog.de/">itservice-herzog.de</a>                      </p>
    383438                    </td>
    384439                </tr>
Note: See TracChangeset for help on using the changeset viewer.