'1' ), $attrs ) ); $GLOBALS['aa_txt_version'] = $version; return '
' . do_shortcode( $content ) . '
'; } function aa_shortcode_handler( $attrs ) { extract( shortcode_atts( array ( 'name' => 'yaruo_01', 'id' => '1', 'class' => 'aa_words', // 'aa_words' or 'words_aa' 'padding' => '' ), $attrs ) ); $aa = aa_loader( $name, $id ); $pad = ''; if ( $padding != '' ) { $pad = "
"; } $figure = << $pad
$aa
EOD; return $figure; } function aa_panel_shortcode_handler( $attrs, $content = null ) { extract( shortcode_atts( array ( 'name' => 'yaruo_01', 'id' => '1', 'class' => 'aa_words', // 'aa_words' or 'words_aa' 'padding' => '' ), $attrs ) ); $aa = aa_loader( $name, $id ); $pad = ''; if ( $padding != '' ) { $pad = "
"; } $words_header = ''; $words_footer = ''; if ( ! is_null( $content ) || $content == '') { if ( strpos($class, 'words_aa') === false ) { $words_footer = '
' . aa_remove_first_br( $content ). '
'; } else { $words_header = '
' . aa_remove_first_br( $content ). '
'; } } $figure = << $pad $words_header
$aa
$words_footer EOD; return $figure; } function aa_remove_first_br ( $content ) { $content = preg_replace('/^
/', '', $content); return $content; } function aa_loader( $name, $id ) { $file_path = __DIR__ .'/txt_' . $GLOBALS['aa_txt_version'] . '/'. $name . '/' . $id . '.txt'; if ( validate_file( $file_path ) && is_readable( $file_path ) === false ) { return "AA data not found. [name:$name][id:$id]
"; } $aa_text = file_get_contents( $file_path ); return nl2br( $aa_text ); } add_action( 'wp_enqueue_scripts', 'aayaruo_plugin_styles' ); function aayaruo_plugin_styles() { wp_register_style( 'aayaruo', plugins_url( 'css/style.css', __FILE__ ) ); wp_enqueue_style( 'aayaruo' ); }