Plugin Directory

Changeset 2181252

Timestamp:
10/28/2019 07:02:50 AM (5 years ago)
Author:
shaharia.azam
Message:

New version uploaded

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  
    11<?php
    2 /**
    3  * @package Auto Post With Image Upload
    4  * @version 1.0
    5  */
    62/*
    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/
     3Plugin Name:  Auto Post After Image Upload
     4Plugin URI:   http://wordpress.org/extend/plugins/auto-post-after-image-upload
     5Description:  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
     6Version:      1.1
     7Author:       Shaharia Azam <mail@shaharia.com>
     8Author URI:   http://www.shaharia.com?utm_source=auto-post-after-image-upload
     9License:      GPL2
     10License URI:  https://www.gnu.org/licenses/gpl-2.0.html
     11Text Domain:  auto-post-after-image-upload
    1312*/
    1413
    15 add_action('add_attachment', 'auto_post_after_image_upload'); // Wordpress Hook
     14if( !defined( 'ABSPATH' ) ) {
     15    header( 'Status: 403 Forbidden' );
     16    header( 'HTTP/1.1 403 Forbidden' );
     17    exit;
     18}
    1619
    17 function auto_post_after_image_upload($attachId)
    18 {
     20define( "APAIU_FULL_FILE_PATH", __FILE__ );
     21define( "APAIP_VERSION", 1.1 );
    1922
    20     $attachment = get_post($attachId);
    21     $image = wp_get_attachment_image_src( $attachId, 'large');
    22     $image_tag = '<p><img src="'.$image[0].'" /></p>';
     23require __DIR__ . DIRECTORY_SEPARATOR . "lib/APAIU_HTMLParser.php";
     24require __DIR__ . DIRECTORY_SEPARATOR . "lib/APAIU_Functions.php";
    2325
    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     );
     26if(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}
    3135
    32     $post_id = wp_insert_post($postData);
     36);
    3337
    34     // attach media to post
    35     wp_update_post(array(
    36         'ID' => $attachId,
    37         'post_parent' => $post_id,
    38     ));
    3938
    40     set_post_thumbnail($post_id, $attachId);
     39register_activation_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_activate' ) );
     40register_deactivation_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_deactivate' ) );
     41register_uninstall_hook( APAIU_FULL_FILE_PATH, array( APAIU_Functions::class, 'on_uninstall' ) );
    4142
    42     return $attachId;
    43 }
  • auto-post-after-image-upload/trunk/readme.txt

    r1021762 r2181252  
    11=== Auto Post After Image Upload ===
    22Contributors: 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
     3Donate link: https://paypal.me/previewtechsllc
     4Tags: auto post, image post, image upload, auto image upload, create post from image, post
     5Requires at least: 4.0
     6Tested up to: 5.3
     7Stable tag: 1.1
     8Requires PHP: 5.5
    79License: GPLv2 or later
    8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10License URI: http://www.gnu.org/licenses/gpl-2.0.html
    911
    10 This plugin will provide you the facility to create post after uploading each media from wordpress media gallery automatically.
     12Upload 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
     13work with bulk image uploads.
    1114
    1215== Description ==
     
    1720
    1821Website 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)
     22Submit Issues: [https://github.com/shahariaazam/auto-post-after-image-upload/issues/new](https://github.com/shahariaazam/auto-post-after-image-upload/issues/new)
    2023Project GitHub URL: [https://github.com/shahariaazam/auto-post-after-image-upload](https://github.com/shahariaazam/auto-post-after-image-upload)
    2124
     
    4043== Screenshots ==
    4144
    42 There is no Screenshot yet!
     451. Configuration Page
    4346
    4447== Changelog ==
     
    4649= 1.0 =
    4750* Initial release
     51
     52
     53
     54
     55
Note: See TracChangeset for help on using the changeset viewer.