From 28365f19b0c36d600b8a7714b21c1575fca6b63f Mon Sep 17 00:00:00 2001 From: Herb Miller Date: Sat, 15 May 2021 15:02:39 +0100 Subject: [PATCH] Use Oik_attachment_contents to load the contents using src attribute. Issue #15 --- examples/example.css | 1 + shortcodes/oik-css.php | 9 +++++++++ shortcodes/oik-geshi.php | 9 +++++++++ 3 files changed, 19 insertions(+) create mode 100644 examples/example.css diff --git a/examples/example.css b/examples/example.css new file mode 100644 index 0000000..7cd741e --- /dev/null +++ b/examples/example.css @@ -0,0 +1 @@ +p { color: red; } \ No newline at end of file diff --git a/shortcodes/oik-css.php b/shortcodes/oik-css.php index 316c3d6..602d1ec 100644 --- a/shortcodes/oik-css.php +++ b/shortcodes/oik-css.php @@ -135,6 +135,15 @@ function bw_detexturize( $content ) { * */ function oik_css( $atts=null, $content=null, $tag=null ) { + if ( !$content ) { + oik_require_lib( 'class-oik-attachment-contents'); + if ( class_exists( 'Oik_attachment_contents') ) { + $oik_attachment_contents=new Oik_attachment_contents(); + $content=$oik_attachment_contents->get_content( $atts, $content ); + } else { + e( "Oik_attachment_contents not loaded"); + } + } if ( $content ) { sdiv(); $dec = bw_remove_unwanted_tags( $content ); diff --git a/shortcodes/oik-geshi.php b/shortcodes/oik-geshi.php index c492fc4..5869a44 100644 --- a/shortcodes/oik-geshi.php +++ b/shortcodes/oik-geshi.php @@ -81,6 +81,15 @@ function bw_format_content( $atts, $content ) { * @return string syntax highlighted content */ function oik_geshi( $atts=null, $content=null, $tag=null ) { + if ( !$content ) { + oik_require_lib( 'class-oik-attachment-contents'); + if ( class_exists( 'Oik_attachment_contents') ) { + $oik_attachment_contents=new Oik_attachment_contents(); + $content=$oik_attachment_contents->get_content( $atts, $content ); + } else { + e( "Oik_attachment_contents not loaded"); + } + } if ( $content ) { oik_require( "shortcodes/oik-css.php", "oik-css" ); bw_format_content( $atts, $content );