Changeset 1401262
- Timestamp:
- 04/21/2016 12:53:24 PM (10 years ago)
- Location:
- simple-google-news-de/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
simple-google-news-de.php (modified) (10 diffs)
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-de1 === Simple Google News DE === 2 Contributors: baynado, itserviceherzog 3 Donate link: https://internet-pr-beratung.de/ 4 Author URI: https://internet-pr-beratung.de/ 5 Plugin URI: https://internet-pr-beratung.de/simple-google-news-de 6 6 Tags: google, google news, rss, feed, news 7 7 Requires at least: 2.5 8 Tested up to: 4. 48 Tested up to: 4.5 9 9 Stable tag: 3.2.1 10 10 License: GPLv2 or later … … 104 104 = 1.5.4 = 105 105 * 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 106 111 107 112 … … 127 132 = 1.5.4 = 128 133 * 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 129 140 130 141 -
simple-google-news-de/trunk/simple-google-news-de.php
r1322322 r1401262 5 5 * Plugin URI: https://internet-pr-beratung.de/simple-google-news-de 6 6 * 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> 10 9 * License: GPL2 11 10 */ … … 28 27 // Prohibit direct script loading. 29 28 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); 29 define('WP_TEMP_DIR', ini_get('upload_tmp_dir')); 30 30 31 31 32 //we need this include to parse the Google News feed with MagPie later on … … 85 86 //this function builds and returns the feed URL 86 87 function 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']; 88 89 return $url; 89 90 } … … 129 130 $newsUrl = build_feed_url($atts); 130 131 132 133 131 134 //call the build_feed function to parse the feed and return the results to us 132 135 $output = build_feed($atts, $newsUrl, $iswidget); … … 138 141 function build_feed($atts, $newsUrl, $iswidget) { 139 142 //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']); 143 177 144 178 //if there are results, loop through them 145 if(!empty($items)) { 179 if(!empty($items)) 180 { 146 181 147 182 $output .= '<div id="googlenewscontainer">'; … … 181 216 //this attribution is required by the Google News terms of use 182 217 $output .= '</div>'; 183 184 218 } 185 219 … … 194 228 $output .= '<div class="clear"></div>'; 195 229 $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 197 240 return $output; 198 } 241 } 242 return "Keine News gefunden!"; 199 243 } 200 244 … … 315 359 $iswidget = 'yes'; 316 360 $myfeed = build_feed($instance, $newsUrl, $iswidget); 317 318 echo $myfeed;361 echo "<h3>".$instance['title']."</h3>" . $myfeed; 362 //echo $myfeed; 319 363 320 364 //echo $after_widget; … … 370 414 <tbody> 371 415 <tr> 372 <th scope="row">Autor </th>416 <th scope="row">Autoren</th> 373 417 <td> 374 418 <p> … … 381 425 <p> 382 426 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> 383 438 </td> 384 439 </tr>
Note: See TracChangeset
for help on using the changeset viewer.