Version Description
Download this release
Release Info
Developer | wpexpertsio |
Plugin | Post Snippets |
Version | 3.1.5 |
Comparing to | |
See all releases |
Code changes from version 3.1.4 to 3.1.5
- 1.0/post-snippets-config.php +34 -0
- 1.0/post-snippets.php +169 -0
- 1.0/readme.txt +35 -0
- 1.0/screenshot-1.jpg +0 -0
- 1.0/screenshot-2.jpg +0 -0
- 1.0/screenshot-3.jpg +0 -0
- 1.0/tinymce/editor_plugin.js +64 -0
- 1.0/tinymce/langs/en.js +4 -0
- 1.0/tinymce/langs/en_US.js +4 -0
- 1.0/tinymce/langs/en_en.js +4 -0
- {tinymce → 1.0/tinymce}/post-snippets.gif +0 -0
- 1.0/tinymce/tinymce.php +59 -0
- 1.0/tinymce/window.php +118 -0
- 1.0/uninstall.php +8 -0
- 1.1/languages/post-snippets-sv_SE.mo +0 -0
- 1.1/languages/post-snippets-sv_SE.po +97 -0
- 1.1/languages/post-snippets.pot +107 -0
- 1.1/post-snippets-config.php +34 -0
- 1.1/post-snippets.php +170 -0
- 1.1/readme.txt +51 -0
- 1.1/screenshot-1.jpg +0 -0
- 1.1/screenshot-2.jpg +0 -0
- 1.1/screenshot-3.jpg +0 -0
- 1.1/tinymce/editor_plugin.js +64 -0
- 1.1/tinymce/langs/en.js +4 -0
- 1.1/tinymce/langs/en_US.js +4 -0
- 1.1/tinymce/langs/en_en.js +4 -0
- 1.1/tinymce/post-snippets.gif +0 -0
- 1.1/tinymce/tinymce.php +59 -0
- 1.1/tinymce/window.php +118 -0
- 1.1/uninstall.php +8 -0
- 1.2/languages/post-snippets-sv_SE.mo +0 -0
- 1.2/languages/post-snippets-sv_SE.po +97 -0
- 1.2/languages/post-snippets.pot +107 -0
- 1.2/post-snippets-config.php +34 -0
- 1.2/post-snippets.php +250 -0
- 1.2/readme.txt +55 -0
- 1.2/screenshot-1.jpg +0 -0
- 1.2/screenshot-2.jpg +0 -0
- 1.2/screenshot-3.jpg +0 -0
- 1.2/tinymce/editor_plugin.js +64 -0
- 1.2/tinymce/langs/en.js +4 -0
- 1.2/tinymce/langs/en_US.js +4 -0
- 1.2/tinymce/langs/en_en.js +4 -0
- 1.2/tinymce/post-snippets.gif +0 -0
- 1.2/tinymce/tinymce.php +59 -0
- 1.2/tinymce/window.php +118 -0
- 1.2/uninstall.php +8 -0
- 1.3.5/languages/post-snippets-sv_SE.mo +0 -0
- 1.3.5/languages/post-snippets-sv_SE.po +113 -0
- 1.3.5/languages/post-snippets.pot +125 -0
- 1.3.5/post-snippets-config.php +34 -0
- 1.3.5/post-snippets.php +297 -0
- 1.3.5/readme.txt +66 -0
- 1.3.5/screenshot-1.jpg +0 -0
- 1.3.5/screenshot-2.jpg +0 -0
- 1.3.5/screenshot-3.jpg +0 -0
- 1.3.5/tinymce/editor_plugin.js +64 -0
- 1.3.5/tinymce/langs/en.js +4 -0
- 1.3.5/tinymce/langs/en_US.js +4 -0
- 1.3.5/tinymce/langs/en_en.js +4 -0
- 1.3.5/tinymce/post-snippets.gif +0 -0
- 1.3.5/tinymce/tinymce.php +50 -0
- 1.3.5/tinymce/window.php +120 -0
- 1.3.5/uninstall.php +8 -0
- 1.3/languages/post-snippets-sv_SE.mo +0 -0
- 1.3/languages/post-snippets-sv_SE.po +113 -0
- 1.3/languages/post-snippets.pot +125 -0
- 1.3/post-snippets-config.php +34 -0
- 1.3/post-snippets.php +297 -0
- 1.3/readme.txt +62 -0
- 1.3/screenshot-1.jpg +0 -0
- 1.3/screenshot-2.jpg +0 -0
- 1.3/screenshot-3.jpg +0 -0
- 1.3/tinymce/editor_plugin.js +64 -0
- 1.3/tinymce/langs/en.js +4 -0
- 1.3/tinymce/langs/en_US.js +4 -0
- 1.3/tinymce/langs/en_en.js +4 -0
- 1.3/tinymce/post-snippets.gif +0 -0
- 1.3/tinymce/tinymce.php +50 -0
- 1.3/tinymce/window.php +118 -0
- 1.3/uninstall.php +8 -0
- 1.4.1/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.1/languages/post-snippets-sv_SE.po +113 -0
- 1.4.1/languages/post-snippets.pot +125 -0
- 1.4.1/post-snippets-config.php +34 -0
- 1.4.1/post-snippets.php +363 -0
- 1.4.1/readme.txt +74 -0
- 1.4.1/screenshot-1.jpg +0 -0
- 1.4.1/screenshot-2.jpg +0 -0
- 1.4.1/screenshot-3.jpg +0 -0
- 1.4.1/tinymce/editor_plugin.js +64 -0
- 1.4.1/tinymce/langs/en.js +4 -0
- 1.4.1/tinymce/langs/en_US.js +4 -0
- 1.4.1/tinymce/langs/en_en.js +4 -0
- 1.4.1/tinymce/post-snippets.gif +0 -0
- 1.4.1/tinymce/tinymce.php +50 -0
- 1.4.1/tinymce/window.php +149 -0
- 1.4.1/uninstall.php +8 -0
- 1.4.2/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.2/languages/post-snippets-sv_SE.po +113 -0
- 1.4.2/languages/post-snippets.pot +125 -0
- 1.4.2/post-snippets-config.php +34 -0
- 1.4.2/post-snippets.php +363 -0
- 1.4.2/readme.txt +77 -0
- 1.4.2/screenshot-1.jpg +0 -0
- 1.4.2/screenshot-2.jpg +0 -0
- 1.4.2/screenshot-3.jpg +0 -0
- 1.4.2/tinymce/editor_plugin.js +64 -0
- 1.4.2/tinymce/langs/en.js +4 -0
- 1.4.2/tinymce/langs/en_US.js +4 -0
- 1.4.2/tinymce/langs/en_en.js +4 -0
- 1.4.2/tinymce/post-snippets.gif +0 -0
- 1.4.2/tinymce/tinymce.php +50 -0
- 1.4.2/tinymce/window.php +149 -0
- 1.4.2/uninstall.php +8 -0
- 1.4.3/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.3/languages/post-snippets-sv_SE.po +113 -0
- 1.4.3/languages/post-snippets.pot +125 -0
- 1.4.3/post-snippets-config.php +34 -0
- 1.4.3/post-snippets.php +364 -0
- 1.4.3/readme.txt +81 -0
- 1.4.3/screenshot-1.jpg +0 -0
- 1.4.3/screenshot-2.jpg +0 -0
- 1.4.3/screenshot-3.jpg +0 -0
- 1.4.3/tinymce/editor_plugin.js +64 -0
- 1.4.3/tinymce/langs/en.js +4 -0
- 1.4.3/tinymce/langs/en_US.js +4 -0
- 1.4.3/tinymce/langs/en_en.js +4 -0
- 1.4.3/tinymce/post-snippets.gif +0 -0
- 1.4.3/tinymce/tinymce.php +50 -0
- 1.4.3/tinymce/window.php +149 -0
- 1.4.3/uninstall.php +8 -0
- 1.4.4/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.4/languages/post-snippets-sv_SE.po +113 -0
- 1.4.4/languages/post-snippets.pot +125 -0
- 1.4.4/post-snippets-config.php +34 -0
- 1.4.4/post-snippets.php +366 -0
- 1.4.4/readme.txt +84 -0
- 1.4.4/screenshot-1.jpg +0 -0
- 1.4.4/screenshot-2.jpg +0 -0
- 1.4.4/screenshot-3.jpg +0 -0
- 1.4.4/tinymce/editor_plugin.js +64 -0
- 1.4.4/tinymce/langs/en.js +4 -0
- 1.4.4/tinymce/langs/en_US.js +4 -0
- 1.4.4/tinymce/langs/en_en.js +4 -0
- 1.4.4/tinymce/post-snippets.gif +0 -0
- 1.4.4/tinymce/tinymce.php +50 -0
- 1.4.4/tinymce/window.php +149 -0
- 1.4.4/uninstall.php +8 -0
- 1.4.5/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.5/languages/post-snippets-sv_SE.po +113 -0
- 1.4.5/languages/post-snippets.pot +125 -0
- 1.4.5/post-snippets-config.php +34 -0
- 1.4.5/post-snippets.php +366 -0
- 1.4.5/readme.txt +88 -0
- 1.4.5/screenshot-1.jpg +0 -0
- 1.4.5/screenshot-2.jpg +0 -0
- 1.4.5/screenshot-3.jpg +0 -0
- 1.4.5/tinymce/editor_plugin.js +64 -0
- 1.4.5/tinymce/langs/en.js +4 -0
- 1.4.5/tinymce/langs/en_US.js +4 -0
- 1.4.5/tinymce/langs/en_en.js +4 -0
- 1.4.5/tinymce/post-snippets.gif +0 -0
- 1.4.5/tinymce/tinymce.php +50 -0
- 1.4.5/tinymce/window.php +149 -0
- 1.4.5/uninstall.php +8 -0
- 1.4.6/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.6/languages/post-snippets-sv_SE.po +113 -0
- 1.4.6/languages/post-snippets.pot +125 -0
- 1.4.6/post-snippets-config.php +34 -0
- 1.4.6/post-snippets.php +366 -0
- 1.4.6/readme.txt +94 -0
- 1.4.6/screenshot-1.jpg +0 -0
- 1.4.6/screenshot-2.jpg +0 -0
- 1.4.6/screenshot-3.jpg +0 -0
- 1.4.6/tinymce/editor_plugin.js +59 -0
- 1.4.6/tinymce/langs/en.js +4 -0
- 1.4.6/tinymce/langs/en_US.js +4 -0
- 1.4.6/tinymce/langs/en_en.js +4 -0
- 1.4.6/tinymce/post-snippets.gif +0 -0
- 1.4.6/tinymce/tinymce.php +50 -0
- 1.4.6/tinymce/window.php +149 -0
- 1.4.6/uninstall.php +8 -0
- 1.4.7/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.7/languages/post-snippets-sv_SE.po +113 -0
- 1.4.7/languages/post-snippets.pot +125 -0
- 1.4.7/post-snippets-config.php +34 -0
- 1.4.7/post-snippets.php +376 -0
- 1.4.7/readme.txt +97 -0
- 1.4.7/screenshot-1.jpg +0 -0
- 1.4.7/screenshot-2.jpg +0 -0
- 1.4.7/screenshot-3.jpg +0 -0
- 1.4.7/tinymce/editor_plugin.js +59 -0
- 1.4.7/tinymce/langs/en.js +4 -0
- 1.4.7/tinymce/langs/en_US.js +4 -0
- 1.4.7/tinymce/langs/en_en.js +4 -0
- 1.4.7/tinymce/post-snippets.gif +0 -0
- 1.4.7/tinymce/tinymce.php +50 -0
- 1.4.7/tinymce/window.php +149 -0
- 1.4.7/uninstall.php +8 -0
- 1.4.8/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.8/languages/post-snippets-sv_SE.po +113 -0
- 1.4.8/languages/post-snippets.pot +125 -0
- 1.4.8/post-snippets.php +379 -0
- 1.4.8/readme.txt +106 -0
- 1.4.8/screenshot-1.jpg +0 -0
- 1.4.8/screenshot-2.jpg +0 -0
- 1.4.8/screenshot-3.jpg +0 -0
- 1.4.8/tinymce/editor_plugin.js +59 -0
- 1.4.8/tinymce/langs/en.js +4 -0
- 1.4.8/tinymce/langs/en_US.js +4 -0
- 1.4.8/tinymce/langs/en_en.js +4 -0
- 1.4.8/tinymce/post-snippets.gif +0 -0
- 1.4.8/tinymce/tinymce.php +50 -0
- 1.4.8/tinymce/window.php +157 -0
- 1.4.8/uninstall.php +8 -0
- {lang → 1.4.9.1/languages}/post-snippets-fr_FR.mo +0 -0
- 1.4.9.1/languages/post-snippets-fr_FR.po +136 -0
- 1.4.9.1/languages/post-snippets-ru_RU.mo +0 -0
- 1.4.9.1/languages/post-snippets-ru_RU.po +114 -0
- 1.4.9.1/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.9.1/languages/post-snippets-sv_SE.po +113 -0
- 1.4.9.1/languages/post-snippets.pot +125 -0
- 1.4.9.1/post-snippets.php +379 -0
- 1.4.9.1/readme.txt +112 -0
- 1.4.9.1/screenshot-1.jpg +0 -0
- 1.4.9.1/screenshot-2.jpg +0 -0
- 1.4.9.1/screenshot-3.jpg +0 -0
- 1.4.9.1/tinymce/editor_plugin.js +59 -0
- 1.4.9.1/tinymce/langs/en.js +4 -0
- 1.4.9.1/tinymce/langs/en_US.js +4 -0
- 1.4.9.1/tinymce/langs/en_en.js +4 -0
- 1.4.9.1/tinymce/post-snippets.gif +0 -0
- 1.4.9.1/tinymce/tinymce.php +50 -0
- 1.4.9.1/tinymce/window.php +157 -0
- 1.4.9.1/uninstall.php +8 -0
- 1.4.9/languages/post-snippets-ru_RU.mo +0 -0
- 1.4.9/languages/post-snippets-ru_RU.po +114 -0
- 1.4.9/languages/post-snippets-sv_SE.mo +0 -0
- 1.4.9/languages/post-snippets-sv_SE.po +113 -0
- 1.4.9/languages/post-snippets.pot +125 -0
- 1.4.9/post-snippets.php +379 -0
- 1.4.9/readme.txt +109 -0
- 1.4.9/screenshot-1.jpg +0 -0
- 1.4.9/screenshot-2.jpg +0 -0
- 1.4.9/screenshot-3.jpg +0 -0
- 1.4.9/tinymce/editor_plugin.js +59 -0
- 1.4.9/tinymce/langs/en.js +4 -0
- 1.4.9/tinymce/langs/en_US.js +4 -0
- 1.4.9/tinymce/langs/en_en.js +4 -0
- 1.4.9/tinymce/post-snippets.gif +0 -0
- 1.4.9/tinymce/tinymce.php +50 -0
- 1.4.9/tinymce/window.php +157 -0
- 1.4.9/uninstall.php +8 -0
- 1.4/languages/post-snippets-sv_SE.mo +0 -0
- 1.4/languages/post-snippets-sv_SE.po +113 -0
- 1.4/languages/post-snippets.pot +125 -0
- 1.4/post-snippets-config.php +34 -0
- 1.4/post-snippets.php +363 -0
- 1.4/readme.txt +71 -0
- 1.4/screenshot-1.jpg +0 -0
- 1.4/screenshot-2.jpg +0 -0
- 1.4/screenshot-3.jpg +0 -0
- 1.4/tinymce/editor_plugin.js +64 -0
- 1.4/tinymce/langs/en.js +4 -0
- 1.4/tinymce/langs/en_US.js +4 -0
- 1.4/tinymce/langs/en_en.js +4 -0
- 1.4/tinymce/post-snippets.gif +0 -0
- 1.4/tinymce/tinymce.php +50 -0
- 1.4/tinymce/window.php +149 -0
- 1.4/uninstall.php +8 -0
- 1.5.1/languages/post-snippets-fr_FR.mo +0 -0
- 1.5.1/languages/post-snippets-fr_FR.po +136 -0
- 1.5.1/languages/post-snippets-ru_RU.mo +0 -0
- 1.5.1/languages/post-snippets-ru_RU.po +114 -0
- 1.5.1/languages/post-snippets-sv_SE.mo +0 -0
- 1.5.1/languages/post-snippets-sv_SE.po +113 -0
- 1.5.1/languages/post-snippets.pot +125 -0
- 1.5.1/post-snippets.php +408 -0
- 1.5.1/readme.txt +118 -0
- 1.5.1/screenshot-1.jpg +0 -0
- 1.5.1/screenshot-2.jpg +0 -0
- 1.5.1/screenshot-3.jpg +0 -0
- 1.5.1/tinymce/editor_plugin.js +59 -0
- 1.5.1/tinymce/langs/en.js +4 -0
- 1.5.1/tinymce/langs/en_US.js +4 -0
- 1.5.1/tinymce/langs/en_en.js +4 -0
- 1.5.1/tinymce/post-snippets.gif +0 -0
- 1.5.1/tinymce/tinymce.php +50 -0
- 1.5.1/tinymce/window.php +157 -0
- 1.5.1/uninstall.php +8 -0
- 1.5.2/languages/post-snippets-fr_FR.mo +0 -0
- 1.5.2/languages/post-snippets-fr_FR.po +136 -0
- 1.5.2/languages/post-snippets-ru_RU.mo +0 -0
- 1.5.2/languages/post-snippets-ru_RU.po +114 -0
- 1.5.2/languages/post-snippets-sv_SE.mo +0 -0
- 1.5.2/languages/post-snippets-sv_SE.po +113 -0
- 1.5.2/languages/post-snippets.pot +125 -0
- 1.5.2/post-snippets.php +412 -0
- 1.5.2/readme.txt +122 -0
- 1.5.2/screenshot-1.jpg +0 -0
- 1.5.2/screenshot-2.jpg +0 -0
- 1.5.2/screenshot-3.jpg +0 -0
- 1.5.2/tinymce/editor_plugin.js +59 -0
- 1.5.2/tinymce/langs/en.js +4 -0
- 1.5.2/tinymce/langs/en_US.js +4 -0
- 1.5.2/tinymce/langs/en_en.js +4 -0
- 1.5.2/tinymce/post-snippets.gif +0 -0
- 1.5.2/tinymce/tinymce.php +50 -0
- 1.5.2/tinymce/window.php +157 -0
- 1.5.2/uninstall.php +8 -0
- 1.5.3/languages/post-snippets-es_ES.mo +0 -0
- 1.5.3/languages/post-snippets-es_ES.po +135 -0
- 1.5.3/languages/post-snippets-fr_FR.mo +0 -0
- 1.5.3/languages/post-snippets-fr_FR.po +136 -0
- 1.5.3/languages/post-snippets-ru_RU.mo +0 -0
- 1.5.3/languages/post-snippets-ru_RU.po +114 -0
- 1.5.3/languages/post-snippets-sv_SE.mo +0 -0
- 1.5.3/languages/post-snippets-sv_SE.po +113 -0
- 1.5.3/languages/post-snippets.pot +125 -0
- 1.5.3/post-snippets.php +412 -0
- 1.5.3/readme.txt +125 -0
- 1.5.3/screenshot-1.jpg +0 -0
- 1.5.3/screenshot-2.jpg +0 -0
- 1.5.3/screenshot-3.jpg +0 -0
- 1.5.3/tinymce/editor_plugin.js +59 -0
- 1.5.3/tinymce/langs/en.js +4 -0
- 1.5.3/tinymce/langs/en_US.js +4 -0
- 1.5.3/tinymce/langs/en_en.js +4 -0
- 1.5.3/tinymce/post-snippets.gif +0 -0
- 1.5.3/tinymce/tinymce.php +50 -0
- 1.5.3/tinymce/window.php +157 -0
- 1.5.3/uninstall.php +8 -0
- 1.5.4/languages/post-snippets-fr_FR.mo +0 -0
- 1.5.4/languages/post-snippets-fr_FR.po +136 -0
- 1.5.4/languages/post-snippets-ru_RU.mo +0 -0
- 1.5.4/languages/post-snippets-ru_RU.po +114 -0
- 1.5.4/languages/post-snippets-sv_SE.mo +0 -0
- 1.5.4/languages/post-snippets-sv_SE.po +113 -0
- 1.5.4/languages/post-snippets-tr_TR.mo +0 -0
- 1.5.4/languages/post-snippets-tr_TR.po +113 -0
- 1.5.4/languages/post-snippets.pot +125 -0
- 1.5.4/post-snippets.php +412 -0
- 1.5.4/readme.txt +128 -0
- 1.5.4/screenshot-1.jpg +0 -0
- 1.5.4/screenshot-2.jpg +0 -0
- 1.5.4/screenshot-3.jpg +0 -0
- 1.5.4/tinymce/editor_plugin.js +59 -0
- 1.5.4/tinymce/langs/en.js +4 -0
- 1.5.4/tinymce/langs/en_US.js +4 -0
- 1.5.4/tinymce/langs/en_en.js +4 -0
- 1.5.4/tinymce/post-snippets.gif +0 -0
- 1.5.4/tinymce/tinymce.php +50 -0
- 1.5.4/tinymce/window.php +157 -0
- 1.5.4/uninstall.php +8 -0
- 1.5/languages/post-snippets-fr_FR.mo +0 -0
- 1.5/languages/post-snippets-fr_FR.po +136 -0
- 1.5/languages/post-snippets-ru_RU.mo +0 -0
- 1.5/languages/post-snippets-ru_RU.po +114 -0
- 1.5/languages/post-snippets-sv_SE.mo +0 -0
- 1.5/languages/post-snippets-sv_SE.po +113 -0
- 1.5/languages/post-snippets.pot +125 -0
- 1.5/post-snippets.php +407 -0
- 1.5/readme.txt +115 -0
- 1.5/screenshot-1.jpg +0 -0
- 1.5/screenshot-2.jpg +0 -0
- 1.5/screenshot-3.jpg +0 -0
- 1.5/tinymce/editor_plugin.js +59 -0
- 1.5/tinymce/langs/en.js +4 -0
- 1.5/tinymce/langs/en_US.js +4 -0
- 1.5/tinymce/langs/en_en.js +4 -0
- 1.5/tinymce/post-snippets.gif +0 -0
- 1.5/tinymce/tinymce.php +50 -0
- 1.5/tinymce/window.php +157 -0
- 1.5/uninstall.php +8 -0
- 1.7.1/assets/post-snippets.css +40 -0
- 1.7.1/languages/post-snippets-fr_FR.mo +0 -0
- 1.7.1/languages/post-snippets-fr_FR.po +136 -0
- 1.7.1/languages/post-snippets-ru_RU.mo +0 -0
- 1.7.1/languages/post-snippets-ru_RU.po +114 -0
- 1.7.1/languages/post-snippets-sv_SE.mo +0 -0
- 1.7.1/languages/post-snippets-sv_SE.po +113 -0
- 1.7.1/languages/post-snippets-tr_TR.mo +0 -0
- 1.7.1/languages/post-snippets-tr_TR.po +113 -0
- 1.7.1/languages/post-snippets.pot +125 -0
- 1.7.1/post-snippets.php +690 -0
- 1.7.1/readme.txt +141 -0
- 1.7.1/screenshot-1.jpg +0 -0
- 1.7.1/screenshot-2.jpg +0 -0
- 1.7.1/screenshot-3.jpg +0 -0
- 1.7.1/tinymce/editor_plugin.js +59 -0
- 1.7.1/tinymce/langs/en.js +4 -0
- 1.7.1/tinymce/langs/en_US.js +4 -0
- 1.7.1/tinymce/langs/en_en.js +4 -0
- 1.7.1/tinymce/post-snippets.gif +0 -0
- 1.7.1/tinymce/tinymce.php +50 -0
- 1.7.1/tinymce/window.php +157 -0
- 1.7.1/uninstall.php +8 -0
- 1.7.2/assets/post-snippets.css +40 -0
- 1.7.2/languages/post-snippets-es_ES.mo +0 -0
- 1.7.2/languages/post-snippets-es_ES.po +133 -0
- 1.7.2/languages/post-snippets-fr_FR.mo +0 -0
- 1.7.2/languages/post-snippets-fr_FR.po +136 -0
- 1.7.2/languages/post-snippets-ru_RU.mo +0 -0
- 1.7.2/languages/post-snippets-ru_RU.po +114 -0
- 1.7.2/languages/post-snippets-sv_SE.mo +0 -0
- 1.7.2/languages/post-snippets-sv_SE.po +113 -0
- 1.7.2/languages/post-snippets-tr_TR.mo +0 -0
- 1.7.2/languages/post-snippets-tr_TR.po +113 -0
- 1.7.2/languages/post-snippets.pot +36 -0
1.0/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.0/post-snippets.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
6 |
+
Version: 1.0
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
function postSnippets()
|
32 |
+
{
|
33 |
+
// define URL
|
34 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
35 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
36 |
+
|
37 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
38 |
+
|
39 |
+
$this->init_hooks();
|
40 |
+
}
|
41 |
+
|
42 |
+
function init_hooks(){
|
43 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The Admin Page and all it's functions
|
48 |
+
*
|
49 |
+
*/
|
50 |
+
function wp_admin() {
|
51 |
+
if (function_exists('add_options_page')) {
|
52 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
function admin_message($message) {
|
57 |
+
if ( $message ) {
|
58 |
+
?>
|
59 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
function options_page() {
|
65 |
+
// Add a new Snippet
|
66 |
+
if (isset($_POST['add-snippet'])) {
|
67 |
+
$snippets = get_option($this->plugin_options);
|
68 |
+
if (empty($snippets)) { $snippets = array(); }
|
69 |
+
array_push($snippets, array (
|
70 |
+
'title' => "Untitled",
|
71 |
+
'vars' => "",
|
72 |
+
'snippet' => ""));
|
73 |
+
update_option($this->plugin_options, $snippets);
|
74 |
+
$this->admin_message( __('A snippet named Untitled has been added.') );
|
75 |
+
}
|
76 |
+
|
77 |
+
// Update Snippets
|
78 |
+
if (isset($_POST['update-post-snippets'])) {
|
79 |
+
$snippets = get_option($this->plugin_options);
|
80 |
+
if (!empty($snippets)) {
|
81 |
+
for ($i=0; $i < count($snippets); $i++) {
|
82 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
83 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
84 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
85 |
+
}
|
86 |
+
update_option($this->plugin_options, $snippets);
|
87 |
+
$this->admin_message( __('Snippets have been updated.') );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
// Delete Snippets
|
92 |
+
if (isset($_POST['delete-selected'])) {
|
93 |
+
$snippets = get_option($this->plugin_options);
|
94 |
+
if (!empty($snippets)) {
|
95 |
+
$delete = $_POST['checked'];
|
96 |
+
$newsnippets = array();
|
97 |
+
for ($i=0; $i < count($snippets); $i++) {
|
98 |
+
if (in_array($i,$delete) == false) {
|
99 |
+
array_push($newsnippets,$snippets[$i]);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
update_option($this->plugin_options, $newsnippets);
|
103 |
+
$this->admin_message( __('Selected snippets have been deleted.') );
|
104 |
+
}
|
105 |
+
}
|
106 |
+
?>
|
107 |
+
<div class=wrap>
|
108 |
+
<h2>Post Snippets</h2>
|
109 |
+
|
110 |
+
<form method="post" action="">
|
111 |
+
<?php wp_nonce_field('update-options'); ?>
|
112 |
+
|
113 |
+
<div class="tablenav">
|
114 |
+
<div class="alignleft actions">
|
115 |
+
<input type="submit" name="add-snippet" value="<?php _e('Add New Snippet') ?>" class="button-secondary" />
|
116 |
+
<input type="submit" name="delete-selected" value="<?php _e('Delete Selected') ?>" class="button-secondary" />
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
<div class="clear"></div>
|
120 |
+
|
121 |
+
<table class="widefat fixed" cellspacing="0">
|
122 |
+
<thead>
|
123 |
+
<tr>
|
124 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
125 |
+
<th scope="col" style="width: 180px;"><?php _e('Title') ?></th>
|
126 |
+
<th scope="col" style="width: 180px;"><?php _e('Variables') ?></th>
|
127 |
+
<th scope="col"><?php _e('Snippet') ?></th>
|
128 |
+
</tr>
|
129 |
+
</thead>
|
130 |
+
|
131 |
+
<tfoot>
|
132 |
+
<tr>
|
133 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
134 |
+
<th scope="col"><?php _e('Title') ?></th>
|
135 |
+
<th scope="col"><?php _e('Variables') ?></th>
|
136 |
+
<th scope="col"><?php _e('Snippet') ?></th>
|
137 |
+
</tr>
|
138 |
+
</tfoot>
|
139 |
+
|
140 |
+
<tbody>
|
141 |
+
<?php
|
142 |
+
$snippets = get_option($this->plugin_options);
|
143 |
+
if (!empty($snippets)) {
|
144 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
145 |
+
<tr class='recent'>
|
146 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
147 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
148 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
149 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
150 |
+
</tr>
|
151 |
+
<?php
|
152 |
+
}
|
153 |
+
}
|
154 |
+
?>
|
155 |
+
</tbody>
|
156 |
+
</table>
|
157 |
+
<div class="submit">
|
158 |
+
<input type="submit" name="update-post-snippets" value="<?php _e('Update Snippets') ?>" class="button-primary" /></div>
|
159 |
+
</form>
|
160 |
+
<h3><?php _e('Help'); ?></h3>
|
161 |
+
<p><?php _e('<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.'); ?></p>
|
162 |
+
</div>
|
163 |
+
<?php
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
168 |
+
|
169 |
+
?>
|
1.0/readme.txt
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
4 |
+
Tags: post, admin, snippet, snippets, html, custom, page, dynamic
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.0
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
|
20 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
21 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
22 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
23 |
+
|
24 |
+
|
25 |
+
== Frequently Asked Questions ==
|
26 |
+
|
27 |
+
= What about foo bar? =
|
28 |
+
|
29 |
+
Answer to foo bar dilemma.
|
30 |
+
|
31 |
+
== Screenshots ==
|
32 |
+
|
33 |
+
1. The Admin page where you set up new snippets.
|
34 |
+
2. The TinyMCE button for Post Snippet.
|
35 |
+
3. The Post Snippet Insert Window.
|
1.0/screenshot-1.jpg
ADDED
Binary file
|
1.0/screenshot-2.jpg
ADDED
Binary file
|
1.0/screenshot-3.jpg
ADDED
Binary file
|
1.0/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.0/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.0/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.0/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
{tinymce → 1.0/tinymce}/post-snippets.gif
RENAMED
File without changes
|
1.0/tinymce/tinymce.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @title TinyMCE V3 Button Integration (for Wp2.5)
|
5 |
+
* @author Alex Rabe
|
6 |
+
*/
|
7 |
+
|
8 |
+
class add_postSnippets_button {
|
9 |
+
|
10 |
+
var $pluginname = "postSnippets";
|
11 |
+
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
|
22 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
23 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
24 |
+
|
25 |
+
// Add only in Rich Editor mode
|
26 |
+
if ( get_user_option('rich_editing') == 'true') {
|
27 |
+
|
28 |
+
// add the button for wp2.5 in a new way
|
29 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
30 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
// used to insert button in wordpress 2.5x editor
|
35 |
+
function register_button($buttons) {
|
36 |
+
|
37 |
+
array_push($buttons, "separator", $this->pluginname );
|
38 |
+
|
39 |
+
return $buttons;
|
40 |
+
}
|
41 |
+
|
42 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
43 |
+
function add_tinymce_plugin($plugin_array) {
|
44 |
+
|
45 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
46 |
+
|
47 |
+
return $plugin_array;
|
48 |
+
}
|
49 |
+
|
50 |
+
function change_tinymce_version($version) {
|
51 |
+
return ++$version;
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
// Call it now
|
57 |
+
$tinymce_button = new add_postSnippets_button();
|
58 |
+
|
59 |
+
?>
|
1.0/tinymce/window.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__("You are not allowed to be here"));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function insertSnippet() {
|
26 |
+
|
27 |
+
var insertString;
|
28 |
+
|
29 |
+
<?php
|
30 |
+
$snippets = get_option($postSnippets->plugin_options);
|
31 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
32 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
var rss = document.getElementById('ps_panel0');
|
36 |
+
|
37 |
+
<?php
|
38 |
+
$snippets = get_option($postSnippets->plugin_options);
|
39 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
40 |
+
// Make it js safe
|
41 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
42 |
+
?>
|
43 |
+
|
44 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
45 |
+
insertString = "<?= $theString; ?>";
|
46 |
+
<?php
|
47 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
48 |
+
if (!empty($var_arr[0])) {
|
49 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
50 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
51 |
+
insertString = insertString.replace(/{<?= $var_arr[$j] ?>}/g, var_<?= $i ?>_<?= $j ?>);
|
52 |
+
<?php } } ?>
|
53 |
+
}
|
54 |
+
<?php } ?>
|
55 |
+
|
56 |
+
|
57 |
+
if(window.tinyMCE) {
|
58 |
+
window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
59 |
+
//Peforms a clean up of the current editor HTML.
|
60 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
61 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
62 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
63 |
+
tinyMCEPopup.close();
|
64 |
+
}
|
65 |
+
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
</script>
|
69 |
+
<base target="_self" />
|
70 |
+
</head>
|
71 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
72 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
73 |
+
<form name="postSnippets" action="#">
|
74 |
+
|
75 |
+
<div class="tabs">
|
76 |
+
<ul>
|
77 |
+
<?php
|
78 |
+
$snippets = get_option($postSnippets->plugin_options);
|
79 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
80 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
81 |
+
<?php } ?>
|
82 |
+
</ul>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="panel_wrapper">
|
86 |
+
<?php
|
87 |
+
$snippets = get_option($postSnippets->plugin_options);
|
88 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
89 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
90 |
+
<br />
|
91 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
92 |
+
<?php
|
93 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
94 |
+
if (!empty($var_arr[0])) {
|
95 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
96 |
+
<tr>
|
97 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
98 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php } } ?>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
<?php } ?>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="mceActionPanel">
|
108 |
+
<div style="float: left">
|
109 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e("Cancel"); ?>" onclick="tinyMCEPopup.close();" />
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div style="float: right">
|
113 |
+
<input type="submit" id="insert" name="insert" value="<?php _e("Insert"); ?>" onclick="insertSnippet();" />
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</form>
|
117 |
+
</body>
|
118 |
+
</html>
|
1.0/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.1/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.1/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-03-24 11:57+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:75
|
20 |
+
msgid "A snippet named Untitled has been added."
|
21 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
22 |
+
|
23 |
+
#: post-snippets.php:88
|
24 |
+
msgid "Snippets have been updated."
|
25 |
+
msgstr "Avsnitten har uppdaterats."
|
26 |
+
|
27 |
+
#: post-snippets.php:104
|
28 |
+
msgid "Selected snippets have been deleted."
|
29 |
+
msgstr "Valda avsnitt har raderats."
|
30 |
+
|
31 |
+
#: post-snippets.php:116
|
32 |
+
msgid "Add New Snippet"
|
33 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
34 |
+
|
35 |
+
#: post-snippets.php:117
|
36 |
+
msgid "Delete Selected"
|
37 |
+
msgstr "Radera Valda"
|
38 |
+
|
39 |
+
#: post-snippets.php:126
|
40 |
+
#: post-snippets.php:135
|
41 |
+
msgid "Title"
|
42 |
+
msgstr "Titel"
|
43 |
+
|
44 |
+
#: post-snippets.php:127
|
45 |
+
#: post-snippets.php:136
|
46 |
+
msgid "Variables"
|
47 |
+
msgstr "Variabler"
|
48 |
+
|
49 |
+
#: post-snippets.php:128
|
50 |
+
#: post-snippets.php:137
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr "Avsnitt"
|
53 |
+
|
54 |
+
#: post-snippets.php:159
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr "Uppdatera Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:161
|
59 |
+
msgid "Help"
|
60 |
+
msgstr "Hjälp"
|
61 |
+
|
62 |
+
#: post-snippets.php:162
|
63 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
64 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren.<br/><br/><strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn<br/><br/><strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
65 |
+
|
66 |
+
#: tinymce/window.php:9
|
67 |
+
msgid "You are not allowed to be here"
|
68 |
+
msgstr "Du har inte tillåtelse att vara här"
|
69 |
+
|
70 |
+
#: tinymce/window.php:109
|
71 |
+
msgid "Cancel"
|
72 |
+
msgstr "Avbryt"
|
73 |
+
|
74 |
+
#: tinymce/window.php:113
|
75 |
+
msgid "Insert"
|
76 |
+
msgstr "Infoga"
|
77 |
+
|
78 |
+
#. Plugin Name of an extension
|
79 |
+
msgid "Post Snippets"
|
80 |
+
msgstr "Post Snippets"
|
81 |
+
|
82 |
+
#. Plugin URI of an extension
|
83 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
84 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
85 |
+
|
86 |
+
#. Description of an extension
|
87 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button."
|
88 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp."
|
89 |
+
|
90 |
+
#. Author of an extension
|
91 |
+
msgid "Johan Steen"
|
92 |
+
msgstr "Johan Steen"
|
93 |
+
|
94 |
+
#. Author URI of an extension
|
95 |
+
msgid "http://coding.cglounge.com/"
|
96 |
+
msgstr "http://coding.cglounge.com/"
|
97 |
+
|
1.1/languages/post-snippets.pot
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:75
|
19 |
+
msgid "A snippet named Untitled has been added."
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:88
|
23 |
+
msgid "Snippets have been updated."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:104
|
27 |
+
msgid "Selected snippets have been deleted."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:116
|
31 |
+
msgid "Add New Snippet"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:117
|
35 |
+
msgid "Delete Selected"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:126 post-snippets.php:135
|
39 |
+
msgid "Title"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:127 post-snippets.php:136
|
43 |
+
msgid "Variables"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:128 post-snippets.php:137
|
47 |
+
msgid "Snippet"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:159
|
51 |
+
msgid "Update Snippets"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:161
|
55 |
+
msgid "Help"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:162
|
59 |
+
msgid ""
|
60 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
61 |
+
"it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma "
|
62 |
+
"separated list of custom variables you can reference in your snippet.<br/"
|
63 |
+
"><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is "
|
64 |
+
"the block of text or HTML to insert in the post when you select the snippet "
|
65 |
+
"from the insert button in the TinyMCE panel in the post editor. If you have "
|
66 |
+
"entered predefined variables you can reference them from the snippet by "
|
67 |
+
"enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the "
|
68 |
+
"variables in the example above, you would enter {url} and {name}.<br/><br/"
|
69 |
+
">So if you enter this snippet:<br/><i>This is the website of <a href="
|
70 |
+
"\"{url}\">{name}</a></i><br/>You will get the option to replace url "
|
71 |
+
"and name on insert if they are defined as variables."
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: tinymce/window.php:9
|
75 |
+
msgid "You are not allowed to be here"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: tinymce/window.php:109
|
79 |
+
msgid "Cancel"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: tinymce/window.php:113
|
83 |
+
msgid "Insert"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#. Plugin Name of an extension
|
87 |
+
msgid "Post Snippets"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#. Plugin URI of an extension
|
91 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#. Description of an extension
|
95 |
+
msgid ""
|
96 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
97 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
98 |
+
"insert. All snippets are available in the post editor with a TinyMCE button."
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#. Author of an extension
|
102 |
+
msgid "Johan Steen"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#. Author URI of an extension
|
106 |
+
msgid "http://coding.cglounge.com/"
|
107 |
+
msgstr ""
|
1.1/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.1/post-snippets.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
6 |
+
Version: 1.1
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
function postSnippets()
|
32 |
+
{
|
33 |
+
// define URL
|
34 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
35 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
36 |
+
|
37 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
38 |
+
|
39 |
+
$this->init_hooks();
|
40 |
+
}
|
41 |
+
|
42 |
+
function init_hooks(){
|
43 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
44 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* The Admin Page and all it's functions
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
function wp_admin() {
|
52 |
+
if (function_exists('add_options_page')) {
|
53 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function admin_message($message) {
|
58 |
+
if ( $message ) {
|
59 |
+
?>
|
60 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
61 |
+
<?php
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function options_page() {
|
66 |
+
// Add a new Snippet
|
67 |
+
if (isset($_POST['add-snippet'])) {
|
68 |
+
$snippets = get_option($this->plugin_options);
|
69 |
+
if (empty($snippets)) { $snippets = array(); }
|
70 |
+
array_push($snippets, array (
|
71 |
+
'title' => "Untitled",
|
72 |
+
'vars' => "",
|
73 |
+
'snippet' => ""));
|
74 |
+
update_option($this->plugin_options, $snippets);
|
75 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
// Update Snippets
|
79 |
+
if (isset($_POST['update-post-snippets'])) {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
84 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
85 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
86 |
+
}
|
87 |
+
update_option($this->plugin_options, $snippets);
|
88 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
// Delete Snippets
|
93 |
+
if (isset($_POST['delete-selected'])) {
|
94 |
+
$snippets = get_option($this->plugin_options);
|
95 |
+
if (!empty($snippets)) {
|
96 |
+
$delete = $_POST['checked'];
|
97 |
+
$newsnippets = array();
|
98 |
+
for ($i=0; $i < count($snippets); $i++) {
|
99 |
+
if (in_array($i,$delete) == false) {
|
100 |
+
array_push($newsnippets,$snippets[$i]);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
update_option($this->plugin_options, $newsnippets);
|
104 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
?>
|
108 |
+
<div class=wrap>
|
109 |
+
<h2>Post Snippets</h2>
|
110 |
+
|
111 |
+
<form method="post" action="">
|
112 |
+
<?php wp_nonce_field('update-options'); ?>
|
113 |
+
|
114 |
+
<div class="tablenav">
|
115 |
+
<div class="alignleft actions">
|
116 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
117 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
<div class="clear"></div>
|
121 |
+
|
122 |
+
<table class="widefat fixed" cellspacing="0">
|
123 |
+
<thead>
|
124 |
+
<tr>
|
125 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
126 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
127 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
128 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
129 |
+
</tr>
|
130 |
+
</thead>
|
131 |
+
|
132 |
+
<tfoot>
|
133 |
+
<tr>
|
134 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
135 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
136 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
137 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
138 |
+
</tr>
|
139 |
+
</tfoot>
|
140 |
+
|
141 |
+
<tbody>
|
142 |
+
<?php
|
143 |
+
$snippets = get_option($this->plugin_options);
|
144 |
+
if (!empty($snippets)) {
|
145 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
146 |
+
<tr class='recent'>
|
147 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
148 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
149 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
150 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
151 |
+
</tr>
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
}
|
155 |
+
?>
|
156 |
+
</tbody>
|
157 |
+
</table>
|
158 |
+
<div class="submit">
|
159 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
160 |
+
</form>
|
161 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
162 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
163 |
+
</div>
|
164 |
+
<?php
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
169 |
+
|
170 |
+
?>
|
1.1/readme.txt
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
4 |
+
Tags: post, admin, snippet, snippets, html, custom, page, dynamic
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.1
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
Some features:
|
18 |
+
|
19 |
+
* **Insert** All defined snippets are available through a window via a TinyMCE button in the post editor.
|
20 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
21 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can used on insert.
|
22 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
23 |
+
|
24 |
+
|
25 |
+
== Installation ==
|
26 |
+
|
27 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
28 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
29 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
30 |
+
|
31 |
+
|
32 |
+
== Frequently Asked Questions ==
|
33 |
+
|
34 |
+
= Guru? =
|
35 |
+
|
36 |
+
Meditation.
|
37 |
+
|
38 |
+
== Screenshots ==
|
39 |
+
|
40 |
+
1. The Admin page where you set up new snippets.
|
41 |
+
2. The TinyMCE button for Post Snippets.
|
42 |
+
3. The Post Snippet Insert Window.
|
43 |
+
|
44 |
+
== Changelog ==
|
45 |
+
|
46 |
+
= 1.1 =
|
47 |
+
* Included Swedish translation.
|
48 |
+
* Added TextDomain functionality for I18n.
|
49 |
+
|
50 |
+
= 1.0 =
|
51 |
+
* Initial Release
|
1.1/screenshot-1.jpg
ADDED
Binary file
|
1.1/screenshot-2.jpg
ADDED
Binary file
|
1.1/screenshot-3.jpg
ADDED
Binary file
|
1.1/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.1/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.1/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.1/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.1/tinymce/post-snippets.gif
ADDED
Binary file
|
1.1/tinymce/tinymce.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @title TinyMCE V3 Button Integration (for Wp2.5)
|
5 |
+
* @author Alex Rabe
|
6 |
+
*/
|
7 |
+
|
8 |
+
class add_postSnippets_button {
|
9 |
+
|
10 |
+
var $pluginname = "postSnippets";
|
11 |
+
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
|
22 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
23 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
24 |
+
|
25 |
+
// Add only in Rich Editor mode
|
26 |
+
if ( get_user_option('rich_editing') == 'true') {
|
27 |
+
|
28 |
+
// add the button for wp2.5 in a new way
|
29 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
30 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
// used to insert button in wordpress 2.5x editor
|
35 |
+
function register_button($buttons) {
|
36 |
+
|
37 |
+
array_push($buttons, "separator", $this->pluginname );
|
38 |
+
|
39 |
+
return $buttons;
|
40 |
+
}
|
41 |
+
|
42 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
43 |
+
function add_tinymce_plugin($plugin_array) {
|
44 |
+
|
45 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
46 |
+
|
47 |
+
return $plugin_array;
|
48 |
+
}
|
49 |
+
|
50 |
+
function change_tinymce_version($version) {
|
51 |
+
return ++$version;
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
// Call it now
|
57 |
+
$tinymce_button = new add_postSnippets_button();
|
58 |
+
|
59 |
+
?>
|
1.1/tinymce/window.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function insertSnippet() {
|
26 |
+
|
27 |
+
var insertString;
|
28 |
+
|
29 |
+
<?php
|
30 |
+
$snippets = get_option($postSnippets->plugin_options);
|
31 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
32 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
var rss = document.getElementById('ps_panel0');
|
36 |
+
|
37 |
+
<?php
|
38 |
+
$snippets = get_option($postSnippets->plugin_options);
|
39 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
40 |
+
// Make it js safe
|
41 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
42 |
+
?>
|
43 |
+
|
44 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
45 |
+
insertString = "<?= $theString; ?>";
|
46 |
+
<?php
|
47 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
48 |
+
if (!empty($var_arr[0])) {
|
49 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
50 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
51 |
+
insertString = insertString.replace(/{<?= $var_arr[$j] ?>}/g, var_<?= $i ?>_<?= $j ?>);
|
52 |
+
<?php } } ?>
|
53 |
+
}
|
54 |
+
<?php } ?>
|
55 |
+
|
56 |
+
|
57 |
+
if(window.tinyMCE) {
|
58 |
+
window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
59 |
+
//Peforms a clean up of the current editor HTML.
|
60 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
61 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
62 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
63 |
+
tinyMCEPopup.close();
|
64 |
+
}
|
65 |
+
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
</script>
|
69 |
+
<base target="_self" />
|
70 |
+
</head>
|
71 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
72 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
73 |
+
<form name="postSnippets" action="#">
|
74 |
+
|
75 |
+
<div class="tabs">
|
76 |
+
<ul>
|
77 |
+
<?php
|
78 |
+
$snippets = get_option($postSnippets->plugin_options);
|
79 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
80 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
81 |
+
<?php } ?>
|
82 |
+
</ul>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="panel_wrapper">
|
86 |
+
<?php
|
87 |
+
$snippets = get_option($postSnippets->plugin_options);
|
88 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
89 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
90 |
+
<br />
|
91 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
92 |
+
<?php
|
93 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
94 |
+
if (!empty($var_arr[0])) {
|
95 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
96 |
+
<tr>
|
97 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
98 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php } } ?>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
<?php } ?>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="mceActionPanel">
|
108 |
+
<div style="float: left">
|
109 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div style="float: right">
|
113 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</form>
|
117 |
+
</body>
|
118 |
+
</html>
|
1.1/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.2/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.2/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-01 13:03+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:75
|
20 |
+
msgid "A snippet named Untitled has been added."
|
21 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
22 |
+
|
23 |
+
#: post-snippets.php:88
|
24 |
+
msgid "Snippets have been updated."
|
25 |
+
msgstr "Avsnitten har uppdaterats."
|
26 |
+
|
27 |
+
#: post-snippets.php:104
|
28 |
+
msgid "Selected snippets have been deleted."
|
29 |
+
msgstr "Valda avsnitt har raderats."
|
30 |
+
|
31 |
+
#: post-snippets.php:116
|
32 |
+
msgid "Add New Snippet"
|
33 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
34 |
+
|
35 |
+
#: post-snippets.php:117
|
36 |
+
msgid "Delete Selected"
|
37 |
+
msgstr "Radera Valda"
|
38 |
+
|
39 |
+
#: post-snippets.php:126
|
40 |
+
#: post-snippets.php:135
|
41 |
+
msgid "Title"
|
42 |
+
msgstr "Titel"
|
43 |
+
|
44 |
+
#: post-snippets.php:127
|
45 |
+
#: post-snippets.php:136
|
46 |
+
msgid "Variables"
|
47 |
+
msgstr "Variabler"
|
48 |
+
|
49 |
+
#: post-snippets.php:128
|
50 |
+
#: post-snippets.php:137
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr "Avsnitt"
|
53 |
+
|
54 |
+
#: post-snippets.php:159
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr "Uppdatera Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:161
|
59 |
+
msgid "Help"
|
60 |
+
msgstr "Hjälp"
|
61 |
+
|
62 |
+
#: post-snippets.php:162
|
63 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
64 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren.<br/><br/><strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn<br/><br/><strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
65 |
+
|
66 |
+
#: tinymce/window.php:9
|
67 |
+
msgid "You are not allowed to be here"
|
68 |
+
msgstr "Du har inte tillåtelse att vara här"
|
69 |
+
|
70 |
+
#: tinymce/window.php:109
|
71 |
+
msgid "Cancel"
|
72 |
+
msgstr "Avbryt"
|
73 |
+
|
74 |
+
#: tinymce/window.php:113
|
75 |
+
msgid "Insert"
|
76 |
+
msgstr "Infoga"
|
77 |
+
|
78 |
+
#. Plugin Name of an extension
|
79 |
+
msgid "Post Snippets"
|
80 |
+
msgstr "Post Snippets"
|
81 |
+
|
82 |
+
#. Plugin URI of an extension
|
83 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
84 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
85 |
+
|
86 |
+
#. Description of an extension
|
87 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button."
|
88 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp."
|
89 |
+
|
90 |
+
#. Author of an extension
|
91 |
+
msgid "Johan Steen"
|
92 |
+
msgstr "Johan Steen"
|
93 |
+
|
94 |
+
#. Author URI of an extension
|
95 |
+
msgid "http://coding.cglounge.com/"
|
96 |
+
msgstr "http://coding.cglounge.com/"
|
97 |
+
|
1.2/languages/post-snippets.pot
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:75
|
19 |
+
msgid "A snippet named Untitled has been added."
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:88
|
23 |
+
msgid "Snippets have been updated."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:104
|
27 |
+
msgid "Selected snippets have been deleted."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:116
|
31 |
+
msgid "Add New Snippet"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:117
|
35 |
+
msgid "Delete Selected"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:126 post-snippets.php:135
|
39 |
+
msgid "Title"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:127 post-snippets.php:136
|
43 |
+
msgid "Variables"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:128 post-snippets.php:137
|
47 |
+
msgid "Snippet"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:159
|
51 |
+
msgid "Update Snippets"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:161
|
55 |
+
msgid "Help"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:162
|
59 |
+
msgid ""
|
60 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
61 |
+
"it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma "
|
62 |
+
"separated list of custom variables you can reference in your snippet.<br/"
|
63 |
+
"><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is "
|
64 |
+
"the block of text or HTML to insert in the post when you select the snippet "
|
65 |
+
"from the insert button in the TinyMCE panel in the post editor. If you have "
|
66 |
+
"entered predefined variables you can reference them from the snippet by "
|
67 |
+
"enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the "
|
68 |
+
"variables in the example above, you would enter {url} and {name}.<br/><br/"
|
69 |
+
">So if you enter this snippet:<br/><i>This is the website of <a href="
|
70 |
+
"\"{url}\">{name}</a></i><br/>You will get the option to replace url "
|
71 |
+
"and name on insert if they are defined as variables."
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: tinymce/window.php:9
|
75 |
+
msgid "You are not allowed to be here"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: tinymce/window.php:109
|
79 |
+
msgid "Cancel"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: tinymce/window.php:113
|
83 |
+
msgid "Insert"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#. Plugin Name of an extension
|
87 |
+
msgid "Post Snippets"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#. Plugin URI of an extension
|
91 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#. Description of an extension
|
95 |
+
msgid ""
|
96 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
97 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
98 |
+
"insert. All snippets are available in the post editor with a TinyMCE button."
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#. Author of an extension
|
102 |
+
msgid "Johan Steen"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#. Author URI of an extension
|
106 |
+
msgid "http://coding.cglounge.com/"
|
107 |
+
msgstr ""
|
1.2/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.2/post-snippets.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
6 |
+
Version: 1.2
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
function postSnippets()
|
32 |
+
{
|
33 |
+
// define URL
|
34 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
35 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
36 |
+
|
37 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
38 |
+
|
39 |
+
$this->init_hooks();
|
40 |
+
}
|
41 |
+
|
42 |
+
function init_hooks() {
|
43 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
44 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
45 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Handling of QuickTags in the HTML editor
|
50 |
+
*
|
51 |
+
*/
|
52 |
+
function quicktags() {
|
53 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
54 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
55 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
56 |
+
|
57 |
+
$snippets = get_option($this->plugin_options);
|
58 |
+
if (!empty($snippets)) {
|
59 |
+
echo '
|
60 |
+
<script type="text/javascript">
|
61 |
+
<!--
|
62 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
63 |
+
var postSnippetsNr, postSnippetsButton;
|
64 |
+
';
|
65 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
66 |
+
|
67 |
+
// Make it js safe
|
68 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
69 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
70 |
+
$theVariables = "";
|
71 |
+
if (!empty($var_arr[0])) {
|
72 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
73 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
74 |
+
if ( $j < (count($var_arr) -1) )
|
75 |
+
$theVariables = $theVariables . ", ";
|
76 |
+
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
echo '
|
81 |
+
postSnippetsNr = edButtons.length;
|
82 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
83 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
84 |
+
|
85 |
+
while (postSnippetsButton.nodeType != 1) {
|
86 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
87 |
+
}
|
88 |
+
|
89 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
90 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
91 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
92 |
+
postSnippetsButton.title = postSnippetsNr;
|
93 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
94 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, \''.$theSnippet.'\', variables' . $i .', parseInt(this.title));}
|
95 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
96 |
+
';
|
97 |
+
}
|
98 |
+
echo '
|
99 |
+
}
|
100 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
101 |
+
var myValue;
|
102 |
+
var insertString;
|
103 |
+
insertString = theSnippet;
|
104 |
+
for (x in theVariables)
|
105 |
+
{
|
106 |
+
myValue = prompt(theVariables[x]);
|
107 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
108 |
+
var re = new RegExp(searchfor, \'g\');
|
109 |
+
insertString = insertString.replace(re, myValue);
|
110 |
+
|
111 |
+
}
|
112 |
+
theSnippet = insertString;
|
113 |
+
if (theSnippet) {
|
114 |
+
edInsertContent(myField, theSnippet);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
//-->
|
118 |
+
</script>
|
119 |
+
';
|
120 |
+
}
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* The Admin Page and all it's functions
|
128 |
+
*
|
129 |
+
*/
|
130 |
+
function wp_admin() {
|
131 |
+
if (function_exists('add_options_page')) {
|
132 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
function admin_message($message) {
|
137 |
+
if ( $message ) {
|
138 |
+
?>
|
139 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
140 |
+
<?php
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
function options_page() {
|
145 |
+
// Add a new Snippet
|
146 |
+
if (isset($_POST['add-snippet'])) {
|
147 |
+
$snippets = get_option($this->plugin_options);
|
148 |
+
if (empty($snippets)) { $snippets = array(); }
|
149 |
+
array_push($snippets, array (
|
150 |
+
'title' => "Untitled",
|
151 |
+
'vars' => "",
|
152 |
+
'snippet' => ""));
|
153 |
+
update_option($this->plugin_options, $snippets);
|
154 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
155 |
+
}
|
156 |
+
|
157 |
+
// Update Snippets
|
158 |
+
if (isset($_POST['update-post-snippets'])) {
|
159 |
+
$snippets = get_option($this->plugin_options);
|
160 |
+
if (!empty($snippets)) {
|
161 |
+
for ($i=0; $i < count($snippets); $i++) {
|
162 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
163 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
164 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
165 |
+
}
|
166 |
+
update_option($this->plugin_options, $snippets);
|
167 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
// Delete Snippets
|
172 |
+
if (isset($_POST['delete-selected'])) {
|
173 |
+
$snippets = get_option($this->plugin_options);
|
174 |
+
if (!empty($snippets)) {
|
175 |
+
$delete = $_POST['checked'];
|
176 |
+
$newsnippets = array();
|
177 |
+
for ($i=0; $i < count($snippets); $i++) {
|
178 |
+
if (in_array($i,$delete) == false) {
|
179 |
+
array_push($newsnippets,$snippets[$i]);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
update_option($this->plugin_options, $newsnippets);
|
183 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
?>
|
187 |
+
<div class=wrap>
|
188 |
+
<h2>Post Snippets</h2>
|
189 |
+
|
190 |
+
<form method="post" action="">
|
191 |
+
<?php wp_nonce_field('update-options'); ?>
|
192 |
+
|
193 |
+
<div class="tablenav">
|
194 |
+
<div class="alignleft actions">
|
195 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
196 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
<div class="clear"></div>
|
200 |
+
|
201 |
+
<table class="widefat fixed" cellspacing="0">
|
202 |
+
<thead>
|
203 |
+
<tr>
|
204 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
205 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
206 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
207 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
208 |
+
</tr>
|
209 |
+
</thead>
|
210 |
+
|
211 |
+
<tfoot>
|
212 |
+
<tr>
|
213 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
214 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
215 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
216 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
217 |
+
</tr>
|
218 |
+
</tfoot>
|
219 |
+
|
220 |
+
<tbody>
|
221 |
+
<?php
|
222 |
+
$snippets = get_option($this->plugin_options);
|
223 |
+
if (!empty($snippets)) {
|
224 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
225 |
+
<tr class='recent'>
|
226 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
227 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
228 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
229 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
230 |
+
</tr>
|
231 |
+
<?php
|
232 |
+
}
|
233 |
+
}
|
234 |
+
?>
|
235 |
+
</tbody>
|
236 |
+
</table>
|
237 |
+
<div class="submit">
|
238 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
239 |
+
</form>
|
240 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
241 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.<br/><br/><strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name<br/><br/><strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
242 |
+
</div>
|
243 |
+
<?php
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
249 |
+
|
250 |
+
?>
|
1.2/readme.txt
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
4 |
+
Tags: post, admin, snippet, snippets, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.2
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
Some features:
|
18 |
+
|
19 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
20 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
21 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
22 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
23 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
24 |
+
|
25 |
+
|
26 |
+
== Installation ==
|
27 |
+
|
28 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
29 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
30 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
31 |
+
|
32 |
+
|
33 |
+
== Frequently Asked Questions ==
|
34 |
+
|
35 |
+
= Guru? =
|
36 |
+
|
37 |
+
Meditation.
|
38 |
+
|
39 |
+
== Screenshots ==
|
40 |
+
|
41 |
+
1. The Admin page where you set up new snippets.
|
42 |
+
2. The TinyMCE button for Post Snippets.
|
43 |
+
3. The Post Snippet Insert Window.
|
44 |
+
|
45 |
+
== Changelog ==
|
46 |
+
|
47 |
+
= 1.2 =
|
48 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
49 |
+
|
50 |
+
= 1.1 =
|
51 |
+
* Included Swedish translation.
|
52 |
+
* Added TextDomain functionality for I18n.
|
53 |
+
|
54 |
+
= 1.0 =
|
55 |
+
* Initial Release
|
1.2/screenshot-1.jpg
ADDED
Binary file
|
1.2/screenshot-2.jpg
ADDED
Binary file
|
1.2/screenshot-3.jpg
ADDED
Binary file
|
1.2/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.2/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.2/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.2/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.2/tinymce/post-snippets.gif
ADDED
Binary file
|
1.2/tinymce/tinymce.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @title TinyMCE V3 Button Integration (for Wp2.5)
|
5 |
+
* @author Alex Rabe
|
6 |
+
*/
|
7 |
+
|
8 |
+
class add_postSnippets_button {
|
9 |
+
|
10 |
+
var $pluginname = "postSnippets";
|
11 |
+
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
|
22 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
23 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
24 |
+
|
25 |
+
// Add only in Rich Editor mode
|
26 |
+
if ( get_user_option('rich_editing') == 'true') {
|
27 |
+
|
28 |
+
// add the button for wp2.5 in a new way
|
29 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
30 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
// used to insert button in wordpress 2.5x editor
|
35 |
+
function register_button($buttons) {
|
36 |
+
|
37 |
+
array_push($buttons, "separator", $this->pluginname );
|
38 |
+
|
39 |
+
return $buttons;
|
40 |
+
}
|
41 |
+
|
42 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
43 |
+
function add_tinymce_plugin($plugin_array) {
|
44 |
+
|
45 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
46 |
+
|
47 |
+
return $plugin_array;
|
48 |
+
}
|
49 |
+
|
50 |
+
function change_tinymce_version($version) {
|
51 |
+
return ++$version;
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
// Call it now
|
57 |
+
$tinymce_button = new add_postSnippets_button();
|
58 |
+
|
59 |
+
?>
|
1.2/tinymce/window.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function insertSnippet() {
|
26 |
+
|
27 |
+
var insertString;
|
28 |
+
|
29 |
+
<?php
|
30 |
+
$snippets = get_option($postSnippets->plugin_options);
|
31 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
32 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
var rss = document.getElementById('ps_panel0');
|
36 |
+
|
37 |
+
<?php
|
38 |
+
$snippets = get_option($postSnippets->plugin_options);
|
39 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
40 |
+
// Make it js safe
|
41 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
42 |
+
?>
|
43 |
+
|
44 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
45 |
+
insertString = "<?= $theString; ?>";
|
46 |
+
<?php
|
47 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
48 |
+
if (!empty($var_arr[0])) {
|
49 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
50 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
51 |
+
insertString = insertString.replace(/{<?= $var_arr[$j] ?>}/g, var_<?= $i ?>_<?= $j ?>);
|
52 |
+
<?php } } ?>
|
53 |
+
}
|
54 |
+
<?php } ?>
|
55 |
+
|
56 |
+
|
57 |
+
if(window.tinyMCE) {
|
58 |
+
window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
59 |
+
//Peforms a clean up of the current editor HTML.
|
60 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
61 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
62 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
63 |
+
tinyMCEPopup.close();
|
64 |
+
}
|
65 |
+
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
</script>
|
69 |
+
<base target="_self" />
|
70 |
+
</head>
|
71 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
72 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
73 |
+
<form name="postSnippets" action="#">
|
74 |
+
|
75 |
+
<div class="tabs">
|
76 |
+
<ul>
|
77 |
+
<?php
|
78 |
+
$snippets = get_option($postSnippets->plugin_options);
|
79 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
80 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
81 |
+
<?php } ?>
|
82 |
+
</ul>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="panel_wrapper">
|
86 |
+
<?php
|
87 |
+
$snippets = get_option($postSnippets->plugin_options);
|
88 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
89 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
90 |
+
<br />
|
91 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
92 |
+
<?php
|
93 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
94 |
+
if (!empty($var_arr[0])) {
|
95 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
96 |
+
<tr>
|
97 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
98 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php } } ?>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
<?php } ?>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="mceActionPanel">
|
108 |
+
<div style="float: left">
|
109 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div style="float: right">
|
113 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</form>
|
117 |
+
</body>
|
118 |
+
</html>
|
1.2/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.3.5/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.3.5/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.3.5/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.3.5/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.3.5/post-snippets.php
ADDED
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.3.5
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Displays a warning when installed in an old Wordpress Version
|
66 |
+
*
|
67 |
+
* @returns Nothing
|
68 |
+
*/
|
69 |
+
function version_warning() {
|
70 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Handling of QuickTags in the HTML editor
|
75 |
+
*
|
76 |
+
*/
|
77 |
+
function quicktags() {
|
78 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
79 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
80 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
81 |
+
|
82 |
+
$snippets = get_option($this->plugin_options);
|
83 |
+
if (!empty($snippets)) {
|
84 |
+
echo '
|
85 |
+
<script type="text/javascript">
|
86 |
+
<!--
|
87 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
88 |
+
var postSnippetsNr, postSnippetsButton;
|
89 |
+
';
|
90 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
91 |
+
|
92 |
+
// Make it js safe
|
93 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
94 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
95 |
+
$theVariables = "";
|
96 |
+
if (!empty($var_arr[0])) {
|
97 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
98 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
99 |
+
if ( $j < (count($var_arr) -1) )
|
100 |
+
$theVariables = $theVariables . ", ";
|
101 |
+
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
echo '
|
106 |
+
postSnippetsNr = edButtons.length;
|
107 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
108 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
109 |
+
|
110 |
+
while (postSnippetsButton.nodeType != 1) {
|
111 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
112 |
+
}
|
113 |
+
|
114 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
115 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
116 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
117 |
+
postSnippetsButton.title = postSnippetsNr;
|
118 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
119 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, \''.$theSnippet.'\', variables' . $i .', parseInt(this.title));}
|
120 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
121 |
+
';
|
122 |
+
}
|
123 |
+
echo '
|
124 |
+
}
|
125 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
126 |
+
var myValue;
|
127 |
+
var insertString;
|
128 |
+
insertString = theSnippet;
|
129 |
+
for (x in theVariables)
|
130 |
+
{
|
131 |
+
myValue = prompt(theVariables[x]);
|
132 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
133 |
+
var re = new RegExp(searchfor, \'g\');
|
134 |
+
insertString = insertString.replace(re, myValue);
|
135 |
+
|
136 |
+
}
|
137 |
+
theSnippet = insertString;
|
138 |
+
if (theSnippet) {
|
139 |
+
edInsertContent(myField, theSnippet);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
//-->
|
143 |
+
</script>
|
144 |
+
';
|
145 |
+
}
|
146 |
+
break;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* The Admin Page and all it's functions
|
153 |
+
*
|
154 |
+
*/
|
155 |
+
function wp_admin() {
|
156 |
+
if (function_exists('add_options_page')) {
|
157 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
function admin_message($message) {
|
162 |
+
if ( $message ) {
|
163 |
+
?>
|
164 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
165 |
+
<?php
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
function options_page() {
|
170 |
+
// Add a new Snippet
|
171 |
+
if (isset($_POST['add-snippet'])) {
|
172 |
+
$snippets = get_option($this->plugin_options);
|
173 |
+
if (empty($snippets)) { $snippets = array(); }
|
174 |
+
array_push($snippets, array (
|
175 |
+
'title' => "Untitled",
|
176 |
+
'vars' => "",
|
177 |
+
'snippet' => ""));
|
178 |
+
update_option($this->plugin_options, $snippets);
|
179 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
180 |
+
}
|
181 |
+
|
182 |
+
// Update Snippets
|
183 |
+
if (isset($_POST['update-post-snippets'])) {
|
184 |
+
$snippets = get_option($this->plugin_options);
|
185 |
+
if (!empty($snippets)) {
|
186 |
+
for ($i=0; $i < count($snippets); $i++) {
|
187 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
188 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
189 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
190 |
+
}
|
191 |
+
update_option($this->plugin_options, $snippets);
|
192 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
// Delete Snippets
|
197 |
+
if (isset($_POST['delete-selected'])) {
|
198 |
+
$snippets = get_option($this->plugin_options);
|
199 |
+
if (!empty($snippets)) {
|
200 |
+
$delete = $_POST['checked'];
|
201 |
+
$newsnippets = array();
|
202 |
+
for ($i=0; $i < count($snippets); $i++) {
|
203 |
+
if (in_array($i,$delete) == false) {
|
204 |
+
array_push($newsnippets,$snippets[$i]);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
update_option($this->plugin_options, $newsnippets);
|
208 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
?>
|
212 |
+
<div class=wrap>
|
213 |
+
<h2>Post Snippets</h2>
|
214 |
+
|
215 |
+
<form method="post" action="">
|
216 |
+
<?php wp_nonce_field('update-options'); ?>
|
217 |
+
|
218 |
+
<div class="tablenav">
|
219 |
+
<div class="alignleft actions">
|
220 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
221 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
222 |
+
</div>
|
223 |
+
</div>
|
224 |
+
<div class="clear"></div>
|
225 |
+
|
226 |
+
<table class="widefat fixed" cellspacing="0">
|
227 |
+
<thead>
|
228 |
+
<tr>
|
229 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
230 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
231 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
232 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
233 |
+
</tr>
|
234 |
+
</thead>
|
235 |
+
|
236 |
+
<tfoot>
|
237 |
+
<tr>
|
238 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
239 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
240 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
241 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
242 |
+
</tr>
|
243 |
+
</tfoot>
|
244 |
+
|
245 |
+
<tbody>
|
246 |
+
<?php
|
247 |
+
$snippets = get_option($this->plugin_options);
|
248 |
+
if (!empty($snippets)) {
|
249 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
250 |
+
<tr class='recent'>
|
251 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
252 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
253 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
254 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
255 |
+
</tr>
|
256 |
+
<?php
|
257 |
+
}
|
258 |
+
}
|
259 |
+
?>
|
260 |
+
</tbody>
|
261 |
+
</table>
|
262 |
+
<div class="submit">
|
263 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
264 |
+
</form>
|
265 |
+
|
266 |
+
<div id="poststuff" class="ui-sortable">
|
267 |
+
<div class="postbox closed">
|
268 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
269 |
+
<div class="inside">
|
270 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
271 |
+
|
272 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
273 |
+
|
274 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
275 |
+
</div>
|
276 |
+
</div>
|
277 |
+
</div>
|
278 |
+
|
279 |
+
<script type="text/javascript">
|
280 |
+
<!--
|
281 |
+
<?php global $wp_version; ?>
|
282 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
283 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
284 |
+
<?php } ?>
|
285 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
286 |
+
jQuery('.postbox.close-me').each(function(){
|
287 |
+
jQuery(this).addClass("closed");
|
288 |
+
});
|
289 |
+
//-->
|
290 |
+
</script>
|
291 |
+
</div>
|
292 |
+
<?php
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
297 |
+
?>
|
1.3.5/readme.txt
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.3.5
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
23 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
24 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
25 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
26 |
+
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
31 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
32 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
33 |
+
|
34 |
+
|
35 |
+
== Frequently Asked Questions ==
|
36 |
+
|
37 |
+
= Guru? =
|
38 |
+
|
39 |
+
Meditation.
|
40 |
+
|
41 |
+
== Screenshots ==
|
42 |
+
|
43 |
+
1. The Admin page where you set up new snippets.
|
44 |
+
2. The TinyMCE button for Post Snippets.
|
45 |
+
3. The Post Snippet Insert Window.
|
46 |
+
|
47 |
+
== Changelog ==
|
48 |
+
|
49 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
50 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
51 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
52 |
+
|
53 |
+
= Version 1.3 - 2 Apr 2009 =
|
54 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
55 |
+
* Updated the Help info in the admin page to take less space.
|
56 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
57 |
+
|
58 |
+
= Version 1.2 - 1 Apr 2009 =
|
59 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
60 |
+
|
61 |
+
= Version 1.1 - 24 Mar 2009 =
|
62 |
+
* Included Swedish translation.
|
63 |
+
* Added TextDomain functionality for I18n.
|
64 |
+
|
65 |
+
= Version 1.0 - 23 Mar 2009 =
|
66 |
+
* Initial Release
|
1.3.5/screenshot-1.jpg
ADDED
Binary file
|
1.3.5/screenshot-2.jpg
ADDED
Binary file
|
1.3.5/screenshot-3.jpg
ADDED
Binary file
|
1.3.5/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.3.5/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3.5/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3.5/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3.5/tinymce/post-snippets.gif
ADDED
Binary file
|
1.3.5/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.3.5/tinymce/window.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function insertSnippet() {
|
26 |
+
|
27 |
+
var insertString;
|
28 |
+
|
29 |
+
<?php
|
30 |
+
$snippets = get_option($postSnippets->plugin_options);
|
31 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
32 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
var rss = document.getElementById('ps_panel0');
|
36 |
+
|
37 |
+
<?php
|
38 |
+
$snippets = get_option($postSnippets->plugin_options);
|
39 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
40 |
+
// Make it js safe
|
41 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
42 |
+
?>
|
43 |
+
|
44 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
45 |
+
insertString = "<?= $theString; ?>";
|
46 |
+
<?php
|
47 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
48 |
+
if (!empty($var_arr[0])) {
|
49 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
50 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
51 |
+
insertString = insertString.replace(/\{<?= $var_arr[$j] ?>\}/g, var_<?= $i ?>_<?= $j ?>);
|
52 |
+
<?php } } ?>
|
53 |
+
}
|
54 |
+
<?php } ?>
|
55 |
+
|
56 |
+
|
57 |
+
if(window.tinyMCE) {
|
58 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
59 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
60 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
61 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
62 |
+
//Peforms a clean up of the current editor HTML.
|
63 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
64 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
65 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
66 |
+
tinyMCEPopup.close();
|
67 |
+
}
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
</script>
|
71 |
+
<base target="_self" />
|
72 |
+
</head>
|
73 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
74 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
75 |
+
<form name="postSnippets" action="#">
|
76 |
+
|
77 |
+
<div class="tabs">
|
78 |
+
<ul>
|
79 |
+
<?php
|
80 |
+
$snippets = get_option($postSnippets->plugin_options);
|
81 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
82 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
83 |
+
<?php } ?>
|
84 |
+
</ul>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
88 |
+
<?php
|
89 |
+
$snippets = get_option($postSnippets->plugin_options);
|
90 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
91 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
92 |
+
<br />
|
93 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
94 |
+
<?php
|
95 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
96 |
+
if (!empty($var_arr[0])) {
|
97 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
98 |
+
<tr>
|
99 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
100 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
101 |
+
</td>
|
102 |
+
</tr>
|
103 |
+
<?php } } ?>
|
104 |
+
</table>
|
105 |
+
</div>
|
106 |
+
<?php } ?>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<div class="mceActionPanel">
|
110 |
+
<div style="float: left">
|
111 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
112 |
+
</div>
|
113 |
+
|
114 |
+
<div style="float: right">
|
115 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
</form>
|
119 |
+
</body>
|
120 |
+
</html>
|
1.3.5/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.3/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.3/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.3/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.3/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.3/post-snippets.php
ADDED
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.3
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Displays a warning when installed in an old Wordpress Version
|
66 |
+
*
|
67 |
+
* @returns Nothing
|
68 |
+
*/
|
69 |
+
function version_warning() {
|
70 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Handling of QuickTags in the HTML editor
|
75 |
+
*
|
76 |
+
*/
|
77 |
+
function quicktags() {
|
78 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
79 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
80 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
81 |
+
|
82 |
+
$snippets = get_option($this->plugin_options);
|
83 |
+
if (!empty($snippets)) {
|
84 |
+
echo '
|
85 |
+
<script type="text/javascript">
|
86 |
+
<!--
|
87 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
88 |
+
var postSnippetsNr, postSnippetsButton;
|
89 |
+
';
|
90 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
91 |
+
|
92 |
+
// Make it js safe
|
93 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
94 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
95 |
+
$theVariables = "";
|
96 |
+
if (!empty($var_arr[0])) {
|
97 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
98 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
99 |
+
if ( $j < (count($var_arr) -1) )
|
100 |
+
$theVariables = $theVariables . ", ";
|
101 |
+
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
echo '
|
106 |
+
postSnippetsNr = edButtons.length;
|
107 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
108 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
109 |
+
|
110 |
+
while (postSnippetsButton.nodeType != 1) {
|
111 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
112 |
+
}
|
113 |
+
|
114 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
115 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
116 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
117 |
+
postSnippetsButton.title = postSnippetsNr;
|
118 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
119 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, \''.$theSnippet.'\', variables' . $i .', parseInt(this.title));}
|
120 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
121 |
+
';
|
122 |
+
}
|
123 |
+
echo '
|
124 |
+
}
|
125 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
126 |
+
var myValue;
|
127 |
+
var insertString;
|
128 |
+
insertString = theSnippet;
|
129 |
+
for (x in theVariables)
|
130 |
+
{
|
131 |
+
myValue = prompt(theVariables[x]);
|
132 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
133 |
+
var re = new RegExp(searchfor, \'g\');
|
134 |
+
insertString = insertString.replace(re, myValue);
|
135 |
+
|
136 |
+
}
|
137 |
+
theSnippet = insertString;
|
138 |
+
if (theSnippet) {
|
139 |
+
edInsertContent(myField, theSnippet);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
//-->
|
143 |
+
</script>
|
144 |
+
';
|
145 |
+
}
|
146 |
+
break;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* The Admin Page and all it's functions
|
153 |
+
*
|
154 |
+
*/
|
155 |
+
function wp_admin() {
|
156 |
+
if (function_exists('add_options_page')) {
|
157 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
function admin_message($message) {
|
162 |
+
if ( $message ) {
|
163 |
+
?>
|
164 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
165 |
+
<?php
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
function options_page() {
|
170 |
+
// Add a new Snippet
|
171 |
+
if (isset($_POST['add-snippet'])) {
|
172 |
+
$snippets = get_option($this->plugin_options);
|
173 |
+
if (empty($snippets)) { $snippets = array(); }
|
174 |
+
array_push($snippets, array (
|
175 |
+
'title' => "Untitled",
|
176 |
+
'vars' => "",
|
177 |
+
'snippet' => ""));
|
178 |
+
update_option($this->plugin_options, $snippets);
|
179 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
180 |
+
}
|
181 |
+
|
182 |
+
// Update Snippets
|
183 |
+
if (isset($_POST['update-post-snippets'])) {
|
184 |
+
$snippets = get_option($this->plugin_options);
|
185 |
+
if (!empty($snippets)) {
|
186 |
+
for ($i=0; $i < count($snippets); $i++) {
|
187 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
188 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
189 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
190 |
+
}
|
191 |
+
update_option($this->plugin_options, $snippets);
|
192 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
// Delete Snippets
|
197 |
+
if (isset($_POST['delete-selected'])) {
|
198 |
+
$snippets = get_option($this->plugin_options);
|
199 |
+
if (!empty($snippets)) {
|
200 |
+
$delete = $_POST['checked'];
|
201 |
+
$newsnippets = array();
|
202 |
+
for ($i=0; $i < count($snippets); $i++) {
|
203 |
+
if (in_array($i,$delete) == false) {
|
204 |
+
array_push($newsnippets,$snippets[$i]);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
update_option($this->plugin_options, $newsnippets);
|
208 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
?>
|
212 |
+
<div class=wrap>
|
213 |
+
<h2>Post Snippets</h2>
|
214 |
+
|
215 |
+
<form method="post" action="">
|
216 |
+
<?php wp_nonce_field('update-options'); ?>
|
217 |
+
|
218 |
+
<div class="tablenav">
|
219 |
+
<div class="alignleft actions">
|
220 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
221 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
222 |
+
</div>
|
223 |
+
</div>
|
224 |
+
<div class="clear"></div>
|
225 |
+
|
226 |
+
<table class="widefat fixed" cellspacing="0">
|
227 |
+
<thead>
|
228 |
+
<tr>
|
229 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
230 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
231 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
232 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
233 |
+
</tr>
|
234 |
+
</thead>
|
235 |
+
|
236 |
+
<tfoot>
|
237 |
+
<tr>
|
238 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
239 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
240 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
241 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
242 |
+
</tr>
|
243 |
+
</tfoot>
|
244 |
+
|
245 |
+
<tbody>
|
246 |
+
<?php
|
247 |
+
$snippets = get_option($this->plugin_options);
|
248 |
+
if (!empty($snippets)) {
|
249 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
250 |
+
<tr class='recent'>
|
251 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
252 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
253 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
254 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
255 |
+
</tr>
|
256 |
+
<?php
|
257 |
+
}
|
258 |
+
}
|
259 |
+
?>
|
260 |
+
</tbody>
|
261 |
+
</table>
|
262 |
+
<div class="submit">
|
263 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
264 |
+
</form>
|
265 |
+
|
266 |
+
<div id="poststuff" class="ui-sortable">
|
267 |
+
<div class="postbox closed">
|
268 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
269 |
+
<div class="inside">
|
270 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
271 |
+
|
272 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
273 |
+
|
274 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
275 |
+
</div>
|
276 |
+
</div>
|
277 |
+
</div>
|
278 |
+
|
279 |
+
<script type="text/javascript">
|
280 |
+
<!--
|
281 |
+
<?php global $wp_version; ?>
|
282 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
283 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
284 |
+
<?php } ?>
|
285 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
286 |
+
jQuery('.postbox.close-me').each(function(){
|
287 |
+
jQuery(this).addClass("closed");
|
288 |
+
});
|
289 |
+
//-->
|
290 |
+
</script>
|
291 |
+
</div>
|
292 |
+
<?php
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
297 |
+
?>
|
1.3/readme.txt
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.3
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
23 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
24 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
25 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
26 |
+
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
31 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
32 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
33 |
+
|
34 |
+
|
35 |
+
== Frequently Asked Questions ==
|
36 |
+
|
37 |
+
= Guru? =
|
38 |
+
|
39 |
+
Meditation.
|
40 |
+
|
41 |
+
== Screenshots ==
|
42 |
+
|
43 |
+
1. The Admin page where you set up new snippets.
|
44 |
+
2. The TinyMCE button for Post Snippets.
|
45 |
+
3. The Post Snippet Insert Window.
|
46 |
+
|
47 |
+
== Changelog ==
|
48 |
+
|
49 |
+
= Version 1.3 - 2 Apr 2009 =
|
50 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
51 |
+
* Updated the Help info in the admin page to take less space.
|
52 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
53 |
+
|
54 |
+
= Version 1.2 - 1 Apr 2009 =
|
55 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
56 |
+
|
57 |
+
= Version 1.1 - 24 Mar 2009 =
|
58 |
+
* Included Swedish translation.
|
59 |
+
* Added TextDomain functionality for I18n.
|
60 |
+
|
61 |
+
= Version 1.0 - 23 Mar 2009 =
|
62 |
+
* Initial Release
|
1.3/screenshot-1.jpg
ADDED
Binary file
|
1.3/screenshot-2.jpg
ADDED
Binary file
|
1.3/screenshot-3.jpg
ADDED
Binary file
|
1.3/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.3/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.3/tinymce/post-snippets.gif
ADDED
Binary file
|
1.3/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.3/tinymce/window.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function insertSnippet() {
|
26 |
+
|
27 |
+
var insertString;
|
28 |
+
|
29 |
+
<?php
|
30 |
+
$snippets = get_option($postSnippets->plugin_options);
|
31 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
32 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
33 |
+
<?php } ?>
|
34 |
+
|
35 |
+
var rss = document.getElementById('ps_panel0');
|
36 |
+
|
37 |
+
<?php
|
38 |
+
$snippets = get_option($postSnippets->plugin_options);
|
39 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
40 |
+
// Make it js safe
|
41 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
42 |
+
?>
|
43 |
+
|
44 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
45 |
+
insertString = "<?= $theString; ?>";
|
46 |
+
<?php
|
47 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
48 |
+
if (!empty($var_arr[0])) {
|
49 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
50 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
51 |
+
insertString = insertString.replace(/\{<?= $var_arr[$j] ?>\}/g, var_<?= $i ?>_<?= $j ?>);
|
52 |
+
<?php } } ?>
|
53 |
+
}
|
54 |
+
<?php } ?>
|
55 |
+
|
56 |
+
|
57 |
+
if(window.tinyMCE) {
|
58 |
+
window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
59 |
+
//Peforms a clean up of the current editor HTML.
|
60 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
61 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
62 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
63 |
+
tinyMCEPopup.close();
|
64 |
+
}
|
65 |
+
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
</script>
|
69 |
+
<base target="_self" />
|
70 |
+
</head>
|
71 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
72 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
73 |
+
<form name="postSnippets" action="#">
|
74 |
+
|
75 |
+
<div class="tabs">
|
76 |
+
<ul>
|
77 |
+
<?php
|
78 |
+
$snippets = get_option($postSnippets->plugin_options);
|
79 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
80 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
81 |
+
<?php } ?>
|
82 |
+
</ul>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="panel_wrapper">
|
86 |
+
<?php
|
87 |
+
$snippets = get_option($postSnippets->plugin_options);
|
88 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
89 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
90 |
+
<br />
|
91 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
92 |
+
<?php
|
93 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
94 |
+
if (!empty($var_arr[0])) {
|
95 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
96 |
+
<tr>
|
97 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
98 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php } } ?>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
<?php } ?>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="mceActionPanel">
|
108 |
+
<div style="float: left">
|
109 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div style="float: right">
|
113 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</form>
|
117 |
+
</body>
|
118 |
+
</html>
|
1.3/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.1/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.1/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.1/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.1/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.1/post-snippets.php
ADDED
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.1
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'.$snippets[$i]["snippet"].'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return "{$snippet}";') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" .$theSnippet. "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
echo '
|
166 |
+
}
|
167 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
168 |
+
theSnippet = \'[\' + shortcodeTag;
|
169 |
+
for (x in shortcodeAtts)
|
170 |
+
{
|
171 |
+
theSnippet += \' \' + shortcodeAtts[x] + \'="{\' + shortcodeAtts[x] + \'}"\';
|
172 |
+
}
|
173 |
+
theSnippet += \']\';
|
174 |
+
return theSnippet;
|
175 |
+
}
|
176 |
+
|
177 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
178 |
+
var myValue;
|
179 |
+
var insertString;
|
180 |
+
insertString = theSnippet;
|
181 |
+
for (x in theVariables)
|
182 |
+
{
|
183 |
+
myValue = prompt(theVariables[x]);
|
184 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
185 |
+
var re = new RegExp(searchfor, \'g\');
|
186 |
+
insertString = insertString.replace(re, myValue);
|
187 |
+
|
188 |
+
}
|
189 |
+
theSnippet = insertString;
|
190 |
+
if (theSnippet) {
|
191 |
+
edInsertContent(myField, theSnippet);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
//-->
|
195 |
+
</script>
|
196 |
+
';
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* The Admin Page and all it's functions
|
205 |
+
*
|
206 |
+
*/
|
207 |
+
function wp_admin() {
|
208 |
+
if (function_exists('add_options_page')) {
|
209 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
function admin_message($message) {
|
214 |
+
if ( $message ) {
|
215 |
+
?>
|
216 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
function options_page() {
|
222 |
+
// Add a new Snippet
|
223 |
+
if (isset($_POST['add-snippet'])) {
|
224 |
+
$snippets = get_option($this->plugin_options);
|
225 |
+
if (empty($snippets)) { $snippets = array(); }
|
226 |
+
array_push($snippets, array (
|
227 |
+
'title' => "Untitled",
|
228 |
+
'vars' => "",
|
229 |
+
'shortcode' => false,
|
230 |
+
'quicktag' => false,
|
231 |
+
'snippet' => ""));
|
232 |
+
update_option($this->plugin_options, $snippets);
|
233 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
234 |
+
}
|
235 |
+
|
236 |
+
// Update Snippets
|
237 |
+
if (isset($_POST['update-post-snippets'])) {
|
238 |
+
$snippets = get_option($this->plugin_options);
|
239 |
+
if (!empty($snippets)) {
|
240 |
+
for ($i=0; $i < count($snippets); $i++) {
|
241 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
242 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
243 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
244 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
245 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
246 |
+
}
|
247 |
+
update_option($this->plugin_options, $snippets);
|
248 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
// Delete Snippets
|
253 |
+
if (isset($_POST['delete-selected'])) {
|
254 |
+
$snippets = get_option($this->plugin_options);
|
255 |
+
if (!empty($snippets)) {
|
256 |
+
$delete = $_POST['checked'];
|
257 |
+
$newsnippets = array();
|
258 |
+
for ($i=0; $i < count($snippets); $i++) {
|
259 |
+
if (in_array($i,$delete) == false) {
|
260 |
+
array_push($newsnippets,$snippets[$i]);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
update_option($this->plugin_options, $newsnippets);
|
264 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
?>
|
268 |
+
<div class=wrap>
|
269 |
+
<h2>Post Snippets</h2>
|
270 |
+
|
271 |
+
<form method="post" action="">
|
272 |
+
<?php wp_nonce_field('update-options'); ?>
|
273 |
+
|
274 |
+
<div class="tablenav">
|
275 |
+
<div class="alignleft actions">
|
276 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
277 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
</div>
|
279 |
+
</div>
|
280 |
+
<div class="clear"></div>
|
281 |
+
|
282 |
+
<table class="widefat fixed" cellspacing="0">
|
283 |
+
<thead>
|
284 |
+
<tr>
|
285 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
286 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col" style="width: 16px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 16px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
291 |
+
</tr>
|
292 |
+
</thead>
|
293 |
+
|
294 |
+
<tfoot>
|
295 |
+
<tr>
|
296 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
297 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
298 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
302 |
+
</tr>
|
303 |
+
</tfoot>
|
304 |
+
|
305 |
+
<tbody>
|
306 |
+
<?php
|
307 |
+
$snippets = get_option($this->plugin_options);
|
308 |
+
if (!empty($snippets)) {
|
309 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
310 |
+
<tr class='recent'>
|
311 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<? echo $i; ?>' /></th>
|
312 |
+
<td class='row-title'><input type='text' name='<? echo $i; ?>_title' value='<? echo $snippets[$i]['title']; ?>' /></td>
|
313 |
+
<td class='name'><input type='text' name='<? echo $i; ?>_vars' value='<? echo $snippets[$i]['vars']; ?>' /></td>
|
314 |
+
<td class='desc'><textarea name="<? echo $i; ?>_snippet" class="large-text" rows="3"><? echo $snippets[$i]['snippet']; ?></textarea></td>
|
315 |
+
<td class='name'><input type='checkbox' name='<? echo $i; ?>_shortcode' value='true'<? if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<? echo $i; ?>_quicktag' value='true'<? if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
317 |
+
</tr>
|
318 |
+
<?php
|
319 |
+
}
|
320 |
+
}
|
321 |
+
?>
|
322 |
+
</tbody>
|
323 |
+
</table>
|
324 |
+
<div class="submit">
|
325 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
326 |
+
</form>
|
327 |
+
|
328 |
+
<div id="poststuff" class="ui-sortable">
|
329 |
+
<div class="postbox closed">
|
330 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
331 |
+
<div class="inside">
|
332 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
333 |
+
|
334 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
335 |
+
|
336 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
337 |
+
|
338 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
339 |
+
|
340 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
341 |
+
</div>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
|
345 |
+
<script type="text/javascript">
|
346 |
+
<!--
|
347 |
+
<?php global $wp_version; ?>
|
348 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
349 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
350 |
+
<?php } ?>
|
351 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
352 |
+
jQuery('.postbox.close-me').each(function(){
|
353 |
+
jQuery(this).addClass("closed");
|
354 |
+
});
|
355 |
+
//-->
|
356 |
+
</script>
|
357 |
+
</div>
|
358 |
+
<?php
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
363 |
+
?>
|
1.4.1/readme.txt
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.1
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
51 |
+
* Bugfix: Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
52 |
+
|
53 |
+
= Version 1.4 - 10 Apr 2009 =
|
54 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
55 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
56 |
+
|
57 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
58 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
59 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
60 |
+
|
61 |
+
= Version 1.3 - 2 Apr 2009 =
|
62 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
63 |
+
* Updated the Help info in the admin page to take less space.
|
64 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
65 |
+
|
66 |
+
= Version 1.2 - 1 Apr 2009 =
|
67 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
68 |
+
|
69 |
+
= Version 1.1 - 24 Mar 2009 =
|
70 |
+
* Included Swedish translation.
|
71 |
+
* Added TextDomain functionality for I18n.
|
72 |
+
|
73 |
+
= Version 1.0 - 23 Mar 2009 =
|
74 |
+
* Initial Release
|
1.4.1/screenshot-1.jpg
ADDED
Binary file
|
1.4.1/screenshot-2.jpg
ADDED
Binary file
|
1.4.1/screenshot-3.jpg
ADDED
Binary file
|
1.4.1/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4.1/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.1/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.1/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.1/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.1/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4.1/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<? echo $i; ?> = document.getElementById('ps_panel<? echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<? echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<? echo $snippets[$i]['title']; ?>", variables<? echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<? echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<? echo $i; ?>_<? echo $j; ?> = document.getElementById('var_<? echo $i; ?>_<? echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<? echo $var_arr[$j]; ?>\}/g, var_<? echo $i; ?>_<? echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<? echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<? echo $i; ?>','ps_panel<? echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<? echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<? echo $i; ?>_<? echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<? echo $i; ?>_<? echo $j; ?>" name="var_<? echo $i; ?>_<? echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.1/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.2/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.2/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.2/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.2/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.2/post-snippets.php
ADDED
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.2
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'.$snippets[$i]["snippet"].'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return "{$snippet}";') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" .$theSnippet. "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
echo '
|
166 |
+
}
|
167 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
168 |
+
theSnippet = \'[\' + shortcodeTag;
|
169 |
+
for (x in shortcodeAtts)
|
170 |
+
{
|
171 |
+
theSnippet += \' \' + shortcodeAtts[x] + \'="{\' + shortcodeAtts[x] + \'}"\';
|
172 |
+
}
|
173 |
+
theSnippet += \']\';
|
174 |
+
return theSnippet;
|
175 |
+
}
|
176 |
+
|
177 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
178 |
+
var myValue;
|
179 |
+
var insertString;
|
180 |
+
insertString = theSnippet;
|
181 |
+
for (x in theVariables)
|
182 |
+
{
|
183 |
+
myValue = prompt(theVariables[x]);
|
184 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
185 |
+
var re = new RegExp(searchfor, \'g\');
|
186 |
+
insertString = insertString.replace(re, myValue);
|
187 |
+
|
188 |
+
}
|
189 |
+
theSnippet = insertString;
|
190 |
+
if (theSnippet) {
|
191 |
+
edInsertContent(myField, theSnippet);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
//-->
|
195 |
+
</script>
|
196 |
+
';
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* The Admin Page and all it's functions
|
205 |
+
*
|
206 |
+
*/
|
207 |
+
function wp_admin() {
|
208 |
+
if (function_exists('add_options_page')) {
|
209 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
function admin_message($message) {
|
214 |
+
if ( $message ) {
|
215 |
+
?>
|
216 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
function options_page() {
|
222 |
+
// Add a new Snippet
|
223 |
+
if (isset($_POST['add-snippet'])) {
|
224 |
+
$snippets = get_option($this->plugin_options);
|
225 |
+
if (empty($snippets)) { $snippets = array(); }
|
226 |
+
array_push($snippets, array (
|
227 |
+
'title' => "Untitled",
|
228 |
+
'vars' => "",
|
229 |
+
'shortcode' => false,
|
230 |
+
'quicktag' => false,
|
231 |
+
'snippet' => ""));
|
232 |
+
update_option($this->plugin_options, $snippets);
|
233 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
234 |
+
}
|
235 |
+
|
236 |
+
// Update Snippets
|
237 |
+
if (isset($_POST['update-post-snippets'])) {
|
238 |
+
$snippets = get_option($this->plugin_options);
|
239 |
+
if (!empty($snippets)) {
|
240 |
+
for ($i=0; $i < count($snippets); $i++) {
|
241 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
242 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
243 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
244 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
245 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
246 |
+
}
|
247 |
+
update_option($this->plugin_options, $snippets);
|
248 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
// Delete Snippets
|
253 |
+
if (isset($_POST['delete-selected'])) {
|
254 |
+
$snippets = get_option($this->plugin_options);
|
255 |
+
if (!empty($snippets)) {
|
256 |
+
$delete = $_POST['checked'];
|
257 |
+
$newsnippets = array();
|
258 |
+
for ($i=0; $i < count($snippets); $i++) {
|
259 |
+
if (in_array($i,$delete) == false) {
|
260 |
+
array_push($newsnippets,$snippets[$i]);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
update_option($this->plugin_options, $newsnippets);
|
264 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
?>
|
268 |
+
<div class=wrap>
|
269 |
+
<h2>Post Snippets</h2>
|
270 |
+
|
271 |
+
<form method="post" action="">
|
272 |
+
<?php wp_nonce_field('update-options'); ?>
|
273 |
+
|
274 |
+
<div class="tablenav">
|
275 |
+
<div class="alignleft actions">
|
276 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
277 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
</div>
|
279 |
+
</div>
|
280 |
+
<div class="clear"></div>
|
281 |
+
|
282 |
+
<table class="widefat fixed" cellspacing="0">
|
283 |
+
<thead>
|
284 |
+
<tr>
|
285 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
286 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col" style="width: 16px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 16px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
291 |
+
</tr>
|
292 |
+
</thead>
|
293 |
+
|
294 |
+
<tfoot>
|
295 |
+
<tr>
|
296 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
297 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
298 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
302 |
+
</tr>
|
303 |
+
</tfoot>
|
304 |
+
|
305 |
+
<tbody>
|
306 |
+
<?php
|
307 |
+
$snippets = get_option($this->plugin_options);
|
308 |
+
if (!empty($snippets)) {
|
309 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
310 |
+
<tr class='recent'>
|
311 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
312 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
313 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
314 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo $snippets[$i]['snippet']; ?></textarea></td>
|
315 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
317 |
+
</tr>
|
318 |
+
<?php
|
319 |
+
}
|
320 |
+
}
|
321 |
+
?>
|
322 |
+
</tbody>
|
323 |
+
</table>
|
324 |
+
<div class="submit">
|
325 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
326 |
+
</form>
|
327 |
+
|
328 |
+
<div id="poststuff" class="ui-sortable">
|
329 |
+
<div class="postbox closed">
|
330 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
331 |
+
<div class="inside">
|
332 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
333 |
+
|
334 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
335 |
+
|
336 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
337 |
+
|
338 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
339 |
+
|
340 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
341 |
+
</div>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
|
345 |
+
<script type="text/javascript">
|
346 |
+
<!--
|
347 |
+
<?php global $wp_version; ?>
|
348 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
349 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
350 |
+
<?php } ?>
|
351 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
352 |
+
jQuery('.postbox.close-me').each(function(){
|
353 |
+
jQuery(this).addClass("closed");
|
354 |
+
});
|
355 |
+
//-->
|
356 |
+
</script>
|
357 |
+
</div>
|
358 |
+
<?php
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
363 |
+
?>
|
1.4.2/readme.txt
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.2
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
51 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting disabled.
|
52 |
+
|
53 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
54 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
55 |
+
|
56 |
+
= Version 1.4 - 10 Apr 2009 =
|
57 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
58 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
59 |
+
|
60 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
61 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
62 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
63 |
+
|
64 |
+
= Version 1.3 - 2 Apr 2009 =
|
65 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
66 |
+
* Updated the Help info in the admin page to take less space.
|
67 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
68 |
+
|
69 |
+
= Version 1.2 - 1 Apr 2009 =
|
70 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
71 |
+
|
72 |
+
= Version 1.1 - 24 Mar 2009 =
|
73 |
+
* Included Swedish translation.
|
74 |
+
* Added TextDomain functionality for I18n.
|
75 |
+
|
76 |
+
= Version 1.0 - 23 Mar 2009 =
|
77 |
+
* Initial Release
|
1.4.2/screenshot-1.jpg
ADDED
Binary file
|
1.4.2/screenshot-2.jpg
ADDED
Binary file
|
1.4.2/screenshot-3.jpg
ADDED
Binary file
|
1.4.2/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4.2/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.2/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.2/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.2/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.2/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4.2/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.2/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.3/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.3/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.3/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.3/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.3/post-snippets.php
ADDED
@@ -0,0 +1,364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.3
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.addslashes($snippets[$i]['snippet']).'\', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
// echo '
|
166 |
+
echo <<<JAVASCRIPT
|
167 |
+
}
|
168 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
169 |
+
theSnippet = '[' + shortcodeTag;
|
170 |
+
for (x in shortcodeAtts)
|
171 |
+
{
|
172 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
173 |
+
}
|
174 |
+
theSnippet += ']';
|
175 |
+
return theSnippet;
|
176 |
+
}
|
177 |
+
|
178 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
179 |
+
var myValue;
|
180 |
+
var insertString;
|
181 |
+
insertString = theSnippet;
|
182 |
+
for (x in theVariables)
|
183 |
+
{
|
184 |
+
myValue = prompt(theVariables[x]);
|
185 |
+
var searchfor = '{' + theVariables[x] + '}';
|
186 |
+
var re = new RegExp(searchfor, 'g');
|
187 |
+
insertString = insertString.replace(re, myValue);
|
188 |
+
|
189 |
+
}
|
190 |
+
theSnippet = insertString;
|
191 |
+
if (theSnippet) {
|
192 |
+
edInsertContent( myField, theSnippet );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
//-->
|
196 |
+
</script>
|
197 |
+
JAVASCRIPT;
|
198 |
+
}
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* The Admin Page and all it's functions
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function wp_admin() {
|
209 |
+
if (function_exists('add_options_page')) {
|
210 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function admin_message($message) {
|
215 |
+
if ( $message ) {
|
216 |
+
?>
|
217 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function options_page() {
|
223 |
+
// Add a new Snippet
|
224 |
+
if (isset($_POST['add-snippet'])) {
|
225 |
+
$snippets = get_option($this->plugin_options);
|
226 |
+
if (empty($snippets)) { $snippets = array(); }
|
227 |
+
array_push($snippets, array (
|
228 |
+
'title' => "Untitled",
|
229 |
+
'vars' => "",
|
230 |
+
'shortcode' => false,
|
231 |
+
'quicktag' => false,
|
232 |
+
'snippet' => ""));
|
233 |
+
update_option($this->plugin_options, $snippets);
|
234 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
// Update Snippets
|
238 |
+
if (isset($_POST['update-post-snippets'])) {
|
239 |
+
$snippets = get_option($this->plugin_options);
|
240 |
+
if (!empty($snippets)) {
|
241 |
+
for ($i=0; $i < count($snippets); $i++) {
|
242 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
243 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
244 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
245 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
246 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
247 |
+
}
|
248 |
+
update_option($this->plugin_options, $snippets);
|
249 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
// Delete Snippets
|
254 |
+
if (isset($_POST['delete-selected'])) {
|
255 |
+
$snippets = get_option($this->plugin_options);
|
256 |
+
if (!empty($snippets)) {
|
257 |
+
$delete = $_POST['checked'];
|
258 |
+
$newsnippets = array();
|
259 |
+
for ($i=0; $i < count($snippets); $i++) {
|
260 |
+
if (in_array($i,$delete) == false) {
|
261 |
+
array_push($newsnippets,$snippets[$i]);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
update_option($this->plugin_options, $newsnippets);
|
265 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
?>
|
269 |
+
<div class=wrap>
|
270 |
+
<h2>Post Snippets</h2>
|
271 |
+
|
272 |
+
<form method="post" action="">
|
273 |
+
<?php wp_nonce_field('update-options'); ?>
|
274 |
+
|
275 |
+
<div class="tablenav">
|
276 |
+
<div class="alignleft actions">
|
277 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
<div class="clear"></div>
|
282 |
+
|
283 |
+
<table class="widefat fixed" cellspacing="0">
|
284 |
+
<thead>
|
285 |
+
<tr>
|
286 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 16px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
291 |
+
<th scope="col" style="width: 16px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
292 |
+
</tr>
|
293 |
+
</thead>
|
294 |
+
|
295 |
+
<tfoot>
|
296 |
+
<tr>
|
297 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
298 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
303 |
+
</tr>
|
304 |
+
</tfoot>
|
305 |
+
|
306 |
+
<tbody>
|
307 |
+
<?php
|
308 |
+
$snippets = get_option($this->plugin_options);
|
309 |
+
if (!empty($snippets)) {
|
310 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
311 |
+
<tr class='recent'>
|
312 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
313 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
314 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
315 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo $snippets[$i]['snippet']; ?></textarea></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
317 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
318 |
+
</tr>
|
319 |
+
<?php
|
320 |
+
}
|
321 |
+
}
|
322 |
+
?>
|
323 |
+
</tbody>
|
324 |
+
</table>
|
325 |
+
<div class="submit">
|
326 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
327 |
+
</form>
|
328 |
+
|
329 |
+
<div id="poststuff" class="ui-sortable">
|
330 |
+
<div class="postbox closed">
|
331 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
332 |
+
<div class="inside">
|
333 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
334 |
+
|
335 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
336 |
+
|
337 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
338 |
+
|
339 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
340 |
+
|
341 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
|
346 |
+
<script type="text/javascript">
|
347 |
+
<!--
|
348 |
+
<?php global $wp_version; ?>
|
349 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
350 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
351 |
+
<?php } ?>
|
352 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
353 |
+
jQuery('.postbox.close-me').each(function(){
|
354 |
+
jQuery(this).addClass("closed");
|
355 |
+
});
|
356 |
+
//-->
|
357 |
+
</script>
|
358 |
+
</div>
|
359 |
+
<?php
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
364 |
+
?>
|
1.4.3/readme.txt
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.3
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
51 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
52 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
53 |
+
|
54 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
55 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
56 |
+
|
57 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
58 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
59 |
+
|
60 |
+
= Version 1.4 - 10 Apr 2009 =
|
61 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
62 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
63 |
+
|
64 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
65 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
66 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
67 |
+
|
68 |
+
= Version 1.3 - 2 Apr 2009 =
|
69 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
70 |
+
* Updated the Help info in the admin page to take less space.
|
71 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
72 |
+
|
73 |
+
= Version 1.2 - 1 Apr 2009 =
|
74 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
75 |
+
|
76 |
+
= Version 1.1 - 24 Mar 2009 =
|
77 |
+
* Included Swedish translation.
|
78 |
+
* Added TextDomain functionality for I18n.
|
79 |
+
|
80 |
+
= Version 1.0 - 23 Mar 2009 =
|
81 |
+
* Initial Release
|
1.4.3/screenshot-1.jpg
ADDED
Binary file
|
1.4.3/screenshot-2.jpg
ADDED
Binary file
|
1.4.3/screenshot-3.jpg
ADDED
Binary file
|
1.4.3/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4.3/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.3/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.3/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.3/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.3/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4.3/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.3/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.4/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.4/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.4/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.4/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.4/post-snippets.php
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.4
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
// echo '
|
166 |
+
echo <<<JAVASCRIPT
|
167 |
+
}
|
168 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
169 |
+
theSnippet = '[' + shortcodeTag;
|
170 |
+
for (x in shortcodeAtts)
|
171 |
+
{
|
172 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
173 |
+
}
|
174 |
+
theSnippet += ']';
|
175 |
+
return theSnippet;
|
176 |
+
}
|
177 |
+
|
178 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
179 |
+
var myValue;
|
180 |
+
var insertString;
|
181 |
+
insertString = theSnippet;
|
182 |
+
for (x in theVariables)
|
183 |
+
{
|
184 |
+
myValue = prompt(theVariables[x]);
|
185 |
+
var searchfor = '{' + theVariables[x] + '}';
|
186 |
+
var re = new RegExp(searchfor, 'g');
|
187 |
+
insertString = insertString.replace(re, myValue);
|
188 |
+
|
189 |
+
}
|
190 |
+
theSnippet = insertString;
|
191 |
+
if (theSnippet) {
|
192 |
+
edInsertContent( myField, theSnippet );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
//-->
|
196 |
+
</script>
|
197 |
+
JAVASCRIPT;
|
198 |
+
}
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* The Admin Page and all it's functions
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function wp_admin() {
|
209 |
+
if (function_exists('add_options_page')) {
|
210 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function admin_message($message) {
|
215 |
+
if ( $message ) {
|
216 |
+
?>
|
217 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function options_page() {
|
223 |
+
// Add a new Snippet
|
224 |
+
if (isset($_POST['add-snippet'])) {
|
225 |
+
$snippets = get_option($this->plugin_options);
|
226 |
+
if (empty($snippets)) { $snippets = array(); }
|
227 |
+
array_push($snippets, array (
|
228 |
+
'title' => "Untitled",
|
229 |
+
'vars' => "",
|
230 |
+
'shortcode' => false,
|
231 |
+
'quicktag' => false,
|
232 |
+
'snippet' => ""));
|
233 |
+
update_option($this->plugin_options, $snippets);
|
234 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
// Update Snippets
|
238 |
+
if (isset($_POST['update-post-snippets'])) {
|
239 |
+
$snippets = get_option($this->plugin_options);
|
240 |
+
if (!empty($snippets)) {
|
241 |
+
for ($i=0; $i < count($snippets); $i++) {
|
242 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
243 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
244 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
245 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
246 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
247 |
+
}
|
248 |
+
update_option($this->plugin_options, $snippets);
|
249 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
// Delete Snippets
|
254 |
+
if (isset($_POST['delete-selected'])) {
|
255 |
+
$snippets = get_option($this->plugin_options);
|
256 |
+
if (!empty($snippets)) {
|
257 |
+
$delete = $_POST['checked'];
|
258 |
+
$newsnippets = array();
|
259 |
+
for ($i=0; $i < count($snippets); $i++) {
|
260 |
+
if (in_array($i,$delete) == false) {
|
261 |
+
array_push($newsnippets,$snippets[$i]);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
update_option($this->plugin_options, $newsnippets);
|
265 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
?>
|
269 |
+
<div class=wrap>
|
270 |
+
<h2>Post Snippets</h2>
|
271 |
+
|
272 |
+
<form method="post" action="">
|
273 |
+
<?php wp_nonce_field('update-options'); ?>
|
274 |
+
|
275 |
+
<div class="tablenav">
|
276 |
+
<div class="alignleft actions">
|
277 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
<div class="clear"></div>
|
282 |
+
|
283 |
+
<table class="widefat fixed" cellspacing="0">
|
284 |
+
<thead>
|
285 |
+
<tr>
|
286 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 16px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
291 |
+
<th scope="col" style="width: 16px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
292 |
+
</tr>
|
293 |
+
</thead>
|
294 |
+
|
295 |
+
<tfoot>
|
296 |
+
<tr>
|
297 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
298 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
303 |
+
</tr>
|
304 |
+
</tfoot>
|
305 |
+
|
306 |
+
<tbody>
|
307 |
+
<?php
|
308 |
+
$snippets = get_option($this->plugin_options);
|
309 |
+
if (!empty($snippets)) {
|
310 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
311 |
+
<tr class='recent'>
|
312 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
313 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
314 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
315 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo $snippets[$i]['snippet']; ?></textarea></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
317 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
318 |
+
</tr>
|
319 |
+
<?php
|
320 |
+
}
|
321 |
+
}
|
322 |
+
?>
|
323 |
+
</tbody>
|
324 |
+
</table>
|
325 |
+
<div class="submit">
|
326 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
327 |
+
</form>
|
328 |
+
|
329 |
+
<div id="poststuff" class="ui-sortable">
|
330 |
+
<div class="postbox">
|
331 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
332 |
+
<div class="inside">
|
333 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
334 |
+
|
335 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
336 |
+
|
337 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
338 |
+
|
339 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
340 |
+
|
341 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
342 |
+
|
343 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
|
348 |
+
<script type="text/javascript">
|
349 |
+
<!--
|
350 |
+
<?php global $wp_version; ?>
|
351 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
352 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
353 |
+
<?php } ?>
|
354 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
355 |
+
jQuery('.postbox.close-me').each(function(){
|
356 |
+
jQuery(this).addClass("closed");
|
357 |
+
});
|
358 |
+
//-->
|
359 |
+
</script>
|
360 |
+
</div>
|
361 |
+
<?php
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
366 |
+
?>
|
1.4.4/readme.txt
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.4
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
51 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
52 |
+
|
53 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
54 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
55 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
56 |
+
|
57 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
58 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
59 |
+
|
60 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
61 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
62 |
+
|
63 |
+
= Version 1.4 - 10 Apr 2009 =
|
64 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
65 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
66 |
+
|
67 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
68 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
69 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
70 |
+
|
71 |
+
= Version 1.3 - 2 Apr 2009 =
|
72 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
73 |
+
* Updated the Help info in the admin page to take less space.
|
74 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
75 |
+
|
76 |
+
= Version 1.2 - 1 Apr 2009 =
|
77 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
78 |
+
|
79 |
+
= Version 1.1 - 24 Mar 2009 =
|
80 |
+
* Included Swedish translation.
|
81 |
+
* Added TextDomain functionality for I18n.
|
82 |
+
|
83 |
+
= Version 1.0 - 23 Mar 2009 =
|
84 |
+
* Initial Release
|
1.4.4/screenshot-1.jpg
ADDED
Binary file
|
1.4.4/screenshot-2.jpg
ADDED
Binary file
|
1.4.4/screenshot-3.jpg
ADDED
Binary file
|
1.4.4/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4.4/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.4/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.4/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.4/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.4/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4.4/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.4/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.5/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.5/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.5/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.5/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.5/post-snippets.php
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.5
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
// echo '
|
166 |
+
echo <<<JAVASCRIPT
|
167 |
+
}
|
168 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
169 |
+
theSnippet = '[' + shortcodeTag;
|
170 |
+
for (x in shortcodeAtts)
|
171 |
+
{
|
172 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
173 |
+
}
|
174 |
+
theSnippet += ']';
|
175 |
+
return theSnippet;
|
176 |
+
}
|
177 |
+
|
178 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
179 |
+
var myValue;
|
180 |
+
var insertString;
|
181 |
+
insertString = theSnippet;
|
182 |
+
for (x in theVariables)
|
183 |
+
{
|
184 |
+
myValue = prompt(theVariables[x]);
|
185 |
+
var searchfor = '{' + theVariables[x] + '}';
|
186 |
+
var re = new RegExp(searchfor, 'g');
|
187 |
+
insertString = insertString.replace(re, myValue);
|
188 |
+
|
189 |
+
}
|
190 |
+
theSnippet = insertString;
|
191 |
+
if (theSnippet) {
|
192 |
+
edInsertContent( myField, theSnippet );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
//-->
|
196 |
+
</script>
|
197 |
+
JAVASCRIPT;
|
198 |
+
}
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* The Admin Page and all it's functions
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function wp_admin() {
|
209 |
+
if (function_exists('add_options_page')) {
|
210 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function admin_message($message) {
|
215 |
+
if ( $message ) {
|
216 |
+
?>
|
217 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function options_page() {
|
223 |
+
// Add a new Snippet
|
224 |
+
if (isset($_POST['add-snippet'])) {
|
225 |
+
$snippets = get_option($this->plugin_options);
|
226 |
+
if (empty($snippets)) { $snippets = array(); }
|
227 |
+
array_push($snippets, array (
|
228 |
+
'title' => "Untitled",
|
229 |
+
'vars' => "",
|
230 |
+
'shortcode' => false,
|
231 |
+
'quicktag' => false,
|
232 |
+
'snippet' => ""));
|
233 |
+
update_option($this->plugin_options, $snippets);
|
234 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
// Update Snippets
|
238 |
+
if (isset($_POST['update-post-snippets'])) {
|
239 |
+
$snippets = get_option($this->plugin_options);
|
240 |
+
if (!empty($snippets)) {
|
241 |
+
for ($i=0; $i < count($snippets); $i++) {
|
242 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
243 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
244 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
245 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
246 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
247 |
+
}
|
248 |
+
update_option($this->plugin_options, $snippets);
|
249 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
// Delete Snippets
|
254 |
+
if (isset($_POST['delete-selected'])) {
|
255 |
+
$snippets = get_option($this->plugin_options);
|
256 |
+
if (!empty($snippets)) {
|
257 |
+
$delete = $_POST['checked'];
|
258 |
+
$newsnippets = array();
|
259 |
+
for ($i=0; $i < count($snippets); $i++) {
|
260 |
+
if (in_array($i,$delete) == false) {
|
261 |
+
array_push($newsnippets,$snippets[$i]);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
update_option($this->plugin_options, $newsnippets);
|
265 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
?>
|
269 |
+
<div class=wrap>
|
270 |
+
<h2>Post Snippets</h2>
|
271 |
+
|
272 |
+
<form method="post" action="">
|
273 |
+
<?php wp_nonce_field('update-options'); ?>
|
274 |
+
|
275 |
+
<div class="tablenav">
|
276 |
+
<div class="alignleft actions">
|
277 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
<div class="clear"></div>
|
282 |
+
|
283 |
+
<table class="widefat fixed" cellspacing="0">
|
284 |
+
<thead>
|
285 |
+
<tr>
|
286 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
291 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
292 |
+
</tr>
|
293 |
+
</thead>
|
294 |
+
|
295 |
+
<tfoot>
|
296 |
+
<tr>
|
297 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
298 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
303 |
+
</tr>
|
304 |
+
</tfoot>
|
305 |
+
|
306 |
+
<tbody>
|
307 |
+
<?php
|
308 |
+
$snippets = get_option($this->plugin_options);
|
309 |
+
if (!empty($snippets)) {
|
310 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
311 |
+
<tr class='recent'>
|
312 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
313 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
314 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
315 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
317 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
318 |
+
</tr>
|
319 |
+
<?php
|
320 |
+
}
|
321 |
+
}
|
322 |
+
?>
|
323 |
+
</tbody>
|
324 |
+
</table>
|
325 |
+
<div class="submit">
|
326 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
327 |
+
</form>
|
328 |
+
|
329 |
+
<div id="poststuff" class="ui-sortable">
|
330 |
+
<div class="postbox">
|
331 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
332 |
+
<div class="inside">
|
333 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
334 |
+
|
335 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
336 |
+
|
337 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
338 |
+
|
339 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
340 |
+
|
341 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
342 |
+
|
343 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
|
348 |
+
<script type="text/javascript">
|
349 |
+
<!--
|
350 |
+
<?php global $wp_version; ?>
|
351 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
352 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
353 |
+
<?php } ?>
|
354 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
355 |
+
jQuery('.postbox.close-me').each(function(){
|
356 |
+
jQuery(this).addClass("closed");
|
357 |
+
});
|
358 |
+
//-->
|
359 |
+
</script>
|
360 |
+
</div>
|
361 |
+
<?php
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
366 |
+
?>
|
1.4.5/readme.txt
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.5
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
51 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
52 |
+
* Widened the columns for SC and QT sligtly in the options panel so they should look a bit better on the mac.
|
53 |
+
|
54 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
55 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
56 |
+
|
57 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
58 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
59 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
60 |
+
|
61 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
62 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
63 |
+
|
64 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
65 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
66 |
+
|
67 |
+
= Version 1.4 - 10 Apr 2009 =
|
68 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
69 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
70 |
+
|
71 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
72 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
73 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
74 |
+
|
75 |
+
= Version 1.3 - 2 Apr 2009 =
|
76 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
77 |
+
* Updated the Help info in the admin page to take less space.
|
78 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
79 |
+
|
80 |
+
= Version 1.2 - 1 Apr 2009 =
|
81 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
82 |
+
|
83 |
+
= Version 1.1 - 24 Mar 2009 =
|
84 |
+
* Included Swedish translation.
|
85 |
+
* Added TextDomain functionality for I18n.
|
86 |
+
|
87 |
+
= Version 1.0 - 23 Mar 2009 =
|
88 |
+
* Initial Release
|
1.4.5/screenshot-1.jpg
ADDED
Binary file
|
1.4.5/screenshot-2.jpg
ADDED
Binary file
|
1.4.5/screenshot-3.jpg
ADDED
Binary file
|
1.4.5/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4.5/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.5/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.5/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.5/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.5/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4.5/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.5/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.6/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.6/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.6/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.6/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.6/post-snippets.php
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.6
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
// echo '
|
166 |
+
echo <<<JAVASCRIPT
|
167 |
+
}
|
168 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
169 |
+
theSnippet = '[' + shortcodeTag;
|
170 |
+
for (x in shortcodeAtts)
|
171 |
+
{
|
172 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
173 |
+
}
|
174 |
+
theSnippet += ']';
|
175 |
+
return theSnippet;
|
176 |
+
}
|
177 |
+
|
178 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
179 |
+
var myValue;
|
180 |
+
var insertString;
|
181 |
+
insertString = theSnippet;
|
182 |
+
for (x in theVariables)
|
183 |
+
{
|
184 |
+
myValue = prompt(theVariables[x]);
|
185 |
+
var searchfor = '{' + theVariables[x] + '}';
|
186 |
+
var re = new RegExp(searchfor, 'g');
|
187 |
+
insertString = insertString.replace(re, myValue);
|
188 |
+
|
189 |
+
}
|
190 |
+
theSnippet = insertString;
|
191 |
+
if (theSnippet) {
|
192 |
+
edInsertContent( myField, theSnippet );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
//-->
|
196 |
+
</script>
|
197 |
+
JAVASCRIPT;
|
198 |
+
}
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* The Admin Page and all it's functions
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function wp_admin() {
|
209 |
+
if (function_exists('add_options_page')) {
|
210 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function admin_message($message) {
|
215 |
+
if ( $message ) {
|
216 |
+
?>
|
217 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function options_page() {
|
223 |
+
// Add a new Snippet
|
224 |
+
if (isset($_POST['add-snippet'])) {
|
225 |
+
$snippets = get_option($this->plugin_options);
|
226 |
+
if (empty($snippets)) { $snippets = array(); }
|
227 |
+
array_push($snippets, array (
|
228 |
+
'title' => "Untitled",
|
229 |
+
'vars' => "",
|
230 |
+
'shortcode' => false,
|
231 |
+
'quicktag' => false,
|
232 |
+
'snippet' => ""));
|
233 |
+
update_option($this->plugin_options, $snippets);
|
234 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
// Update Snippets
|
238 |
+
if (isset($_POST['update-post-snippets'])) {
|
239 |
+
$snippets = get_option($this->plugin_options);
|
240 |
+
if (!empty($snippets)) {
|
241 |
+
for ($i=0; $i < count($snippets); $i++) {
|
242 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
243 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
244 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
245 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
246 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
247 |
+
}
|
248 |
+
update_option($this->plugin_options, $snippets);
|
249 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
// Delete Snippets
|
254 |
+
if (isset($_POST['delete-selected'])) {
|
255 |
+
$snippets = get_option($this->plugin_options);
|
256 |
+
if (!empty($snippets)) {
|
257 |
+
$delete = $_POST['checked'];
|
258 |
+
$newsnippets = array();
|
259 |
+
for ($i=0; $i < count($snippets); $i++) {
|
260 |
+
if (in_array($i,$delete) == false) {
|
261 |
+
array_push($newsnippets,$snippets[$i]);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
update_option($this->plugin_options, $newsnippets);
|
265 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
?>
|
269 |
+
<div class=wrap>
|
270 |
+
<h2>Post Snippets</h2>
|
271 |
+
|
272 |
+
<form method="post" action="">
|
273 |
+
<?php wp_nonce_field('update-options'); ?>
|
274 |
+
|
275 |
+
<div class="tablenav">
|
276 |
+
<div class="alignleft actions">
|
277 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
<div class="clear"></div>
|
282 |
+
|
283 |
+
<table class="widefat fixed" cellspacing="0">
|
284 |
+
<thead>
|
285 |
+
<tr>
|
286 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
291 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
292 |
+
</tr>
|
293 |
+
</thead>
|
294 |
+
|
295 |
+
<tfoot>
|
296 |
+
<tr>
|
297 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
298 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
303 |
+
</tr>
|
304 |
+
</tfoot>
|
305 |
+
|
306 |
+
<tbody>
|
307 |
+
<?php
|
308 |
+
$snippets = get_option($this->plugin_options);
|
309 |
+
if (!empty($snippets)) {
|
310 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
311 |
+
<tr class='recent'>
|
312 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
313 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
314 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
315 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
317 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
318 |
+
</tr>
|
319 |
+
<?php
|
320 |
+
}
|
321 |
+
}
|
322 |
+
?>
|
323 |
+
</tbody>
|
324 |
+
</table>
|
325 |
+
<div class="submit">
|
326 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
327 |
+
</form>
|
328 |
+
|
329 |
+
<div id="poststuff" class="ui-sortable">
|
330 |
+
<div class="postbox">
|
331 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
332 |
+
<div class="inside">
|
333 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
334 |
+
|
335 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
336 |
+
|
337 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
338 |
+
|
339 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
340 |
+
|
341 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
342 |
+
|
343 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
|
348 |
+
<script type="text/javascript">
|
349 |
+
<!--
|
350 |
+
<?php global $wp_version; ?>
|
351 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
352 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
353 |
+
<?php } ?>
|
354 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
355 |
+
jQuery('.postbox.close-me').each(function(){
|
356 |
+
jQuery(this).addClass("closed");
|
357 |
+
});
|
358 |
+
//-->
|
359 |
+
</script>
|
360 |
+
</div>
|
361 |
+
<?php
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
366 |
+
?>
|
1.4.6/readme.txt
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.6
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
51 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
52 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
53 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
54 |
+
* Added additional proofing for the variables string.
|
55 |
+
|
56 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
57 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
58 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
59 |
+
|
60 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
61 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
62 |
+
|
63 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
64 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
65 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
66 |
+
|
67 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
68 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
69 |
+
|
70 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
71 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
72 |
+
|
73 |
+
= Version 1.4 - 10 Apr 2009 =
|
74 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
75 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
76 |
+
|
77 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
78 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
79 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
80 |
+
|
81 |
+
= Version 1.3 - 2 Apr 2009 =
|
82 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
83 |
+
* Updated the Help info in the admin page to take less space.
|
84 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
85 |
+
|
86 |
+
= Version 1.2 - 1 Apr 2009 =
|
87 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
88 |
+
|
89 |
+
= Version 1.1 - 24 Mar 2009 =
|
90 |
+
* Included Swedish translation.
|
91 |
+
* Added TextDomain functionality for I18n.
|
92 |
+
|
93 |
+
= Version 1.0 - 23 Mar 2009 =
|
94 |
+
* Initial Release
|
1.4.6/screenshot-1.jpg
ADDED
Binary file
|
1.4.6/screenshot-2.jpg
ADDED
Binary file
|
1.4.6/screenshot-3.jpg
ADDED
Binary file
|
1.4.6/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.4.6/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.6/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.6/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.6/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.6/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.4.6/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($post_snippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($post_snippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="post_snippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($post_snippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($post_snippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.6/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.7/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.7/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.7/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.7/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4.7/post-snippets.php
ADDED
@@ -0,0 +1,376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.7
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
// echo '
|
166 |
+
echo <<<JAVASCRIPT
|
167 |
+
}
|
168 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
169 |
+
theSnippet = '[' + shortcodeTag;
|
170 |
+
for (x in shortcodeAtts)
|
171 |
+
{
|
172 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
173 |
+
}
|
174 |
+
theSnippet += ']';
|
175 |
+
return theSnippet;
|
176 |
+
}
|
177 |
+
|
178 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
179 |
+
var myValue;
|
180 |
+
var insertString;
|
181 |
+
insertString = theSnippet;
|
182 |
+
for (x in theVariables)
|
183 |
+
{
|
184 |
+
myValue = prompt(theVariables[x]);
|
185 |
+
var searchfor = '{' + theVariables[x] + '}';
|
186 |
+
var re = new RegExp(searchfor, 'g');
|
187 |
+
insertString = insertString.replace(re, myValue);
|
188 |
+
|
189 |
+
}
|
190 |
+
theSnippet = insertString;
|
191 |
+
if (theSnippet) {
|
192 |
+
edInsertContent( myField, theSnippet );
|
193 |
+
}
|
194 |
+
}
|
195 |
+
//-->
|
196 |
+
</script>
|
197 |
+
JAVASCRIPT;
|
198 |
+
}
|
199 |
+
break;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* The Admin Page and all it's functions
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function wp_admin() {
|
209 |
+
if (function_exists('add_options_page')) {
|
210 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function admin_message($message) {
|
215 |
+
if ( $message ) {
|
216 |
+
?>
|
217 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function options_page() {
|
223 |
+
// Add a new Snippet
|
224 |
+
if (isset($_POST['add-snippet'])) {
|
225 |
+
$snippets = get_option($this->plugin_options);
|
226 |
+
if (empty($snippets)) { $snippets = array(); }
|
227 |
+
array_push($snippets, array (
|
228 |
+
'title' => "Untitled",
|
229 |
+
'vars' => "",
|
230 |
+
'shortcode' => false,
|
231 |
+
'quicktag' => false,
|
232 |
+
'snippet' => ""));
|
233 |
+
update_option($this->plugin_options, $snippets);
|
234 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
// Update Snippets
|
238 |
+
if (isset($_POST['update-post-snippets'])) {
|
239 |
+
$snippets = get_option($this->plugin_options);
|
240 |
+
if (!empty($snippets)) {
|
241 |
+
for ($i=0; $i < count($snippets); $i++) {
|
242 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
243 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
244 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
245 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
246 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
247 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
248 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
249 |
+
the plugin work correctly on PHP versions below 5.1.
|
250 |
+
This problem is fixed in WP 2.8.
|
251 |
+
*/
|
252 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
253 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
254 |
+
} else {
|
255 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
update_option($this->plugin_options, $snippets);
|
259 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
// Delete Snippets
|
264 |
+
if (isset($_POST['delete-selected'])) {
|
265 |
+
$snippets = get_option($this->plugin_options);
|
266 |
+
if (!empty($snippets)) {
|
267 |
+
$delete = $_POST['checked'];
|
268 |
+
$newsnippets = array();
|
269 |
+
for ($i=0; $i < count($snippets); $i++) {
|
270 |
+
if (in_array($i,$delete) == false) {
|
271 |
+
array_push($newsnippets,$snippets[$i]);
|
272 |
+
}
|
273 |
+
}
|
274 |
+
update_option($this->plugin_options, $newsnippets);
|
275 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
276 |
+
}
|
277 |
+
}
|
278 |
+
?>
|
279 |
+
<div class=wrap>
|
280 |
+
<h2>Post Snippets</h2>
|
281 |
+
|
282 |
+
<form method="post" action="">
|
283 |
+
<?php wp_nonce_field('update-options'); ?>
|
284 |
+
|
285 |
+
<div class="tablenav">
|
286 |
+
<div class="alignleft actions">
|
287 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
288 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
289 |
+
</div>
|
290 |
+
</div>
|
291 |
+
<div class="clear"></div>
|
292 |
+
|
293 |
+
<table class="widefat fixed" cellspacing="0">
|
294 |
+
<thead>
|
295 |
+
<tr>
|
296 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
297 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
298 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
302 |
+
</tr>
|
303 |
+
</thead>
|
304 |
+
|
305 |
+
<tfoot>
|
306 |
+
<tr>
|
307 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
308 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
309 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
310 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
311 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
312 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
313 |
+
</tr>
|
314 |
+
</tfoot>
|
315 |
+
|
316 |
+
<tbody>
|
317 |
+
<?php
|
318 |
+
$snippets = get_option($this->plugin_options);
|
319 |
+
if (!empty($snippets)) {
|
320 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
321 |
+
<tr class='recent'>
|
322 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
323 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
324 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
325 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
326 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
327 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
328 |
+
</tr>
|
329 |
+
<?php
|
330 |
+
}
|
331 |
+
}
|
332 |
+
?>
|
333 |
+
</tbody>
|
334 |
+
</table>
|
335 |
+
<div class="submit">
|
336 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
337 |
+
</form>
|
338 |
+
|
339 |
+
<div id="poststuff" class="ui-sortable">
|
340 |
+
<div class="postbox">
|
341 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
342 |
+
<div class="inside">
|
343 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
344 |
+
|
345 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
346 |
+
|
347 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
348 |
+
|
349 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
350 |
+
|
351 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
352 |
+
|
353 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
354 |
+
</div>
|
355 |
+
</div>
|
356 |
+
</div>
|
357 |
+
|
358 |
+
<script type="text/javascript">
|
359 |
+
<!--
|
360 |
+
<?php global $wp_version; ?>
|
361 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
362 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
363 |
+
<?php } ?>
|
364 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
365 |
+
jQuery('.postbox.close-me').each(function(){
|
366 |
+
jQuery(this).addClass("closed");
|
367 |
+
});
|
368 |
+
//-->
|
369 |
+
</script>
|
370 |
+
</div>
|
371 |
+
<?php
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
376 |
+
?>
|
1.4.7/readme.txt
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.7
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
51 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
52 |
+
|
53 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
54 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
55 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
56 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
57 |
+
* Added additional proofing for the variables string.
|
58 |
+
|
59 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
60 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
61 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
62 |
+
|
63 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
64 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
65 |
+
|
66 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
67 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
68 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
69 |
+
|
70 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
71 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
72 |
+
|
73 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
74 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
75 |
+
|
76 |
+
= Version 1.4 - 10 Apr 2009 =
|
77 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
78 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
79 |
+
|
80 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
81 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
82 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
83 |
+
|
84 |
+
= Version 1.3 - 2 Apr 2009 =
|
85 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
86 |
+
* Updated the Help info in the admin page to take less space.
|
87 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
88 |
+
|
89 |
+
= Version 1.2 - 1 Apr 2009 =
|
90 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
91 |
+
|
92 |
+
= Version 1.1 - 24 Mar 2009 =
|
93 |
+
* Included Swedish translation.
|
94 |
+
* Added TextDomain functionality for I18n.
|
95 |
+
|
96 |
+
= Version 1.0 - 23 Mar 2009 =
|
97 |
+
* Initial Release
|
1.4.7/screenshot-1.jpg
ADDED
Binary file
|
1.4.7/screenshot-2.jpg
ADDED
Binary file
|
1.4.7/screenshot-3.jpg
ADDED
Binary file
|
1.4.7/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.4.7/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.7/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.7/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.7/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.7/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.4.7/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($post_snippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($post_snippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?php echo $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="post_snippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($post_snippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($post_snippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4.7/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.8/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.8/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.8/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.8/post-snippets.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.8
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
130 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
131 |
+
$theVariables = "";
|
132 |
+
if (!empty($var_arr[0])) {
|
133 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
134 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
135 |
+
if ( $j < (count($var_arr) -1) )
|
136 |
+
$theVariables = $theVariables . ", ";
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($snippets[$i]['shortcode']) {
|
142 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
143 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
144 |
+
}else{
|
145 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
146 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
147 |
+
}
|
148 |
+
echo '
|
149 |
+
postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
164 |
+
';
|
165 |
+
} // End if
|
166 |
+
} // Next
|
167 |
+
// echo '
|
168 |
+
echo <<<JAVASCRIPT
|
169 |
+
}
|
170 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
171 |
+
theSnippet = '[' + shortcodeTag;
|
172 |
+
for (x in shortcodeAtts)
|
173 |
+
{
|
174 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
175 |
+
}
|
176 |
+
theSnippet += ']';
|
177 |
+
return theSnippet;
|
178 |
+
}
|
179 |
+
|
180 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
181 |
+
var myValue;
|
182 |
+
var insertString;
|
183 |
+
insertString = theSnippet;
|
184 |
+
for (x in theVariables)
|
185 |
+
{
|
186 |
+
myValue = prompt(theVariables[x]);
|
187 |
+
var searchfor = '{' + theVariables[x] + '}';
|
188 |
+
var re = new RegExp(searchfor, 'g');
|
189 |
+
insertString = insertString.replace(re, myValue);
|
190 |
+
|
191 |
+
}
|
192 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
193 |
+
theSnippet = insertString;
|
194 |
+
if (theSnippet) {
|
195 |
+
edInsertContent( myField, theSnippet );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
//-->
|
199 |
+
</script>
|
200 |
+
JAVASCRIPT;
|
201 |
+
}
|
202 |
+
break;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* The Admin Page and all it's functions
|
209 |
+
*
|
210 |
+
*/
|
211 |
+
function wp_admin() {
|
212 |
+
if (function_exists('add_options_page')) {
|
213 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
function admin_message($message) {
|
218 |
+
if ( $message ) {
|
219 |
+
?>
|
220 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
function options_page() {
|
226 |
+
// Add a new Snippet
|
227 |
+
if (isset($_POST['add-snippet'])) {
|
228 |
+
$snippets = get_option($this->plugin_options);
|
229 |
+
if (empty($snippets)) { $snippets = array(); }
|
230 |
+
array_push($snippets, array (
|
231 |
+
'title' => "Untitled",
|
232 |
+
'vars' => "",
|
233 |
+
'shortcode' => false,
|
234 |
+
'quicktag' => false,
|
235 |
+
'snippet' => ""));
|
236 |
+
update_option($this->plugin_options, $snippets);
|
237 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
238 |
+
}
|
239 |
+
|
240 |
+
// Update Snippets
|
241 |
+
if (isset($_POST['update-post-snippets'])) {
|
242 |
+
$snippets = get_option($this->plugin_options);
|
243 |
+
if (!empty($snippets)) {
|
244 |
+
for ($i=0; $i < count($snippets); $i++) {
|
245 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
246 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
247 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
248 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
249 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
250 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
251 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
252 |
+
the plugin work correctly on PHP versions below 5.1.
|
253 |
+
This problem is fixed in WP 2.8.
|
254 |
+
*/
|
255 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
256 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
257 |
+
} else {
|
258 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
update_option($this->plugin_options, $snippets);
|
262 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
// Delete Snippets
|
267 |
+
if (isset($_POST['delete-selected'])) {
|
268 |
+
$snippets = get_option($this->plugin_options);
|
269 |
+
if (!empty($snippets)) {
|
270 |
+
$delete = $_POST['checked'];
|
271 |
+
$newsnippets = array();
|
272 |
+
for ($i=0; $i < count($snippets); $i++) {
|
273 |
+
if (in_array($i,$delete) == false) {
|
274 |
+
array_push($newsnippets,$snippets[$i]);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
update_option($this->plugin_options, $newsnippets);
|
278 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
<div class=wrap>
|
283 |
+
<h2>Post Snippets</h2>
|
284 |
+
|
285 |
+
<form method="post" action="">
|
286 |
+
<?php wp_nonce_field('update-options'); ?>
|
287 |
+
|
288 |
+
<div class="tablenav">
|
289 |
+
<div class="alignleft actions">
|
290 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
291 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
292 |
+
</div>
|
293 |
+
</div>
|
294 |
+
<div class="clear"></div>
|
295 |
+
|
296 |
+
<table class="widefat fixed" cellspacing="0">
|
297 |
+
<thead>
|
298 |
+
<tr>
|
299 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
300 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
303 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
304 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
305 |
+
</tr>
|
306 |
+
</thead>
|
307 |
+
|
308 |
+
<tfoot>
|
309 |
+
<tr>
|
310 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
311 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
312 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
313 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
314 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
315 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
316 |
+
</tr>
|
317 |
+
</tfoot>
|
318 |
+
|
319 |
+
<tbody>
|
320 |
+
<?php
|
321 |
+
$snippets = get_option($this->plugin_options);
|
322 |
+
if (!empty($snippets)) {
|
323 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
324 |
+
<tr class='recent'>
|
325 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
326 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
327 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
328 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
329 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
330 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
331 |
+
</tr>
|
332 |
+
<?php
|
333 |
+
}
|
334 |
+
}
|
335 |
+
?>
|
336 |
+
</tbody>
|
337 |
+
</table>
|
338 |
+
<div class="submit">
|
339 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
340 |
+
</form>
|
341 |
+
|
342 |
+
<div id="poststuff" class="ui-sortable">
|
343 |
+
<div class="postbox">
|
344 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
345 |
+
<div class="inside">
|
346 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
347 |
+
|
348 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
349 |
+
|
350 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
351 |
+
|
352 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
353 |
+
|
354 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
355 |
+
|
356 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
357 |
+
</div>
|
358 |
+
</div>
|
359 |
+
</div>
|
360 |
+
|
361 |
+
<script type="text/javascript">
|
362 |
+
<!--
|
363 |
+
<?php global $wp_version; ?>
|
364 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
365 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
366 |
+
<?php } ?>
|
367 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
368 |
+
jQuery('.postbox.close-me').each(function(){
|
369 |
+
jQuery(this).addClass("closed");
|
370 |
+
});
|
371 |
+
//-->
|
372 |
+
</script>
|
373 |
+
</div>
|
374 |
+
<?php
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
379 |
+
?>
|
1.4.8/readme.txt
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4.8
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new.
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://coding.cglounge.com/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.4.8 - 9 May 2009 =
|
56 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
57 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
58 |
+
|
59 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
60 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
61 |
+
|
62 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
63 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
64 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
65 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
66 |
+
* Added additional proofing for the variables string.
|
67 |
+
|
68 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
69 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
70 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
71 |
+
|
72 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
73 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
74 |
+
|
75 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
76 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
77 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
78 |
+
|
79 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
80 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
81 |
+
|
82 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
83 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
84 |
+
|
85 |
+
= Version 1.4 - 10 Apr 2009 =
|
86 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
87 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
88 |
+
|
89 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
90 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
91 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
92 |
+
|
93 |
+
= Version 1.3 - 2 Apr 2009 =
|
94 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
95 |
+
* Updated the Help info in the admin page to take less space.
|
96 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
97 |
+
|
98 |
+
= Version 1.2 - 1 Apr 2009 =
|
99 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
100 |
+
|
101 |
+
= Version 1.1 - 24 Mar 2009 =
|
102 |
+
* Included Swedish translation.
|
103 |
+
* Added TextDomain functionality for I18n.
|
104 |
+
|
105 |
+
= Version 1.0 - 23 Mar 2009 =
|
106 |
+
* Initial Release
|
1.4.8/screenshot-1.jpg
ADDED
Binary file
|
1.4.8/screenshot-2.jpg
ADDED
Binary file
|
1.4.8/screenshot-3.jpg
ADDED
Binary file
|
1.4.8/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.4.8/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.8/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.8/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.8/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.8/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.4.8/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.4.8/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
{lang → 1.4.9.1/languages}/post-snippets-fr_FR.mo
RENAMED
File without changes
|
1.4.9.1/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.4.9.1/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.4.9.1/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.4.9.1/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.9.1/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.9.1/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.9.1/post-snippets.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.9.1
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
130 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
131 |
+
$theVariables = "";
|
132 |
+
if (!empty($var_arr[0])) {
|
133 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
134 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
135 |
+
if ( $j < (count($var_arr) -1) )
|
136 |
+
$theVariables = $theVariables . ", ";
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($snippets[$i]['shortcode']) {
|
142 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
143 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
144 |
+
}else{
|
145 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
146 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
147 |
+
}
|
148 |
+
echo '
|
149 |
+
postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
164 |
+
';
|
165 |
+
} // End if
|
166 |
+
} // Next
|
167 |
+
// echo '
|
168 |
+
echo <<<JAVASCRIPT
|
169 |
+
}
|
170 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
171 |
+
theSnippet = '[' + shortcodeTag;
|
172 |
+
for (x in shortcodeAtts)
|
173 |
+
{
|
174 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
175 |
+
}
|
176 |
+
theSnippet += ']';
|
177 |
+
return theSnippet;
|
178 |
+
}
|
179 |
+
|
180 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
181 |
+
var myValue;
|
182 |
+
var insertString;
|
183 |
+
insertString = theSnippet;
|
184 |
+
for (x in theVariables)
|
185 |
+
{
|
186 |
+
myValue = prompt(theVariables[x]);
|
187 |
+
var searchfor = '{' + theVariables[x] + '}';
|
188 |
+
var re = new RegExp(searchfor, 'g');
|
189 |
+
insertString = insertString.replace(re, myValue);
|
190 |
+
|
191 |
+
}
|
192 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
193 |
+
theSnippet = insertString;
|
194 |
+
if (theSnippet) {
|
195 |
+
edInsertContent( myField, theSnippet );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
//-->
|
199 |
+
</script>
|
200 |
+
JAVASCRIPT;
|
201 |
+
}
|
202 |
+
break;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* The Admin Page and all it's functions
|
209 |
+
*
|
210 |
+
*/
|
211 |
+
function wp_admin() {
|
212 |
+
if (function_exists('add_options_page')) {
|
213 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
function admin_message($message) {
|
218 |
+
if ( $message ) {
|
219 |
+
?>
|
220 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
function options_page() {
|
226 |
+
// Add a new Snippet
|
227 |
+
if (isset($_POST['add-snippet'])) {
|
228 |
+
$snippets = get_option($this->plugin_options);
|
229 |
+
if (empty($snippets)) { $snippets = array(); }
|
230 |
+
array_push($snippets, array (
|
231 |
+
'title' => "Untitled",
|
232 |
+
'vars' => "",
|
233 |
+
'shortcode' => false,
|
234 |
+
'quicktag' => false,
|
235 |
+
'snippet' => ""));
|
236 |
+
update_option($this->plugin_options, $snippets);
|
237 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
238 |
+
}
|
239 |
+
|
240 |
+
// Update Snippets
|
241 |
+
if (isset($_POST['update-post-snippets'])) {
|
242 |
+
$snippets = get_option($this->plugin_options);
|
243 |
+
if (!empty($snippets)) {
|
244 |
+
for ($i=0; $i < count($snippets); $i++) {
|
245 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
246 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
247 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
248 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
249 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
250 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
251 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
252 |
+
the plugin work correctly on PHP versions below 5.1.
|
253 |
+
This problem is fixed in WP 2.8.
|
254 |
+
*/
|
255 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
256 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
257 |
+
} else {
|
258 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
update_option($this->plugin_options, $snippets);
|
262 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
// Delete Snippets
|
267 |
+
if (isset($_POST['delete-selected'])) {
|
268 |
+
$snippets = get_option($this->plugin_options);
|
269 |
+
if (!empty($snippets)) {
|
270 |
+
$delete = $_POST['checked'];
|
271 |
+
$newsnippets = array();
|
272 |
+
for ($i=0; $i < count($snippets); $i++) {
|
273 |
+
if (in_array($i,$delete) == false) {
|
274 |
+
array_push($newsnippets,$snippets[$i]);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
update_option($this->plugin_options, $newsnippets);
|
278 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
<div class=wrap>
|
283 |
+
<h2>Post Snippets</h2>
|
284 |
+
|
285 |
+
<form method="post" action="">
|
286 |
+
<?php wp_nonce_field('update-options'); ?>
|
287 |
+
|
288 |
+
<div class="tablenav">
|
289 |
+
<div class="alignleft actions">
|
290 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
291 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
292 |
+
</div>
|
293 |
+
</div>
|
294 |
+
<div class="clear"></div>
|
295 |
+
|
296 |
+
<table class="widefat fixed" cellspacing="0">
|
297 |
+
<thead>
|
298 |
+
<tr>
|
299 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
300 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
303 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
304 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
305 |
+
</tr>
|
306 |
+
</thead>
|
307 |
+
|
308 |
+
<tfoot>
|
309 |
+
<tr>
|
310 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
311 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
312 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
313 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
314 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
315 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
316 |
+
</tr>
|
317 |
+
</tfoot>
|
318 |
+
|
319 |
+
<tbody>
|
320 |
+
<?php
|
321 |
+
$snippets = get_option($this->plugin_options);
|
322 |
+
if (!empty($snippets)) {
|
323 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
324 |
+
<tr class='recent'>
|
325 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
326 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
327 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
328 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
329 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
330 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
331 |
+
</tr>
|
332 |
+
<?php
|
333 |
+
}
|
334 |
+
}
|
335 |
+
?>
|
336 |
+
</tbody>
|
337 |
+
</table>
|
338 |
+
<div class="submit">
|
339 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
340 |
+
</form>
|
341 |
+
|
342 |
+
<div id="poststuff" class="ui-sortable">
|
343 |
+
<div class="postbox">
|
344 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
345 |
+
<div class="inside">
|
346 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
347 |
+
|
348 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
349 |
+
|
350 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
351 |
+
|
352 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
353 |
+
|
354 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
355 |
+
|
356 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
357 |
+
</div>
|
358 |
+
</div>
|
359 |
+
</div>
|
360 |
+
|
361 |
+
<script type="text/javascript">
|
362 |
+
<!--
|
363 |
+
<?php global $wp_version; ?>
|
364 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
365 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
366 |
+
<?php } ?>
|
367 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
368 |
+
jQuery('.postbox.close-me').each(function(){
|
369 |
+
jQuery(this).addClass("closed");
|
370 |
+
});
|
371 |
+
//-->
|
372 |
+
</script>
|
373 |
+
</div>
|
374 |
+
<?php
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
379 |
+
?>
|
1.4.9.1/readme.txt
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.8.4
|
7 |
+
Stable tag: 1.4.9.1
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://coding.cglounge.com/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://coding.cglounge.com/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
56 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
57 |
+
|
58 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
59 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
60 |
+
|
61 |
+
= Version 1.4.8 - 9 May 2009 =
|
62 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
63 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
64 |
+
|
65 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
66 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
67 |
+
|
68 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
69 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
70 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
71 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
72 |
+
* Added additional proofing for the variables string.
|
73 |
+
|
74 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
75 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
76 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
77 |
+
|
78 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
79 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
80 |
+
|
81 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
82 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
83 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
84 |
+
|
85 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
86 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
87 |
+
|
88 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
89 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
90 |
+
|
91 |
+
= Version 1.4 - 10 Apr 2009 =
|
92 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
93 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
94 |
+
|
95 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
96 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
97 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
98 |
+
|
99 |
+
= Version 1.3 - 2 Apr 2009 =
|
100 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
101 |
+
* Updated the Help info in the admin page to take less space.
|
102 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
103 |
+
|
104 |
+
= Version 1.2 - 1 Apr 2009 =
|
105 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
106 |
+
|
107 |
+
= Version 1.1 - 24 Mar 2009 =
|
108 |
+
* Included Swedish translation.
|
109 |
+
* Added TextDomain functionality for I18n.
|
110 |
+
|
111 |
+
= Version 1.0 - 23 Mar 2009 =
|
112 |
+
* Initial Release
|
1.4.9.1/screenshot-1.jpg
ADDED
Binary file
|
1.4.9.1/screenshot-2.jpg
ADDED
Binary file
|
1.4.9.1/screenshot-3.jpg
ADDED
Binary file
|
1.4.9.1/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.4.9.1/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9.1/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9.1/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9.1/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.9.1/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.4.9.1/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.4.9.1/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4.9/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.4.9/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.4.9/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4.9/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4.9/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4.9/post-snippets.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4.9
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return stripslashes($snippet);') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
130 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
131 |
+
$theVariables = "";
|
132 |
+
if (!empty($var_arr[0])) {
|
133 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
134 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
135 |
+
if ( $j < (count($var_arr) -1) )
|
136 |
+
$theVariables = $theVariables . ", ";
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($snippets[$i]['shortcode']) {
|
142 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
143 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
144 |
+
}else{
|
145 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
146 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
147 |
+
}
|
148 |
+
echo '
|
149 |
+
postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
164 |
+
';
|
165 |
+
} // End if
|
166 |
+
} // Next
|
167 |
+
// echo '
|
168 |
+
echo <<<JAVASCRIPT
|
169 |
+
}
|
170 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
171 |
+
theSnippet = '[' + shortcodeTag;
|
172 |
+
for (x in shortcodeAtts)
|
173 |
+
{
|
174 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
175 |
+
}
|
176 |
+
theSnippet += ']';
|
177 |
+
return theSnippet;
|
178 |
+
}
|
179 |
+
|
180 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
181 |
+
var myValue;
|
182 |
+
var insertString;
|
183 |
+
insertString = theSnippet;
|
184 |
+
for (x in theVariables)
|
185 |
+
{
|
186 |
+
myValue = prompt(theVariables[x]);
|
187 |
+
var searchfor = '{' + theVariables[x] + '}';
|
188 |
+
var re = new RegExp(searchfor, 'g');
|
189 |
+
insertString = insertString.replace(re, myValue);
|
190 |
+
|
191 |
+
}
|
192 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
193 |
+
theSnippet = insertString;
|
194 |
+
if (theSnippet) {
|
195 |
+
edInsertContent( myField, theSnippet );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
//-->
|
199 |
+
</script>
|
200 |
+
JAVASCRIPT;
|
201 |
+
}
|
202 |
+
break;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* The Admin Page and all it's functions
|
209 |
+
*
|
210 |
+
*/
|
211 |
+
function wp_admin() {
|
212 |
+
if (function_exists('add_options_page')) {
|
213 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
function admin_message($message) {
|
218 |
+
if ( $message ) {
|
219 |
+
?>
|
220 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
function options_page() {
|
226 |
+
// Add a new Snippet
|
227 |
+
if (isset($_POST['add-snippet'])) {
|
228 |
+
$snippets = get_option($this->plugin_options);
|
229 |
+
if (empty($snippets)) { $snippets = array(); }
|
230 |
+
array_push($snippets, array (
|
231 |
+
'title' => "Untitled",
|
232 |
+
'vars' => "",
|
233 |
+
'shortcode' => false,
|
234 |
+
'quicktag' => false,
|
235 |
+
'snippet' => ""));
|
236 |
+
update_option($this->plugin_options, $snippets);
|
237 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
238 |
+
}
|
239 |
+
|
240 |
+
// Update Snippets
|
241 |
+
if (isset($_POST['update-post-snippets'])) {
|
242 |
+
$snippets = get_option($this->plugin_options);
|
243 |
+
if (!empty($snippets)) {
|
244 |
+
for ($i=0; $i < count($snippets); $i++) {
|
245 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
246 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
247 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
248 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
249 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
250 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
251 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
252 |
+
the plugin work correctly on PHP versions below 5.1.
|
253 |
+
This problem is fixed in WP 2.8.
|
254 |
+
*/
|
255 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
256 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
257 |
+
} else {
|
258 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
update_option($this->plugin_options, $snippets);
|
262 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
// Delete Snippets
|
267 |
+
if (isset($_POST['delete-selected'])) {
|
268 |
+
$snippets = get_option($this->plugin_options);
|
269 |
+
if (!empty($snippets)) {
|
270 |
+
$delete = $_POST['checked'];
|
271 |
+
$newsnippets = array();
|
272 |
+
for ($i=0; $i < count($snippets); $i++) {
|
273 |
+
if (in_array($i,$delete) == false) {
|
274 |
+
array_push($newsnippets,$snippets[$i]);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
update_option($this->plugin_options, $newsnippets);
|
278 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
<div class=wrap>
|
283 |
+
<h2>Post Snippets</h2>
|
284 |
+
|
285 |
+
<form method="post" action="">
|
286 |
+
<?php wp_nonce_field('update-options'); ?>
|
287 |
+
|
288 |
+
<div class="tablenav">
|
289 |
+
<div class="alignleft actions">
|
290 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
291 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
292 |
+
</div>
|
293 |
+
</div>
|
294 |
+
<div class="clear"></div>
|
295 |
+
|
296 |
+
<table class="widefat fixed" cellspacing="0">
|
297 |
+
<thead>
|
298 |
+
<tr>
|
299 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
300 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
302 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
303 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
304 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
305 |
+
</tr>
|
306 |
+
</thead>
|
307 |
+
|
308 |
+
<tfoot>
|
309 |
+
<tr>
|
310 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
311 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
312 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
313 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
314 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
315 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
316 |
+
</tr>
|
317 |
+
</tfoot>
|
318 |
+
|
319 |
+
<tbody>
|
320 |
+
<?php
|
321 |
+
$snippets = get_option($this->plugin_options);
|
322 |
+
if (!empty($snippets)) {
|
323 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
324 |
+
<tr class='recent'>
|
325 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
326 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
327 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
328 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
329 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
330 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
331 |
+
</tr>
|
332 |
+
<?php
|
333 |
+
}
|
334 |
+
}
|
335 |
+
?>
|
336 |
+
</tbody>
|
337 |
+
</table>
|
338 |
+
<div class="submit">
|
339 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
340 |
+
</form>
|
341 |
+
|
342 |
+
<div id="poststuff" class="ui-sortable">
|
343 |
+
<div class="postbox">
|
344 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
345 |
+
<div class="inside">
|
346 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
347 |
+
|
348 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
349 |
+
|
350 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
351 |
+
|
352 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
353 |
+
|
354 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
355 |
+
|
356 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
357 |
+
</div>
|
358 |
+
</div>
|
359 |
+
</div>
|
360 |
+
|
361 |
+
<script type="text/javascript">
|
362 |
+
<!--
|
363 |
+
<?php global $wp_version; ?>
|
364 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
365 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
366 |
+
<?php } ?>
|
367 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
368 |
+
jQuery('.postbox.close-me').each(function(){
|
369 |
+
jQuery(this).addClass("closed");
|
370 |
+
});
|
371 |
+
//-->
|
372 |
+
</script>
|
373 |
+
</div>
|
374 |
+
<?php
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
379 |
+
?>
|
1.4.9/readme.txt
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.8.3
|
7 |
+
Stable tag: 1.4.9
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://coding.cglounge.com/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://coding.cglounge.com/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
56 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
57 |
+
|
58 |
+
= Version 1.4.8 - 9 May 2009 =
|
59 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
60 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
61 |
+
|
62 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
63 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
64 |
+
|
65 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
66 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
67 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
68 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
69 |
+
* Added additional proofing for the variables string.
|
70 |
+
|
71 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
72 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
73 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
74 |
+
|
75 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
76 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
77 |
+
|
78 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
79 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
80 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
81 |
+
|
82 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
83 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
84 |
+
|
85 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
86 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
87 |
+
|
88 |
+
= Version 1.4 - 10 Apr 2009 =
|
89 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
90 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
91 |
+
|
92 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
93 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
94 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
95 |
+
|
96 |
+
= Version 1.3 - 2 Apr 2009 =
|
97 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
98 |
+
* Updated the Help info in the admin page to take less space.
|
99 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
100 |
+
|
101 |
+
= Version 1.2 - 1 Apr 2009 =
|
102 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
103 |
+
|
104 |
+
= Version 1.1 - 24 Mar 2009 =
|
105 |
+
* Included Swedish translation.
|
106 |
+
* Added TextDomain functionality for I18n.
|
107 |
+
|
108 |
+
= Version 1.0 - 23 Mar 2009 =
|
109 |
+
* Initial Release
|
1.4.9/screenshot-1.jpg
ADDED
Binary file
|
1.4.9/screenshot-2.jpg
ADDED
Binary file
|
1.4.9/screenshot-3.jpg
ADDED
Binary file
|
1.4.9/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.4.9/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4.9/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4.9/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.4.9/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.4.9/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.4/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.4/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.4/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.4/post-snippets-config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
+
* This is requried when a plugin requires access not via the admin screen.
|
5 |
+
*
|
6 |
+
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
+
*
|
8 |
+
* @package WordPress
|
9 |
+
* @since Version 2.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
+
|
14 |
+
$path = ''; // It should be end with a trailing slash
|
15 |
+
|
16 |
+
/** That's all, stop editing from here **/
|
17 |
+
|
18 |
+
if ( !defined('WP_LOAD_PATH') ) {
|
19 |
+
|
20 |
+
/** classic root path if wp-content and plugins is below wp-config.php */
|
21 |
+
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
22 |
+
|
23 |
+
if (file_exists( $classic_root . 'wp-load.php') )
|
24 |
+
define( 'WP_LOAD_PATH', $classic_root);
|
25 |
+
else
|
26 |
+
if (file_exists( $path . 'wp-load.php') )
|
27 |
+
define( 'WP_LOAD_PATH', $path);
|
28 |
+
else
|
29 |
+
exit("Could not find wp-load.php");
|
30 |
+
}
|
31 |
+
|
32 |
+
// let's load WordPress
|
33 |
+
require_once( WP_LOAD_PATH . 'wp-load.php');
|
34 |
+
?>
|
1.4/post-snippets.php
ADDED
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.4
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class postSnippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function postSnippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('postSnippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('postSnippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_footer', array(&$this,'quicktags'));
|
62 |
+
$this->create_shortcodes();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Displays a warning when installed in an old Wordpress Version
|
67 |
+
*
|
68 |
+
* @returns Nothing
|
69 |
+
*/
|
70 |
+
function version_warning() {
|
71 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Create the functions for shortcodes dynamically and register them
|
77 |
+
*
|
78 |
+
*/
|
79 |
+
function create_shortcodes() {
|
80 |
+
$snippets = get_option($this->plugin_options);
|
81 |
+
if (!empty($snippets)) {
|
82 |
+
for ($i=0; $i < count($snippets); $i++) {
|
83 |
+
if ($snippets[$i]['shortcode'] == true) {
|
84 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
85 |
+
$vars_str = '';
|
86 |
+
for ($j=0; $j < count($vars); $j++) {
|
87 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
88 |
+
|
89 |
+
}
|
90 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
91 |
+
'$shortcode_symbols = array('.$vars_str.');
|
92 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
93 |
+
|
94 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
95 |
+
|
96 |
+
$snippet = "'.$snippets[$i]["snippet"].'";
|
97 |
+
|
98 |
+
foreach ($newArr as $key => $val) {
|
99 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
100 |
+
}
|
101 |
+
|
102 |
+
return "{$snippet}";') );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Handling of QuickTags in the HTML editor
|
110 |
+
*
|
111 |
+
*/
|
112 |
+
function quicktags() {
|
113 |
+
$quicktag_pages = array( 'post.php', 'post-new.php', 'page-new.php', 'page.php', 'comment.php' );
|
114 |
+
for($i = 0; $i < count($quicktag_pages); $i++) {
|
115 |
+
if( strpos($_SERVER['REQUEST_URI'], $quicktag_pages[$i]) ) {
|
116 |
+
|
117 |
+
$snippets = get_option($this->plugin_options);
|
118 |
+
if (!empty($snippets)) {
|
119 |
+
echo '
|
120 |
+
<script type="text/javascript">
|
121 |
+
<!--
|
122 |
+
if (postSnippetsToolbar = document.getElementById("ed_toolbar")) {
|
123 |
+
var postSnippetsNr, postSnippetsButton;
|
124 |
+
';
|
125 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
126 |
+
if ($snippets[$i]['quicktag']) {
|
127 |
+
// Make it js safe
|
128 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
129 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
130 |
+
$theVariables = "";
|
131 |
+
if (!empty($var_arr[0])) {
|
132 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
133 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
134 |
+
if ( $j < (count($var_arr) -1) )
|
135 |
+
$theVariables = $theVariables . ", ";
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if ($snippets[$i]['shortcode']) {
|
141 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
142 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
143 |
+
}else{
|
144 |
+
echo "var insertString" . $i ." = '" .$theSnippet. "';";
|
145 |
+
}
|
146 |
+
echo '
|
147 |
+
postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', \''.$snippets[$i]['snippet'].'\', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'";
|
162 |
+
';
|
163 |
+
} // End if
|
164 |
+
} // Next
|
165 |
+
echo '
|
166 |
+
}
|
167 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
168 |
+
theSnippet = \'[\' + shortcodeTag;
|
169 |
+
for (x in shortcodeAtts)
|
170 |
+
{
|
171 |
+
theSnippet += \' \' + shortcodeAtts[x] + \'="{\' + shortcodeAtts[x] + \'}"\';
|
172 |
+
}
|
173 |
+
theSnippet += \']\';
|
174 |
+
return theSnippet;
|
175 |
+
}
|
176 |
+
|
177 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
178 |
+
var myValue;
|
179 |
+
var insertString;
|
180 |
+
insertString = theSnippet;
|
181 |
+
for (x in theVariables)
|
182 |
+
{
|
183 |
+
myValue = prompt(theVariables[x]);
|
184 |
+
var searchfor = \'{\' + theVariables[x] + \'}\';
|
185 |
+
var re = new RegExp(searchfor, \'g\');
|
186 |
+
insertString = insertString.replace(re, myValue);
|
187 |
+
|
188 |
+
}
|
189 |
+
theSnippet = insertString;
|
190 |
+
if (theSnippet) {
|
191 |
+
edInsertContent(myField, theSnippet);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
//-->
|
195 |
+
</script>
|
196 |
+
';
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* The Admin Page and all it's functions
|
205 |
+
*
|
206 |
+
*/
|
207 |
+
function wp_admin() {
|
208 |
+
if (function_exists('add_options_page')) {
|
209 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
function admin_message($message) {
|
214 |
+
if ( $message ) {
|
215 |
+
?>
|
216 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
function options_page() {
|
222 |
+
// Add a new Snippet
|
223 |
+
if (isset($_POST['add-snippet'])) {
|
224 |
+
$snippets = get_option($this->plugin_options);
|
225 |
+
if (empty($snippets)) { $snippets = array(); }
|
226 |
+
array_push($snippets, array (
|
227 |
+
'title' => "Untitled",
|
228 |
+
'vars' => "",
|
229 |
+
'shortcode' => false,
|
230 |
+
'quicktag' => false,
|
231 |
+
'snippet' => ""));
|
232 |
+
update_option($this->plugin_options, $snippets);
|
233 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
234 |
+
}
|
235 |
+
|
236 |
+
// Update Snippets
|
237 |
+
if (isset($_POST['update-post-snippets'])) {
|
238 |
+
$snippets = get_option($this->plugin_options);
|
239 |
+
if (!empty($snippets)) {
|
240 |
+
for ($i=0; $i < count($snippets); $i++) {
|
241 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
242 |
+
$snippets[$i]['vars'] = trim($_POST[$i.'_vars']);
|
243 |
+
$snippets[$i]['shortcode'] = $_POST[$i.'_shortcode'] == true ? true : false;
|
244 |
+
$snippets[$i]['quicktag'] = $_POST[$i.'_quicktag'] == true ? true : false;
|
245 |
+
$snippets[$i]['snippet'] = trim(stripslashes($_POST[$i.'_snippet']));
|
246 |
+
}
|
247 |
+
update_option($this->plugin_options, $snippets);
|
248 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
// Delete Snippets
|
253 |
+
if (isset($_POST['delete-selected'])) {
|
254 |
+
$snippets = get_option($this->plugin_options);
|
255 |
+
if (!empty($snippets)) {
|
256 |
+
$delete = $_POST['checked'];
|
257 |
+
$newsnippets = array();
|
258 |
+
for ($i=0; $i < count($snippets); $i++) {
|
259 |
+
if (in_array($i,$delete) == false) {
|
260 |
+
array_push($newsnippets,$snippets[$i]);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
update_option($this->plugin_options, $newsnippets);
|
264 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
?>
|
268 |
+
<div class=wrap>
|
269 |
+
<h2>Post Snippets</h2>
|
270 |
+
|
271 |
+
<form method="post" action="">
|
272 |
+
<?php wp_nonce_field('update-options'); ?>
|
273 |
+
|
274 |
+
<div class="tablenav">
|
275 |
+
<div class="alignleft actions">
|
276 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
277 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
278 |
+
</div>
|
279 |
+
</div>
|
280 |
+
<div class="clear"></div>
|
281 |
+
|
282 |
+
<table class="widefat fixed" cellspacing="0">
|
283 |
+
<thead>
|
284 |
+
<tr>
|
285 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
286 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
287 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
288 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
289 |
+
<th scope="col" style="width: 16px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
290 |
+
<th scope="col" style="width: 16px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
291 |
+
</tr>
|
292 |
+
</thead>
|
293 |
+
|
294 |
+
<tfoot>
|
295 |
+
<tr>
|
296 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
297 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
298 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
299 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
300 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
301 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
302 |
+
</tr>
|
303 |
+
</tfoot>
|
304 |
+
|
305 |
+
<tbody>
|
306 |
+
<?php
|
307 |
+
$snippets = get_option($this->plugin_options);
|
308 |
+
if (!empty($snippets)) {
|
309 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
310 |
+
<tr class='recent'>
|
311 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?= $i ?>' /></th>
|
312 |
+
<td class='row-title'><input type='text' name='<?= $i ?>_title' value='<?= $snippets[$i]['title'] ?>' /></td>
|
313 |
+
<td class='name'><input type='text' name='<?= $i ?>_vars' value='<?= $snippets[$i]['vars'] ?>' /></td>
|
314 |
+
<td class='desc'><textarea name="<?= $i ?>_snippet" class="large-text" rows="3"><?= $snippets[$i]['snippet'] ?></textarea></td>
|
315 |
+
<td class='name'><input type='checkbox' name='<?= $i ?>_shortcode' value='true'<? if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
316 |
+
<td class='name'><input type='checkbox' name='<?= $i ?>_quicktag' value='true'<? if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
317 |
+
</tr>
|
318 |
+
<?php
|
319 |
+
}
|
320 |
+
}
|
321 |
+
?>
|
322 |
+
</tbody>
|
323 |
+
</table>
|
324 |
+
<div class="submit">
|
325 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
326 |
+
</form>
|
327 |
+
|
328 |
+
<div id="poststuff" class="ui-sortable">
|
329 |
+
<div class="postbox closed">
|
330 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
331 |
+
<div class="inside">
|
332 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
333 |
+
|
334 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
335 |
+
|
336 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
337 |
+
|
338 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
339 |
+
|
340 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
341 |
+
</div>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
|
345 |
+
<script type="text/javascript">
|
346 |
+
<!--
|
347 |
+
<?php global $wp_version; ?>
|
348 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
349 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
350 |
+
<?php } ?>
|
351 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
352 |
+
jQuery('.postbox.close-me').each(function(){
|
353 |
+
jQuery(this).addClass("closed");
|
354 |
+
});
|
355 |
+
//-->
|
356 |
+
</script>
|
357 |
+
</div>
|
358 |
+
<?php
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
add_action( 'plugins_loaded', create_function( '', 'global $postSnippets; $postSnippets = new postSnippets();' ) );
|
363 |
+
?>
|
1.4/readme.txt
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 1.4
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/other_notes/) for what's new.
|
18 |
+
|
19 |
+
Some features:
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
33 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
34 |
+
|
35 |
+
|
36 |
+
== Frequently Asked Questions ==
|
37 |
+
|
38 |
+
= Guru? =
|
39 |
+
|
40 |
+
Meditation.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. The Admin page where you set up new snippets.
|
45 |
+
2. The TinyMCE button for Post Snippets.
|
46 |
+
3. The Post Snippet Insert Window.
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= Version 1.4 - 10 Apr 2009 =
|
51 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
52 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
53 |
+
|
54 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
55 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
56 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
57 |
+
|
58 |
+
= Version 1.3 - 2 Apr 2009 =
|
59 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
60 |
+
* Updated the Help info in the admin page to take less space.
|
61 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
62 |
+
|
63 |
+
= Version 1.2 - 1 Apr 2009 =
|
64 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
65 |
+
|
66 |
+
= Version 1.1 - 24 Mar 2009 =
|
67 |
+
* Included Swedish translation.
|
68 |
+
* Added TextDomain functionality for I18n.
|
69 |
+
|
70 |
+
= Version 1.0 - 23 Mar 2009 =
|
71 |
+
* Initial Release
|
1.4/screenshot-1.jpg
ADDED
Binary file
|
1.4/screenshot-2.jpg
ADDED
Binary file
|
1.4/screenshot-3.jpg
ADDED
Binary file
|
1.4/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('postSnippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.postSnippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepostSnippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('postSnippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('postSnippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('postSnippets', {
|
32 |
+
title : 'postSnippets.desc',
|
33 |
+
cmd : 'mcepostSnippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
|
37 |
+
// Add a node change handler, selects the button in the UI when a image is selected
|
38 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
39 |
+
cm.setActive('postSnippets', n.nodeName == 'IMG');
|
40 |
+
});
|
41 |
+
},
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns information about the plugin as a name/value array.
|
45 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
46 |
+
*
|
47 |
+
* @return {Object} Name/value array containing information about the plugin.
|
48 |
+
*/
|
49 |
+
getInfo : function() {
|
50 |
+
return {
|
51 |
+
longname : 'postSnippets',
|
52 |
+
author : 'Johan Steen',
|
53 |
+
authorurl : 'http://coding.cglounge.com/',
|
54 |
+
infourl : 'http://coding.cglounge.com/',
|
55 |
+
version : "1.0"
|
56 |
+
};
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
// Register plugin
|
61 |
+
tinymce.PluginManager.add('postSnippets', tinymce.plugins.postSnippets);
|
62 |
+
})();
|
63 |
+
|
64 |
+
|
1.4/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
postSnippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.4/tinymce/post-snippets.gif
ADDED
Binary file
|
1.4/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_postSnippets_button {
|
7 |
+
var $pluginname = "postSnippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_postSnippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'addbuttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function addbuttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = postSnippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_postSnippets_button();
|
50 |
+
?>
|
1.4/tinymce/window.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// look up for the path
|
3 |
+
require_once( dirname( dirname(__FILE__) ) .'/post-snippets-config.php');
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
// check for rights
|
8 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
9 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
10 |
+
|
11 |
+
?>
|
12 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
+
<head>
|
15 |
+
<title>Post Snippets</title>
|
16 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
17 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
18 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
19 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
+
<script language="javascript" type="text/javascript">
|
21 |
+
function init() {
|
22 |
+
tinyMCEPopup.resizeToInnerSize();
|
23 |
+
}
|
24 |
+
|
25 |
+
function createSnippet(theSnippet) {
|
26 |
+
}
|
27 |
+
|
28 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
29 |
+
theSnippet = "[" + shortcodeTag;
|
30 |
+
for (x in shortcodeAtts)
|
31 |
+
{
|
32 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
33 |
+
}
|
34 |
+
theSnippet += "]";
|
35 |
+
return theSnippet;
|
36 |
+
}
|
37 |
+
|
38 |
+
function insertSnippet() {
|
39 |
+
|
40 |
+
var insertString;
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$snippets = get_option($postSnippets->plugin_options);
|
44 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
45 |
+
var panel<?= $i ?> = document.getElementById('ps_panel<?= $i ?>');
|
46 |
+
<?php } ?>
|
47 |
+
|
48 |
+
var rss = document.getElementById('ps_panel0');
|
49 |
+
|
50 |
+
<?php
|
51 |
+
$snippets = get_option($postSnippets->plugin_options);
|
52 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
53 |
+
// Make it js safe
|
54 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])))
|
55 |
+
?>
|
56 |
+
|
57 |
+
if (panel<?= $i ?>.className.indexOf('current') != -1) {
|
58 |
+
<?php
|
59 |
+
if ($snippets[$i]['shortcode']) {
|
60 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
61 |
+
$theVariables = "";
|
62 |
+
if (!empty($var_arr[0])) {
|
63 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
64 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
65 |
+
if ( $j < (count($var_arr) -1) )
|
66 |
+
$theVariables = $theVariables . ", ";
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
71 |
+
insertString = createShortcode("<?= $snippets[$i]['title']; ?>", variables<?= $i; ?>);
|
72 |
+
<?php }else{ ?>
|
73 |
+
insertString = "<?= $theString; ?>";
|
74 |
+
<?php } ?>
|
75 |
+
<?php
|
76 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
77 |
+
if (!empty($var_arr[0])) {
|
78 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
79 |
+
var var_<?= $i ?>_<?= $j ?> = document.getElementById('var_<?= $i ?>_<?= $j ?>').value;
|
80 |
+
insertString = insertString.replace(/\{<?= $var_arr[$j] ?>\}/g, var_<?= $i ?>_<?= $j ?>);
|
81 |
+
<?php } } ?>
|
82 |
+
}
|
83 |
+
<?php } ?>
|
84 |
+
|
85 |
+
|
86 |
+
if(window.tinyMCE) {
|
87 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
88 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
89 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
90 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
91 |
+
//Peforms a clean up of the current editor HTML.
|
92 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
93 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
94 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
95 |
+
tinyMCEPopup.close();
|
96 |
+
}
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
</script>
|
100 |
+
<base target="_self" />
|
101 |
+
</head>
|
102 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
103 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
104 |
+
<form name="postSnippets" action="#">
|
105 |
+
|
106 |
+
<div class="tabs">
|
107 |
+
<ul>
|
108 |
+
<?php
|
109 |
+
$snippets = get_option($postSnippets->plugin_options);
|
110 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
111 |
+
<li id="ps_tab<?= $i ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?= $i ?>','ps_panel<?= $i ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
112 |
+
<?php } ?>
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
117 |
+
<?php
|
118 |
+
$snippets = get_option($postSnippets->plugin_options);
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
120 |
+
<div id="ps_panel<?= $i ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
121 |
+
<br />
|
122 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
123 |
+
<?php
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
if (!empty($var_arr[0])) {
|
126 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
127 |
+
<tr>
|
128 |
+
<td nowrap="nowrap"><label for="var_<?= $i ?>_<?= $j ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
129 |
+
<td><input type="text" id="var_<?= $i ?>_<?= $j ?>" name="var_<?= $i ?>_<?= $j ?>" style="width: 190px" />
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<?php } } ?>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<div class="mceActionPanel">
|
139 |
+
<div style="float: left">
|
140 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div style="float: right">
|
144 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</form>
|
148 |
+
</body>
|
149 |
+
</html>
|
1.4/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.5.1/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.5.1/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.5.1/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.5.1/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.5.1/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.5.1/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5.1/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.5.1/post-snippets.php
ADDED
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.5.1
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://wpstorm.net/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2010 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_head', array(&$this,'quicktags'));
|
62 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
63 |
+
$this->create_shortcodes();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Displays a warning when installed in an old Wordpress Version
|
68 |
+
*
|
69 |
+
* @returns Nothing
|
70 |
+
*/
|
71 |
+
function version_warning() {
|
72 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create the functions for shortcodes dynamically and register them
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function create_shortcodes() {
|
81 |
+
$snippets = get_option($this->plugin_options);
|
82 |
+
if (!empty($snippets)) {
|
83 |
+
for ($i=0; $i < count($snippets); $i++) {
|
84 |
+
if ($snippets[$i]['shortcode'] == true) {
|
85 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
86 |
+
$vars_str = '';
|
87 |
+
for ($j=0; $j < count($vars); $j++) {
|
88 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
89 |
+
|
90 |
+
}
|
91 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
92 |
+
'$shortcode_symbols = array('.$vars_str.');
|
93 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
94 |
+
|
95 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
96 |
+
|
97 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
98 |
+
$snippet = str_replace("&", "&", $snippet);
|
99 |
+
|
100 |
+
foreach ($newArr as $key => $val) {
|
101 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
102 |
+
}
|
103 |
+
|
104 |
+
return stripslashes($snippet);') );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Handling of QuickTags in the HTML editor
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
function quicktags() {
|
115 |
+
$snippets = get_option($this->plugin_options);
|
116 |
+
if (!empty($snippets)) { ?>
|
117 |
+
<script type="text/javascript">
|
118 |
+
if(typeof(edButtons)!='undefined') {
|
119 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
120 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
121 |
+
if ($snippets[$i]['quicktag']) {
|
122 |
+
// Make it js safe
|
123 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
124 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
125 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
126 |
+
$theVariables = "";
|
127 |
+
if (!empty($var_arr[0])) {
|
128 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
129 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
130 |
+
if ( $j < (count($var_arr) -1) )
|
131 |
+
$theVariables = $theVariables . ", ";
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($snippets[$i]['shortcode']) {
|
136 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
137 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
138 |
+
}else{
|
139 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
140 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
141 |
+
}
|
142 |
+
|
143 |
+
echo '
|
144 |
+
postSnippetsNr = edButtons.length;
|
145 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
146 |
+
|
147 |
+
';
|
148 |
+
/* postSnippetsNr = edButtons.length;
|
149 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
150 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
151 |
+
|
152 |
+
while (postSnippetsButton.nodeType != 1) {
|
153 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
154 |
+
}
|
155 |
+
|
156 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
157 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
158 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
159 |
+
postSnippetsButton.title = postSnippetsNr;
|
160 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
161 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
162 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
163 |
+
} // end if
|
164 |
+
} //next ?>
|
165 |
+
};
|
166 |
+
window.onload = ps_quicktags;
|
167 |
+
function ps_quicktags() { <?php
|
168 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
169 |
+
if ($snippets[$i]['quicktag']) {
|
170 |
+
// Make it js safe
|
171 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
172 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
173 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
174 |
+
$theVariables = "";
|
175 |
+
if (!empty($var_arr[0])) {
|
176 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
177 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
178 |
+
if ( $j < (count($var_arr) -1) )
|
179 |
+
$theVariables = $theVariables . ", ";
|
180 |
+
}
|
181 |
+
}
|
182 |
+
if ($snippets[$i]['shortcode']) {
|
183 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
184 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
185 |
+
}else{
|
186 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
187 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
188 |
+
}
|
189 |
+
?>
|
190 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
191 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
192 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
193 |
+
<?php
|
194 |
+
} // end if
|
195 |
+
} // next ?>
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
<?php
|
200 |
+
echo <<<JAVASCRIPT
|
201 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
202 |
+
theSnippet = '[' + shortcodeTag;
|
203 |
+
for (x in shortcodeAtts)
|
204 |
+
{
|
205 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
206 |
+
}
|
207 |
+
theSnippet += ']';
|
208 |
+
return theSnippet;
|
209 |
+
}
|
210 |
+
|
211 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
212 |
+
var myValue;
|
213 |
+
var insertString;
|
214 |
+
insertString = theSnippet;
|
215 |
+
for (x in theVariables)
|
216 |
+
{
|
217 |
+
myValue = prompt(theVariables[x]);
|
218 |
+
var searchfor = '{' + theVariables[x] + '}';
|
219 |
+
var re = new RegExp(searchfor, 'g');
|
220 |
+
insertString = insertString.replace(re, myValue);
|
221 |
+
|
222 |
+
}
|
223 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
224 |
+
theSnippet = insertString;
|
225 |
+
if (theSnippet) {
|
226 |
+
edInsertContent( myField, theSnippet );
|
227 |
+
}
|
228 |
+
}
|
229 |
+
//-->
|
230 |
+
</script>
|
231 |
+
JAVASCRIPT;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
|
236 |
+
/**
|
237 |
+
* The Admin Page and all it's functions
|
238 |
+
*
|
239 |
+
*/
|
240 |
+
function wp_admin() {
|
241 |
+
if (function_exists('add_options_page')) {
|
242 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
function admin_message($message) {
|
247 |
+
if ( $message ) {
|
248 |
+
?>
|
249 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
250 |
+
<?php
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
function options_page() {
|
255 |
+
// Add a new Snippet
|
256 |
+
if (isset($_POST['add-snippet'])) {
|
257 |
+
$snippets = get_option($this->plugin_options);
|
258 |
+
if (empty($snippets)) { $snippets = array(); }
|
259 |
+
array_push($snippets, array (
|
260 |
+
'title' => "Untitled",
|
261 |
+
'vars' => "",
|
262 |
+
'shortcode' => false,
|
263 |
+
'quicktag' => false,
|
264 |
+
'snippet' => ""));
|
265 |
+
update_option($this->plugin_options, $snippets);
|
266 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
267 |
+
}
|
268 |
+
|
269 |
+
// Update Snippets
|
270 |
+
if (isset($_POST['update-post-snippets'])) {
|
271 |
+
$snippets = get_option($this->plugin_options);
|
272 |
+
if (!empty($snippets)) {
|
273 |
+
for ($i=0; $i < count($snippets); $i++) {
|
274 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
275 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
276 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
277 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
278 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
279 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
280 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
281 |
+
the plugin work correctly on PHP versions below 5.1.
|
282 |
+
This problem is fixed in WP 2.8.
|
283 |
+
*/
|
284 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
285 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
286 |
+
} else {
|
287 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
update_option($this->plugin_options, $snippets);
|
291 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
// Delete Snippets
|
296 |
+
if (isset($_POST['delete-selected'])) {
|
297 |
+
$snippets = get_option($this->plugin_options);
|
298 |
+
if (!empty($snippets)) {
|
299 |
+
$delete = $_POST['checked'];
|
300 |
+
$newsnippets = array();
|
301 |
+
for ($i=0; $i < count($snippets); $i++) {
|
302 |
+
if (in_array($i,$delete) == false) {
|
303 |
+
array_push($newsnippets,$snippets[$i]);
|
304 |
+
}
|
305 |
+
}
|
306 |
+
update_option($this->plugin_options, $newsnippets);
|
307 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
308 |
+
}
|
309 |
+
}
|
310 |
+
?>
|
311 |
+
<div class=wrap>
|
312 |
+
<h2>Post Snippets</h2>
|
313 |
+
|
314 |
+
<form method="post" action="">
|
315 |
+
<?php wp_nonce_field('update-options'); ?>
|
316 |
+
|
317 |
+
<div class="tablenav">
|
318 |
+
<div class="alignleft actions">
|
319 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
320 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
321 |
+
</div>
|
322 |
+
</div>
|
323 |
+
<div class="clear"></div>
|
324 |
+
|
325 |
+
<table class="widefat fixed" cellspacing="0">
|
326 |
+
<thead>
|
327 |
+
<tr>
|
328 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
329 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
330 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
331 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
332 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
333 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
334 |
+
</tr>
|
335 |
+
</thead>
|
336 |
+
|
337 |
+
<tfoot>
|
338 |
+
<tr>
|
339 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
340 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
341 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
342 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
343 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
344 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
345 |
+
</tr>
|
346 |
+
</tfoot>
|
347 |
+
|
348 |
+
<tbody>
|
349 |
+
<?php
|
350 |
+
$snippets = get_option($this->plugin_options);
|
351 |
+
if (!empty($snippets)) {
|
352 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
353 |
+
<tr class='recent'>
|
354 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
355 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
356 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
357 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
358 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
359 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
360 |
+
</tr>
|
361 |
+
<?php
|
362 |
+
}
|
363 |
+
}
|
364 |
+
?>
|
365 |
+
</tbody>
|
366 |
+
</table>
|
367 |
+
<div class="submit">
|
368 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
369 |
+
</form>
|
370 |
+
|
371 |
+
<div id="poststuff" class="ui-sortable">
|
372 |
+
<div class="postbox">
|
373 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
374 |
+
<div class="inside">
|
375 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
376 |
+
|
377 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
378 |
+
|
379 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
380 |
+
|
381 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
382 |
+
|
383 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
384 |
+
|
385 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
</div>
|
389 |
+
|
390 |
+
<script type="text/javascript">
|
391 |
+
<!--
|
392 |
+
<?php global $wp_version; ?>
|
393 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
394 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
395 |
+
<?php } ?>
|
396 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
397 |
+
jQuery('.postbox.close-me').each(function(){
|
398 |
+
jQuery(this).addClass("closed");
|
399 |
+
});
|
400 |
+
//-->
|
401 |
+
</script>
|
402 |
+
</div>
|
403 |
+
<?php
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
408 |
+
?>
|
1.5.1/readme.txt
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.9.2
|
7 |
+
Stable tag: 1.5.1
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.5.1 - 12 Mar 2010 =
|
56 |
+
* Fixed ampersands when used in a shortcode, so they are XHTML valid.
|
57 |
+
|
58 |
+
= Version 1.5 - 12 Jan 2010 =
|
59 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
60 |
+
|
61 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
62 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
63 |
+
|
64 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
65 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
66 |
+
|
67 |
+
= Version 1.4.8 - 9 May 2009 =
|
68 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
69 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
70 |
+
|
71 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
72 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
73 |
+
|
74 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
75 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
76 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
77 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
78 |
+
* Added additional proofing for the variables string.
|
79 |
+
|
80 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
81 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
82 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
83 |
+
|
84 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
85 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
86 |
+
|
87 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
88 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
89 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
90 |
+
|
91 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
92 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
93 |
+
|
94 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
95 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
96 |
+
|
97 |
+
= Version 1.4 - 10 Apr 2009 =
|
98 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
99 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
100 |
+
|
101 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
102 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
103 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
104 |
+
|
105 |
+
= Version 1.3 - 2 Apr 2009 =
|
106 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
107 |
+
* Updated the Help info in the admin page to take less space.
|
108 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
109 |
+
|
110 |
+
= Version 1.2 - 1 Apr 2009 =
|
111 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
112 |
+
|
113 |
+
= Version 1.1 - 24 Mar 2009 =
|
114 |
+
* Included Swedish translation.
|
115 |
+
* Added TextDomain functionality for I18n.
|
116 |
+
|
117 |
+
= Version 1.0 - 23 Mar 2009 =
|
118 |
+
* Initial Release
|
1.5.1/screenshot-1.jpg
ADDED
Binary file
|
1.5.1/screenshot-2.jpg
ADDED
Binary file
|
1.5.1/screenshot-3.jpg
ADDED
Binary file
|
1.5.1/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.5.1/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.1/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.1/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.1/tinymce/post-snippets.gif
ADDED
Binary file
|
1.5.1/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.5.1/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.5.1/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.5.2/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.5.2/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.5.2/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.5.2/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.5.2/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.5.2/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5.2/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.5.2/post-snippets.php
ADDED
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.5.2
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://wpstorm.net/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2010 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_head', array(&$this,'quicktags'));
|
62 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
63 |
+
$this->create_shortcodes();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Displays a warning when installed in an old Wordpress Version
|
68 |
+
*
|
69 |
+
* @returns Nothing
|
70 |
+
*/
|
71 |
+
function version_warning() {
|
72 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create the functions for shortcodes dynamically and register them
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function create_shortcodes() {
|
81 |
+
$snippets = get_option($this->plugin_options);
|
82 |
+
if (!empty($snippets)) {
|
83 |
+
for ($i=0; $i < count($snippets); $i++) {
|
84 |
+
if ($snippets[$i]['shortcode'] == true) {
|
85 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
86 |
+
$vars_str = '';
|
87 |
+
for ($j=0; $j < count($vars); $j++) {
|
88 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
89 |
+
|
90 |
+
}
|
91 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
92 |
+
'$shortcode_symbols = array('.$vars_str.');
|
93 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
94 |
+
|
95 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
96 |
+
|
97 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
98 |
+
$snippet = str_replace("&", "&", $snippet);
|
99 |
+
|
100 |
+
foreach ($newArr as $key => $val) {
|
101 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
102 |
+
}
|
103 |
+
|
104 |
+
return stripslashes($snippet);') );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Handling of QuickTags in the HTML editor
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
function quicktags() {
|
115 |
+
$snippets = get_option($this->plugin_options);
|
116 |
+
if (!empty($snippets)) { ?>
|
117 |
+
<script type="text/javascript">
|
118 |
+
if(typeof(edButtons)!='undefined') {
|
119 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
120 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
121 |
+
if ($snippets[$i]['quicktag']) {
|
122 |
+
// Make it js safe
|
123 |
+
$theSnippet = $snippets[$i]['snippet'];
|
124 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
|
125 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
126 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
127 |
+
$theVariables = "";
|
128 |
+
if (!empty($var_arr[0])) {
|
129 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
130 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
131 |
+
if ( $j < (count($var_arr) -1) )
|
132 |
+
$theVariables = $theVariables . ", ";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
if ($snippets[$i]['shortcode']) {
|
137 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
138 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
139 |
+
}else{
|
140 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
141 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
142 |
+
}
|
143 |
+
|
144 |
+
echo '
|
145 |
+
postSnippetsNr = edButtons.length;
|
146 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
147 |
+
|
148 |
+
';
|
149 |
+
/* postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
164 |
+
} // end if
|
165 |
+
} //next ?>
|
166 |
+
};
|
167 |
+
window.onload = ps_quicktags;
|
168 |
+
function ps_quicktags() { <?php
|
169 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
170 |
+
if ($snippets[$i]['quicktag']) {
|
171 |
+
// Make it js safe
|
172 |
+
$theSnippet = $snippets[$i]['snippet'];
|
173 |
+
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
174 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
175 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
176 |
+
$theVariables = "";
|
177 |
+
if (!empty($var_arr[0])) {
|
178 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
179 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
180 |
+
if ( $j < (count($var_arr) -1) )
|
181 |
+
$theVariables = $theVariables . ", ";
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if ($snippets[$i]['shortcode']) {
|
185 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
186 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
187 |
+
}else{
|
188 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
189 |
+
$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
|
190 |
+
$theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
|
191 |
+
echo "var insertString" . $i ." = '" . $theSnippet . "';";
|
192 |
+
}
|
193 |
+
?>
|
194 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
195 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
196 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
197 |
+
<?php
|
198 |
+
} // end if
|
199 |
+
} // next ?>
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
<?php
|
204 |
+
echo <<<JAVASCRIPT
|
205 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
206 |
+
theSnippet = '[' + shortcodeTag;
|
207 |
+
for (x in shortcodeAtts)
|
208 |
+
{
|
209 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
210 |
+
}
|
211 |
+
theSnippet += ']';
|
212 |
+
return theSnippet;
|
213 |
+
}
|
214 |
+
|
215 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
216 |
+
var myValue;
|
217 |
+
var insertString;
|
218 |
+
insertString = theSnippet;
|
219 |
+
for (x in theVariables)
|
220 |
+
{
|
221 |
+
myValue = prompt(theVariables[x]);
|
222 |
+
var searchfor = '{' + theVariables[x] + '}';
|
223 |
+
var re = new RegExp(searchfor, 'g');
|
224 |
+
insertString = insertString.replace(re, myValue);
|
225 |
+
|
226 |
+
}
|
227 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
228 |
+
theSnippet = insertString;
|
229 |
+
if (theSnippet) {
|
230 |
+
edInsertContent( myField, theSnippet );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
//-->
|
234 |
+
</script>
|
235 |
+
JAVASCRIPT;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/**
|
241 |
+
* The Admin Page and all it's functions
|
242 |
+
*
|
243 |
+
*/
|
244 |
+
function wp_admin() {
|
245 |
+
if (function_exists('add_options_page')) {
|
246 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
function admin_message($message) {
|
251 |
+
if ( $message ) {
|
252 |
+
?>
|
253 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
function options_page() {
|
259 |
+
// Add a new Snippet
|
260 |
+
if (isset($_POST['add-snippet'])) {
|
261 |
+
$snippets = get_option($this->plugin_options);
|
262 |
+
if (empty($snippets)) { $snippets = array(); }
|
263 |
+
array_push($snippets, array (
|
264 |
+
'title' => "Untitled",
|
265 |
+
'vars' => "",
|
266 |
+
'shortcode' => false,
|
267 |
+
'quicktag' => false,
|
268 |
+
'snippet' => ""));
|
269 |
+
update_option($this->plugin_options, $snippets);
|
270 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
271 |
+
}
|
272 |
+
|
273 |
+
// Update Snippets
|
274 |
+
if (isset($_POST['update-post-snippets'])) {
|
275 |
+
$snippets = get_option($this->plugin_options);
|
276 |
+
if (!empty($snippets)) {
|
277 |
+
for ($i=0; $i < count($snippets); $i++) {
|
278 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
279 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
280 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
281 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
282 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
283 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
284 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
285 |
+
the plugin work correctly on PHP versions below 5.1.
|
286 |
+
This problem is fixed in WP 2.8.
|
287 |
+
*/
|
288 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
289 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
290 |
+
} else {
|
291 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
292 |
+
}
|
293 |
+
}
|
294 |
+
update_option($this->plugin_options, $snippets);
|
295 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
// Delete Snippets
|
300 |
+
if (isset($_POST['delete-selected'])) {
|
301 |
+
$snippets = get_option($this->plugin_options);
|
302 |
+
if (!empty($snippets)) {
|
303 |
+
$delete = $_POST['checked'];
|
304 |
+
$newsnippets = array();
|
305 |
+
for ($i=0; $i < count($snippets); $i++) {
|
306 |
+
if (in_array($i,$delete) == false) {
|
307 |
+
array_push($newsnippets,$snippets[$i]);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
update_option($this->plugin_options, $newsnippets);
|
311 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
?>
|
315 |
+
<div class=wrap>
|
316 |
+
<h2>Post Snippets</h2>
|
317 |
+
|
318 |
+
<form method="post" action="">
|
319 |
+
<?php wp_nonce_field('update-options'); ?>
|
320 |
+
|
321 |
+
<div class="tablenav">
|
322 |
+
<div class="alignleft actions">
|
323 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
324 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
325 |
+
</div>
|
326 |
+
</div>
|
327 |
+
<div class="clear"></div>
|
328 |
+
|
329 |
+
<table class="widefat fixed" cellspacing="0">
|
330 |
+
<thead>
|
331 |
+
<tr>
|
332 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
333 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
334 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
335 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
336 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
337 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
338 |
+
</tr>
|
339 |
+
</thead>
|
340 |
+
|
341 |
+
<tfoot>
|
342 |
+
<tr>
|
343 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
344 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
345 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
346 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
347 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
348 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
349 |
+
</tr>
|
350 |
+
</tfoot>
|
351 |
+
|
352 |
+
<tbody>
|
353 |
+
<?php
|
354 |
+
$snippets = get_option($this->plugin_options);
|
355 |
+
if (!empty($snippets)) {
|
356 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
357 |
+
<tr class='recent'>
|
358 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
359 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
360 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
361 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
362 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
363 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
364 |
+
</tr>
|
365 |
+
<?php
|
366 |
+
}
|
367 |
+
}
|
368 |
+
?>
|
369 |
+
</tbody>
|
370 |
+
</table>
|
371 |
+
<div class="submit">
|
372 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
373 |
+
</form>
|
374 |
+
|
375 |
+
<div id="poststuff" class="ui-sortable">
|
376 |
+
<div class="postbox">
|
377 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
378 |
+
<div class="inside">
|
379 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
380 |
+
|
381 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
382 |
+
|
383 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
384 |
+
|
385 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
386 |
+
|
387 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
388 |
+
|
389 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
390 |
+
</div>
|
391 |
+
</div>
|
392 |
+
</div>
|
393 |
+
|
394 |
+
<script type="text/javascript">
|
395 |
+
<!--
|
396 |
+
<?php global $wp_version; ?>
|
397 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
398 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
399 |
+
<?php } ?>
|
400 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
401 |
+
jQuery('.postbox.close-me').each(function(){
|
402 |
+
jQuery(this).addClass("closed");
|
403 |
+
});
|
404 |
+
//-->
|
405 |
+
</script>
|
406 |
+
</div>
|
407 |
+
<?php
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
412 |
+
?>
|
1.5.2/readme.txt
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.5.2
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.5.2 - 17 Sep 2010 =
|
56 |
+
* The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
|
57 |
+
* Updated the code to not generate warnings when running WordPress in debug mode.
|
58 |
+
|
59 |
+
= Version 1.5.1 - 12 Mar 2010 =
|
60 |
+
* Fixed ampersands when used in a shortcode, so they are XHTML valid.
|
61 |
+
|
62 |
+
= Version 1.5 - 12 Jan 2010 =
|
63 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
64 |
+
|
65 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
66 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
67 |
+
|
68 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
69 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
70 |
+
|
71 |
+
= Version 1.4.8 - 9 May 2009 =
|
72 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
73 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
74 |
+
|
75 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
76 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
77 |
+
|
78 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
79 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
80 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
81 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
82 |
+
* Added additional proofing for the variables string.
|
83 |
+
|
84 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
85 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
86 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
87 |
+
|
88 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
89 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
90 |
+
|
91 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
92 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
93 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
94 |
+
|
95 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
96 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
97 |
+
|
98 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
99 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
100 |
+
|
101 |
+
= Version 1.4 - 10 Apr 2009 =
|
102 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
103 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
104 |
+
|
105 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
106 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
107 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
108 |
+
|
109 |
+
= Version 1.3 - 2 Apr 2009 =
|
110 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
111 |
+
* Updated the Help info in the admin page to take less space.
|
112 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
113 |
+
|
114 |
+
= Version 1.2 - 1 Apr 2009 =
|
115 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
116 |
+
|
117 |
+
= Version 1.1 - 24 Mar 2009 =
|
118 |
+
* Included Swedish translation.
|
119 |
+
* Added TextDomain functionality for I18n.
|
120 |
+
|
121 |
+
= Version 1.0 - 23 Mar 2009 =
|
122 |
+
* Initial Release
|
1.5.2/screenshot-1.jpg
ADDED
Binary file
|
1.5.2/screenshot-2.jpg
ADDED
Binary file
|
1.5.2/screenshot-3.jpg
ADDED
Binary file
|
1.5.2/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.5.2/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.2/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.2/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.2/tinymce/post-snippets.gif
ADDED
Binary file
|
1.5.2/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.5.2/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.5.2/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.5.3/languages/post-snippets-es_ES.mo
ADDED
Binary file
|
1.5.3/languages/post-snippets-es_ES.po
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2010-09-17 15:31-0400\n"
|
7 |
+
"Last-Translator: Melvis León <me_leon@hotmail.com>\n"
|
8 |
+
"Language-Team: MLL Designs <me_leon@hotmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: Spanish\n"
|
14 |
+
"X-Poedit-Country: SPAIN\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
#@ post-snippets
|
22 |
+
#: post-snippets.php:71
|
23 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
24 |
+
msgstr "Post Snippets requiere WordPress versión 2.7 o posterior!"
|
25 |
+
|
26 |
+
#@ post-snippets
|
27 |
+
#: post-snippets.php:237
|
28 |
+
msgid "A snippet named Untitled has been added."
|
29 |
+
msgstr "Un Snippet llamado Sin título ha sido agregado."
|
30 |
+
|
31 |
+
#@ post-snippets
|
32 |
+
#: post-snippets.php:262
|
33 |
+
msgid "Snippets have been updated."
|
34 |
+
msgstr "Los Snippets han sido actualizados."
|
35 |
+
|
36 |
+
#@ post-snippets
|
37 |
+
#: post-snippets.php:278
|
38 |
+
msgid "Selected snippets have been deleted."
|
39 |
+
msgstr "Los snippets han sido eliminados."
|
40 |
+
|
41 |
+
#@ post-snippets
|
42 |
+
#: post-snippets.php:290
|
43 |
+
msgid "Add New Snippet"
|
44 |
+
msgstr "Agregar nuevo Snippet"
|
45 |
+
|
46 |
+
#@ post-snippets
|
47 |
+
#: post-snippets.php:291
|
48 |
+
msgid "Delete Selected"
|
49 |
+
msgstr "Eliminar seleccionados"
|
50 |
+
|
51 |
+
#@ post-snippets
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
msgid "Title"
|
55 |
+
msgstr "Título"
|
56 |
+
|
57 |
+
#@ post-snippets
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
msgid "Variables"
|
61 |
+
msgstr "Variables"
|
62 |
+
|
63 |
+
#@ post-snippets
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
msgid "Snippet"
|
67 |
+
msgstr "Snippet"
|
68 |
+
|
69 |
+
#@ post-snippets
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
msgid "SC"
|
73 |
+
msgstr "SC"
|
74 |
+
|
75 |
+
#@ post-snippets
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
msgid "QT"
|
79 |
+
msgstr "QT"
|
80 |
+
|
81 |
+
#@ post-snippets
|
82 |
+
#: post-snippets.php:339
|
83 |
+
msgid "Update Snippets"
|
84 |
+
msgstr "Actualizar Snippets"
|
85 |
+
|
86 |
+
#@ post-snippets
|
87 |
+
#: post-snippets.php:344
|
88 |
+
msgid "Help"
|
89 |
+
msgstr "Ayuda"
|
90 |
+
|
91 |
+
#@ post-snippets
|
92 |
+
#: post-snippets.php:346
|
93 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
94 |
+
msgstr "<strong>Titulo</strong><br/>Nombrar al snippet con un título que le ayude a identificarlo en el editor de entradas."
|
95 |
+
|
96 |
+
#@ post-snippets
|
97 |
+
#: post-snippets.php:348
|
98 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
99 |
+
msgstr "<strong>Variables</strong><br/>Puedes hacer referencia a una lista separada por comas de variables personalizadas en tu snippet.<br/><br/>Ejemplo:<br/>url, nombre"
|
100 |
+
|
101 |
+
#@ post-snippets
|
102 |
+
#: post-snippets.php:350
|
103 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
104 |
+
msgstr "<strong>Snippet</strong><br/>Este es el bloque de texto o HTML a insertar en la entrada al seleccionar el snippet del botón de insertar en el TinyMCE en el editor de entradas. Si ha introducido las variables predefinidas usted puede referenciarlas desde el snippet al encerrarlas entre llaves {}.<br/> Ejemplo: <br/>Para hacer referencia a las variables en el ejemplo anterior, debe escribir {url} y {nombre}.<br/>Así que si digitas este snippet: <br/> <i> Esta es la página web de <a href=\"{url}\">{nombre}</a></i><br/> </ i> <br/>Usted recibirá la opción de reemplazar url y el nombre cuando se inserta, si se definen como variables."
|
105 |
+
|
106 |
+
#@ post-snippets
|
107 |
+
#: post-snippets.php:352
|
108 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
109 |
+
msgstr "<strong>SC</strong> <br/>Se usa para tratar el snippet como un atajo. El nombre del atajo es el mismo título del snippet (no se permiten espacios) y será utilizado en la entrada."
|
110 |
+
|
111 |
+
#@ post-snippets
|
112 |
+
#: post-snippets.php:354
|
113 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
114 |
+
msgstr "<strong>QT</strong><br/>Permite el snippet estar disponible como un quicktag en el editor de HTML."
|
115 |
+
|
116 |
+
#@ post-snippets
|
117 |
+
#: post-snippets.php:356
|
118 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
119 |
+
msgstr "<strong>Acerca de Post Snippets</strong> <br/> Visite mi página <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> para informaciones adicionales."
|
120 |
+
|
121 |
+
#@ post-snippets
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
msgid "You are not allowed to be here"
|
124 |
+
msgstr "No tiene permitido estar aquí"
|
125 |
+
|
126 |
+
#@ post-snippets
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
msgid "Cancel"
|
129 |
+
msgstr "Cancelar"
|
130 |
+
|
131 |
+
#@ post-snippets
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
msgid "Insert"
|
134 |
+
msgstr "Insertar"
|
135 |
+
|
1.5.3/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.5.3/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.5.3/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.5.3/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.5.3/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.5.3/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5.3/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.5.3/post-snippets.php
ADDED
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.5.3
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://wpstorm.net/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2010 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_head', array(&$this,'quicktags'));
|
62 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
63 |
+
$this->create_shortcodes();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Displays a warning when installed in an old Wordpress Version
|
68 |
+
*
|
69 |
+
* @returns Nothing
|
70 |
+
*/
|
71 |
+
function version_warning() {
|
72 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create the functions for shortcodes dynamically and register them
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function create_shortcodes() {
|
81 |
+
$snippets = get_option($this->plugin_options);
|
82 |
+
if (!empty($snippets)) {
|
83 |
+
for ($i=0; $i < count($snippets); $i++) {
|
84 |
+
if ($snippets[$i]['shortcode'] == true) {
|
85 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
86 |
+
$vars_str = '';
|
87 |
+
for ($j=0; $j < count($vars); $j++) {
|
88 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
89 |
+
|
90 |
+
}
|
91 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
92 |
+
'$shortcode_symbols = array('.$vars_str.');
|
93 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
94 |
+
|
95 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
96 |
+
|
97 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
98 |
+
$snippet = str_replace("&", "&", $snippet);
|
99 |
+
|
100 |
+
foreach ($newArr as $key => $val) {
|
101 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
102 |
+
}
|
103 |
+
|
104 |
+
return stripslashes($snippet);') );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Handling of QuickTags in the HTML editor
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
function quicktags() {
|
115 |
+
$snippets = get_option($this->plugin_options);
|
116 |
+
if (!empty($snippets)) { ?>
|
117 |
+
<script type="text/javascript">
|
118 |
+
if(typeof(edButtons)!='undefined') {
|
119 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
120 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
121 |
+
if ($snippets[$i]['quicktag']) {
|
122 |
+
// Make it js safe
|
123 |
+
$theSnippet = $snippets[$i]['snippet'];
|
124 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
|
125 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
126 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
127 |
+
$theVariables = "";
|
128 |
+
if (!empty($var_arr[0])) {
|
129 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
130 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
131 |
+
if ( $j < (count($var_arr) -1) )
|
132 |
+
$theVariables = $theVariables . ", ";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
if ($snippets[$i]['shortcode']) {
|
137 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
138 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
139 |
+
}else{
|
140 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
141 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
142 |
+
}
|
143 |
+
|
144 |
+
echo '
|
145 |
+
postSnippetsNr = edButtons.length;
|
146 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
147 |
+
|
148 |
+
';
|
149 |
+
/* postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
164 |
+
} // end if
|
165 |
+
} //next ?>
|
166 |
+
};
|
167 |
+
window.onload = ps_quicktags;
|
168 |
+
function ps_quicktags() { <?php
|
169 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
170 |
+
if ($snippets[$i]['quicktag']) {
|
171 |
+
// Make it js safe
|
172 |
+
$theSnippet = $snippets[$i]['snippet'];
|
173 |
+
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
174 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
175 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
176 |
+
$theVariables = "";
|
177 |
+
if (!empty($var_arr[0])) {
|
178 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
179 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
180 |
+
if ( $j < (count($var_arr) -1) )
|
181 |
+
$theVariables = $theVariables . ", ";
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if ($snippets[$i]['shortcode']) {
|
185 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
186 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
187 |
+
}else{
|
188 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
189 |
+
$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
|
190 |
+
$theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
|
191 |
+
echo "var insertString" . $i ." = '" . $theSnippet . "';";
|
192 |
+
}
|
193 |
+
?>
|
194 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
195 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
196 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
197 |
+
<?php
|
198 |
+
} // end if
|
199 |
+
} // next ?>
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
<?php
|
204 |
+
echo <<<JAVASCRIPT
|
205 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
206 |
+
theSnippet = '[' + shortcodeTag;
|
207 |
+
for (x in shortcodeAtts)
|
208 |
+
{
|
209 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
210 |
+
}
|
211 |
+
theSnippet += ']';
|
212 |
+
return theSnippet;
|
213 |
+
}
|
214 |
+
|
215 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
216 |
+
var myValue;
|
217 |
+
var insertString;
|
218 |
+
insertString = theSnippet;
|
219 |
+
for (x in theVariables)
|
220 |
+
{
|
221 |
+
myValue = prompt(theVariables[x]);
|
222 |
+
var searchfor = '{' + theVariables[x] + '}';
|
223 |
+
var re = new RegExp(searchfor, 'g');
|
224 |
+
insertString = insertString.replace(re, myValue);
|
225 |
+
|
226 |
+
}
|
227 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
228 |
+
theSnippet = insertString;
|
229 |
+
if (theSnippet) {
|
230 |
+
edInsertContent( myField, theSnippet );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
//-->
|
234 |
+
</script>
|
235 |
+
JAVASCRIPT;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/**
|
241 |
+
* The Admin Page and all it's functions
|
242 |
+
*
|
243 |
+
*/
|
244 |
+
function wp_admin() {
|
245 |
+
if (function_exists('add_options_page')) {
|
246 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
function admin_message($message) {
|
251 |
+
if ( $message ) {
|
252 |
+
?>
|
253 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
function options_page() {
|
259 |
+
// Add a new Snippet
|
260 |
+
if (isset($_POST['add-snippet'])) {
|
261 |
+
$snippets = get_option($this->plugin_options);
|
262 |
+
if (empty($snippets)) { $snippets = array(); }
|
263 |
+
array_push($snippets, array (
|
264 |
+
'title' => "Untitled",
|
265 |
+
'vars' => "",
|
266 |
+
'shortcode' => false,
|
267 |
+
'quicktag' => false,
|
268 |
+
'snippet' => ""));
|
269 |
+
update_option($this->plugin_options, $snippets);
|
270 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
271 |
+
}
|
272 |
+
|
273 |
+
// Update Snippets
|
274 |
+
if (isset($_POST['update-post-snippets'])) {
|
275 |
+
$snippets = get_option($this->plugin_options);
|
276 |
+
if (!empty($snippets)) {
|
277 |
+
for ($i=0; $i < count($snippets); $i++) {
|
278 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
279 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
280 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
281 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
282 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
283 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
284 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
285 |
+
the plugin work correctly on PHP versions below 5.1.
|
286 |
+
This problem is fixed in WP 2.8.
|
287 |
+
*/
|
288 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
289 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
290 |
+
} else {
|
291 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
292 |
+
}
|
293 |
+
}
|
294 |
+
update_option($this->plugin_options, $snippets);
|
295 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
// Delete Snippets
|
300 |
+
if (isset($_POST['delete-selected'])) {
|
301 |
+
$snippets = get_option($this->plugin_options);
|
302 |
+
if (!empty($snippets)) {
|
303 |
+
$delete = $_POST['checked'];
|
304 |
+
$newsnippets = array();
|
305 |
+
for ($i=0; $i < count($snippets); $i++) {
|
306 |
+
if (in_array($i,$delete) == false) {
|
307 |
+
array_push($newsnippets,$snippets[$i]);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
update_option($this->plugin_options, $newsnippets);
|
311 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
?>
|
315 |
+
<div class=wrap>
|
316 |
+
<h2>Post Snippets</h2>
|
317 |
+
|
318 |
+
<form method="post" action="">
|
319 |
+
<?php wp_nonce_field('update-options'); ?>
|
320 |
+
|
321 |
+
<div class="tablenav">
|
322 |
+
<div class="alignleft actions">
|
323 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
324 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
325 |
+
</div>
|
326 |
+
</div>
|
327 |
+
<div class="clear"></div>
|
328 |
+
|
329 |
+
<table class="widefat fixed" cellspacing="0">
|
330 |
+
<thead>
|
331 |
+
<tr>
|
332 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
333 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
334 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
335 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
336 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
337 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
338 |
+
</tr>
|
339 |
+
</thead>
|
340 |
+
|
341 |
+
<tfoot>
|
342 |
+
<tr>
|
343 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
344 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
345 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
346 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
347 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
348 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
349 |
+
</tr>
|
350 |
+
</tfoot>
|
351 |
+
|
352 |
+
<tbody>
|
353 |
+
<?php
|
354 |
+
$snippets = get_option($this->plugin_options);
|
355 |
+
if (!empty($snippets)) {
|
356 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
357 |
+
<tr class='recent'>
|
358 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
359 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
360 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
361 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
362 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
363 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
364 |
+
</tr>
|
365 |
+
<?php
|
366 |
+
}
|
367 |
+
}
|
368 |
+
?>
|
369 |
+
</tbody>
|
370 |
+
</table>
|
371 |
+
<div class="submit">
|
372 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
373 |
+
</form>
|
374 |
+
|
375 |
+
<div id="poststuff" class="ui-sortable">
|
376 |
+
<div class="postbox">
|
377 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
378 |
+
<div class="inside">
|
379 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
380 |
+
|
381 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
382 |
+
|
383 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
384 |
+
|
385 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
386 |
+
|
387 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
388 |
+
|
389 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
390 |
+
</div>
|
391 |
+
</div>
|
392 |
+
</div>
|
393 |
+
|
394 |
+
<script type="text/javascript">
|
395 |
+
<!--
|
396 |
+
<?php global $wp_version; ?>
|
397 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
398 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
399 |
+
<?php } ?>
|
400 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
401 |
+
jQuery('.postbox.close-me').each(function(){
|
402 |
+
jQuery(this).addClass("closed");
|
403 |
+
});
|
404 |
+
//-->
|
405 |
+
</script>
|
406 |
+
</div>
|
407 |
+
<?php
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
412 |
+
?>
|
1.5.3/readme.txt
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.5.3
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.5.3 - 19 Sep 2010 =
|
56 |
+
* Included Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
|
57 |
+
|
58 |
+
= Version 1.5.2 - 17 Sep 2010 =
|
59 |
+
* The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
|
60 |
+
* Updated the code to not generate warnings when running WordPress in debug mode.
|
61 |
+
|
62 |
+
= Version 1.5.1 - 12 Mar 2010 =
|
63 |
+
* Fixed ampersands when used in a shortcode, so they are XHTML valid.
|
64 |
+
|
65 |
+
= Version 1.5 - 12 Jan 2010 =
|
66 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
67 |
+
|
68 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
69 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
70 |
+
|
71 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
72 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
73 |
+
|
74 |
+
= Version 1.4.8 - 9 May 2009 =
|
75 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
76 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
77 |
+
|
78 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
79 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
80 |
+
|
81 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
82 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
83 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
84 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
85 |
+
* Added additional proofing for the variables string.
|
86 |
+
|
87 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
88 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
89 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
90 |
+
|
91 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
92 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
93 |
+
|
94 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
95 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
96 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
97 |
+
|
98 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
99 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
100 |
+
|
101 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
102 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
103 |
+
|
104 |
+
= Version 1.4 - 10 Apr 2009 =
|
105 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
106 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
107 |
+
|
108 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
109 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
110 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
111 |
+
|
112 |
+
= Version 1.3 - 2 Apr 2009 =
|
113 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
114 |
+
* Updated the Help info in the admin page to take less space.
|
115 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
116 |
+
|
117 |
+
= Version 1.2 - 1 Apr 2009 =
|
118 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
119 |
+
|
120 |
+
= Version 1.1 - 24 Mar 2009 =
|
121 |
+
* Included Swedish translation.
|
122 |
+
* Added TextDomain functionality for I18n.
|
123 |
+
|
124 |
+
= Version 1.0 - 23 Mar 2009 =
|
125 |
+
* Initial Release
|
1.5.3/screenshot-1.jpg
ADDED
Binary file
|
1.5.3/screenshot-2.jpg
ADDED
Binary file
|
1.5.3/screenshot-3.jpg
ADDED
Binary file
|
1.5.3/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.5.3/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.3/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.3/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.3/tinymce/post-snippets.gif
ADDED
Binary file
|
1.5.3/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.5.3/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.5.3/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.5.4/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.5.4/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.5.4/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.5.4/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.5.4/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.5.4/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5.4/languages/post-snippets-tr_TR.mo
ADDED
Binary file
|
1.5.4/languages/post-snippets-tr_TR.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2011-01-23 02:21+0200\n"
|
11 |
+
"Last-Translator: JSEL <jselivingston@gmail.com>\n"
|
12 |
+
"Language-Team: www.tml.web.tr <jselivingston@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Country: TURKEY\n"
|
17 |
+
"X-Poedit-Language: Turkish\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets eklentisi WordPress 2.7 veya daha üst bir sürümde çalışır!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Untitled adında bir snippet eklendi."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Snippets alanları güncellendi."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Seçili snippet(lar) silindi."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Yeni Snippet Ekle"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Seçili Olanları Sil"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Başlık"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Değişkenler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Snippet"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Güncelle"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Yardım"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Başlık</strong><br/>Yazı editöründe kullanmak üzere snippet'a bir başlık yazın."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Değişkenler</strong><br/>Snippet'da kullanmak üzere virgülle birbirinden ayrılmış özel değişkenler listesi.<br/><br/>Örnek:<br/>url,name"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Snippet</strong><br/>Burası TinyMCE panelindeki ekle düğmesi aracılığıyla seçeceğiniz snippet'ın gönderide ekleneceği metin bloğu veya HTML kısmıdır. Snippet'ınızda daha önce tanımlanmış olan değişkenleri kullanmak için {} karakterleri arasına yazabilirsiniz.<br/><br/>Örnek:<br/>Yukarıdaki örnekteki değişkenleri kullanmak için {url} ve {name} kodlarını yazmalısınız.<br/><br/>Yani aşağıdaki snippet yazıldığında:<br/><i>Siteye ait url ve anchor metni: <a href=\"{url}\">{name}</a> şeklinde olacaktır.</i><br/>Böylelikle url ve name değişkenlerini değiştirme şansına sahip olacaksınız."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Post Snippets Hakkında"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "İzniniz yok"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Vazgeç"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Ekle"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Yazılarınızda sıklıkla kullandığınız HTML kodu veya metinlerdeki snippetlerı kaydeder. Tanımladığınız değişkenleri kullanarak snippet bölümlerini de değiştirebilirsiniz. Tüm snippetlara yazı editöründe yer alan TinyMCE, Quicktags veya Shortcodes düğmeleri aracılığıyla ulaşabilirsiniz."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5.4/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.5.4/post-snippets.php
ADDED
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.5.4
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://wpstorm.net/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2011 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_head', array(&$this,'quicktags'));
|
62 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
63 |
+
$this->create_shortcodes();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Displays a warning when installed in an old Wordpress Version
|
68 |
+
*
|
69 |
+
* @returns Nothing
|
70 |
+
*/
|
71 |
+
function version_warning() {
|
72 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create the functions for shortcodes dynamically and register them
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function create_shortcodes() {
|
81 |
+
$snippets = get_option($this->plugin_options);
|
82 |
+
if (!empty($snippets)) {
|
83 |
+
for ($i=0; $i < count($snippets); $i++) {
|
84 |
+
if ($snippets[$i]['shortcode'] == true) {
|
85 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
86 |
+
$vars_str = '';
|
87 |
+
for ($j=0; $j < count($vars); $j++) {
|
88 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
89 |
+
|
90 |
+
}
|
91 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
92 |
+
'$shortcode_symbols = array('.$vars_str.');
|
93 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
94 |
+
|
95 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
96 |
+
|
97 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
98 |
+
$snippet = str_replace("&", "&", $snippet);
|
99 |
+
|
100 |
+
foreach ($newArr as $key => $val) {
|
101 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
102 |
+
}
|
103 |
+
|
104 |
+
return stripslashes($snippet);') );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Handling of QuickTags in the HTML editor
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
function quicktags() {
|
115 |
+
$snippets = get_option($this->plugin_options);
|
116 |
+
if (!empty($snippets)) { ?>
|
117 |
+
<script type="text/javascript">
|
118 |
+
if(typeof(edButtons)!='undefined') {
|
119 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
120 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
121 |
+
if ($snippets[$i]['quicktag']) {
|
122 |
+
// Make it js safe
|
123 |
+
$theSnippet = $snippets[$i]['snippet'];
|
124 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
|
125 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
126 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
127 |
+
$theVariables = "";
|
128 |
+
if (!empty($var_arr[0])) {
|
129 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
130 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
131 |
+
if ( $j < (count($var_arr) -1) )
|
132 |
+
$theVariables = $theVariables . ", ";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
if ($snippets[$i]['shortcode']) {
|
137 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
138 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
139 |
+
}else{
|
140 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
141 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
142 |
+
}
|
143 |
+
|
144 |
+
echo '
|
145 |
+
postSnippetsNr = edButtons.length;
|
146 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
147 |
+
|
148 |
+
';
|
149 |
+
/* postSnippetsNr = edButtons.length;
|
150 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
151 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
152 |
+
|
153 |
+
while (postSnippetsButton.nodeType != 1) {
|
154 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
155 |
+
}
|
156 |
+
|
157 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
158 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
159 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
160 |
+
postSnippetsButton.title = postSnippetsNr;
|
161 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
162 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
163 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
164 |
+
} // end if
|
165 |
+
} //next ?>
|
166 |
+
};
|
167 |
+
window.onload = ps_quicktags;
|
168 |
+
function ps_quicktags() { <?php
|
169 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
170 |
+
if ($snippets[$i]['quicktag']) {
|
171 |
+
// Make it js safe
|
172 |
+
$theSnippet = $snippets[$i]['snippet'];
|
173 |
+
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
174 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
175 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
176 |
+
$theVariables = "";
|
177 |
+
if (!empty($var_arr[0])) {
|
178 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
179 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
180 |
+
if ( $j < (count($var_arr) -1) )
|
181 |
+
$theVariables = $theVariables . ", ";
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if ($snippets[$i]['shortcode']) {
|
185 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
186 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
187 |
+
}else{
|
188 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
189 |
+
$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
|
190 |
+
$theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
|
191 |
+
echo "var insertString" . $i ." = '" . $theSnippet . "';";
|
192 |
+
}
|
193 |
+
?>
|
194 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
195 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
196 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
197 |
+
<?php
|
198 |
+
} // end if
|
199 |
+
} // next ?>
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
<?php
|
204 |
+
echo <<<JAVASCRIPT
|
205 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
206 |
+
theSnippet = '[' + shortcodeTag;
|
207 |
+
for (x in shortcodeAtts)
|
208 |
+
{
|
209 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
210 |
+
}
|
211 |
+
theSnippet += ']';
|
212 |
+
return theSnippet;
|
213 |
+
}
|
214 |
+
|
215 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
216 |
+
var myValue;
|
217 |
+
var insertString;
|
218 |
+
insertString = theSnippet;
|
219 |
+
for (x in theVariables)
|
220 |
+
{
|
221 |
+
myValue = prompt(theVariables[x]);
|
222 |
+
var searchfor = '{' + theVariables[x] + '}';
|
223 |
+
var re = new RegExp(searchfor, 'g');
|
224 |
+
insertString = insertString.replace(re, myValue);
|
225 |
+
|
226 |
+
}
|
227 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
228 |
+
theSnippet = insertString;
|
229 |
+
if (theSnippet) {
|
230 |
+
edInsertContent( myField, theSnippet );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
//-->
|
234 |
+
</script>
|
235 |
+
JAVASCRIPT;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/**
|
241 |
+
* The Admin Page and all it's functions
|
242 |
+
*
|
243 |
+
*/
|
244 |
+
function wp_admin() {
|
245 |
+
if (function_exists('add_options_page')) {
|
246 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
function admin_message($message) {
|
251 |
+
if ( $message ) {
|
252 |
+
?>
|
253 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
function options_page() {
|
259 |
+
// Add a new Snippet
|
260 |
+
if (isset($_POST['add-snippet'])) {
|
261 |
+
$snippets = get_option($this->plugin_options);
|
262 |
+
if (empty($snippets)) { $snippets = array(); }
|
263 |
+
array_push($snippets, array (
|
264 |
+
'title' => "Untitled",
|
265 |
+
'vars' => "",
|
266 |
+
'shortcode' => false,
|
267 |
+
'quicktag' => false,
|
268 |
+
'snippet' => ""));
|
269 |
+
update_option($this->plugin_options, $snippets);
|
270 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
271 |
+
}
|
272 |
+
|
273 |
+
// Update Snippets
|
274 |
+
if (isset($_POST['update-post-snippets'])) {
|
275 |
+
$snippets = get_option($this->plugin_options);
|
276 |
+
if (!empty($snippets)) {
|
277 |
+
for ($i=0; $i < count($snippets); $i++) {
|
278 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
279 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
280 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
281 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
282 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
283 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
284 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
285 |
+
the plugin work correctly on PHP versions below 5.1.
|
286 |
+
This problem is fixed in WP 2.8.
|
287 |
+
*/
|
288 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
289 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
290 |
+
} else {
|
291 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
292 |
+
}
|
293 |
+
}
|
294 |
+
update_option($this->plugin_options, $snippets);
|
295 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
// Delete Snippets
|
300 |
+
if (isset($_POST['delete-selected'])) {
|
301 |
+
$snippets = get_option($this->plugin_options);
|
302 |
+
if (!empty($snippets)) {
|
303 |
+
$delete = $_POST['checked'];
|
304 |
+
$newsnippets = array();
|
305 |
+
for ($i=0; $i < count($snippets); $i++) {
|
306 |
+
if (in_array($i,$delete) == false) {
|
307 |
+
array_push($newsnippets,$snippets[$i]);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
update_option($this->plugin_options, $newsnippets);
|
311 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
?>
|
315 |
+
<div class=wrap>
|
316 |
+
<h2>Post Snippets</h2>
|
317 |
+
|
318 |
+
<form method="post" action="">
|
319 |
+
<?php wp_nonce_field('update-options'); ?>
|
320 |
+
|
321 |
+
<div class="tablenav">
|
322 |
+
<div class="alignleft actions">
|
323 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
324 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
325 |
+
</div>
|
326 |
+
</div>
|
327 |
+
<div class="clear"></div>
|
328 |
+
|
329 |
+
<table class="widefat fixed" cellspacing="0">
|
330 |
+
<thead>
|
331 |
+
<tr>
|
332 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
333 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
334 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
335 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
336 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
337 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
338 |
+
</tr>
|
339 |
+
</thead>
|
340 |
+
|
341 |
+
<tfoot>
|
342 |
+
<tr>
|
343 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
344 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
345 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
346 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
347 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
348 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
349 |
+
</tr>
|
350 |
+
</tfoot>
|
351 |
+
|
352 |
+
<tbody>
|
353 |
+
<?php
|
354 |
+
$snippets = get_option($this->plugin_options);
|
355 |
+
if (!empty($snippets)) {
|
356 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
357 |
+
<tr class='recent'>
|
358 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
359 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
360 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
361 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
362 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
363 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
364 |
+
</tr>
|
365 |
+
<?php
|
366 |
+
}
|
367 |
+
}
|
368 |
+
?>
|
369 |
+
</tbody>
|
370 |
+
</table>
|
371 |
+
<div class="submit">
|
372 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
373 |
+
</form>
|
374 |
+
|
375 |
+
<div id="poststuff" class="ui-sortable">
|
376 |
+
<div class="postbox">
|
377 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
378 |
+
<div class="inside">
|
379 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
380 |
+
|
381 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
382 |
+
|
383 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
384 |
+
|
385 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
386 |
+
|
387 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
388 |
+
|
389 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
390 |
+
</div>
|
391 |
+
</div>
|
392 |
+
</div>
|
393 |
+
|
394 |
+
<script type="text/javascript">
|
395 |
+
<!--
|
396 |
+
<?php global $wp_version; ?>
|
397 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
398 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
399 |
+
<?php } ?>
|
400 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
401 |
+
jQuery('.postbox.close-me').each(function(){
|
402 |
+
jQuery(this).addClass("closed");
|
403 |
+
});
|
404 |
+
//-->
|
405 |
+
</script>
|
406 |
+
</div>
|
407 |
+
<?php
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
412 |
+
?>
|
1.5.4/readme.txt
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.5.4
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.5.4 - 26 Jan 2011 =
|
56 |
+
* Included Turkish translation by [Ersan Özdil](http://www.tml.web.tr/).
|
57 |
+
|
58 |
+
= Version 1.5.3 - 19 Sep 2010 =
|
59 |
+
* Included Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
|
60 |
+
|
61 |
+
= Version 1.5.2 - 17 Sep 2010 =
|
62 |
+
* The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
|
63 |
+
* Updated the code to not generate warnings when running WordPress in debug mode.
|
64 |
+
|
65 |
+
= Version 1.5.1 - 12 Mar 2010 =
|
66 |
+
* Fixed ampersands when used in a shortcode, so they are XHTML valid.
|
67 |
+
|
68 |
+
= Version 1.5 - 12 Jan 2010 =
|
69 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
70 |
+
|
71 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
72 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
73 |
+
|
74 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
75 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
76 |
+
|
77 |
+
= Version 1.4.8 - 9 May 2009 =
|
78 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
79 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
80 |
+
|
81 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
82 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
83 |
+
|
84 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
85 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
86 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
87 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
88 |
+
* Added additional proofing for the variables string.
|
89 |
+
|
90 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
91 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
92 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
93 |
+
|
94 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
95 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
96 |
+
|
97 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
98 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
99 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
100 |
+
|
101 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
102 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
103 |
+
|
104 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
105 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
106 |
+
|
107 |
+
= Version 1.4 - 10 Apr 2009 =
|
108 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
109 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
110 |
+
|
111 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
112 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
113 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
114 |
+
|
115 |
+
= Version 1.3 - 2 Apr 2009 =
|
116 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
117 |
+
* Updated the Help info in the admin page to take less space.
|
118 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
119 |
+
|
120 |
+
= Version 1.2 - 1 Apr 2009 =
|
121 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
122 |
+
|
123 |
+
= Version 1.1 - 24 Mar 2009 =
|
124 |
+
* Included Swedish translation.
|
125 |
+
* Added TextDomain functionality for I18n.
|
126 |
+
|
127 |
+
= Version 1.0 - 23 Mar 2009 =
|
128 |
+
* Initial Release
|
1.5.4/screenshot-1.jpg
ADDED
Binary file
|
1.5.4/screenshot-2.jpg
ADDED
Binary file
|
1.5.4/screenshot-3.jpg
ADDED
Binary file
|
1.5.4/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.5.4/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.4/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.4/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5.4/tinymce/post-snippets.gif
ADDED
Binary file
|
1.5.4/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.5.4/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.5.4/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.5/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.5/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.5/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.5/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.5/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.5/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.5/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.5/post-snippets.php
ADDED
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://coding.cglounge.com/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.5
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://coding.cglounge.com/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2010 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '>=') ) {
|
47 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
48 |
+
$this->init_hooks();
|
49 |
+
} else {
|
50 |
+
$this->version_warning();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
add_action('admin_menu', array(&$this,'wp_admin'));
|
61 |
+
add_action('admin_head', array(&$this,'quicktags'));
|
62 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
63 |
+
$this->create_shortcodes();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Displays a warning when installed in an old Wordpress Version
|
68 |
+
*
|
69 |
+
* @returns Nothing
|
70 |
+
*/
|
71 |
+
function version_warning() {
|
72 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or later!', 'post-snippets').'</strong></p></div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Create the functions for shortcodes dynamically and register them
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
function create_shortcodes() {
|
81 |
+
$snippets = get_option($this->plugin_options);
|
82 |
+
if (!empty($snippets)) {
|
83 |
+
for ($i=0; $i < count($snippets); $i++) {
|
84 |
+
if ($snippets[$i]['shortcode'] == true) {
|
85 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
86 |
+
$vars_str = '';
|
87 |
+
for ($j=0; $j < count($vars); $j++) {
|
88 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
89 |
+
|
90 |
+
}
|
91 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
92 |
+
'$shortcode_symbols = array('.$vars_str.');
|
93 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
94 |
+
|
95 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
96 |
+
|
97 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
98 |
+
|
99 |
+
foreach ($newArr as $key => $val) {
|
100 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
101 |
+
}
|
102 |
+
|
103 |
+
return stripslashes($snippet);') );
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Handling of QuickTags in the HTML editor
|
111 |
+
*
|
112 |
+
*/
|
113 |
+
function quicktags() {
|
114 |
+
$snippets = get_option($this->plugin_options);
|
115 |
+
if (!empty($snippets)) { ?>
|
116 |
+
<script type="text/javascript">
|
117 |
+
if(typeof(edButtons)!='undefined') {
|
118 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
119 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
120 |
+
if ($snippets[$i]['quicktag']) {
|
121 |
+
// Make it js safe
|
122 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
123 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
124 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
125 |
+
$theVariables = "";
|
126 |
+
if (!empty($var_arr[0])) {
|
127 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
128 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
129 |
+
if ( $j < (count($var_arr) -1) )
|
130 |
+
$theVariables = $theVariables . ", ";
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
if ($snippets[$i]['shortcode']) {
|
135 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
136 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
137 |
+
}else{
|
138 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
139 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
140 |
+
}
|
141 |
+
|
142 |
+
echo '
|
143 |
+
postSnippetsNr = edButtons.length;
|
144 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
145 |
+
|
146 |
+
';
|
147 |
+
/* postSnippetsNr = edButtons.length;
|
148 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
149 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
150 |
+
|
151 |
+
while (postSnippetsButton.nodeType != 1) {
|
152 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
153 |
+
}
|
154 |
+
|
155 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
156 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
157 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
158 |
+
postSnippetsButton.title = postSnippetsNr;
|
159 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
160 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
161 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
162 |
+
} // end if
|
163 |
+
} //next ?>
|
164 |
+
};
|
165 |
+
window.onload = ps_quicktags;
|
166 |
+
function ps_quicktags() { <?php
|
167 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
168 |
+
if ($snippets[$i]['quicktag']) {
|
169 |
+
// Make it js safe
|
170 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $snippets[$i]['snippet'])));
|
171 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
172 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
173 |
+
$theVariables = "";
|
174 |
+
if (!empty($var_arr[0])) {
|
175 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
176 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
177 |
+
if ( $j < (count($var_arr) -1) )
|
178 |
+
$theVariables = $theVariables . ", ";
|
179 |
+
}
|
180 |
+
}
|
181 |
+
if ($snippets[$i]['shortcode']) {
|
182 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
183 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
184 |
+
}else{
|
185 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
186 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
187 |
+
}
|
188 |
+
?>
|
189 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
190 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
191 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
192 |
+
<?php
|
193 |
+
} // end if
|
194 |
+
} // next ?>
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
<?php
|
199 |
+
echo <<<JAVASCRIPT
|
200 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
201 |
+
theSnippet = '[' + shortcodeTag;
|
202 |
+
for (x in shortcodeAtts)
|
203 |
+
{
|
204 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
205 |
+
}
|
206 |
+
theSnippet += ']';
|
207 |
+
return theSnippet;
|
208 |
+
}
|
209 |
+
|
210 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
211 |
+
var myValue;
|
212 |
+
var insertString;
|
213 |
+
insertString = theSnippet;
|
214 |
+
for (x in theVariables)
|
215 |
+
{
|
216 |
+
myValue = prompt(theVariables[x]);
|
217 |
+
var searchfor = '{' + theVariables[x] + '}';
|
218 |
+
var re = new RegExp(searchfor, 'g');
|
219 |
+
insertString = insertString.replace(re, myValue);
|
220 |
+
|
221 |
+
}
|
222 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
223 |
+
theSnippet = insertString;
|
224 |
+
if (theSnippet) {
|
225 |
+
edInsertContent( myField, theSnippet );
|
226 |
+
}
|
227 |
+
}
|
228 |
+
//-->
|
229 |
+
</script>
|
230 |
+
JAVASCRIPT;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
|
235 |
+
/**
|
236 |
+
* The Admin Page and all it's functions
|
237 |
+
*
|
238 |
+
*/
|
239 |
+
function wp_admin() {
|
240 |
+
if (function_exists('add_options_page')) {
|
241 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 10, __FILE__, array(&$this, 'options_page') );
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
function admin_message($message) {
|
246 |
+
if ( $message ) {
|
247 |
+
?>
|
248 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
249 |
+
<?php
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
function options_page() {
|
254 |
+
// Add a new Snippet
|
255 |
+
if (isset($_POST['add-snippet'])) {
|
256 |
+
$snippets = get_option($this->plugin_options);
|
257 |
+
if (empty($snippets)) { $snippets = array(); }
|
258 |
+
array_push($snippets, array (
|
259 |
+
'title' => "Untitled",
|
260 |
+
'vars' => "",
|
261 |
+
'shortcode' => false,
|
262 |
+
'quicktag' => false,
|
263 |
+
'snippet' => ""));
|
264 |
+
update_option($this->plugin_options, $snippets);
|
265 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
266 |
+
}
|
267 |
+
|
268 |
+
// Update Snippets
|
269 |
+
if (isset($_POST['update-post-snippets'])) {
|
270 |
+
$snippets = get_option($this->plugin_options);
|
271 |
+
if (!empty($snippets)) {
|
272 |
+
for ($i=0; $i < count($snippets); $i++) {
|
273 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
274 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
275 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
276 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
277 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
278 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
279 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
280 |
+
the plugin work correctly on PHP versions below 5.1.
|
281 |
+
This problem is fixed in WP 2.8.
|
282 |
+
*/
|
283 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
284 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
285 |
+
} else {
|
286 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
update_option($this->plugin_options, $snippets);
|
290 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
// Delete Snippets
|
295 |
+
if (isset($_POST['delete-selected'])) {
|
296 |
+
$snippets = get_option($this->plugin_options);
|
297 |
+
if (!empty($snippets)) {
|
298 |
+
$delete = $_POST['checked'];
|
299 |
+
$newsnippets = array();
|
300 |
+
for ($i=0; $i < count($snippets); $i++) {
|
301 |
+
if (in_array($i,$delete) == false) {
|
302 |
+
array_push($newsnippets,$snippets[$i]);
|
303 |
+
}
|
304 |
+
}
|
305 |
+
update_option($this->plugin_options, $newsnippets);
|
306 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
?>
|
310 |
+
<div class=wrap>
|
311 |
+
<h2>Post Snippets</h2>
|
312 |
+
|
313 |
+
<form method="post" action="">
|
314 |
+
<?php wp_nonce_field('update-options'); ?>
|
315 |
+
|
316 |
+
<div class="tablenav">
|
317 |
+
<div class="alignleft actions">
|
318 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
319 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
320 |
+
</div>
|
321 |
+
</div>
|
322 |
+
<div class="clear"></div>
|
323 |
+
|
324 |
+
<table class="widefat fixed" cellspacing="0">
|
325 |
+
<thead>
|
326 |
+
<tr>
|
327 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
328 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
329 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
330 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
331 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
332 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
333 |
+
</tr>
|
334 |
+
</thead>
|
335 |
+
|
336 |
+
<tfoot>
|
337 |
+
<tr>
|
338 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
339 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
340 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
341 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
342 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
343 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
344 |
+
</tr>
|
345 |
+
</tfoot>
|
346 |
+
|
347 |
+
<tbody>
|
348 |
+
<?php
|
349 |
+
$snippets = get_option($this->plugin_options);
|
350 |
+
if (!empty($snippets)) {
|
351 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
352 |
+
<tr class='recent'>
|
353 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
354 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
355 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
356 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
357 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
358 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
359 |
+
</tr>
|
360 |
+
<?php
|
361 |
+
}
|
362 |
+
}
|
363 |
+
?>
|
364 |
+
</tbody>
|
365 |
+
</table>
|
366 |
+
<div class="submit">
|
367 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
368 |
+
</form>
|
369 |
+
|
370 |
+
<div id="poststuff" class="ui-sortable">
|
371 |
+
<div class="postbox">
|
372 |
+
<h3><?php _e( 'Help', 'post-snippets' ); ?></h3>
|
373 |
+
<div class="inside">
|
374 |
+
<p><?php _e( '<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor.', 'post-snippets' ); ?></p>
|
375 |
+
|
376 |
+
<p><?php _e( '<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets' ); ?></p>
|
377 |
+
|
378 |
+
<p><?php _e( '<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets' ); ?></p>
|
379 |
+
|
380 |
+
<p><?php _e( '<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets' ); ?></p>
|
381 |
+
|
382 |
+
<p><?php _e( '<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor.', 'post-snippets' ); ?></p>
|
383 |
+
|
384 |
+
<p><?php _e( '<strong>About Post Snippets</strong><br/>Visit my <a href="http://coding.cglounge.com/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets' ); ?></p>
|
385 |
+
</div>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
|
389 |
+
<script type="text/javascript">
|
390 |
+
<!--
|
391 |
+
<?php global $wp_version; ?>
|
392 |
+
<?php if ( version_compare( $wp_version, '2.6.999', '<' ) ) { ?>
|
393 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
394 |
+
<?php } ?>
|
395 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
396 |
+
jQuery('.postbox.close-me').each(function(){
|
397 |
+
jQuery(this).addClass("closed");
|
398 |
+
});
|
399 |
+
//-->
|
400 |
+
</script>
|
401 |
+
</div>
|
402 |
+
<?php
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
407 |
+
?>
|
1.5/readme.txt
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://coding.cglounge.com/wordpress-plugins/post-snippets/#pintware
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.9.1
|
7 |
+
Stable tag: 1.5
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://coding.cglounge.com/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://coding.cglounge.com/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://coding.cglounge.com/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.5 - 12 Jan 2010 =
|
56 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
57 |
+
|
58 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
59 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
60 |
+
|
61 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
62 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
63 |
+
|
64 |
+
= Version 1.4.8 - 9 May 2009 =
|
65 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
66 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
67 |
+
|
68 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
69 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
70 |
+
|
71 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
72 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
73 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
74 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
75 |
+
* Added additional proofing for the variables string.
|
76 |
+
|
77 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
78 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
79 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
80 |
+
|
81 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
82 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
83 |
+
|
84 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
85 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
86 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
87 |
+
|
88 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
89 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
90 |
+
|
91 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
92 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
93 |
+
|
94 |
+
= Version 1.4 - 10 Apr 2009 =
|
95 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
96 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
97 |
+
|
98 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
99 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
100 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
101 |
+
|
102 |
+
= Version 1.3 - 2 Apr 2009 =
|
103 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
104 |
+
* Updated the Help info in the admin page to take less space.
|
105 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
106 |
+
|
107 |
+
= Version 1.2 - 1 Apr 2009 =
|
108 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
109 |
+
|
110 |
+
= Version 1.1 - 24 Mar 2009 =
|
111 |
+
* Included Swedish translation.
|
112 |
+
* Added TextDomain functionality for I18n.
|
113 |
+
|
114 |
+
= Version 1.0 - 23 Mar 2009 =
|
115 |
+
* Initial Release
|
1.5/screenshot-1.jpg
ADDED
Binary file
|
1.5/screenshot-2.jpg
ADDED
Binary file
|
1.5/screenshot-3.jpg
ADDED
Binary file
|
1.5/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.5/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.5/tinymce/post-snippets.gif
ADDED
Binary file
|
1.5/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.5/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.5/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.7.1/assets/post-snippets.css
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Styling for the jQuery UI dialog used by Post Snippets
|
3 |
+
*
|
4 |
+
* @since Post Snippets 1.7.1
|
5 |
+
*/
|
6 |
+
#post-snippets-tabs {
|
7 |
+
padding: 15px 15px 3px;
|
8 |
+
background-color: #f1f1f1;
|
9 |
+
border-bottom: 1px solid #dfdfdf;
|
10 |
+
}
|
11 |
+
#post-snippets-tabs li {
|
12 |
+
display: inline;
|
13 |
+
}
|
14 |
+
#post-snippets-tabs li {
|
15 |
+
color: #2583AD;
|
16 |
+
padding: 6px 6px 6px 6px;
|
17 |
+
border-width: 1px 1px 0;
|
18 |
+
border-style: solid solid none;
|
19 |
+
border-color: #f1f1f1;
|
20 |
+
}
|
21 |
+
#post-snippets-tabs li.ui-tabs-selected {
|
22 |
+
background-color: #fff;
|
23 |
+
border-color: #dfdfdf;
|
24 |
+
border-bottom-color: #fff;
|
25 |
+
color: #d54e21;
|
26 |
+
}
|
27 |
+
#post-snippets-tabs li.ui-state-hover {
|
28 |
+
color: #d54e21;
|
29 |
+
}
|
30 |
+
#post-snippets-tabs a {
|
31 |
+
text-decoration: none;
|
32 |
+
}
|
33 |
+
#post-snippets-tabs .ui-tabs-panel {
|
34 |
+
margin: 5px 0 0 0;
|
35 |
+
padding: 5px 20px 10px;
|
36 |
+
background-color: #fff;
|
37 |
+
border-left: 1px solid #dfdfdf;
|
38 |
+
border-bottom: 1px solid #dfdfdf;
|
39 |
+
border: 1px solid #dfdfdf;
|
40 |
+
}
|
1.7.1/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.7.1/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.7.1/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.7.1/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.7.1/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.7.1/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.7.1/languages/post-snippets-tr_TR.mo
ADDED
Binary file
|
1.7.1/languages/post-snippets-tr_TR.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2011-01-23 02:21+0200\n"
|
11 |
+
"Last-Translator: JSEL <jselivingston@gmail.com>\n"
|
12 |
+
"Language-Team: www.tml.web.tr <jselivingston@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Country: TURKEY\n"
|
17 |
+
"X-Poedit-Language: Turkish\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets eklentisi WordPress 2.7 veya daha üst bir sürümde çalışır!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Untitled adında bir snippet eklendi."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Snippets alanları güncellendi."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Seçili snippet(lar) silindi."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Yeni Snippet Ekle"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Seçili Olanları Sil"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Başlık"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Değişkenler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Snippet"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Güncelle"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Yardım"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Başlık</strong><br/>Yazı editöründe kullanmak üzere snippet'a bir başlık yazın."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Değişkenler</strong><br/>Snippet'da kullanmak üzere virgülle birbirinden ayrılmış özel değişkenler listesi.<br/><br/>Örnek:<br/>url,name"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Snippet</strong><br/>Burası TinyMCE panelindeki ekle düğmesi aracılığıyla seçeceğiniz snippet'ın gönderide ekleneceği metin bloğu veya HTML kısmıdır. Snippet'ınızda daha önce tanımlanmış olan değişkenleri kullanmak için {} karakterleri arasına yazabilirsiniz.<br/><br/>Örnek:<br/>Yukarıdaki örnekteki değişkenleri kullanmak için {url} ve {name} kodlarını yazmalısınız.<br/><br/>Yani aşağıdaki snippet yazıldığında:<br/><i>Siteye ait url ve anchor metni: <a href=\"{url}\">{name}</a> şeklinde olacaktır.</i><br/>Böylelikle url ve name değişkenlerini değiştirme şansına sahip olacaksınız."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Post Snippets Hakkında"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "İzniniz yok"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Vazgeç"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Ekle"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Yazılarınızda sıklıkla kullandığınız HTML kodu veya metinlerdeki snippetlerı kaydeder. Tanımladığınız değişkenleri kullanarak snippet bölümlerini de değiştirebilirsiniz. Tüm snippetlara yazı editöründe yer alan TinyMCE, Quicktags veya Shortcodes düğmeleri aracılığıyla ulaşabilirsiniz."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.7.1/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: post-snippets.php:221
|
39 |
+
msgid "Delete Selected"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: post-snippets.php:230 post-snippets.php:239
|
43 |
+
msgid "Title"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: post-snippets.php:231 post-snippets.php:240
|
47 |
+
msgid "Variables"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: post-snippets.php:232 post-snippets.php:241
|
51 |
+
msgid "Snippet"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: post-snippets.php:263
|
55 |
+
msgid "Update Snippets"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: post-snippets.php:268
|
59 |
+
msgid "Help"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: post-snippets.php:270
|
63 |
+
msgid ""
|
64 |
+
"<strong>Title</strong><br/>Give the snippet a title that helps you identify "
|
65 |
+
"it in the post editor."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-snippets.php:272
|
69 |
+
msgid ""
|
70 |
+
"<strong>Variables</strong><br/>A comma separated list of custom variables "
|
71 |
+
"you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid ""
|
76 |
+
"<strong>Snippet</strong><br/>This is the block of text or HTML to insert in "
|
77 |
+
"the post when you select the snippet from the insert button in the TinyMCE "
|
78 |
+
"panel in the post editor. If you have entered predefined variables you can "
|
79 |
+
"reference them from the snippet by enclosing them in {} brackets.<br/><br/"
|
80 |
+
">Example:<br/>To reference the variables in the example above, you would "
|
81 |
+
"enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This "
|
82 |
+
"is the website of <a href=\"{url}\">{name}</a></i><br/>You will "
|
83 |
+
"get the option to replace url and name on insert if they are defined as "
|
84 |
+
"variables."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: post-snippets.php:281
|
88 |
+
msgid "About Post Snippets"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: tinymce/window.php:9
|
92 |
+
msgid "You are not allowed to be here"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: tinymce/window.php:109
|
96 |
+
msgid "Cancel"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: tinymce/window.php:113
|
100 |
+
msgid "Insert"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Plugin Name of an extension
|
104 |
+
msgid "Post Snippets"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#. Plugin URI of an extension
|
108 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#. Description of an extension
|
112 |
+
msgid ""
|
113 |
+
"Stores snippets of HTML code or reoccurring text that you often use in your "
|
114 |
+
"posts. You can use predefined variables to replace parts of the snippet on "
|
115 |
+
"insert. All snippets are available in the post editor with a TinyMCE button, "
|
116 |
+
"Quicktags or Shortcodes."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#. Author of an extension
|
120 |
+
msgid "Johan Steen"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Author URI of an extension
|
124 |
+
msgid "http://coding.cglounge.com/"
|
125 |
+
msgstr ""
|
1.7.1/post-snippets.php
ADDED
@@ -0,0 +1,690 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Snippets
|
4 |
+
Plugin URI: http://wpstorm.net/wordpress-plugins/post-snippets/
|
5 |
+
Description: Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button or Quicktags.
|
6 |
+
Version: 1.7.1
|
7 |
+
Author: Johan Steen
|
8 |
+
Author URI: http://wpstorm.net/
|
9 |
+
Text Domain: post-snippets
|
10 |
+
|
11 |
+
Copyright 2009-2011 Johan Steen (email : artstorm [at] gmail [dot] com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class post_snippets {
|
29 |
+
var $plugin_options = "post_snippets_options";
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function post_snippets()
|
36 |
+
{
|
37 |
+
// define URL
|
38 |
+
define('post_snippets_ABSPATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
39 |
+
define('post_snippets_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
40 |
+
|
41 |
+
// Define the domain for translations
|
42 |
+
load_plugin_textdomain( 'post-snippets', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
43 |
+
|
44 |
+
// Check installed Wordpress version.
|
45 |
+
global $wp_version;
|
46 |
+
if ( version_compare($wp_version, '2.7', '<') ) {
|
47 |
+
add_action( 'admin_notices', array(&$this, 'version_warning') );
|
48 |
+
} else {
|
49 |
+
include_once (dirname (__FILE__)."/tinymce/tinymce.php");
|
50 |
+
$this->init_hooks();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initializes the hooks for the plugin
|
56 |
+
*
|
57 |
+
* @returns Nothing
|
58 |
+
*/
|
59 |
+
function init_hooks() {
|
60 |
+
# Settings link on plugins list
|
61 |
+
add_filter( 'plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 );
|
62 |
+
# Options Page
|
63 |
+
add_action( 'admin_menu', array(&$this,'wp_admin') );
|
64 |
+
|
65 |
+
// This old methos is no longer used, DELETE when the new method is tried by users.
|
66 |
+
// Add Quicktags to header (used to be in footer!)
|
67 |
+
// add_action('admin_head', array(&$this,'quicktags'));
|
68 |
+
// add_action('admin_footer', array(&$this,'quicktags'));
|
69 |
+
|
70 |
+
$this->create_shortcodes();
|
71 |
+
|
72 |
+
# Adds the JS and HTML code in the header and footer for the jQuery insert UI dialog in the editor
|
73 |
+
add_action( 'admin_init', array(&$this,'enqueue_assets') );
|
74 |
+
add_action( 'admin_head', array(&$this,'jquery_ui_dialog') );
|
75 |
+
add_action( 'admin_footer', array(&$this,'insert_ui_dialog') );
|
76 |
+
|
77 |
+
# Add Editor QuickTag button
|
78 |
+
add_action( 'edit_form_advanced', array(&$this,'add_quicktag_button'));
|
79 |
+
add_action( 'edit_page_form', array(&$this,'add_quicktag_button'));
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Quick link to the Post Snippets Settings page from the Plugins page.
|
85 |
+
*
|
86 |
+
* @returns Array with all the plugin's action links
|
87 |
+
*/
|
88 |
+
function plugin_action_links( $links, $file ) {
|
89 |
+
if ( $file == plugin_basename( dirname(__FILE__).'/post-snippets.php' ) ) {
|
90 |
+
$links[] = '<a href="options-general.php?page=post-snippets/post-snippets.php">'.__('Settings', 'post-snippets').'</a>';
|
91 |
+
}
|
92 |
+
return $links;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Displays a warning when installed in an old Wordpress Version
|
97 |
+
*
|
98 |
+
* @returns Nothing
|
99 |
+
*/
|
100 |
+
function version_warning() {
|
101 |
+
echo '<div class="updated fade"><p><strong>'.__('Post Snippets requires WordPress version 2.7 or higher.', 'post-snippets').'</strong></p></div>';
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Enqueues the necessary scripts and styles for the plugins
|
106 |
+
*
|
107 |
+
* @since Post Snippets 1.7
|
108 |
+
*
|
109 |
+
* @returns Nothing
|
110 |
+
*/
|
111 |
+
function enqueue_assets() {
|
112 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
113 |
+
wp_enqueue_script( 'jquery-ui-tabs' );
|
114 |
+
|
115 |
+
# Adds the CSS stylesheet for the jQuery UI dialog
|
116 |
+
$style_url = plugins_url( '/assets/post-snippets.css', __FILE__);
|
117 |
+
wp_register_style('post-snippets-css', $style_url);
|
118 |
+
wp_enqueue_style( 'post-snippets-css');
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* jQuery control for the dialog and Javascript needed to insert snippets into the editor
|
123 |
+
*
|
124 |
+
* @since Post Snippets 1.7
|
125 |
+
*
|
126 |
+
* @returns Nothing
|
127 |
+
*/
|
128 |
+
function jquery_ui_dialog() {
|
129 |
+
echo "\n<!-- START: Post Snippets jQuery UI and related functions -->\n";
|
130 |
+
echo "<script>\n";
|
131 |
+
|
132 |
+
# Prepare the snippets and shortcodes into javascript variables
|
133 |
+
# so they can be inserted into the editor, and get the variables replaced
|
134 |
+
# with user defined strings.
|
135 |
+
$snippets = get_option($this->plugin_options);
|
136 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
137 |
+
if ($snippets[$i]['shortcode']) {
|
138 |
+
# Build a long string of the variables, ie: varname1={varname1} varname2={varname2}
|
139 |
+
# so {varnameX} can be replaced at runtime.
|
140 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
141 |
+
$variables = '';
|
142 |
+
if (!empty($var_arr[0])) {
|
143 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
144 |
+
$variables .= ' ' . $var_arr[$j] . '="{' . $var_arr[$j] . '}"';
|
145 |
+
}
|
146 |
+
}
|
147 |
+
$shortcode = $snippets[$i]['title'] . $variables;
|
148 |
+
echo "var postsnippet_{$i} = '[" . $shortcode . "]';\n";
|
149 |
+
} else {
|
150 |
+
$theSnippet = $snippets[$i]['snippet'];
|
151 |
+
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
152 |
+
echo "var postsnippet_{$i} = \"" . $theSnippet . "\";\n";
|
153 |
+
//echo "var postsnippet_{$i} = '" . esc_js( $snippets[$i]['snippet'] ) . "';\n";
|
154 |
+
}
|
155 |
+
}
|
156 |
+
?>
|
157 |
+
|
158 |
+
jQuery(document).ready(function($){
|
159 |
+
<?php
|
160 |
+
# Create js variables for all form fields
|
161 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
162 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
163 |
+
if (!empty($var_arr[0])) {
|
164 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
165 |
+
$varname = "var_" . $i . "_" . $j;
|
166 |
+
echo "var {$varname} = $( \"#{$varname}\" );\n";
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
?>
|
171 |
+
|
172 |
+
var $tabs = $("#post-snippets-tabs").tabs();
|
173 |
+
|
174 |
+
$(function() {
|
175 |
+
$( "#post-snippets-dialog" ).dialog({
|
176 |
+
autoOpen: false,
|
177 |
+
modal: true,
|
178 |
+
dialogClass: 'wp-dialog',
|
179 |
+
buttons: {
|
180 |
+
Cancel: function() {
|
181 |
+
$( this ).dialog( "close" );
|
182 |
+
},
|
183 |
+
"Insert": function() {
|
184 |
+
$( this ).dialog( "close" );
|
185 |
+
var selected = $tabs.tabs('option', 'selected');
|
186 |
+
<?php
|
187 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
188 |
+
?>
|
189 |
+
if (selected == <?php echo $i; ?>) {
|
190 |
+
insert_snippet = postsnippet_<?php echo $i; ?>;
|
191 |
+
<?php
|
192 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
193 |
+
if (!empty($var_arr[0])) {
|
194 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
195 |
+
$varname = "var_" . $i . "_" . $j; ?>
|
196 |
+
insert_snippet = insert_snippet.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, <?php echo $varname; ?>.val());
|
197 |
+
<?php
|
198 |
+
echo "\n";
|
199 |
+
}
|
200 |
+
}
|
201 |
+
?>
|
202 |
+
}
|
203 |
+
<?php
|
204 |
+
}
|
205 |
+
?>
|
206 |
+
edInsertContent(muppCanv, insert_snippet);
|
207 |
+
}
|
208 |
+
},
|
209 |
+
width: 500,
|
210 |
+
});
|
211 |
+
});
|
212 |
+
});
|
213 |
+
|
214 |
+
|
215 |
+
var muppCanv;
|
216 |
+
|
217 |
+
|
218 |
+
function edOpenPostSnippets(myField) {
|
219 |
+
muppCanv = myField;
|
220 |
+
jQuery( "#post-snippets-dialog" ).dialog( "open" );
|
221 |
+
};
|
222 |
+
|
223 |
+
|
224 |
+
<?php
|
225 |
+
echo "</script>\n";
|
226 |
+
echo "\n<!-- END: Post Snippets jQuery UI and related functions -->\n";
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
/**
|
232 |
+
* jQuery Insert Dialog for the editor
|
233 |
+
*
|
234 |
+
* @since Post Snippets 1.7
|
235 |
+
*
|
236 |
+
* @returns Nothing
|
237 |
+
*/
|
238 |
+
function insert_ui_dialog() {
|
239 |
+
echo "\n<!-- START: Post Snippets UI Dialog -->\n";
|
240 |
+
?>
|
241 |
+
<div class="hidden">
|
242 |
+
<div id="post-snippets-dialog" title="Post Snippets">
|
243 |
+
|
244 |
+
<div id="post-snippets-tabs">
|
245 |
+
<ul>
|
246 |
+
<?php
|
247 |
+
# Create a tab for each available snippet
|
248 |
+
$snippets = get_option($this->plugin_options);
|
249 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
250 |
+
<li><a href="#ps-tabs-<?php echo $i; ?>"><?php echo $snippets[$i]['title']; ?></a></li>
|
251 |
+
<?php } ?>
|
252 |
+
</ul>
|
253 |
+
|
254 |
+
<?php
|
255 |
+
# Create a panel with form fields for each available snippet
|
256 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
257 |
+
<div id="ps-tabs-<?php echo $i; ?>">
|
258 |
+
<?php
|
259 |
+
// Print a snippet description is available
|
260 |
+
if ( isset($snippets[$i]['description']) )
|
261 |
+
echo "<p>" . $snippets[$i]['description'] . "</p>\n";
|
262 |
+
|
263 |
+
// Get all variables defined for the snippet and output them as input fields
|
264 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
265 |
+
if (!empty($var_arr[0])) {
|
266 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
267 |
+
<label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label>
|
268 |
+
<input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
269 |
+
<br/>
|
270 |
+
<?php
|
271 |
+
}
|
272 |
+
} else {
|
273 |
+
// If no variables and no description available, output a text to inform the user that it's an insert snippet only
|
274 |
+
if ( empty($snippets[$i]['description']) )
|
275 |
+
echo "<p>" . __('This snippet is insert only, no variables defined.', 'post-snippets') . "</p>";
|
276 |
+
}
|
277 |
+
?>
|
278 |
+
</div><!-- #ps-tabs-## -->
|
279 |
+
<?php
|
280 |
+
}
|
281 |
+
?>
|
282 |
+
</div><!-- #post-snippets-tabs -->
|
283 |
+
</div><!-- #post-snippets-dialog -->
|
284 |
+
</div><!-- .hidden -->
|
285 |
+
<?
|
286 |
+
echo "\n<!-- END: Post Snippets UI Dialog -->\n";
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Adds a QuickTag button to the HTML editor
|
291 |
+
*
|
292 |
+
* @see wp-includes/js/quicktags.dev.js
|
293 |
+
* @since Post Snippets 1.7
|
294 |
+
*
|
295 |
+
* @returns Nothing
|
296 |
+
*/
|
297 |
+
function add_quicktag_button() {
|
298 |
+
echo "\n<!-- START: Post Snippets QuickTag button -->\n";
|
299 |
+
?>
|
300 |
+
<script type="text/javascript" charset="utf-8">
|
301 |
+
// <![CDATA[
|
302 |
+
//edButton(id, display, tagStart, tagEnd, access, open)
|
303 |
+
edbuttonlength = edButtons.length;
|
304 |
+
edButtons[edbuttonlength++] = new edButton('ed_postsnippets', 'Post Snippets', '', '', '', -1);
|
305 |
+
(function(){
|
306 |
+
if (typeof jQuery === 'undefined') {
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
jQuery(document).ready(function(){
|
310 |
+
jQuery("#ed_toolbar").append('<input type="button" value="Post Snippets" id="ed_postsnippets" class="ed_button" onclick="edOpenPostSnippets(edCanvas);" title="Post Snippets" />');
|
311 |
+
});
|
312 |
+
}());
|
313 |
+
// ]]>
|
314 |
+
</script>
|
315 |
+
<?php
|
316 |
+
echo "\n<!-- END: Post Snippets QuickTag button -->\n";
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Create the functions for shortcodes dynamically and register them
|
322 |
+
*
|
323 |
+
*/
|
324 |
+
function create_shortcodes() {
|
325 |
+
$snippets = get_option($this->plugin_options);
|
326 |
+
if (!empty($snippets)) {
|
327 |
+
for ($i=0; $i < count($snippets); $i++) {
|
328 |
+
// If shortcode is enabled for the snippet, and a snippet has been entered, register it as a shortcode.
|
329 |
+
if ( $snippets[$i]['shortcode'] && !empty($snippets[$i]['snippet']) ) {
|
330 |
+
|
331 |
+
$vars = explode(",",$snippets[$i]['vars']);
|
332 |
+
$vars_str = '';
|
333 |
+
for ($j=0; $j < count($vars); $j++) {
|
334 |
+
$vars_str = $vars_str . '"'.$vars[$j].'" => "",';
|
335 |
+
|
336 |
+
}
|
337 |
+
add_shortcode($snippets[$i]['title'], create_function('$atts',
|
338 |
+
'$shortcode_symbols = array('.$vars_str.');
|
339 |
+
extract(shortcode_atts($shortcode_symbols, $atts));
|
340 |
+
|
341 |
+
$newArr = compact( array_keys($shortcode_symbols) );
|
342 |
+
|
343 |
+
$snippet = "'. addslashes($snippets[$i]["snippet"]) .'";
|
344 |
+
$snippet = str_replace("&", "&", $snippet);
|
345 |
+
|
346 |
+
foreach ($newArr as $key => $val) {
|
347 |
+
$snippet = str_replace("{".$key."}", $val, $snippet);
|
348 |
+
}
|
349 |
+
|
350 |
+
return stripslashes($snippet);') );
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Handling of QuickTags in the HTML editor
|
358 |
+
*
|
359 |
+
* DELETE THIS PART WHEN THE NEW QUICKTAGS FUNCTION HAVE BEEN TRIED BY USERS.
|
360 |
+
*/
|
361 |
+
function quicktags() {
|
362 |
+
$snippets = get_option($this->plugin_options);
|
363 |
+
if (!empty($snippets)) { ?>
|
364 |
+
<script type="text/javascript">
|
365 |
+
if(typeof(edButtons)!='undefined') {
|
366 |
+
var postSnippetsNr, postSnippetsButton; <?php
|
367 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
368 |
+
if ($snippets[$i]['quicktag']) {
|
369 |
+
// Make it js safe
|
370 |
+
$theSnippet = $snippets[$i]['snippet'];
|
371 |
+
$theSnippet = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', $theSnippet)));
|
372 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
373 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
374 |
+
$theVariables = "";
|
375 |
+
if (!empty($var_arr[0])) {
|
376 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
377 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
378 |
+
if ( $j < (count($var_arr) -1) )
|
379 |
+
$theVariables = $theVariables . ", ";
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
if ($snippets[$i]['shortcode']) {
|
384 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
385 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
386 |
+
}else{
|
387 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
388 |
+
echo "var insertString" . $i ." = '" . str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) )). "';";
|
389 |
+
}
|
390 |
+
|
391 |
+
echo '
|
392 |
+
postSnippetsNr = edButtons.length;
|
393 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_psnip'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
394 |
+
|
395 |
+
';
|
396 |
+
/* postSnippetsNr = edButtons.length;
|
397 |
+
edButtons[postSnippetsNr] = new edButton(\'ed_ps'. $i . '\', \'' . $snippets[$i]['title'] . '\', insertString'. $i .', \'\', \'\', -1);
|
398 |
+
var postSnippetsButton = postSnippetsToolbar.lastChild;
|
399 |
+
|
400 |
+
while (postSnippetsButton.nodeType != 1) {
|
401 |
+
postSnippetsButton = postSnippetsButton.previousSibling;
|
402 |
+
}
|
403 |
+
|
404 |
+
postSnippetsButton = postSnippetsButton.cloneNode(true);
|
405 |
+
postSnippetsToolbar.appendChild(postSnippetsButton);
|
406 |
+
postSnippetsButton.value = \'' . $snippets[$i]['title'] . '\';
|
407 |
+
postSnippetsButton.title = postSnippetsNr;
|
408 |
+
var variables' . $i .' = new Array('.$theVariables.');
|
409 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString' . $i .', variables' . $i .', parseInt(this.title));}
|
410 |
+
postSnippetsButton.id = "ed_ps' . $i .'"; */
|
411 |
+
} // end if
|
412 |
+
} //next ?>
|
413 |
+
};
|
414 |
+
window.onload = ps_quicktags;
|
415 |
+
function ps_quicktags() { <?php
|
416 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
417 |
+
if ($snippets[$i]['quicktag']) {
|
418 |
+
// Make it js safe
|
419 |
+
$theSnippet = $snippets[$i]['snippet'];
|
420 |
+
$theSnippet = str_replace('"','\"',str_replace(chr(13), '', str_replace(chr(10), '%%LF%%', $theSnippet)));
|
421 |
+
//$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', $theSnippet));
|
422 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
423 |
+
$theVariables = "";
|
424 |
+
if (!empty($var_arr[0])) {
|
425 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
426 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
427 |
+
if ( $j < (count($var_arr) -1) )
|
428 |
+
$theVariables = $theVariables . ", ";
|
429 |
+
}
|
430 |
+
}
|
431 |
+
if ($snippets[$i]['shortcode']) {
|
432 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");";
|
433 |
+
echo "var insertString" . $i ." = createShortcode('".$snippets[$i]['title']."', variables".$i.");";
|
434 |
+
}else{
|
435 |
+
//echo "var insertString" . $i ." = '" . addslashes(stripslashes($theSnippet)). "';";
|
436 |
+
$theSnippet = str_replace('<', '\x3C', str_replace('>', '\x3E', addslashes(stripslashes($theSnippet)) ));
|
437 |
+
$theSnippet = str_replace('%%LF%%', '\n', $theSnippet);
|
438 |
+
echo "var insertString" . $i ." = '" . $theSnippet . "';";
|
439 |
+
}
|
440 |
+
?>
|
441 |
+
var postSnippetsButton = document.getElementById('ed_psnip<?php echo $i; ?>');
|
442 |
+
var variables<?php echo $i; ?> = new Array(<?php echo $theVariables; ?>);
|
443 |
+
postSnippetsButton.onclick = function () {edInsertSnippet(edCanvas, insertString<?php echo $i; ?>, variables<?php echo $i; ?>, parseInt(this.title));}
|
444 |
+
<?php
|
445 |
+
} // end if
|
446 |
+
} // next ?>
|
447 |
+
}
|
448 |
+
|
449 |
+
|
450 |
+
<?php
|
451 |
+
echo <<<JAVASCRIPT
|
452 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
453 |
+
theSnippet = '[' + shortcodeTag;
|
454 |
+
for (x in shortcodeAtts)
|
455 |
+
{
|
456 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
457 |
+
}
|
458 |
+
theSnippet += ']';
|
459 |
+
return theSnippet;
|
460 |
+
}
|
461 |
+
|
462 |
+
function edInsertSnippet(myField,theSnippet,theVariables) {
|
463 |
+
var myValue;
|
464 |
+
var insertString;
|
465 |
+
insertString = theSnippet;
|
466 |
+
for (x in theVariables)
|
467 |
+
{
|
468 |
+
myValue = prompt(theVariables[x]);
|
469 |
+
var searchfor = '{' + theVariables[x] + '}';
|
470 |
+
var re = new RegExp(searchfor, 'g');
|
471 |
+
insertString = insertString.replace(re, myValue);
|
472 |
+
|
473 |
+
}
|
474 |
+
//theSnippet = str_replace('\x3C', '<', str_replace('\x3E', '>', insertString));
|
475 |
+
theSnippet = insertString;
|
476 |
+
if (theSnippet) {
|
477 |
+
edInsertContent( myField, theSnippet );
|
478 |
+
}
|
479 |
+
}
|
480 |
+
//-->
|
481 |
+
</script>
|
482 |
+
JAVASCRIPT;
|
483 |
+
}
|
484 |
+
}
|
485 |
+
|
486 |
+
|
487 |
+
/**
|
488 |
+
* The Admin Page and all it's functions
|
489 |
+
*
|
490 |
+
*/
|
491 |
+
function wp_admin() {
|
492 |
+
add_action( 'contextual_help', array(&$this,'add_help_text'), 10, 3 );
|
493 |
+
add_options_page( 'Post Snippets Options', 'Post Snippets', 'administrator', __FILE__, array(&$this, 'options_page') );
|
494 |
+
}
|
495 |
+
|
496 |
+
function admin_message($message) {
|
497 |
+
if ( $message ) {
|
498 |
+
?>
|
499 |
+
<div class="updated"><p><strong><?php echo $message; ?></strong></p></div>
|
500 |
+
<?php
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Display contextual help in the help drop down menu at the options page.
|
506 |
+
*
|
507 |
+
* @since Post Snippets 1.7.1
|
508 |
+
*
|
509 |
+
* @returns string The Contextual Help
|
510 |
+
*/
|
511 |
+
function add_help_text($contextual_help, $screen_id, $screen) {
|
512 |
+
//$contextual_help .= var_dump($screen); // use this to help determine $screen->id
|
513 |
+
if ( $screen->id == 'settings_page_post-snippets/post-snippets' ) {
|
514 |
+
$contextual_help =
|
515 |
+
'<p><strong>' . __('Title', 'post-snippets') . '</strong></p>' .
|
516 |
+
'<p>' . __('Give the snippet a title that helps you identify it in the post editor. If you make it into a shortcode, this is the name of the shortcode as well.', 'post-snippets') . '</p>' .
|
517 |
+
|
518 |
+
'<p><strong>' . __('Variables', 'post-snippets') . '</strong></p>' .
|
519 |
+
'<p>' . __('A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name', 'post-snippets') . '</p>' .
|
520 |
+
|
521 |
+
'<p><strong>' . __('Snippet', 'post-snippets') . '</strong></p>' .
|
522 |
+
'<p>' . __('This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href="{url}">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables.', 'post-snippets') . '</p>' .
|
523 |
+
|
524 |
+
'<p><strong>' . __('SC', 'post-snippets') . '</strong></p>' .
|
525 |
+
'<p>' . __('Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert.', 'post-snippets') . '</p>' .
|
526 |
+
|
527 |
+
'<p><strong>' . __('Advanced', 'post-snippets') . '</strong></p>' .
|
528 |
+
'<p>' . __('The snippets can be retrieved directly from PHP, in a theme for instance, with the get_post_snippet() function. Visit the Post Snippets link under more information for instructions.', 'post-snippets') . '</p>' .
|
529 |
+
|
530 |
+
'<p><strong>' . __('For more information:', 'post-snippets') . '</strong></p>' .
|
531 |
+
'<p>' . __('Visit my <a href="http://wpstorm.net/wordpress-plugins/post-snippets/">Post Snippets</a> page for additional information.', 'post-snippets') . '</p>';
|
532 |
+
}
|
533 |
+
return $contextual_help;
|
534 |
+
}
|
535 |
+
|
536 |
+
|
537 |
+
function options_page() {
|
538 |
+
// Add a new Snippet
|
539 |
+
if (isset($_POST['add-snippet'])) {
|
540 |
+
$snippets = get_option($this->plugin_options);
|
541 |
+
if (empty($snippets)) { $snippets = array(); }
|
542 |
+
array_push($snippets, array (
|
543 |
+
'title' => "Untitled",
|
544 |
+
'vars' => "",
|
545 |
+
'shortcode' => false,
|
546 |
+
'quicktag' => false,
|
547 |
+
'snippet' => ""));
|
548 |
+
update_option($this->plugin_options, $snippets);
|
549 |
+
$this->admin_message( __( 'A snippet named Untitled has been added.', 'post-snippets' ) );
|
550 |
+
}
|
551 |
+
|
552 |
+
// Update Snippets
|
553 |
+
if (isset($_POST['update-post-snippets'])) {
|
554 |
+
$snippets = get_option($this->plugin_options);
|
555 |
+
if (!empty($snippets)) {
|
556 |
+
for ($i=0; $i < count($snippets); $i++) {
|
557 |
+
$snippets[$i]['title'] = trim($_POST[$i.'_title']);
|
558 |
+
$snippets[$i]['vars'] = str_replace(" ", "", trim($_POST[$i.'_vars']) );
|
559 |
+
$snippets[$i]['shortcode'] = isset($_POST[$i.'_shortcode']) ? true : false;
|
560 |
+
$snippets[$i]['quicktag'] = isset($_POST[$i.'_quicktag']) ? true : false;
|
561 |
+
/* Check if the plugin runs on PHP below version 5.1.0
|
562 |
+
Because of a bug in WP 2.7.x in includes/compat.php the htmlspecialchars_decode
|
563 |
+
don't revert back to a PHP 4.x compatible version. So this is a workaround to make
|
564 |
+
the plugin work correctly on PHP versions below 5.1.
|
565 |
+
This problem is fixed in WP 2.8.
|
566 |
+
*/
|
567 |
+
if (version_compare(PHP_VERSION, '5.1.0', '<')) {
|
568 |
+
$snippets[$i]['snippet'] = htmlspecialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
569 |
+
} else {
|
570 |
+
$snippets[$i]['snippet'] = wp_specialchars_decode( trim(stripslashes($_POST[$i.'_snippet'])), ENT_NOQUOTES);
|
571 |
+
}
|
572 |
+
}
|
573 |
+
update_option($this->plugin_options, $snippets);
|
574 |
+
$this->admin_message( __( 'Snippets have been updated.', 'post-snippets' ) );
|
575 |
+
}
|
576 |
+
}
|
577 |
+
|
578 |
+
// Delete Snippets
|
579 |
+
if (isset($_POST['delete-selected'])) {
|
580 |
+
$snippets = get_option($this->plugin_options);
|
581 |
+
if (!empty($snippets)) {
|
582 |
+
$delete = $_POST['checked'];
|
583 |
+
$newsnippets = array();
|
584 |
+
for ($i=0; $i < count($snippets); $i++) {
|
585 |
+
if (in_array($i,$delete) == false) {
|
586 |
+
array_push($newsnippets,$snippets[$i]);
|
587 |
+
}
|
588 |
+
}
|
589 |
+
update_option($this->plugin_options, $newsnippets);
|
590 |
+
$this->admin_message( __( 'Selected snippets have been deleted.', 'post-snippets' ) );
|
591 |
+
}
|
592 |
+
}
|
593 |
+
?>
|
594 |
+
<div class=wrap>
|
595 |
+
<h2>Post Snippets</h2>
|
596 |
+
|
597 |
+
<form method="post" action="">
|
598 |
+
<?php wp_nonce_field('update-options'); ?>
|
599 |
+
|
600 |
+
<div class="tablenav">
|
601 |
+
<div class="alignleft actions">
|
602 |
+
<input type="submit" name="add-snippet" value="<?php _e( 'Add New Snippet', 'post-snippets' ) ?>" class="button-secondary" />
|
603 |
+
<input type="submit" name="delete-selected" value="<?php _e( 'Delete Selected', 'post-snippets' ) ?>" class="button-secondary" />
|
604 |
+
<span class="description"><?php _e( '(Use the help dropdown button above for additional information.)', 'post-snippets' ); ?></span>
|
605 |
+
</div>
|
606 |
+
</div>
|
607 |
+
<div class="clear"></div>
|
608 |
+
|
609 |
+
<table class="widefat fixed" cellspacing="0">
|
610 |
+
<thead>
|
611 |
+
<tr>
|
612 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
613 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
614 |
+
<th scope="col" style="width: 180px;"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
615 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
616 |
+
<th scope="col" style="width: 20px;"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
617 |
+
<th scope="col" style="width: 20px;"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
618 |
+
</tr>
|
619 |
+
</thead>
|
620 |
+
|
621 |
+
<tfoot>
|
622 |
+
<tr>
|
623 |
+
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
624 |
+
<th scope="col"><?php _e( 'Title', 'post-snippets' ) ?></th>
|
625 |
+
<th scope="col"><?php _e( 'Variables', 'post-snippets' ) ?></th>
|
626 |
+
<th scope="col"><?php _e( 'Snippet', 'post-snippets' ) ?></th>
|
627 |
+
<th scope="col"><?php _e( 'SC', 'post-snippets' ) ?></th>
|
628 |
+
<th scope="col"><?php _e( 'QT', 'post-snippets' ) ?></th>
|
629 |
+
</tr>
|
630 |
+
</tfoot>
|
631 |
+
|
632 |
+
<tbody>
|
633 |
+
<?php
|
634 |
+
$snippets = get_option($this->plugin_options);
|
635 |
+
if (!empty($snippets)) {
|
636 |
+
for ($i=0; $i < count($snippets); $i++) { ?>
|
637 |
+
<tr class='recent'>
|
638 |
+
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='<?php echo $i; ?>' /></th>
|
639 |
+
<td class='row-title'><input type='text' name='<?php echo $i; ?>_title' value='<?php echo $snippets[$i]['title']; ?>' /></td>
|
640 |
+
<td class='name'><input type='text' name='<?php echo $i; ?>_vars' value='<?php echo $snippets[$i]['vars']; ?>' /></td>
|
641 |
+
<td class='desc'><textarea name="<?php echo $i; ?>_snippet" class="large-text" rows="3"><?php echo htmlspecialchars($snippets[$i]['snippet'], ENT_NOQUOTES); ?></textarea></td>
|
642 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_shortcode' value='true'<?php if ($snippets[$i]['shortcode'] == true) { echo " checked"; }?> /></td>
|
643 |
+
<td class='name'><input type='checkbox' name='<?php echo $i; ?>_quicktag' value='true'<?php if ($snippets[$i]['quicktag'] == true) { echo " checked"; }?> /></td>
|
644 |
+
</tr>
|
645 |
+
<?php
|
646 |
+
}
|
647 |
+
}
|
648 |
+
?>
|
649 |
+
</tbody>
|
650 |
+
</table>
|
651 |
+
<div class="submit">
|
652 |
+
<input type="submit" name="update-post-snippets" value="<?php _e( 'Update Snippets', 'post-snippets' ) ?>" class="button-primary" /></div>
|
653 |
+
</form>
|
654 |
+
</div>
|
655 |
+
<?php
|
656 |
+
}
|
657 |
+
}
|
658 |
+
|
659 |
+
add_action( 'plugins_loaded', create_function( '', 'global $post_snippets; $post_snippets = new post_snippets();' ) );
|
660 |
+
|
661 |
+
|
662 |
+
/**
|
663 |
+
* Allow snippets to be retrieved directly from PHP
|
664 |
+
*
|
665 |
+
* @since Post Snippets 1.6
|
666 |
+
*
|
667 |
+
* @param string $snippet_name The name of the snippet to retrieve
|
668 |
+
* @param string $snippet_vars The variables to pass to the snippet, formatted as a query string.
|
669 |
+
* @returns string The Snippet
|
670 |
+
*/
|
671 |
+
function get_post_snippet( $snippet_name, $snippet_vars ) {
|
672 |
+
global $post_snippets;
|
673 |
+
$snippets = get_option($post_snippets -> plugin_options);
|
674 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
675 |
+
if ($snippets[$i]['title'] == $snippet_name) {
|
676 |
+
parse_str( htmlspecialchars_decode($snippet_vars), $snippet_output );
|
677 |
+
$snippet = $snippets[$i]['snippet'];
|
678 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
679 |
+
|
680 |
+
if ( !empty($var_arr[0]) ) {
|
681 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
682 |
+
$snippet = str_replace("{".$var_arr[$j]."}", $snippet_output[$var_arr[$j]], $snippet);
|
683 |
+
}
|
684 |
+
}
|
685 |
+
}
|
686 |
+
}
|
687 |
+
return $snippet;
|
688 |
+
}
|
689 |
+
|
690 |
+
?>
|
1.7.1/readme.txt
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Post Snippets ===
|
2 |
+
Contributors: artstorm
|
3 |
+
Donate link: http://wpstorm.net/wordpress-plugins/post-snippets/#donation
|
4 |
+
Tags: post, admin, snippet, html, custom, page, dynamic, editor, quicktag
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.1
|
7 |
+
Stable tag: 1.7.1
|
8 |
+
|
9 |
+
Store snippets of HTML code or reoccurring text that you often use in your posts. Custom variables can be used.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This admin plugin stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet.
|
14 |
+
|
15 |
+
For complete usage instructions see: [Post Snippets](http://wpstorm.net/wordpress-plugins/post-snippets/ "Complete Usage Instructions for Post Snippets")
|
16 |
+
|
17 |
+
See the [Changelog](http://wordpress.org/extend/plugins/post-snippets/changelog/) for what's new. Available [Translations](http://wpstorm.net/wordpress-plugins/post-snippets/#translations).
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* **Insert** All defined snippets is inserted from a button directly in the post editor.
|
22 |
+
* **Shortcodes** You can use this plugin to create your own shortcodes.
|
23 |
+
* **Buttons** The snippets are available in the viusal editor with a TinyMCE button and in the HTML editor with quicktag buttons.
|
24 |
+
* **Admin** Easy to use administration panel where you can add, edit and remove snippets.
|
25 |
+
* **Variables** Each snippet can have as many custom variables as you like, which can be used on insert.
|
26 |
+
* **Uninstall** If you delete the plugin from your plugins panel it cleans up all data it has created in the Wordpress database.
|
27 |
+
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
= Install =
|
32 |
+
|
33 |
+
1. Upload the 'post-snippets' folder to the '/wp-content/plugins/' directory.
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
35 |
+
3. Go to Settings -> Post Snippets and start entering your snippets.
|
36 |
+
|
37 |
+
= Uninstall =
|
38 |
+
|
39 |
+
1. Deactivate Post Snippets in the 'Plugins' menu in Wordpress.
|
40 |
+
2. Select Post Snippets in the 'Recently Active Plugins' section and select 'Delete' from the 'Bulk Actions' drop down menu.
|
41 |
+
3. This will delete all the plugin files from the server as well as erasing all options the plugin has stored in the database.
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
Please visit [Post Snippets' Comments](http://wpstorm.net/wordpress-plugins/post-snippets/#comments) for questions and answers.
|
46 |
+
|
47 |
+
== Screenshots ==
|
48 |
+
|
49 |
+
1. The Admin page where you set up new snippets.
|
50 |
+
2. The TinyMCE button for Post Snippets.
|
51 |
+
3. The Post Snippet Insert Window.
|
52 |
+
|
53 |
+
== Changelog ==
|
54 |
+
|
55 |
+
= Version 1.7.1 - 26 Feb 2011 =
|
56 |
+
* Added styling to the Tabs in the Quicktag jQuery dialog window to make them more "tab-like".
|
57 |
+
* Added the possibility to use a description for each snippet to display for the user when opening the Quicktag jQuery dialog window. Snippets without description and variables, has a default information message.
|
58 |
+
* Moved the help text from below the snippets to the contextual help dropdown menu at the top of the settings page.
|
59 |
+
* **Changed the required version of WordPress to 3.0**.
|
60 |
+
* Request by proximity2008: A snippet without anything entered in the snippet field will not be registered as a shortcode.
|
61 |
+
|
62 |
+
= Version 1.7 - 26 Feb 2011 =
|
63 |
+
* Complete rewrite of the QuickTags insert functionality. It now uses jQuery UI to display a similar tabbed window as the TinyMCE button does. There is now one 'Post Snippets' button in the HTML editor instead of a separate button for each snippet. As the QuickTags function is completely rewritten, and this is the initial release of the new method, please report if you encounter any problems with it.
|
64 |
+
* Fixed QuickTags compability with WordPress 3.1.
|
65 |
+
* Added a link to the Post Snippets Settings directly from the entry on the 'Plugins List' page.
|
66 |
+
* Added get_post_snippet() function to retrieve snippets directly from PHP.
|
67 |
+
|
68 |
+
= Version 1.5.4 - 26 Jan 2011 =
|
69 |
+
* Included Turkish translation by [Ersan Özdil](http://www.tml.web.tr/).
|
70 |
+
|
71 |
+
= Version 1.5.3 - 19 Sep 2010 =
|
72 |
+
* Included Spanish translation by [Melvis E. Leon Lopez](http://www.soludata.net/site/).
|
73 |
+
|
74 |
+
= Version 1.5.2 - 17 Sep 2010 =
|
75 |
+
* The plugin now keeps linefeed formatting when inserting a snippet directly with a quicktag in the HTML editor.
|
76 |
+
* Updated the code to not generate warnings when running WordPress in debug mode.
|
77 |
+
|
78 |
+
= Version 1.5.1 - 12 Mar 2010 =
|
79 |
+
* Fixed ampersands when used in a shortcode, so they are XHTML valid.
|
80 |
+
|
81 |
+
= Version 1.5 - 12 Jan 2010 =
|
82 |
+
* Updated the plugin so it works with WordPress 2.9.x (the quicktags didn't work in 2.9, now fixed.).
|
83 |
+
|
84 |
+
= Version 1.4.9.1 - 5 Sep 2009 =
|
85 |
+
* Included French translation by [Thomas Cailhe (Oyabi)](http://www.oyabi.fr/).
|
86 |
+
|
87 |
+
= Version 1.4.9 - 10 Aug 2009 =
|
88 |
+
* Included Russian translation by [FatCow](http://www.fatcow.com/).
|
89 |
+
|
90 |
+
= Version 1.4.8 - 9 May 2009 =
|
91 |
+
* Changed the handling of the TinyMCE button as some server configurations had problems finding the correct path.
|
92 |
+
* Fixed a problem that didn't let a snippet contain a </script> tag.
|
93 |
+
|
94 |
+
= Version 1.4.7 - 27 Apr 2009 =
|
95 |
+
* Added a workaround for a bug in WordPress 2.7.x wp-includes/compat.php that prevented the plugin to work correctly on webservers running with PHP below version 5.1.0 together with WP 2.7.x. This bug is patched in WordPress 2.8.
|
96 |
+
|
97 |
+
= Version 1.4.6 - 25 Apr 2009 =
|
98 |
+
* Updated all code to follow the WordPress Coding Standards for consistency, if someone wants to modify my code.
|
99 |
+
* Removed the nodechangehandler from the TinyMCE js, as it didn't fill any purpose.
|
100 |
+
* Updated the save code to remove the PHP Notice messages, if using error logging on the server.
|
101 |
+
* Added additional proofing for the variables string.
|
102 |
+
|
103 |
+
= Version 1.4.5 - 24 Apr 2009 =
|
104 |
+
* Fixed a problem in the admin options that didn't allow a form with a textarea to be used as a snippet.
|
105 |
+
* Widened the columns for SC and QT slightly in the options panel so they should look a bit better on the mac.
|
106 |
+
|
107 |
+
= Version 1.4.4 - 19 Apr 2009 =
|
108 |
+
* Minor fix with quicktags and certain snippets that was left out in the last update.
|
109 |
+
|
110 |
+
= Version 1.4.3 - 16 Apr 2009 =
|
111 |
+
* Fixed an escaping problem with the recently implemented shortcode function, that could cause problems on certain strings.
|
112 |
+
* Fixed an escaping problem with the quicktag javascript, that could cause problems on certain strings.
|
113 |
+
|
114 |
+
= Version 1.4.2 - 11 Apr 2009 =
|
115 |
+
* Fixed some additional syntax for servers where the short_open_tag configuration setting is disabled.
|
116 |
+
|
117 |
+
= Version 1.4.1 - 10 Apr 2009 =
|
118 |
+
* Removed all short syntax commands and replaced them with the full versions so the plugin also works on servers with the short_open_tag configuration setting disabled.
|
119 |
+
|
120 |
+
= Version 1.4 - 10 Apr 2009 =
|
121 |
+
* Added a checkbox for Shortcodes (SC) in the admin panel. When checking this one a dynamic shortcode will be generated and inserted instead of the snippet, which allows snippets to be updated later on for all posts it's been inserted into when using this option.
|
122 |
+
* Added a checkbox for Quicktags (QT) in the admin panel, so Quicktags are optional. Speeds up loading of the post editor if you don't need the quicktag support, and only use the visual editor. Defaults to off.
|
123 |
+
|
124 |
+
= Version 1.3.5 - 9 Apr 2009 =
|
125 |
+
* Fixed so the TinyMCE window adds a scrollbar if there is more variables for a snippet than fits in the window.
|
126 |
+
* Fixed a bug that snippets didn't get inserted when using the visual editor in fullscreen mode.
|
127 |
+
|
128 |
+
= Version 1.3 - 2 Apr 2009 =
|
129 |
+
* Fixed a problem with the regular expressions that prohibited variables consisting of just a single number to work.
|
130 |
+
* Updated the Help info in the admin page to take less space.
|
131 |
+
* Included a check so the plugin only runs in WP 2.7 or newer.
|
132 |
+
|
133 |
+
= Version 1.2 - 1 Apr 2009 =
|
134 |
+
* Added support for Quicktags so the snippets can be made available in the HTML editor as well.
|
135 |
+
|
136 |
+
= Version 1.1 - 24 Mar 2009 =
|
137 |
+
* Included Swedish translation.
|
138 |
+
* Added TextDomain functionality for I18n.
|
139 |
+
|
140 |
+
= Version 1.0 - 23 Mar 2009 =
|
141 |
+
* Initial Release
|
1.7.1/screenshot-1.jpg
ADDED
Binary file
|
1.7.1/screenshot-2.jpg
ADDED
Binary file
|
1.7.1/screenshot-3.jpg
ADDED
Binary file
|
1.7.1/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
|
2 |
+
|
3 |
+
(function() {
|
4 |
+
// Load plugin specific language pack
|
5 |
+
tinymce.PluginManager.requireLangPack('post_snippets');
|
6 |
+
|
7 |
+
tinymce.create('tinymce.plugins.post_snippets', {
|
8 |
+
/**
|
9 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
10 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
11 |
+
* of the editor instance to intercept that event.
|
12 |
+
*
|
13 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
14 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
15 |
+
*/
|
16 |
+
init : function(ed, url) {
|
17 |
+
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
18 |
+
|
19 |
+
ed.addCommand('mcepost_snippets', function() {
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/window.php',
|
22 |
+
width : 360 + ed.getLang('post_snippets.delta_width', 0),
|
23 |
+
height : 210 + ed.getLang('post_snippets.delta_height', 0),
|
24 |
+
inline : 1
|
25 |
+
}, {
|
26 |
+
plugin_url : url // Plugin absolute URL
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
// Register example button
|
31 |
+
ed.addButton('post_snippets', {
|
32 |
+
title : 'post_snippets.desc',
|
33 |
+
cmd : 'mcepost_snippets',
|
34 |
+
image : url + '/post-snippets.gif'
|
35 |
+
});
|
36 |
+
},
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Returns information about the plugin as a name/value array.
|
40 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
41 |
+
*
|
42 |
+
* @return {Object} Name/value array containing information about the plugin.
|
43 |
+
*/
|
44 |
+
getInfo : function() {
|
45 |
+
return {
|
46 |
+
longname : 'post_snippets',
|
47 |
+
author : 'Johan Steen',
|
48 |
+
authorurl : 'http://coding.cglounge.com/',
|
49 |
+
infourl : 'http://coding.cglounge.com/',
|
50 |
+
version : "1.0"
|
51 |
+
};
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Register plugin
|
56 |
+
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets);
|
57 |
+
})();
|
58 |
+
|
59 |
+
|
1.7.1/tinymce/langs/en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.7.1/tinymce/langs/en_US.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.7.1/tinymce/langs/en_en.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
tinyMCE.addI18n({en_US:{
|
2 |
+
post_snippets:{
|
3 |
+
desc : 'Insert a Post Snippet'
|
4 |
+
}}});
|
1.7.1/tinymce/post-snippets.gif
ADDED
Binary file
|
1.7.1/tinymce/tinymce.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class that adds a TinyMCE button to the Post editor
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class add_post_snippets_button {
|
7 |
+
var $pluginname = "post_snippets";
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor
|
11 |
+
*/
|
12 |
+
function add_post_snippets_button() {
|
13 |
+
// Modify the version when tinyMCE plugins are changed.
|
14 |
+
add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
|
15 |
+
|
16 |
+
// init process for button control
|
17 |
+
add_action('init', array (&$this, 'add_buttons') );
|
18 |
+
}
|
19 |
+
|
20 |
+
function add_buttons() {
|
21 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
22 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
23 |
+
|
24 |
+
// Add only in Rich Editor mode
|
25 |
+
if ( get_user_option('rich_editing') == 'true') {
|
26 |
+
// add the button for wp2.5 in a new way
|
27 |
+
add_filter("mce_external_plugins", array (&$this, "add_tinymce_plugin" ), 5);
|
28 |
+
add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// used to insert button in wordpress 2.5x editor
|
33 |
+
function register_button($buttons) {
|
34 |
+
array_push($buttons, "separator", $this->pluginname );
|
35 |
+
return $buttons;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
|
39 |
+
function add_tinymce_plugin($plugin_array) {
|
40 |
+
$plugin_array[$this->pluginname] = post_snippets_URLPATH.'tinymce/editor_plugin.js';
|
41 |
+
return $plugin_array;
|
42 |
+
}
|
43 |
+
|
44 |
+
function change_tinymce_version($version) {
|
45 |
+
return ++$version;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$tinymce_button = new add_post_snippets_button();
|
50 |
+
?>
|
1.7.1/tinymce/window.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Finding the path to the wp-admin folder */
|
3 |
+
$iswin = preg_match('/:\\\/', dirname(__file__));
|
4 |
+
$slash = ($iswin) ? "\\" : "/";
|
5 |
+
|
6 |
+
$wp_path = preg_split('/(?=((\\\|\/)wp-content)).*/', dirname(__file__));
|
7 |
+
$wp_path = (isset($wp_path[0]) && $wp_path[0] != "") ? $wp_path[0] : $_SERVER["DOCUMENT_ROOT"];
|
8 |
+
|
9 |
+
/** Load WordPress Administration Bootstrap */
|
10 |
+
require_once($wp_path . $slash . 'wp-load.php');
|
11 |
+
require_once($wp_path . $slash . 'wp-admin' . $slash . 'admin.php');
|
12 |
+
|
13 |
+
|
14 |
+
// check for rights
|
15 |
+
if ( !is_user_logged_in() || !current_user_can('edit_posts') )
|
16 |
+
wp_die(__( "You are not allowed to be here", 'post-snippets' ));
|
17 |
+
|
18 |
+
?>
|
19 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
20 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
+
<head>
|
22 |
+
<title>Post Snippets</title>
|
23 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
24 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
25 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
|
26 |
+
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
27 |
+
<script language="javascript" type="text/javascript">
|
28 |
+
function init() {
|
29 |
+
tinyMCEPopup.resizeToInnerSize();
|
30 |
+
}
|
31 |
+
|
32 |
+
function createSnippet(theSnippet) {
|
33 |
+
}
|
34 |
+
|
35 |
+
function createShortcode(shortcodeTag, shortcodeAtts) {
|
36 |
+
theSnippet = "[" + shortcodeTag;
|
37 |
+
for (x in shortcodeAtts)
|
38 |
+
{
|
39 |
+
theSnippet += ' ' + shortcodeAtts[x] + '="{' + shortcodeAtts[x] + '}"';
|
40 |
+
}
|
41 |
+
theSnippet += "]";
|
42 |
+
return theSnippet;
|
43 |
+
}
|
44 |
+
|
45 |
+
function insertSnippet() {
|
46 |
+
|
47 |
+
var insertString;
|
48 |
+
|
49 |
+
<?php
|
50 |
+
$snippets = get_option($post_snippets->plugin_options);
|
51 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
52 |
+
var panel<?php echo $i; ?> = document.getElementById('ps_panel<?php echo $i; ?>');
|
53 |
+
<?php } ?>
|
54 |
+
|
55 |
+
var rss = document.getElementById('ps_panel0');
|
56 |
+
|
57 |
+
<?php
|
58 |
+
$snippets = get_option($post_snippets->plugin_options);
|
59 |
+
for ($i = 0; $i < count($snippets); $i++) {
|
60 |
+
// Make it js safe
|
61 |
+
$theString = str_replace('"','\"',str_replace(Chr(13), '', str_replace(Chr(10), '', str_replace('<', '\x3C', str_replace('>', '\x3E', $snippets[$i]['snippet'])))));
|
62 |
+
// \x3C and \x3E
|
63 |
+
?>
|
64 |
+
|
65 |
+
if (panel<?php echo $i; ?>.className.indexOf('current') != -1) {
|
66 |
+
<?php
|
67 |
+
if ($snippets[$i]['shortcode']) {
|
68 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
69 |
+
$theVariables = "";
|
70 |
+
if (!empty($var_arr[0])) {
|
71 |
+
for ($j = 0; $j < count($var_arr); $j++) {
|
72 |
+
$theVariables = $theVariables . "'" . $var_arr[$j] . "'";
|
73 |
+
if ( $j < (count($var_arr) -1) )
|
74 |
+
$theVariables = $theVariables . ", ";
|
75 |
+
|
76 |
+
}
|
77 |
+
}
|
78 |
+
echo "var variables" . $i ." = new Array(".$theVariables.");"; ?>
|
79 |
+
insertString = createShortcode("<?php echo $snippets[$i]['title']; ?>", variables<?php echo $i; ?>);
|
80 |
+
<?php }else{ ?>
|
81 |
+
insertString = "<?php echo $theString; ?>";
|
82 |
+
<?php } ?>
|
83 |
+
<?php
|
84 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
85 |
+
if (!empty($var_arr[0])) {
|
86 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
87 |
+
var var_<?php echo $i; ?>_<?php echo $j; ?> = document.getElementById('var_<?php echo $i; ?>_<?php echo $j; ?>').value;
|
88 |
+
insertString = insertString.replace(/\{<?php echo $var_arr[$j]; ?>\}/g, var_<?php echo $i; ?>_<?php echo $j; ?>);
|
89 |
+
<?php } } ?>
|
90 |
+
}
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
|
94 |
+
if(window.tinyMCE) {
|
95 |
+
//window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, insertString);
|
96 |
+
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
97 |
+
tinyMCEPopup.execCommand('mceInsertContent', false, insertString);
|
98 |
+
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
99 |
+
//Peforms a clean up of the current editor HTML.
|
100 |
+
//tinyMCEPopup.editor.execCommand('mceCleanup');
|
101 |
+
//Repaints the editor. Sometimes the browser has graphic glitches.
|
102 |
+
tinyMCEPopup.editor.execCommand('mceRepaint');
|
103 |
+
tinyMCEPopup.close();
|
104 |
+
}
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
</script>
|
108 |
+
<base target="_self" />
|
109 |
+
</head>
|
110 |
+
<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
|
111 |
+
<!-- <form onsubmit="insertLink();return false;" action="#"> -->
|
112 |
+
<form name="post_snippets" action="#">
|
113 |
+
|
114 |
+
<div class="tabs">
|
115 |
+
<ul>
|
116 |
+
<?php
|
117 |
+
$snippets = get_option($post_snippets->plugin_options);
|
118 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
119 |
+
<li id="ps_tab<?php echo $i; ?>"<?php if ($i == 0) {?> class="current"><?php } ?><span><a href="javascript:mcTabs.displayTab('ps_tab<?php echo $i; ?>','ps_panel<?php echo $i; ?>');" onmousedown="return false;"><?php echo $snippets[$i]['title']; ?></a></span></li>
|
120 |
+
<?php } ?>
|
121 |
+
</ul>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="panel_wrapper" style="overflow:auto;">
|
125 |
+
<?php
|
126 |
+
$snippets = get_option($post_snippets->plugin_options);
|
127 |
+
for ($i = 0; $i < count($snippets); $i++) { ?>
|
128 |
+
<div id="ps_panel<?php echo $i; ?>" class="panel<?php if ($i == 0) {?> current<?php } ?>">
|
129 |
+
<br />
|
130 |
+
<table border="0" cellpadding="4" cellspacing="0">
|
131 |
+
<?php
|
132 |
+
$var_arr = explode(",",$snippets[$i]['vars']);
|
133 |
+
if (!empty($var_arr[0])) {
|
134 |
+
for ($j = 0; $j < count($var_arr); $j++) { ?>
|
135 |
+
<tr>
|
136 |
+
<td nowrap="nowrap"><label for="var_<?php echo $i; ?>_<?php echo $j; ?>"><?php echo($var_arr[$j]);?>:</label></td>
|
137 |
+
<td><input type="text" id="var_<?php echo $i; ?>_<?php echo $j; ?>" name="var_<?php echo $i; ?>_<?php echo $j; ?>" style="width: 190px" />
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<?php } } ?>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php } ?>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mceActionPanel">
|
147 |
+
<div style="float: left">
|
148 |
+
<input type="button" id="cancel" name="cancel" value="<?php _e( 'Cancel', 'post-snippets' ); ?>" onclick="tinyMCEPopup.close();" />
|
149 |
+
</div>
|
150 |
+
|
151 |
+
<div style="float: right">
|
152 |
+
<input type="submit" id="insert" name="insert" value="<?php _e( 'Insert', 'post-snippets' ); ?>" onclick="insertSnippet();" />
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
</form>
|
156 |
+
</body>
|
157 |
+
</html>
|
1.7.1/uninstall.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall
|
4 |
+
* Clean up the WP DB by deleting the options created by the plugin.
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
delete_option('post_snippets_options');
|
8 |
+
?>
|
1.7.2/assets/post-snippets.css
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Styling for the jQuery UI dialog used by Post Snippets
|
3 |
+
*
|
4 |
+
* @since Post Snippets 1.7.1
|
5 |
+
*/
|
6 |
+
#post-snippets-tabs {
|
7 |
+
padding: 15px 15px 3px;
|
8 |
+
background-color: #f1f1f1;
|
9 |
+
border-bottom: 1px solid #dfdfdf;
|
10 |
+
}
|
11 |
+
#post-snippets-tabs li {
|
12 |
+
display: inline;
|
13 |
+
}
|
14 |
+
#post-snippets-tabs li {
|
15 |
+
color: #2583AD;
|
16 |
+
padding: 6px 6px 6px 6px;
|
17 |
+
border-width: 1px 1px 0;
|
18 |
+
border-style: solid solid none;
|
19 |
+
border-color: #f1f1f1;
|
20 |
+
}
|
21 |
+
#post-snippets-tabs li.ui-tabs-selected {
|
22 |
+
background-color: #fff;
|
23 |
+
border-color: #dfdfdf;
|
24 |
+
border-bottom-color: #fff;
|
25 |
+
color: #d54e21;
|
26 |
+
}
|
27 |
+
#post-snippets-tabs li.ui-state-hover {
|
28 |
+
color: #d54e21;
|
29 |
+
}
|
30 |
+
#post-snippets-tabs a {
|
31 |
+
text-decoration: none;
|
32 |
+
}
|
33 |
+
#post-snippets-tabs .ui-tabs-panel {
|
34 |
+
margin: 5px 0 0 0;
|
35 |
+
padding: 5px 20px 10px;
|
36 |
+
background-color: #fff;
|
37 |
+
border-left: 1px solid #dfdfdf;
|
38 |
+
border-bottom: 1px solid #dfdfdf;
|
39 |
+
border: 1px solid #dfdfdf;
|
40 |
+
}
|
1.7.2/languages/post-snippets-es_ES.mo
ADDED
Binary file
|
1.7.2/languages/post-snippets-es_ES.po
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.7\n"
|
4 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
5 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
6 |
+
"PO-Revision-Date: 2011-02-25 23:17-0400\n"
|
7 |
+
"Last-Translator: Melvis Leon <me_leon@hotmail.com>\n"
|
8 |
+
"Language-Team: MLL Designs <me_leon@hotmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: Spanish\n"
|
14 |
+
"X-Poedit-Country: SPAIN\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
# @ post-snippets
|
22 |
+
#: post-snippets.php:70
|
23 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
24 |
+
msgstr "Post Snippets requiere WordPress versión 2.7 o posterior!"
|
25 |
+
|
26 |
+
# @ post-snippets
|
27 |
+
#: post-snippets.php:179
|
28 |
+
msgid "A snippet named Untitled has been added."
|
29 |
+
msgstr "Un Snippet llamado Sin título ha sido agregado."
|
30 |
+
|
31 |
+
# @ post-snippets
|
32 |
+
#: post-snippets.php:192
|
33 |
+
msgid "Snippets have been updated."
|
34 |
+
msgstr "Los Snippets han sido actualizados."
|
35 |
+
|
36 |
+
# @ post-snippets
|
37 |
+
#: post-snippets.php:208
|
38 |
+
msgid "Selected snippets have been deleted."
|
39 |
+
msgstr "Los snippets han sido eliminados."
|
40 |
+
|
41 |
+
# @ post-snippets
|
42 |
+
#: post-snippets.php:220
|
43 |
+
msgid "Add New Snippet"
|
44 |
+
msgstr "Agregar nuevo Snippet"
|
45 |
+
|
46 |
+
# @ post-snippets
|
47 |
+
#: post-snippets.php:221
|
48 |
+
msgid "Delete Selected"
|
49 |
+
msgstr "Eliminar seleccionados"
|
50 |
+
|
51 |
+
# @ post-snippets
|
52 |
+
#: post-snippets.php:230
|
53 |
+
#: post-snippets.php:239
|
54 |
+
msgid "Title"
|
55 |
+
msgstr "Título"
|
56 |
+
|
57 |
+
# @ post-snippets
|
58 |
+
#: post-snippets.php:231
|
59 |
+
#: post-snippets.php:240
|
60 |
+
msgid "Variables"
|
61 |
+
msgstr "Variables"
|
62 |
+
|
63 |
+
# @ post-snippets
|
64 |
+
#: post-snippets.php:232
|
65 |
+
#: post-snippets.php:241
|
66 |
+
msgid "Snippet"
|
67 |
+
msgstr "Snippet"
|
68 |
+
|
69 |
+
# @ post-snippets
|
70 |
+
#: post-snippets.php:263
|
71 |
+
msgid "Update Snippets"
|
72 |
+
msgstr "Actualizar Snippets"
|
73 |
+
|
74 |
+
# @ post-snippets
|
75 |
+
#: post-snippets.php:268
|
76 |
+
msgid "Help"
|
77 |
+
msgstr "Ayuda"
|
78 |
+
|
79 |
+
# @ post-snippets
|
80 |
+
#: post-snippets.php:270
|
81 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
82 |
+
msgstr "<strong>Titulo</strong><br/>Nombrar al snippet con un título que le ayude a identificarlo en el editor de entradas."
|
83 |
+
|
84 |
+
# @ post-snippets
|
85 |
+
#: post-snippets.php:272
|
86 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
87 |
+
msgstr "<strong>Variables</strong><br/>Puedes hacer referencia a una lista separada por comas de variables personalizadas en tu snippet.<br/><br/>Ejemplo:<br/>url, nombre"
|
88 |
+
|
89 |
+
# @ post-snippets
|
90 |
+
#: post-snippets.php:274
|
91 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
92 |
+
msgstr "<strong>Snippet</strong><br/>Este es el bloque de texto o HTML a insertar en la entrada al seleccionar el snippet del botón de insertar en el TinyMCE en el editor de entradas. Si ha introducido las variables predefinidas usted puede referenciarlas desde el snippet al encerrarlas entre llaves {}.<br/> Ejemplo: <br/>Para hacer referencia a las variables en el ejemplo anterior, debe escribir {url} y {nombre}.<br/>Así que si digitas este snippet: <br/> <i> Esta es la página web de <a href=\"{url}\">{nombre}</a></i><br/> </ i> <br/>Usted recibirá la opción de reemplazar url y el nombre cuando se inserta, si se definen como variables."
|
93 |
+
|
94 |
+
#: post-snippets.php:281
|
95 |
+
msgid "About Post Snippets"
|
96 |
+
msgstr "Acerca de Post Snippets"
|
97 |
+
|
98 |
+
# @ post-snippets
|
99 |
+
#: tinymce/window.php:9
|
100 |
+
msgid "You are not allowed to be here"
|
101 |
+
msgstr "No tiene permitido estar aquí"
|
102 |
+
|
103 |
+
# @ post-snippets
|
104 |
+
#: tinymce/window.php:109
|
105 |
+
msgid "Cancel"
|
106 |
+
msgstr "Cancelar"
|
107 |
+
|
108 |
+
# @ post-snippets
|
109 |
+
#: tinymce/window.php:113
|
110 |
+
msgid "Insert"
|
111 |
+
msgstr "Insertar"
|
112 |
+
|
113 |
+
# @ post-snippets
|
114 |
+
#. Plugin Name of an extension
|
115 |
+
msgid "Post Snippets"
|
116 |
+
msgstr "Post Snippets"
|
117 |
+
|
118 |
+
#. Plugin URI of an extension
|
119 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
120 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
121 |
+
|
122 |
+
#. Description of an extension
|
123 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
124 |
+
msgstr "Almacena de snippets(fragmentos) de código HTML o texto recurrente para usarlo en tus entradas. Puedes utilizar las variables predefinidas para reemplazar partes del snippet(fragmento) en inserción. Todos los snippets(fragmentos) están disponibles en el editor de entradas con un botón de TinyMCE, Quicktags o Shortcodes."
|
125 |
+
|
126 |
+
#. Author of an extension
|
127 |
+
msgid "Johan Steen"
|
128 |
+
msgstr "Johan Steen"
|
129 |
+
|
130 |
+
#. Author URI of an extension
|
131 |
+
msgid "http://coding.cglounge.com/"
|
132 |
+
msgstr "http://coding.cglounge.com/"
|
133 |
+
|
1.7.2/languages/post-snippets-fr_FR.mo
ADDED
Binary file
|
1.7.2/languages/post-snippets-fr_FR.po
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Post Snippets v1.4.9\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2009-09-03 09:32+0200\n"
|
7 |
+
"Last-Translator: Oyabi <mousaka666@hotmail.fr>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: French\n"
|
14 |
+
"X-Poedit-Country: FRANCE\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: post-snippets.php:71
|
23 |
+
#@ post-snippets
|
24 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
25 |
+
msgstr "Post Snippets requiert WordPress version 2.7 ou supérieur!"
|
26 |
+
|
27 |
+
#: post-snippets.php:237
|
28 |
+
#@ post-snippets
|
29 |
+
msgid "A snippet named Untitled has been added."
|
30 |
+
msgstr "Un Snippet Sans Titre a été ajouté."
|
31 |
+
|
32 |
+
#: post-snippets.php:262
|
33 |
+
#@ post-snippets
|
34 |
+
msgid "Snippets have been updated."
|
35 |
+
msgstr "Les Snippets ont été mis à jour."
|
36 |
+
|
37 |
+
#: post-snippets.php:278
|
38 |
+
#@ post-snippets
|
39 |
+
msgid "Selected snippets have been deleted."
|
40 |
+
msgstr "Les Snippets sélectionnés ont été supprimés."
|
41 |
+
|
42 |
+
#: post-snippets.php:290
|
43 |
+
#@ post-snippets
|
44 |
+
msgid "Add New Snippet"
|
45 |
+
msgstr "Ajouter un nouveau Snippet"
|
46 |
+
|
47 |
+
#: post-snippets.php:291
|
48 |
+
#@ post-snippets
|
49 |
+
msgid "Delete Selected"
|
50 |
+
msgstr "Supprimer la sélection"
|
51 |
+
|
52 |
+
#: post-snippets.php:300
|
53 |
+
#: post-snippets.php:311
|
54 |
+
#@ post-snippets
|
55 |
+
msgid "Title"
|
56 |
+
msgstr "Titre"
|
57 |
+
|
58 |
+
#: post-snippets.php:301
|
59 |
+
#: post-snippets.php:312
|
60 |
+
#@ post-snippets
|
61 |
+
msgid "Variables"
|
62 |
+
msgstr "Variables"
|
63 |
+
|
64 |
+
#: post-snippets.php:302
|
65 |
+
#: post-snippets.php:313
|
66 |
+
#@ post-snippets
|
67 |
+
msgid "Snippet"
|
68 |
+
msgstr "Snippet"
|
69 |
+
|
70 |
+
#: post-snippets.php:303
|
71 |
+
#: post-snippets.php:314
|
72 |
+
#@ post-snippets
|
73 |
+
msgid "SC"
|
74 |
+
msgstr "SC"
|
75 |
+
|
76 |
+
#: post-snippets.php:304
|
77 |
+
#: post-snippets.php:315
|
78 |
+
#@ post-snippets
|
79 |
+
msgid "QT"
|
80 |
+
msgstr "QT"
|
81 |
+
|
82 |
+
#: post-snippets.php:339
|
83 |
+
#@ post-snippets
|
84 |
+
msgid "Update Snippets"
|
85 |
+
msgstr "Mise à jour des Snippets"
|
86 |
+
|
87 |
+
#: post-snippets.php:344
|
88 |
+
#@ post-snippets
|
89 |
+
msgid "Help"
|
90 |
+
msgstr "Aide"
|
91 |
+
|
92 |
+
#: post-snippets.php:346
|
93 |
+
#@ post-snippets
|
94 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
95 |
+
msgstr "<strong>Titre</strong> <br/> Donner au Snippet un titre qui vous permet de l'identifier dans l'éditeur de messages."
|
96 |
+
|
97 |
+
#: post-snippets.php:348
|
98 |
+
#@ post-snippets
|
99 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
100 |
+
msgstr "<strong>Variables</strong> <br/> Une liste de variables personnalisées séparée par des virgules que vous pouvez inclure dans votre Snippet. <br/><br/> Exemple: <br/> url, name"
|
101 |
+
|
102 |
+
#: post-snippets.php:350
|
103 |
+
#@ post-snippets
|
104 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
105 |
+
msgstr "<strong>Snippet</strong><br/>C'est le bloc de texte ou HTML à insérer dans l'article lorsque vous sélectionnez l'extrait à partir du bouton insérer dans le panneau TinyMCE de l'éditeur de pages. Si vous avez entré les variables prédéfinies, vous pouvez les inclure dans l'extrait en les entourant de {} crochets. <br/> Exemple: <br/> Pour inclure des variables dans l'exemple ci-dessus, vous devez entrer {url} et {name}. <br/> Donc, si vous entrez le code suivant: <br/> <i> Ceci est le site de <a href=\"{url}\">{name}</a></i><br/> </ i> <br/> Vous avez la possibilité de remplacer les URL et le nom s'ils sont définis comme des variables."
|
106 |
+
|
107 |
+
#: post-snippets.php:352
|
108 |
+
#@ post-snippets
|
109 |
+
msgid "<strong>SC</strong><br/>Treats the snippet as a shortcode. The name for the shortcode is the same as the title of the snippet (spaces not allowed) and will be used on insert."
|
110 |
+
msgstr "<strong>SC</strong> <br/> Traite l'extrait comme un shortcode. Le nom du shortcode est le même que le titre de l'extrait (espaces non autorisés) et sera utilisé avec insérer."
|
111 |
+
|
112 |
+
#: post-snippets.php:354
|
113 |
+
#@ post-snippets
|
114 |
+
msgid "<strong>QT</strong><br/>Enables the snippet to be available as a quicktag in the HTML editor."
|
115 |
+
msgstr "<strong>QT</strong><br/>Permet au snippet d'être disponible comme un quicktag dans le l'éditeur HTML."
|
116 |
+
|
117 |
+
#: post-snippets.php:356
|
118 |
+
#@ post-snippets
|
119 |
+
msgid "<strong>About Post Snippets</strong><br/>Visit my <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> page for additional information."
|
120 |
+
msgstr "<strong>A propos de Post Snippets</strong> <br/> Visitez la page de <a href=\"http://coding.cglounge.com/wordpress-plugins/post-snippets/\">Post Snippets</a> pour plus d'informations."
|
121 |
+
|
122 |
+
#: tinymce/window.php:16
|
123 |
+
#@ post-snippets
|
124 |
+
msgid "You are not allowed to be here"
|
125 |
+
msgstr "Vous n'êtes pas autorisé à être ici"
|
126 |
+
|
127 |
+
#: tinymce/window.php:148
|
128 |
+
#@ post-snippets
|
129 |
+
msgid "Cancel"
|
130 |
+
msgstr "Annuler"
|
131 |
+
|
132 |
+
#: tinymce/window.php:152
|
133 |
+
#@ post-snippets
|
134 |
+
msgid "Insert"
|
135 |
+
msgstr "Insérer"
|
136 |
+
|
1.7.2/languages/post-snippets-ru_RU.mo
ADDED
Binary file
|
1.7.2/languages/post-snippets-ru_RU.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-08-08 14:02+0300\n"
|
11 |
+
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
12 |
+
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Russian\n"
|
17 |
+
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
18 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
19 |
+
|
20 |
+
#: post-snippets.php:70
|
21 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
22 |
+
msgstr "Post Snippets требует WordPress версии 2.7 или позднее!"
|
23 |
+
|
24 |
+
#: post-snippets.php:179
|
25 |
+
msgid "A snippet named Untitled has been added."
|
26 |
+
msgstr "Сниппет с названием Untitled был добавлен."
|
27 |
+
|
28 |
+
#: post-snippets.php:192
|
29 |
+
msgid "Snippets have been updated."
|
30 |
+
msgstr "Сниппет был обновлен."
|
31 |
+
|
32 |
+
#: post-snippets.php:208
|
33 |
+
msgid "Selected snippets have been deleted."
|
34 |
+
msgstr "Выбранные сниппеты были удалены."
|
35 |
+
|
36 |
+
#: post-snippets.php:220
|
37 |
+
msgid "Add New Snippet"
|
38 |
+
msgstr "Добавлен новый сниппет "
|
39 |
+
|
40 |
+
#: post-snippets.php:221
|
41 |
+
msgid "Delete Selected"
|
42 |
+
msgstr "Удаление выбранного"
|
43 |
+
|
44 |
+
#: post-snippets.php:230
|
45 |
+
#: post-snippets.php:239
|
46 |
+
msgid "Title"
|
47 |
+
msgstr "Заглавие"
|
48 |
+
|
49 |
+
#: post-snippets.php:231
|
50 |
+
#: post-snippets.php:240
|
51 |
+
msgid "Variables"
|
52 |
+
msgstr "Переменные"
|
53 |
+
|
54 |
+
#: post-snippets.php:232
|
55 |
+
#: post-snippets.php:241
|
56 |
+
msgid "Snippet"
|
57 |
+
msgstr "Сниппет"
|
58 |
+
|
59 |
+
#: post-snippets.php:263
|
60 |
+
msgid "Update Snippets"
|
61 |
+
msgstr "Сниппеты обновлены"
|
62 |
+
|
63 |
+
#: post-snippets.php:268
|
64 |
+
msgid "Help"
|
65 |
+
msgstr "ПОмощь"
|
66 |
+
|
67 |
+
#: post-snippets.php:270
|
68 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
69 |
+
msgstr "<strong>Заглавие</strong><br/>Давайте сниппетам понятные для дальнейшего восприятия имена."
|
70 |
+
|
71 |
+
#: post-snippets.php:272
|
72 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
73 |
+
msgstr "<strong>Переменные</strong><br/>Пример:<br/>url,name"
|
74 |
+
|
75 |
+
#: post-snippets.php:274
|
76 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
77 |
+
msgstr "<strong>Сниппет</strong><br/>Это блок текста или HTML для вставки в пост, когда вы выбираете фрагмент из добавить кнопку в панель TinyMCE в должности редактора. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
78 |
+
|
79 |
+
#: post-snippets.php:281
|
80 |
+
msgid "About Post Snippets"
|
81 |
+
msgstr "О Post Snippets"
|
82 |
+
|
83 |
+
#: tinymce/window.php:9
|
84 |
+
msgid "You are not allowed to be here"
|
85 |
+
msgstr "Вам не разрешено быть здесь"
|
86 |
+
|
87 |
+
#: tinymce/window.php:109
|
88 |
+
msgid "Cancel"
|
89 |
+
msgstr "Отмена"
|
90 |
+
|
91 |
+
#: tinymce/window.php:113
|
92 |
+
msgid "Insert"
|
93 |
+
msgstr "Вставить"
|
94 |
+
|
95 |
+
#. Plugin Name of an extension
|
96 |
+
msgid "Post Snippets"
|
97 |
+
msgstr "Post Snippets"
|
98 |
+
|
99 |
+
#. Plugin URI of an extension
|
100 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
102 |
+
|
103 |
+
#. Description of an extension
|
104 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
105 |
+
msgstr "Магазины фрагмент HTML-код или повторение текста, который вы часто используете в должности. Вы можете использовать предопределенные переменные для замены частей, взяв на вставки. Все фрагменты имеются в должности редактора с TinyMCE кнопки, Quicktags или Shortcodes. "
|
106 |
+
|
107 |
+
#. Author of an extension
|
108 |
+
msgid "Johan Steen"
|
109 |
+
msgstr "Johan Steen"
|
110 |
+
|
111 |
+
#. Author URI of an extension
|
112 |
+
msgid "http://coding.cglounge.com/"
|
113 |
+
msgstr "http://coding.cglounge.com/"
|
114 |
+
|
1.7.2/languages/post-snippets-sv_SE.mo
ADDED
Binary file
|
1.7.2/languages/post-snippets-sv_SE.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2009-04-02 20:41+0100\n"
|
11 |
+
"Last-Translator: Johan Steen <artstorm@gmail.com>\n"
|
12 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Language: Swedish\n"
|
17 |
+
"X-Poedit-Country: SWEDEN\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets kräver WordPress version 2.7 eller nyare!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Ett nytt avsnitt med namnet Untitled har lagts till."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Avsnitten har uppdaterats."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Valda avsnitt har raderats."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Lägg Till Nytt Avsnitt"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Radera Valda"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Titel"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Variabler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Avsnitt"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Uppdatera Avsnitt"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Hjälp"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Titel</strong><br/>Ge avsnittet en titel som hjälper dig att identifiera det i inläggsredigeraren."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Variabler</strong><br/>En kommaseparerad lista av egendefinerade variabler som du kan referera i ditt avsnitt.<br/><br/>Exempel:<br/>url,namn"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Avsnitt</strong><br/>Detta är blocket med text eller HTML att lägga till inlägget när du väljer ett avsnitt med insättnings knappen i TinyMCE panelen i inläggsredigeraren. Om du har definerat egna variabler kan du referera dem i avnittet genom att omsluta dem med {}.<br/><br/>Exempel:<br/>För att referera variabler i exemplet ovan, skulle du skriva {url} and {namn}.<br/><br/>Så om du har det här avsnittet:<br/><i>Det är websidan till <a href=\"{url}\">{namn}</a></i><br/>När du infogar avsnittet i ditt inlägg kan du fylla i vad som ska ersätta url och namn."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Om Post Snippets"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "Du har inte tillåtelse att vara här"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Avbryt"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Infoga"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Lagrar avsnitt (snippets) av HTML kod eller återkommande text som du ofta använder i dina inlägg. Du kan använda fördefinerade variabler för att ersätta delar av ditt avsnitt vid infogning. All avsnitt är tillgängliga i inläggsredigeraren via en TinyMCE knapp, Quicktags eller Shortcodes."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.7.2/languages/post-snippets-tr_TR.mo
ADDED
Binary file
|
1.7.2/languages/post-snippets-tr_TR.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: Post Snippets\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
9 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
10 |
+
"PO-Revision-Date: 2011-01-23 02:21+0200\n"
|
11 |
+
"Last-Translator: JSEL <jselivingston@gmail.com>\n"
|
12 |
+
"Language-Team: www.tml.web.tr <jselivingston@gmail.com>\n"
|
13 |
+
"MIME-Version: 1.0\n"
|
14 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
+
"Content-Transfer-Encoding: 8bit\n"
|
16 |
+
"X-Poedit-Country: TURKEY\n"
|
17 |
+
"X-Poedit-Language: Turkish\n"
|
18 |
+
|
19 |
+
#: post-snippets.php:70
|
20 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
21 |
+
msgstr "Post Snippets eklentisi WordPress 2.7 veya daha üst bir sürümde çalışır!"
|
22 |
+
|
23 |
+
#: post-snippets.php:179
|
24 |
+
msgid "A snippet named Untitled has been added."
|
25 |
+
msgstr "Untitled adında bir snippet eklendi."
|
26 |
+
|
27 |
+
#: post-snippets.php:192
|
28 |
+
msgid "Snippets have been updated."
|
29 |
+
msgstr "Snippets alanları güncellendi."
|
30 |
+
|
31 |
+
#: post-snippets.php:208
|
32 |
+
msgid "Selected snippets have been deleted."
|
33 |
+
msgstr "Seçili snippet(lar) silindi."
|
34 |
+
|
35 |
+
#: post-snippets.php:220
|
36 |
+
msgid "Add New Snippet"
|
37 |
+
msgstr "Yeni Snippet Ekle"
|
38 |
+
|
39 |
+
#: post-snippets.php:221
|
40 |
+
msgid "Delete Selected"
|
41 |
+
msgstr "Seçili Olanları Sil"
|
42 |
+
|
43 |
+
#: post-snippets.php:230
|
44 |
+
#: post-snippets.php:239
|
45 |
+
msgid "Title"
|
46 |
+
msgstr "Başlık"
|
47 |
+
|
48 |
+
#: post-snippets.php:231
|
49 |
+
#: post-snippets.php:240
|
50 |
+
msgid "Variables"
|
51 |
+
msgstr "Değişkenler"
|
52 |
+
|
53 |
+
#: post-snippets.php:232
|
54 |
+
#: post-snippets.php:241
|
55 |
+
msgid "Snippet"
|
56 |
+
msgstr "Snippet"
|
57 |
+
|
58 |
+
#: post-snippets.php:263
|
59 |
+
msgid "Update Snippets"
|
60 |
+
msgstr "Güncelle"
|
61 |
+
|
62 |
+
#: post-snippets.php:268
|
63 |
+
msgid "Help"
|
64 |
+
msgstr "Yardım"
|
65 |
+
|
66 |
+
#: post-snippets.php:270
|
67 |
+
msgid "<strong>Title</strong><br/>Give the snippet a title that helps you identify it in the post editor."
|
68 |
+
msgstr "<strong>Başlık</strong><br/>Yazı editöründe kullanmak üzere snippet'a bir başlık yazın."
|
69 |
+
|
70 |
+
#: post-snippets.php:272
|
71 |
+
msgid "<strong>Variables</strong><br/>A comma separated list of custom variables you can reference in your snippet.<br/><br/>Example:<br/>url,name"
|
72 |
+
msgstr "<strong>Değişkenler</strong><br/>Snippet'da kullanmak üzere virgülle birbirinden ayrılmış özel değişkenler listesi.<br/><br/>Örnek:<br/>url,name"
|
73 |
+
|
74 |
+
#: post-snippets.php:274
|
75 |
+
msgid "<strong>Snippet</strong><br/>This is the block of text or HTML to insert in the post when you select the snippet from the insert button in the TinyMCE panel in the post editor. If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets.<br/><br/>Example:<br/>To reference the variables in the example above, you would enter {url} and {name}.<br/><br/>So if you enter this snippet:<br/><i>This is the website of <a href=\"{url}\">{name}</a></i><br/>You will get the option to replace url and name on insert if they are defined as variables."
|
76 |
+
msgstr "<strong>Snippet</strong><br/>Burası TinyMCE panelindeki ekle düğmesi aracılığıyla seçeceğiniz snippet'ın gönderide ekleneceği metin bloğu veya HTML kısmıdır. Snippet'ınızda daha önce tanımlanmış olan değişkenleri kullanmak için {} karakterleri arasına yazabilirsiniz.<br/><br/>Örnek:<br/>Yukarıdaki örnekteki değişkenleri kullanmak için {url} ve {name} kodlarını yazmalısınız.<br/><br/>Yani aşağıdaki snippet yazıldığında:<br/><i>Siteye ait url ve anchor metni: <a href=\"{url}\">{name}</a> şeklinde olacaktır.</i><br/>Böylelikle url ve name değişkenlerini değiştirme şansına sahip olacaksınız."
|
77 |
+
|
78 |
+
#: post-snippets.php:281
|
79 |
+
msgid "About Post Snippets"
|
80 |
+
msgstr "Post Snippets Hakkında"
|
81 |
+
|
82 |
+
#: tinymce/window.php:9
|
83 |
+
msgid "You are not allowed to be here"
|
84 |
+
msgstr "İzniniz yok"
|
85 |
+
|
86 |
+
#: tinymce/window.php:109
|
87 |
+
msgid "Cancel"
|
88 |
+
msgstr "Vazgeç"
|
89 |
+
|
90 |
+
#: tinymce/window.php:113
|
91 |
+
msgid "Insert"
|
92 |
+
msgstr "Ekle"
|
93 |
+
|
94 |
+
#. Plugin Name of an extension
|
95 |
+
msgid "Post Snippets"
|
96 |
+
msgstr "Post Snippets"
|
97 |
+
|
98 |
+
#. Plugin URI of an extension
|
99 |
+
msgid "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
100 |
+
msgstr "http://coding.cglounge.com/wordpress-plugins/post-snippets/"
|
101 |
+
|
102 |
+
#. Description of an extension
|
103 |
+
msgid "Stores snippets of HTML code or reoccurring text that you often use in your posts. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor with a TinyMCE button, Quicktags or Shortcodes."
|
104 |
+
msgstr "Yazılarınızda sıklıkla kullandığınız HTML kodu veya metinlerdeki snippetlerı kaydeder. Tanımladığınız değişkenleri kullanarak snippet bölümlerini de değiştirebilirsiniz. Tüm snippetlara yazı editöründe yer alan TinyMCE, Quicktags veya Shortcodes düğmeleri aracılığıyla ulaşabilirsiniz."
|
105 |
+
|
106 |
+
#. Author of an extension
|
107 |
+
msgid "Johan Steen"
|
108 |
+
msgstr "Johan Steen"
|
109 |
+
|
110 |
+
#. Author URI of an extension
|
111 |
+
msgid "http://coding.cglounge.com/"
|
112 |
+
msgstr "http://coding.cglounge.com/"
|
113 |
+
|
1.7.2/languages/post-snippets.pot
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation Template for Post Snippets.
|
2 |
+
# Copyright (C) 2009 Johan Steen
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
#
|
5 |
+
#, fuzzy
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: Post Snippets\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-snippets\n"
|
10 |
+
"POT-Creation-Date: 2009-03-24 09:38+0000\n"
|
11 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: <artstorm@gmail.com>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: post-snippets.php:70
|
19 |
+
msgid "Post Snippets requires WordPress version 2.7 or later!"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: post-snippets.php:179
|
23 |
+
msgid "A snippet named Untitled has been added."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: post-snippets.php:192
|
27 |
+
msgid "Snippets have been updated."
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: post-snippets.php:208
|
31 |
+
msgid "Selected snippets have been deleted."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: post-snippets.php:220
|
35 |
+
msgid "Add New Snippet"
|
36 |
+
msgstr
|