diff --git a/class-newcity-shortcodes.php b/class-newcity-shortcodes.php
index 4baca94..583acc4 100644
--- a/class-newcity-shortcodes.php
+++ b/class-newcity-shortcodes.php
@@ -2,7 +2,7 @@
/**
*
- * Defines custom TimberPost extensions
+ * Defines custom shortcodes
*
* @since 0.1.0
*
@@ -14,7 +14,6 @@ class NewCityShortcodes {
public function __construct() {
add_shortcode( 'newcity_blockquote', array( 'NewCityShortcodes', 'newcity_blockquote' ), 7 );
- // add_filter( 'img_caption_shortcode', array( $this, 'update_caption_shortcode' ), 10, 3 );
add_filter( 'mce_external_plugins', array( 'NewCityShortcodes', 'add_blockquote_mce' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_jquery_ui' ) );
}
@@ -51,99 +50,4 @@ public static function newcity_blockquote( $attr, $content = '' ) {
)?\[($block)(\s[^\]]+)?\](<\/p>|
)?/",'[$2$3]',$content );
- // closing tag
- $rep = preg_replace( "/(
)?\[\/($block)](<\/p>|
)?/",'[/$2]',$rep );
- // $rep = preg_replace("/\[\/($block)\][\S]*/","[/$2]",$rep);
- // $rep = preg_replace( '/([\n\r][\s\t]*){3,}/', "\n\n", $rep );
- return $rep;
- }
-
- function strip_breaks( $content ) {
- $content = preg_replace( '/
/', '', $content );
-
- return $content;
- }
-
- public static function inline_callout( $atts, $content = null ) {
- extract( shortcode_atts( array(), $atts ) );
-
- $output = '
' . trim( do_shortcode( $content ) ) . '
';
-
- return $output;
- }
-
- public static function callout_header( $atts, $content = null, $tag = '' ) {
-
- $atts = shortcode_atts(
- [
- 'heading' => 'h3',
- ], $atts, $tag
- );
-
- return '';
- }
-
- public static function callout_body( $atts, $content = null ) {
-
- extract( shortcode_atts( array(), $atts ) );
-
- return '' . trim( $content ) . '
';
- }
-
- function wrap_all_img_in_shortcode( $html, $id, $alt, $title, $align, $url, $size ) {
- // $url = wp_get_attachment_url($id); // Grab the current image URL
- $html = '[caption]' . $html . '[/caption]';
- return $html;
- }
-
- function update_caption_shortcode( $val, $attr, $content = null ) {
- $a = shortcode_atts(
- array(
- 'id' => '',
- 'align' => 'alignnone',
- 'width' => '',
- 'caption' => '',
- ), $attr
- );
-
- $image_id = '';
- if ( 'attachment_' === substr( $a['id'], 0, 11 ) ) {
- $image_id = substr( $a['id'], 11 );
- }
-
- if ( $image_id ) {
- $image_acf = get_fields( $image_id );
- }
-
-
- $html_parent = new DOMDocument;
- $html_parent->loadHTML( do_shortcode( $content ) );
- $html_image = $html_parent->getElementsByTagName( 'img' );
-
- $img_width = 640;
- // $img_height = $html_image[0]->getAttribute( 'height' );
- $img_alt = $html_image[0]->getAttribute( 'alt' );
-
- return Timber::compile(
- 'figure.twig', array(
- 'image' => $image_id,
- 'caption' => $a['caption'],
- 'alt' => $img_alt,
- 'attribution' => $image_acf['attribution'],
- 'figure_modifier' => $a['align'],
- 'media_width' => $img_width,
- // 'media_height' => $img_height,
- 'alt' => $img_alt,
- 'figure_modifier' => 'article-image',
- 'original_ratio' => true,
- )
- );
- }
-
}
diff --git a/newcity-shortcodes.php b/newcity-shortcodes.php
index 3ce6fc9..49fe503 100644
--- a/newcity-shortcodes.php
+++ b/newcity-shortcodes.php
@@ -22,10 +22,5 @@
die;
}
-require_once( dirname( __FILE__ ) . '/class-newcity-shortcodes.php');
-
-function newcity_shortcodes_run() {
- $newcity_shortcodes = new NewCityShortcodes();
-}
-
-newcity_shortcodes_run();
+require_once( __DIR__ . '/class-newcity-shortcodes.php');
+new NewCityShortcodes();