PHP Classes

WordPress Hosted Content Importer: WordPress plugin to import content hosted remotely

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 152 All time: 9,065 This week: 51Up
Version License PHP version Categories
hci 1.0.0GNU General Publi...5PHP 5, Content management, Web services, B...
Description 

Author

This package is a WordPress plugin to import content hosted remotely.

It defines tags that can be inserted in the articles as placeholders for content to be imported from remote sites.

Currently it supports importing content in Markdown format, local files, database queries, Wikipedia content, remote APIs, etc..

The plugin retrieves the contents and inserts it the placeholder places in the WordPress articles.

Innovation Award
PHP Programming Innovation award nominee
June 2016
Number 7
WordPress is a very popular program thanks to the many plugins that allow to expand its capabilities to produce and edit content.

Sometimes you need to use content in posts obtained from other sources.

This package is a plugin that makes it easy to import content into posts from sources like local files including those in Markdown format, database query results, Wikipedia excerpts and even the requests of calls to remote APIs.

Manuel Lemos
Picture of Bimal Poudel
Name: Bimal Poudel <contact>
Classes: 5 packages by
Country: Canada Canada
Age: 42
All time rank: 169937 in Canada Canada
Week rank: 193 Up4 in Canada Canada Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
/*
 * Plugin Name: Hosted Content Importer (HCI)
 * Plugin URI: https://wordpress.org/plugins/hosted-content-importer/
 * Description: Embeds third party contents. Usage: <code>[third source="markdown" id="URL" section=""]</code>
 * Author: Bimal Poudel
 * Author URI: http://bimal.org.np/
 * Development URI: https://github.com/bimalpoudel/hosted-content-importer/
 * License: GPLv2 or later
 * Version: 2.0.0
 */

define('HCI_PLUGIN_DIR', dirname(__FILE__));

/**
 * Class file Parsedown.php renamed. Rest, 100% original.
 * http://parsedown.org/
 * https://github.com/erusev/parsedown
 */
if(!class_exists('Parsedown'))
{
    require_once(
HCI_PLUGIN_DIR . '/classes/parsedown/class.parsedown.inc.php' );
}

/**
 * Main binder
 */
require_once(HCI_PLUGIN_DIR . '/classes/hci/interface.hosted_content_interface.inc.php');
require_once(
HCI_PLUGIN_DIR . '/classes/hci/class.hosted_content_importer.inc.php');

/**
 * List of content processors.
 * Disabled accessing incomplete processors.
 * @todo Load classes on demand.
 */
require_once(HCI_PLUGIN_DIR . '/classes/processors/class.processor_database.inc.php');
require_once(
HCI_PLUGIN_DIR . '/classes/processors/class.processor_file.inc.php');
require_once(
HCI_PLUGIN_DIR . '/classes/processors/class.processor_markdown.inc.php');
require_once(
HCI_PLUGIN_DIR . '/classes/processors/class.processor_none.inc.php'); # helpful when source="" is missing
#require_once(HCI_PLUGIN_DIR . '/classes/processors/class.processor_url.inc.php');
#require_once(HCI_PLUGIN_DIR . '/classes/processors/class.processor_wikipedia.inc.php');


/**
 * Install WordPress Shortcodes
 */
require_once(HCI_PLUGIN_DIR . '/classes/hci/class.hosted_content_shortcode.inc.php');

new
hosted_content_shortcode;



/**
 * Report on which pages have [third] shortcode tags
 */
function hci_third_tags_page()
{
    require_once(
dirname(__FILE__).'/pages/help.php');
}

add_action( 'admin_menu', 'hci_third_tags_menu');
function
hci_third_tags_menu(){
   
$icon = 'dashicons-format-aside';
   
$myself = basename(dirname(__FILE__)).'/'.basename(__FILE__);
   
#add_menu_page('[third] Tags', '[third] Tags', 'manage_options', $myself, 'hci_third_tags_page', $icon, 80 );
   
add_submenu_page('edit.php', 'Posts with [third] Tags', 'Posts [third] Tags', 'manage_options', $myself, 'hci_third_tags_page');
   
#wp_enqueue_style('hci-third-tags', plugins_url( 'pages/css/style.css', __FILE__));
}


Details

=== Hosted Content Importer (HCI) === Contributors: pbimal Donate link: http://bimal.org.np/ Tags: cached, content, embed, external, hci, hosted, import, markdown, remote, third Requires at least: 4.5 Tested up to: 4.5 Stable tag: 2.0.0 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html Embeds a remotely hosted content. Maintainers can edit a tiny piece of your blog text externally, without having ANY access to your website. == Description == It imports third party hosted contents within WordPress blog texts. You define from which url/resource to fetch the content. The source may be editable by anyone else whom you trust. Thus, it logically empowers you to allow other users to externally edit a particular section of your blogs. And, you do not have to give them any access to your website. After installation, use shortcode tag `[third]` with few parameters as: Example: `[third source="markdown" id="https://goo.gl/UpclKH" section=""]` It will then embed remote markdown content inside your blog. Additionally, it will convert the text into HTML using <a href="https://github.com/erusev/parsedown">Parsedown</a>. = Parameters explained = **source**: Where to seek the data (eg. Content Hosting Server). Examples: - markdown: implemented - file: implemented - database (implemented, and left for developers) - [Join development](https://goo.gl/89KgSC) - wikipedia (work in progress) - [Join development](https://goo.gl/89KgSC) - url/api (work in progress) - [Join development](https://goo.gl/89KgSC) - The list is not limited, if you expand it. **id**: Content ID (unique identifier) of the data you want. Often, full URL as well. **section**: Additional parameter to identify the particular section (piece) of the content. = Example: Reading from a remote .md file = `[third source="markdown" id="https://goo.gl/UpclKH" section=""]` = Example: Reading from a local file = `[third source="file" id="/tmp/readme.txt" section=""]` = Example: Accessing database = `[third source="database" id="0" section="recent"]` Some implementations are left for developers because of the nature. This plugin should act as proof of concept in such cases. Please feel free to modify it. == Installation == = Method #1 = * Go to your WP Admin > Plugins > Add New page. * Search for "Hosted Content Importer". * Click install. Click activate. = Method #2 = * Download this plugin as a .zip file. * Go to WP Admin > Plugins > Add new > Upload Plugin. * Upload the .zip file and activate the plugin. = Method #3 = * Download the file hosted-content-importer.zip. * Unzip the file on your computer. * Upload folder correct-me (you just unziped) to /wp-content/plugins/ directory. * Activate the plugin through the WP Admin > Plugins menu. == Frequently Asked Questions == = How can I use it? = Write a WordPress shortcode with a full URL to your .md file on remote server. Example: `[third source="markdown" id="FULLURL/README.md" section=""]` = How does it work = The plugin brings your content using the defined Source with ID and Section. The parameters is a stable list of names proposed for *future development* in order to include more sources like WikiPedia, File, API, URL and Database. = Does it work for everyone? = Yes, but not necessarily. The usage is very tricky. You can remotely host your .md files and embed them in your blogs. In some cases, you may consider editing this plugin and adding your own methods. = Are all the content sources processors implemented fully? = By the nature of the product, no. However, You can consider `source="markdown"` and `source="file"` as a complete. Any other implementation may require you to modify your plugin to suit it for yourself. = Is it safe to embed third party contents? = As a matter of rule, do not embed something that you do not trust at all. Implementation should be designed NOT to reveal API access details or anything else. Limit the access only to the standard parameters only. Other private details should be defined within the content processor class files. It does NOT execute PHP scripts from remote contents. But HTML yes - which means, it can consume external image, css, javascripts, media files, etc. If you are maintainer of a portion of the content of any website, act responsibly; NOT to commit any unsafe contents. When you edit some file that you have access to, it may affect someone else's website that you are authorised to manage contents. Behavioural policy: Be good, do good. Always import contents from trusted source only. = How to safeguard my remote contents? = The answer is beyond the scope of this plugin. But, always consume content from trusted sources only. Security depends on how you use remote contents. If the remote content is distorted, it may reflect back in your website. Do not allow weak security on your remotely edited contents. Sources like Dropbox, GitHub, FTP may be considered safe as they require password to upload the contents. == Screenshots == 1. Usage Example for "seo.md" file on a remote server with full URL. View raw [seo.md](https://goo.gl/GFgqwp) file. 2. Output inside your blog. == Changelog == Please view the original development at: https://goo.gl/89KgSC for details, further plans, and todos. = 2.0.0 = * Product name has HCI word in it. * WP Admin > Pages > Pages with [third] Tags as menu option. * Implemented caches to store them locally. * Relocated assets. = 1.0.0 = * Forced not to cache in cURL. * Use cases explained for developers: when to use which content source processor. * Initial release. == Upgrade Notice == When this plugin is disabled, your blogs will show your `[third]` shortcode as it is, which may reveal your associated parameters.

  Files folder image Files (26)  
File Role Description
Files folder imagecaches (1 file, 7 directories)
Files folder imageclasses (3 directories)
Files folder imagecss (2 files)
Files folder imagepages (1 file)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file hosted-content-importer.php Example Example script
Accessible without login Plain text file readme.txt Doc. Documentation

  Files folder image Files (26)  /  caches  
File Role Description
Files folder imageapi (1 file)
Files folder imagedatabase (1 file)
Files folder imagefile (1 file)
Files folder imagemarkdown (1 file)
Files folder imagenone (1 file)
Files folder imageurl (1 file)
Files folder imagewikipedia (1 file)
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  api  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  database  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  file  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  markdown  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  none  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  url  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  caches  /  wikipedia  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files (26)  /  classes  
File Role Description
Files folder imagehci (3 files)
Files folder imageparsedown (3 files)
Files folder imageprocessors (6 files)

  Files folder image Files (26)  /  classes  /  hci  
File Role Description
  Plain text file class.hosted_content_importer.inc.php Class Class source
  Plain text file class.hosted_content_shortcode.inc.php Class Class source
  Plain text file interface.hosted_c...t_interface.inc.php Class Class source

  Files folder image Files (26)  /  classes  /  parsedown  
File Role Description
  Plain text file class.parsedown.inc.php Class Class source
  Accessible without login Plain text file LICENSE.txt Lic. License
  Accessible without login Plain text file readme.md Data Auxiliary data

  Files folder image Files (26)  /  classes  /  processors  
File Role Description
  Plain text file class.processor_database.inc.php Class Class source
  Plain text file class.processor_file.inc.php Class Class source
  Plain text file class.processor_markdown.inc.php Class Class source
  Plain text file class.processor_none.inc.php Class Class source
  Plain text file class.processor_url.inc.php Class Class source
  Plain text file class.processor_wikipedia.inc.php Class Class source

  Files folder image Files (26)  /  css  
File Role Description
  Accessible without login Plain text file hci-colors.css Data Auxiliary data
  Accessible without login Plain text file hci.css Data Auxiliary data

  Files folder image Files (26)  /  pages  
File Role Description
  Accessible without login Plain text file help.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:152
This week:0
All time:9,065
This week:51Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:731