Changeset 2570360
- Timestamp:
- 07/22/2021 07:31:58 PM (5 years ago)
- Location:
- social-media-library/trunk
- Files:
-
- 4 edited
-
index.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
src/Image.php (modified) (1 diff)
-
src/Settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
social-media-library/trunk/index.php
r2567475 r2570360 4 4 * Plugin URI: https://github.com/wpmotto/wp-instagram-media-library 5 5 * Description: Save images from a public Instagram account to your WordPress library. 6 * Version: 1. 1.06 * Version: 1.2 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 16 16 require __DIR__ . '/vendor/autoload.php'; 17 17 18 define('MOTTO_IGML_VERSION', '1. 0.0' );18 define('MOTTO_IGML_VERSION', '1.2.0' ); 19 19 20 20 use Motto\InstagramMediaLibrary\MediaUploads; … … 38 38 * Initial Run when settings are updated. 39 39 */ 40 add_action( 41 'update_option_igml_settings', [$remote, 'uploadUnsavedMedia'] 42 ); 40 add_action( 'update_option_igml_settings', [$remote, 'uploadUnsavedMedia']); 43 41 44 42 if ( !wp_next_scheduled( 'igml_cron_hook' ) ) … … 48 46 // Add Shortcode 49 47 add_shortcode( 'social_feed', function( $atts ) { 48 49 $link = false; 50 if( isset($atts['link']) ) { 51 $link = $atts['link']; 52 unset($atts['link']); 53 } 54 50 55 $media = new MediaUploads( $atts ); 51 $images = implode('', array_map( function( $item ) { 52 return "<li>{$item->html()}</li>"; 56 $images = implode('', array_map( function( $item ) use ($link) { 57 $html = "<li>"; 58 if( $link ) { 59 $href = ($link == "social") ? $item->social('link') : $item->attachment_url(); 60 $html .= "<a href=\"$href\">"; 61 } 62 $html .= $item->html(); 63 if( $link ) $html .= "</a>"; 64 $html .= "</li>"; 65 return $html; 53 66 }, $media->get() )); 54 67 -
social-media-library/trunk/readme.txt
r2567475 r2570360 1 === Social Media Library===1 === Social Media Downloader === 2 2 Contributors: mottodesignstudio 3 Tags: instagram, media library, feed, social 3 Tags: instagram, media library, feed, social, media downloader 4 4 Donate link: https://motto.ca 5 5 Requires at least: 4.8 6 6 Tested up to: 5.8 7 7 Requires PHP: 7.2 8 Stable tag: 1. 1.08 Stable tag: 1.2 9 9 License: GPLv2 10 10 License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html 11 11 12 This plugin allows you to save images from a public Instagram account to your WordPress library. 12 Download images from public social media accounts to your WordPress image library. This is a great way to embed Instagram posts on your site without it breaking in the future. 13 13 14 14 == Description == 15 There are many Instagram feed plugins for WordPress available. Unfortunately, Instagram would rather users not embed their media feeds on external websites. Therefore there isn\'t any official open API to do so and the unoffocial APIs are very error prone. Even if an API is working today, it will likely fail in the near future.16 15 17 That\'s why this plugin doesn\'t embed external images. Instead it\'ll sync your media library with Instagram by downloading them when available. If the API eventually breaks, the only side-effect is an out-of-date but still working instagram feed; as opposed to other plugins which will produce broken feeds while the authors work to update code to work with the breaking API changes. 16 There are many Instagram feed plugins for WordPress available. Unfortunately, Instagram would rather users not embed their media feeds on external websites. Therefore there isn't any official open API to do so and the unoffocial APIs are very error prone. Even if an API is working today, it will likely fail in the near future. 17 18 That's why this plugin doesn't embed external images. Instead it'll sync your media library with Instagram by downloading them when available. If the API eventually breaks, the only side-effect is an out-of-date but still working instagram feed; as opposed to other plugins which will produce broken feeds while the authors work to update code to work with the breaking API changes. 18 19 19 20 == Installation == 20 21 - Install and activate the plugin 21 22 - In Settings > Media > Social Media Library, enter and save the account username you want to download from 22 - Use the included shortcode to output your most recent images `[igml posts_per_page=\"5\"]` 23 - Use the included shortcode to output your most recent images `[igml posts_per_page="5"]` 24 - Attributes map directly to `WP_Query` arguments. 25 - Use `link="social"` or `link="attachment"` to link the image. 26 - Currently, requests from your server may occasionally get blocked and so it's best to use a proxy. [Signup here](https://rapidapi.com/restyler/api/instagram40) and enter your API key. 23 27 24 28 == Changelog == 29 30 = 1.2 = 31 * Added option to run sync immediately. 32 * Added url ink to the shortcode. 25 33 26 34 = 1.1 = -
social-media-library/trunk/src/Image.php
r2567475 r2570360 19 19 { 20 20 return $this->post; 21 } 22 23 public function attachment_url() 24 { 25 return get_permalink($this->post->ID); 21 26 } 22 27 -
social-media-library/trunk/src/Settings.php
r2555949 r2570360 73 73 74 74 add_settings_field( 75 'igml_run_now', 76 __( 'Run Now', 'motto-igml' ), 77 function() { 78 ?> 79 <input type="<?php echo esc_attr('checkbox') ?>" name="<?php echo esc_attr('igml_settings[run_now]') ?>" value="<?php echo esc_attr('1') ?>"> 80 <?php 81 }, 82 'media', 83 'igml_media_section' 84 ); 85 86 add_settings_field( 75 87 'igml_frequency', 76 88 __( 'Sync Frequency', 'motto-igml' ),
Note: See TracChangeset
for help on using the changeset viewer.