Skip to content

Instantly share code, notes, and snippets.

@wabson
Created November 10, 2012 23:12
Show Gist options
  • Save wabson/4052901 to your computer and use it in GitHub Desktop.
Save wabson/4052901 to your computer and use it in GitHub Desktop.
WordPress plugin to embed document views from Alfresco Cloud
<?php
/*
Plugin Name: My Alfresco Embeds
Plugin URI: http://my.alfresco.com/
Description: Embed documents from Alfresco Cloud in a blog post
Author: Sergio Buitrago, Will Abson
Version: 0.0.1
Author URI: http://my.alfresco.com/
*/
function lyte_parse($the_content,$doExcerpt=false) {
if(strpos($the_content, "https://my.alfresco.com/share/s/")) {
$lytes_regexp="/https:\\/\\/my\\.alfresco\\.com\\/share\\/s\\/[a-zA-Z0-9]*/";
preg_match($lytes_regexp, $the_content, $matches);
foreach($matches as $match) {
/*print_r("First Element " . $match[0]);*/
/* print_r($match[1]); */
/* print_r($match[2]); */
$replacements = "<iframe width='1000' height='1000' src=\"" . $match . "\"></iframe>";
/* $the_content = $the_content . $replacements; */
$the_content=str_replace($match, $replacements, $the_content);
}
}
return $the_content;
}
if ( is_admin() ) {
//require_once(dirname(__FILE__).'/options.php');
} else {
add_filter('the_content', 'alf_parse', 4);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment