Changeset 2181252
- Timestamp:
- 10/28/2019 07:02:50 AM (5 years ago)
- Location:
- auto-post-after-image-upload/trunk
- Files:
-
- 13 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
auto-post-after-image-upload/trunk/auto_post_after_image_upload.php
r1021762 r2181252 1 1 <?php 2 /**3 * @package Auto Post With Image Upload4 * @version 1.05 */6 2 /* 7 Plugin Name: Auto Post With Image Upload 8 Plugin URI: http://wordpress.org/extend/plugins/auto-post-after-image-upload/ 9 Description: This plugin will provide you the facility to create automated post when you will upload an image to your wordpress media gallery. Each time after uploading one media file upload one post will be created with attached this uploaded image automatically 10 Author: G. M. Shaharia Azam 11 Version: 1.0 12 Author URI: http://www.shahariaazam.com/ 3 Plugin Name: Auto Post After Image Upload 4 Plugin URI: http://wordpress.org/extend/plugins/auto-post-after-image-upload 5 Description: This plugin will provide you the facility to create automated post when you will upload an image to your wordpress media gallery. Each time after uploading one media file upload one post will be created with attached this uploaded image automatically 6 Version: 1.1 7 Author: Shaharia Azam <mail@shaharia.com> 8 Author URI: http://www.shaharia.com?utm_source=auto-post-after-image-upload 9 License: GPL2 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 Text Domain: auto-post-after-image-upload 13 12 */ 14 13 15 add_action('add_attachment', 'auto_post_after_image_upload'); // Wordpress Hook 14 if( !defined( 'ABSPATH' ) ) { 15 header( 'Status: 403 Forbidden' ); 16 header( 'HTTP/1.1 403 Forbidden' ); 17 exit; 18 } 16 19 17 function auto_post_after_image_upload($attachId) 18 { 20 define( "APAIU_FULL_FILE_PATH", __FILE__ ); 21 define( "APAIP_VERSION", 1.1 ); 19 22 20 $attachment = get_post($attachId); 21 $image = wp_get_attachment_image_src( $attachId, 'large'); 22 $image_tag = '<p><img src="'.$image[0].'" /></p>'; 23 require __DIR__ . DIRECTORY_SEPARATOR . "lib/APAIU_HTMLParser.php"; 24 require __DIR__ . DIRECTORY_SEPARATOR . "lib/APAIU_Functions.php"; 23 25 24 $postData = array( 25 'post_title' => $attachment->post_title, 26 'post_type' => 'post', 27 'post_content' => $image_tag . $attachment->post_title, 28 'post_category' => array('0'), 29 'post_status' => 'publish' 30 ); 26 if(is_admin()){ 27 add_action( 'admin_init', array( APAIU_Functions::class, 'registerWhitelistedOptions' ) ); 28 add_action( 'admin_menu', array( APAIU_Functions::class, 'adminMenu' ) ); 29 add_action( 'admin_enqueue_scripts', array( APAIU_Functions::class, 'loadAdminHeadStyles' ) ); 30 add_action( 'admin_footer', array( APAIU_Functions::class, 'adminFooterScripts' ) ); 31 add_action( 'wp_ajax_apaiu_save_preference', array( APAIU_Functions::class, 'apaiu_save_preferences' ) ); 32 add_action( 'wp_ajax_apaiu_get_preference', array( APAIU_Functions::class, 'apaiu_get_preferences' ) ); 33 add_filter( 'plugin_row_meta', array( APAIU_Functions::class, 'custom_plugin_row_meta' ), 10, 2 ); 34 } 31 35 32 $post_id = wp_insert_post($postData);36 ); 33 37 34 // attach media to post35 wp_update_post(array(36 'ID' => $attachId,37 'post_parent' => $post_id,38 ));39 38 40 set_post_thumbnail($post_id, $attachId); 39 register_activation_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_activate' ) ); 40 register_deactivation_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_deactivate' ) ); 41 register_uninstall_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_uninstall' ) ); 41 42 42 return $attachId;43 } -
auto-post-after-image-upload/trunk/readme.txt
r1021762 r2181252 1 1 === Auto Post After Image Upload === 2 2 Contributors: shaharia.azam 3 Tags: auto post, post, image upload 4 Requires at least: 3.0.1 5 Tested up to: 4.0 6 Stable tag: 2.0 3 Donate link: https://paypal.me/previewtechsllc 4 Tags: auto post, image post, image upload, auto image upload, create post from image, post 5 Requires at least: 4.0 6 Tested up to: 5.3 7 Stable tag: 1.1 8 Requires PHP: 5.5 7 9 License: GPLv2 or later 8 License URI: http ://www.gnu.org/licenses/gpl-2.0.html10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 11 10 This plugin will provide you the facility to create post after uploading each media from wordpress media gallery automatically. 12 Upload image and create post automatically. Saves lots of time. This plugin will provide you the facility to create post after uploading each media from wordpress media gallery automatically. It even 13 work with bulk image uploads. 11 14 12 15 == Description == … … 17 20 18 21 Website of Author: [http://www.shahariaazam.com](http://www.shahariaazam.com) 19 Submit Issues /Suggestions/Recommendations: [https://github.com/shahariaazam/auto-post-after-image-upload/issues/new](https://github.com/shahariaazam/auto-post-after-image-upload/issues/new)22 Submit Issues: [https://github.com/shahariaazam/auto-post-after-image-upload/issues/new](https://github.com/shahariaazam/auto-post-after-image-upload/issues/new) 20 23 Project GitHub URL: [https://github.com/shahariaazam/auto-post-after-image-upload](https://github.com/shahariaazam/auto-post-after-image-upload) 21 24 … … 40 43 == Screenshots == 41 44 42 There is no Screenshot yet! 45 1. Configuration Page 43 46 44 47 == Changelog == … … 46 49 = 1.0 = 47 50 * Initial release 51 52 53 54 55
Note: See TracChangeset
for help on using the changeset viewer.