SyntaxHighlighter Evolvedで文字化けとクリップアイコン表示しない

SyntaxHighlighter Evolvedのコードを記載して記事を投稿すると<,>の文字が&lt,&gtへ文字化けされてます。


ネットで探してみると親切に記事にしてくれてました。
SyntaxHighlighter Evolvedで文字化けする
「SyntaxHighlighter Evolved」のアイコンが出ない時の対応


【文字化け対応】
[プラグインバージョン]
SyntaxHighlighter Evolved3.2.1


[修正ディレクトリー]
/syntaxhighlighter/

[修正ファイル]
syntaxhighlighter.php

[修正箇所]下記 -:削除  +:追加


オリジナル(変更前)

	// The callback function for SyntaxHighlighter::encode_shortcode_contents()
	function encode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
		$this->encoded = true;
		$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars), htmlspecialchars( $code ) );
		return '[' . $tag . $this->atts2string( $atts ) . "]{$code}[/$tag]";
	}



カスタマイズ(変更後)

	// The callback function for SyntaxHighlighter::encode_shortcode_contents()
	function encode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
		$this->encoded = true;
		//$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars), htmlspecialchars( $code ) );
		$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars),  $code );
		return '[' . $tag . $this->atts2string( $atts ) . "]{$code}[/$tag]";
	}



オリジナル(変更前)

// The callback function for SyntaxHighlighter:Grinecode_shortcode_contents()
	// Shortcode attribute values need to not be quoted with TinyMCE disabled for some reason (weird bug)
	function decode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
		$quotes = ( user_can_richedit() ) ? true : false;
		$code = str_replace(  array_values($this->specialchars), array_keys($this->specialchars), htmlspecialchars_decode( $code ) );
		return '[' . $tag . $this->atts2string( $atts, $quotes ) . "]{$code}[/$tag]";
	}



カスタマイズ(変更後)

// The callback function for SyntaxHighlighter:Grinecode_shortcode_contents()
	// Shortcode attribute values need to not be quoted with TinyMCE disabled for some reason (weird bug)
	function decode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
		$quotes = ( user_can_richedit() ) ? true : false;
		//$code = str_replace(  array_values($this->specialchars), array_keys($this->specialchars), htmlspecialchars_decode( $code ) );
		$code = str_replace(  array_values($this->specialchars), array_keys($this->specialchars),  $code );
		return '[' . $tag . $this->atts2string( $atts, $quotes ) . "]{$code}[/$tag]";
	}



「クリップボードにコピー」アイコンが表示されていない
SyntaxHighlighterの設定でversion2系を使用するとツールバーに表示するクリップアイコンが表示されません。
これは、表示するclipboard.swfのファイルサイズが0KBになっているためとアイコンを指定しているパスの変更が必要との事です。


(クリップアイコンの入手)

http://alexgorbatchev.com/SyntaxHighlighter/download/

上記のサイトからバージョン2.1.382をダウンロードにて入手が可能です。


(アイコンを指定しているパス変更)
[プラグインバージョン]
SyntaxHighlighter Evolved3.2.1

[修正ディレクトリー]
/syntaxhighlighter/

[修正ファイル]
syntaxhighlighter.php


[修正箇所]
オリジナル(変更前)

		switch ( $this->settings['shversion'] ) {
			case 2:
				echo "	SyntaxHighlighter.config.clipboardSwf = '" . esc_js( apply_filters( 'syntaxhighlighter_clipboardurl', plugins_url( 'syntaxhighlighter2/scripts/clipboard.swf', __FILE__ ) ) ) . "';\n";



カスタマイズ(変更後)

		switch ( $this->settings['shversion'] ) {
			case 2:
				echo "	SyntaxHighlighter.config.clipboardSwf = '" . esc_js( apply_filters( 'syntaxhighlighter_clipboardurl', plugins_url( 'syntaxhighlighter/syntaxhighlighter2/scripts/clipboard.swf', __FILE__ ) ) ) . "';\n";



スポンサーリンク
広告
広告

シェアする

  • このエントリーをはてなブックマークに追加

フォローする

スポンサーリンク
広告