Changeset 1138170
- Timestamp:
- 04/18/2015 08:50:38 PM (11 years ago)
- Location:
- yandexnews-feed-by-teplitsa/trunk
- Files:
-
- 6 edited
-
inc/admin.php (modified) (3 diffs)
-
inc/feed.php (modified) (2 diffs)
-
inc/tst-yandex-feed-core.php (modified) (6 diffs)
-
readme.md (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
tst-yandex-feed.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
yandexnews-feed-by-teplitsa/trunk/inc/admin.php
r1091243 r1138170 58 58 59 59 add_settings_field( 60 'layf_custom_url', 61 __('URL for feed', 'layf'), 62 array($this, 'settngs_custom_url_callback'), 63 'layf_settings', 64 'layf_base' 65 ); 66 67 add_settings_field( 60 68 'layf_post_types', 61 69 __('Post types for feed', 'layf'), … … 102 110 register_setting( 'layf_settings', 'layf_filter_taxonomy' ); 103 111 register_setting( 'layf_settings', 'layf_filter_terms' ); 104 112 register_setting( 'layf_settings', 'layf_custom_url' ); 105 113 106 114 } 107 115 108 116 function layf_settings_screen(){ 109 117 … … 125 133 function layf_base_section_screen($args) { 126 134 //may be some description 135 } 136 137 function settngs_custom_url_callback() { 138 139 $value = trailingslashit(get_option('layf_custom_url', 'yandex/news')); 140 update_option('layf_permalinks_flushed', 0); //is it ok? 141 142 ?> 143 <label for="layf_custom_url"> 144 <?php echo home_url('/');?><input name="layf_custom_url" id="layf_custom_url" type="text" class="regular-text code" value="<?php echo $value;?>"> </label> 145 <p class="description"><?php _e('Customoze the URL of the feed if needed', 'layf');?></p> 146 <?php 127 147 } 128 148 -
yandexnews-feed-by-teplitsa/trunk/inc/feed.php
r1091243 r1138170 52 52 <category><?php echo $category;?></category> 53 53 <?php endif; ?> 54 <?php 54 <?php //enclosures 55 55 $enclosure = La_Yandex_Feed_Core::item_enclosure(); 56 56 if(!empty($enclosure)): foreach($enclosure as $i => $img): … … 58 58 <enclosure url="<?php echo esc_url($img['url']);?>" type="<?php echo esc_attr($img['mime']);?>"/> 59 59 <?php endforeach; endif;?> 60 <?php //media group 61 $media = La_Yandex_Feed_Core::item_media(); 62 if(!empty($media)): foreach($media as $media_obj) : 63 ?> 64 <media:group> 65 <media:content url=""/> 66 <media player url="<?php echo esc_url($media_obj['url']);?>"/> 67 <?php if(!empty($media_obj['thumb'])) { ?> 68 <media:thumbnail url="<?php echo esc_url($media_obj['thumb']);?>"/> 69 <?php }?> 70 </media:group> 60 71 <?php 72 endforeach; endif; 61 73 $related = La_Yandex_Feed_Core::item_related(); 62 74 if(!empty($related)): -
yandexnews-feed-by-teplitsa/trunk/inc/tst-yandex-feed-core.php
r1068031 r1138170 85 85 86 86 $wp->add_query_var('yandex_feed'); 87 //deafult 87 88 add_rewrite_rule('^yandex/([^/]*)/?', 'index.php?yandex_feed=$matches[1]', 'top'); 89 90 //custom 91 $slug = trailingslashit(get_option('layf_custom_url', 'yandex/news')); 92 if($slug != 'yandex/news/'){ 93 add_rewrite_rule("^$slug?", 'index.php?yandex_feed=news', 'top'); 94 } 88 95 89 96 if( !get_option('layf_permalinks_flushed') ) { … … 202 209 203 210 211 212 204 213 /** template helpers */ 205 214 static function get_the_content_feed() { … … 207 216 $post = get_post(); 208 217 $content = str_replace(']]>', ']]>', $post->post_content); 218 219 add_filter('img_caption_shortcode', 'layf_filter_image_caption', 20, 3); //filter caption text 220 add_filter( 'layf_content_feed', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 ); //embed media to HTML 209 221 210 222 add_filter( 'layf_content_feed', 'wptexturize' ); … … 216 228 217 229 218 return apply_filters('layf_content_feed', $content); 219 220 } 221 222 static function item_enclosure(){ 230 return apply_filters('layf_content_feed', $content); 231 } 232 233 234 /* @to-do: add support for support video files */ 235 static function item_enclosure(){ 223 236 global $post; 224 237 … … 269 282 270 283 return $mime; 284 } 285 286 287 /* videos */ 288 static function item_media(){ 289 global $post; 290 291 $matches = $res = array(); 292 //include shorcodes and oembeds 293 $out = do_shortcode($post->post_content); 294 $out = $GLOBALS['wp_embed']->autoembed($out); 295 296 //youtube 297 $youtube_regexp = "/(?:http(?:s)?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([\w-]{10,12})/"; 298 preg_match_all($youtube_regexp, $out, $matches); 299 if(isset($matches[0]) && !empty($matches[0])) 300 $res = array_merge($res, $matches[0]); //append links 301 302 //@to_do: add another video providers 303 304 //modify $res to be able add thumbnails 305 $return = array(); 306 if(!empty($res)){ foreach($res as $i => $url) { 307 $return[] = array('url' => $url, 'thumb' => ''); 308 }} 309 310 return apply_filters('layf_video_embeds', $return, $post->ID); 271 311 } 272 312 … … 565 605 } 566 606 607 608 function layf_filter_image_caption($out, $attr, $content) { 609 610 return $content; 611 } 567 612 ?> -
yandexnews-feed-by-teplitsa/trunk/readme.md
r1091243 r1138170 31 31  32 32 33 Трансляция (фид) доступна для просмотра по ссылке _domain.ru/yandex/news/_. Пример выдачи33 Трансляция (фид) доступна для просмотра по ссылке _domain.ru/yandex/news/_. В настройках может быть указан собственный адрес, которые работает при активных "красивых пермалинках". Пример выдачи 34 34  35 35 … … 80 80 After installing the plugin settings are available under menu _Settings -> Yandex.Novosti_. 81 81 82 Feed is accessible at the link _domain.ru/yandex/news/_. 82 Feed is accessible at the link _domain.ru/yandex/news/_. A custom URL could be specify through Settings page in case of active "pretty permalinks". 83 83 84 84 The plugin has the minimum of settings. Read more about it's usage at the developers' website: -
yandexnews-feed-by-teplitsa/trunk/readme.txt
r1091243 r1138170 3 3 Tags: yandex,news,xml,rss,seo 4 4 Requires at least: 3.9 5 Tested up to: 4.1 5 Tested up to: 4.1.1 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 32 32 После установки настройки плагина доступны через меню _Настройки -> Яндекс.Новости_. 33 33 34 Трансляция (фид) доступна для просмотра по ссылке _domain.ru/yandex/news/_. 34 Трансляция (фид) доступна для просмотра по ссылке _domain.ru/yandex/news/_. В настройках может быть указан собственный адрес, которые работает при активных "красивых пермалинках". 35 35 36 36 Плагин имеет минимум необходимых настроек. Подробнее о его использовании можно узнать на сайте разработчиков: … … 72 72 After installing the plugin settings are available under menu _Settings -> Yandex.Novosti_. 73 73 74 Feed is accessible at the link _domain.ru/yandex/news/_. 74 Feed is accessible at the link _domain.ru/yandex/news/_. A custom URL could be specify through Settings page in case of active "pretty permalinks". 75 75 76 76 The plugin has the minimum of settings. Read more about it's usage at the developers' website: … … 105 105 == Changelog == 106 106 107 = 1.8 = 108 * New: Support for YouTube video embedded in the post content 109 * News: Custom URL for the feed (with pretty permalinks active) 110 * Fix: Image caption text stripped out from the translation context 111 107 112 = 1.7 = 108 113 * New: Added support for new Yandex square logo format update -
yandexnews-feed-by-teplitsa/trunk/tst-yandex-feed.php
r1091243 r1138170 3 3 Plugin Name: Yandex.News Feed by Teplitsa 4 4 Description: The plugin creates feed for Yandex.News service 5 Version: 1. 75 Version: 1.8 6 6 Author: Teplitsa 7 7 Author URI: http://te-st.ru/
Note: See TracChangeset
for help on using the changeset viewer.