http-syndication

Leírás

This plugins offers the following “ground” functionnalities:

    1. Display the content of a post or page without any header, sidebar and footer.
    1. Importing the content from an external web site
    1. Importing an internal content of the wordpress site
    1. A few other deprecated functionalities

1. Displaying a post or page without any header, sidebar and footer

In order to render the raw content of a post or page without any header, sidebar and footer use the link:

http://#mywordpressadress?httpsyndication&p=#post_or_page_id&title=#1_or_0

where:

  • #mywordpressadress is the wordpress web site adress.
  • #post_or_page_id is the post or page id (you can read the post id in the http link when you edit the post).
  • #1_or_0 defines whether the post title (enclosed in a <h1> HTML tag) is displayed (default is 1, i.e., true).

Remarks:

  • The post content is exported after filtering.

2. Importing the content from an external web site

In order to import an external a post or page contents in another post or page, use the following shortcode:

[import url="#external_resource_location" ]

where:

  • #external_resource_location is the external web site http location.

Inside the [import ..] shortcode, the following options allows to select and adjust the content to import:

  • Content selection:
    • body=1 : in order to only import the <body..>..</body> part of the <html><head>..</head><body..>..</body></html> page.
    • tag_id=#id : only extract the content of the 1st tag of the given id, i.e. the <#tag id="#id">..</#tag> part, where #tag is any tag (e.g., div, span, ..).
    • tag_class=#class : only extract the content of the 1st tag of the given class, i.e. the <#tag class="#class">..</#tag> part, where #tag is any tag (e.g., div, span, ..).
    • tag_name=#name : only extract the content of all tags of the given name, i.e. the <#name ..>..</#name> part (for code safety only 100 tags can be extracted).
  • Content filtering:
    • noscript=1 : in order to delete all <script..>..</script> parts, avoiding any active JavaScript running from the imported HTML.
    • raw_href=1 : in order to provide raw href values, instead of properly relocating relative href in the source HTML code, as done by default.
    • mediawiki=1 : adds the ?printable=yes&action=render query to the URL, in order to properly syndicate mediawiki sites.
    • style=#style or class=#class allows to encapsulate the content in a <div . with customized class and/or style attribute.

Example :

  • [import url="http://localhost/wordpress/?cat=4687" tag_id="content" style="width:100%"] allows to import a category rendering with another page.

Remarks:

  • If the external content can not be read, an error message is produced in the page output.
  • This functionality requires the allow_url_fopen option to be validated in the PHP configuration, otherwise an error message is produced in the page output.
  • By construction the import is “dynamic”, i.e., each time the page is loaded, the external content is queried and inserted in the page. Good news, to be sure to have an updated information. Bad news, if the external web site is down or slowed down. You may consider having a cache mechanism to overcome related caveats.
  • The external HTML content is imported with its external CSS class styles. For another WordPress site, the match is expected to be good. If this is an exotic content management system, the situation is less obvious: Local CSS patch is likely required, or some additional content filter has to be hooked.
  • There is no way to prevent from infinite syndication loops between sites (e.g., a site with a page importing an external page that itself import the inquiring page).
  • Unless using noscript=1, the external JavaScript code is imported. Though security flaws are normally not to be expected considering usual JavaScript security rules, clearly malicious code can easily hugely perturb the page rendering.
  • The embed shortcode is a core WordPress feature. It can embed content from many resources via direct link, and the iframe allows to safely and obviously include any external site page in “frame”. The iframe plugin works well and properly make the job. The present import is a 3rd alternative, to be preferred when the former fail or mixing pages content is required.

3. Importing an internal content of the wordpress site

In order to import a post or page contents in another post or page, use the following shortcode:

  • [import id="#post_or_page_id"] to include the filtered content of another post or page in the current content.
  • [import id="#post_or_page_id" content=1] to include the raw (with shortcode expanded, but not content filter applied) of another post or page in the current content (to be used only if required).
  • [import id="#post_or_page_id" title=1] to include the title of another post or page in the current content.

where:

  • #post_or_page_id is the post or page id (you can read the post id in the http link when you edit the post).

Remarks:

  • This avoids spurious import, e.g. of social media buttons (contrary to usual include plugins).
  • Shortcode recursion is managed (i.e. stopped when an infinite loop is detected).

4. A few other deprecated functionalities

These additonal functionalities are deprecated but still available for backward compatibility

  • Using the ?w=#id query allows to refer any page, post or archive by its numerical index.

  • Using the [import wform=1 label="#theinputlabel"] shortcode, allows to insert a small input field to switch to any page, post or archive given its numerical index.

  • Using the [import banner="#page_id" url="#external_url"]#link-text[/import] shortcode allows to display another site page in an iframe, with a banner from this site sitting on top of the external page. Inside the [import ..] shortcode, the following options allows to adjust the behavior.

    • header=false : in order to include or not the usual site header().php on the top of the banner
    • height=1000 : in order to adjust the height of the frame for very long external pages.
    • newtab=1 : in order to open the page and banner in a new browser window.
    • style="border:none;" : in order to adjust the height of the frame for very long external pages.

Telepítés

Manual installation

  1. Download the ZIP file.
  2. In your WordPress Dashboard -> Plugins -> Add new page choose upload plugin in .zip format via this page
  3. Browse and select the http_syndication.zip to upload
  4. Activate the plugin through the ‘Plugins’ menu in WordPress

Automatic installation

  1. In your WordPress Dashboard -> Plugins -> Add new page search for http syndication
  2. Install the plugin and activate it through the ‘Plugins’ menu in WordPress

Vélemények

2016.09.03.
Thank you for this great plugin and please keep the updates coming. I followed your instructions to the letter and modified the page I was pulling the information from....and viola! With the syndicated page I used there was no other way of implementing the code. This little plugin of yours bypassed the headache...:)
2 (az összes) vélemény olvasása

Közreműködők és fejlesztők

“http-syndication” egy nyílt forráskódú szoftver. A bővítményhez a következő személyek járultak hozzá:

Közreműködők

“http-syndication” fordítása a saját nyelvünkre.

Érdekeltek vagyunk a fejlesztésben?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Változási napló

1.7

Improve the introduction of style or class in import.

1.6

Add the title option of the offering content to other sites
Reorganize the doc page, and update code accordingly
Declare deprecated some features, still available.

1.5

Now wrap with iframe and embed
Better support of remote pages parsing

1.4

Add the refering content by tiny URL functionnality

1.3

Adapt the shortcode parsing to editor that escape ‘&’

1.2

Add the [import banner=..] shortcode functionality.

1.1

Adding the [import ..] shortcode functionality.

Uses the monkeysuffrage/phpuri open PHP library for converting relative URLs to absolute, thanks!

1.0

Nothing special with this trivial plugin, debugged with WP_DEBUG.