Home » Extensions » Sourcerer
NoNumber!

Joomla!® Websites & Extensions
development  -  support  -  consultancy

Sourcerer enables you to place PHP and any kind of HTML style code (including CSS and JavaScript) right into your content! Not only in your articles, but also in sections, categories, modules, components, META tags, etc.

If you use Sourcerer, please post a rating and a review at the Joomla! Extensions Directory.

Description

Sourcerer enables you to place PHP and any kind of HTML style code (including CSS and JavaScript) right into your content! Not only in your articles, but also in sections, categories, modules, components, META tags, etc.

You can now just place your original codes right into your WYSIWYG editor. The only thing you have to do is surround the code with the Sourcerer tags. Easy peasy!

So now you can also use PHP scripts in your content. That opens up a great deal of possibilities.

Most Joomla! Text Editors will strip parts of your HTML code, like JavaScripts (think of statistics scripts) and movie embed tags. With Sourcerer you won't have these limitations.

Easy to use editor button

Sourcerer comes with a very easy to use editor button. This will help you paste your code in a clean format that will not cause any problems. Also it can give some colors to different types of code.

Syntax

Sourcerer can read the code you place in your editor. Your editor will add html to the code when you have enters or give code colors and styling. But Sourcerer will strip those (hidden) html tags, so it will not be a problem.

Tags get stripped? Use double bracket syntax

Some editors (i.e. TinyMCE) will strip html style tags when you enter them in the WYSIWYG view. For that reason you can also use double square brackets for the HTML style tags. So if your tags get stripped, use the double bracket syntax.

For instance, instead of doing this:
{source}<strong>Text</strong>{/source}

Use this syntax:
{source}[[strong]]Text[[/strong]]{/source}

The editor button will help you convert code to double bracket syntax (or back to normal tags).

Using html entities

When you want to use html entities in your code, you will notice that most editors will convert them to actual characters when saving.

You can prevent that from happening by using an underscore to escape it, like:
{source}Dani&_euml;lle{/source}

Not using a WYSIWYG editor?

Sourcerer is designed to be used with a WYSIWYG editor. It will strip all tags in the html of the content, to prevent styling from messing with the code.

When you do not use a WYSIWYG editor, practically all code will be stripped, which you don't want of course.

To disable Sourcerer from stripping the html code, you can use the '0' parameter in the {source} tag, like:

{source 0}code in an html editor{/source}

Examples

Note: The default Sourcerer syntax tags {source}...{/source} will be used in these examples. The Sourcerer plugin gives you the possibility to change these to whatever you want. So you could - for instance - use shorter syntax tags like {s}...{/s}.

Main syntax
Syntax {source}your code{/source}
HTML tags
Syntax {source}<span style="color:red">This text should be red!</span>{/source}
HTML output <span style="color: red">This text should be red!</span>
Result in website This text should be red!
HTML tags (with double square brackets)
You can also use the square brackets for the CSS, JavaScript and PHP tags.
Syntax {source}[[span style="color:red"]]This text should be red![[/span]]{/source}
HTML output <span style="color: red">This text should be red!</span>
Result in website This text should be red!
JavaScript
Syntax {source}
<script type="text/javascript">
<!--
document.write('This text is placed through <b>JavaScript</b>!');
//-->
</script>
{/source}
HTML output <script type="text/javascript">
<!--
document.write('This text is placed through <b>JavaScript</b>!');
//-->
</script>
Result in website
PHP
Syntax {source}
<?php
echo 'This text is placed through <b>PHP</b>!';
?>
{/source}
HTML output This text is placed through <b>PHP</b>!
Result in website This text is placed through PHP!
Combined (HTML, JavaScript and PHP)
Syntax {source}

<span style="color:red">This text should be red!</span>
<br />

<script type="text/javascript">
<!--
document.write('This text is placed through <b>JavaScript</b>!');
//-->
</script>

<?php
echo '<p>';
echo 'This text is placed through <b>PHP</b>!';
echo '</p>';
?>

{/source}
HTML output <span style="color:red">This text should be red!</span>
<br />

<script type="text/javascript">
<!--
document.write('This text is placed through <b>JavaScript</b>!');
//-->
</script>

<p>This text is placed through <b>PHP</b>!</p>
Result in website This text should be red!

This text is placed through PHP!

PHP with error
Syntax {source}
<?php
echo 'Oops, forgot to close the print_r function!';
print_r( $myvar;
?>
{/source}
HTML output
if NOT logged in as
(Super) Administrator
<!-- Comment - Sourcerer: The PHP code has been removed, because it contains errors.
(Log in as (Super) Administrator to show the PHP Debugging.) -->
Result in website
if logged in as
(Super) Administrator
Sourcerer PHP Debugging
PHP Code
1echo 'Oops, forgot to close the print_r function!';
2print_r( $myvar;;
PHP Error
Parse error: syntax error, unexpected ';' in /home/users/nonumftp/nonumber.nl/plugins/system/sourcerer.php(436) : eval()'d code on line 2
To hide this error, turn off PHP Debugging in the Sourcerer plugin parameters.More about Sourcerer

Troubleshooting

Please use the forum for support.

Can't get your codes to work? Please try the below suggestions:

Sourcerer does not work. I still see the source tags in the frontend.

  • The Sourcerer plugin is not published.
    Check if the Sourcerer plugin is published. Go to Extensions >> Plugin manager and search for the system plugin "System - Sourcerer". Then publish it.
  • There is markup code in the Sourcerer syntax tags.
    Sourcerer has no problem with markup codes between the {source} tags. However, the {source} tags themselves will have to be free from markup. So this will make the {source} block from working:
    <span>{</span>source}

Code is stripped when I save the article (like JavaScript and PHP).

  • Some editors remove tags you enter in the editor (even if not in html view).
    To prevent tags from being stripped, use the double bracket syntax. So instead of <tag>, do [[tag]].
    Some editors (like JCE) allow you to enter tags in the WYSIWYG view.

Code is stripped on the frontend. (In the editor the code is all there)

  • The security level prevents the use of Sourcerer.
    You can set certain security settings in the Sourcerer plugin. This way you can prevent certain user group levels and certain content types to not allow the use of Sourcerer. Please look in the html output source of you site to see if you have a Sourcerer comment that tells you this is the case.
  • If you use JavaScript or PHP in the tags...
    Please see below for more answers.

JavaScript is not working.

  • You have forgotten the script open- and close-tags.
    JavaScript should be placed inside the script tags:
    <script type="text/javascript">...</script>
    Or for double bracket syntax:
    [[script type="text/javascript"]]...[[/script]]
  • The security level prevents the use of JavaScript.
    You can set certain security settings in the Sourcerer plugin. This way you can prevent certain user group levels and certain content types to not allow the use of JavaScript. Please look in the html output source of you site to see if you have a Sourcerer comment that tells you this is the case.

PHP is not working.

  • You have forgotten the PHP open- and closetags.
    PHP should be placed inside the PHP tags:

    Or for double bracket syntax:
    [[?php ... ?]]
  • The security level prevents the use of PHP.
    You can set certain security settings in the Sourcerer plugin. This way you can prevent certain user group levels and certain content types to not allow the use of PHP. Please look in the html output source of you site to see if you have a Sourcerer comment that tells you this is the case.
  • There are errors in your PHP code.
    Sourcerer will not execute your PHP code if it has errors. You can check if you have errors by looking in the html output source of you site to see if you have a Sourcerer comment that tells you this is the case.
    You can also set the PHP debugging option on (in the Sourcerer plugin) to see a report of where the error is.
    You can only see the PHP debugging report if you are logged in as (Super) Administrator in the frontend.

Haven't found the answer you were looking for?

Please use the forum for support.

Screenshots

Sourcerer editor button

Sourcerer editor button

Sourcerer plugin setting: editor button

Sourcerer plugin setting: editor button

Sourcerer plugin setting: system plugin

Sourcerer plugin setting: system plugin
Sourcerer plugin setting: system plugin
Sourcerer plugin setting: system plugin
Sourcerer plugin setting: system plugin
Sourcerer plugin setting: system plugin

Tutorials

Specs

Specifications

Sourcerer is a Joomla extension compatible with Joomla 1.5, Joomla 1.7 and Joomla 2.5.

The extension consists of:

  • a system plugin
  • an editor button plugin

Requirements

Sourcerer will only work correctly if your setup meets these requirements:

  • Up-to-date version of Joomla!
  • PHP 5.3+
  • PHP mbstring (Multibyte String) functions should be enabled
  • MySQL 5+

Using PHP 5.2 (or lower)?
PHP 5.2 is old and support for it has stopped with the release of PHP 5.2.16 (16-Dec-2010). This means that PHP 5.2 cannot be considered stable or secure anymore.
If your host will not or cannot provide you with an up-to-date version of PHP, then you have reason enough to look for a decent host.
PHP 5.2 mainly has problems with installation of the zip packages. The extensions might work without problems for you once installed, but I can not give any guarantees on that.
>> For more detailed information, read: No more php 5.2 support - move on to php 5.3

I can not provide support for setups that do not meet the above requirements.

The core Joomla files should of course not be altered in any way.

Installation

The easiest way to install/update is via the NoNumber! Extension Manager.

If you have problems installing Sourcerer, please try the manual installation process as described here:
docs.joomla.org/Installing_an_extension

Otherwise, please report this on the forum or let me know via the contact form.

Updating

If you want to update to the latest version, you do not have to uninstall first.

The easiest way to install/update is via the NoNumber! Extension Manager.

You can also update simply by installing the package via the Joomla core installation process.

Downgrading

If for some reason you need to downgrade, it is best to uninstall the extension first.

Also, you will have to uninstall the NoNumber! Framework plugin (system) (and the NoNumber Elements plugin if you have it installed).

After that you can simply install the older version zip file.

Please note that I cannot not provide support on older versions!

Open Source License

Sourcerer is an Open Source Joomla extension. It is in compliance with the GNU/GPL license:
Licence: GNU/GPL GNU General Public License, version 2

Joomla is also Open Source.

Support

Need more help?

Before requesting help, make sure your installation and setup meet the requirements (see the Specs) and your extensions are up-to-date.

If you need more help, please take a look in the NoNumber! Forum.
If you can't find your answer there, please post your question. I am very willing to help!

You can also contact me via the contact form or via chat (if I'm online).

Changelog

Changelog

+ = Added ! = Removed ^ = Changed # = Fixed

13-Jan-2012 : v2.11.3
+ Added translations: bg-BG, pl-PL, pt-PT, th-TH
^ Updated translations: de-DE
^ Cleaned up more code
# Fixed issue with database error in editor button popup window (Joomla 1.7+)
# Fixed issue with installer not removing the folder/zip from the tmp

07-Nov-2011 : v2.11.2
+ Added translations: sl-SI
^ Cleaned code syntax (no longer guaranteed support for php 5.2.x and lower)
# Fixed issue with tags being handled in some edit forms

17-Oct-2011 : v2.11.1
^ Updated translations: de-DE
# Fixed security issue in !NoNumber! Framework plugin

08-Oct-2011 : v2.11.0
^ Improved installer
^ Moved translation language files to main package (no more language packs)
^ Cleaned up some code (like no more use of DS)
^ Changed !NoNumber! Elements plugin to !NoNumber! Framework
^ Moved common language strings to !NoNumber! Framework files
# Fixed issue with installation problems on some Joomla 1.7 setups
# Fixed issue with php debugging not working (Joomla 1.7)
# Fixed issue with Editor Button settings not being handled (Joomla 1.7)
# Fixed issue with Example Code field in Editor Button settings not working (Joomla 1.7)

05-Jul-2011 : v2.9.0
+ Joomla 1.7 compatible!
+ Added option to set security levels for css, js and php to default

20-Jun-2011 : v2.8.5
# Fixed issue with installation problems (Joomla 1.5)

18-Jun-2011 : v2.8.4
^ Changed way the mootools version is detected
^ Improved insertion of rich content in !TinyMCE editor
^ Changed layout of settings
^ Changed use of elements
# Fixed issue with {source} tags being interpreted in frontend editor

01-Apr-2011 : v2.8.3
# Fixed issue plugin being executed on raw format pages
# Fixed issue with colors not being removed from source tags when inserting code

25-Mar-2011 : v2.8.2
# Fixed issue with php error (get)

25-Mar-2011 : v2.8.1
^ Changed language files to be J1.6 ready
# Fixed issue with editor button not working for registered/author level
# Fixed issue with tags being interpreted in frontend editor fields with very large contents
# Fixed issue with search component breaking in some cases

11-Feb-2011 : v2.8.0
^ Changed extension icon / logo
# Fixed issue with public access to editor button popup page (security fix!)

14-Dec-2010 : v2.7.1
# Fixed issues with document being called to early
# Fixed some issues with loading of language strings
# Cleaned up some code

25-Nov-2010 : v2.7.0
+ Added checks to see if !NoNumber! Elements plugin is installed/enabled
^ Fixed and updated all language strings
^ Improved code to make it lighter/faster
# Fixed issue with tags being handled in edit fields

16-Nov-2010 : v2.6.0
# Fixed extension causing pages to break on some setups
# Fixed issue with not working in some forms (where they should)

15-Nov-2010 : v2.5.0
^ Made !MooTools 1.2 compatible
# Fixed some missing language strings
# Fixed some styling issues of PHP debug output
# Fixed issues with wrong version numbers in files

18-Oct-2010 : v2.4.10
# Fixed faulty version number in package

18-Oct-2010 : v2.4.9
# Fixed issue with use of some special characters like Ã
# Fixed issue with language file not being loaded for comment strings in html output

24-Jul-2010 : v2.4.8
^ Changed way version and license information are displayed (now via ajax)
^ Changed way versions and licenses are checked (no more base64)
# Fixed issue with plugin edit page give error due to missing file

19-Jul-2010 : v2.4.7
# Fixed issue with usage of multiple php blocks without trailing semi-colon

07-Jul-2010 : v2.4.6
^ Improved some code to make it lighter
# Fixed issue with errors in some cases when used in combination with Articles Anywhere

Commercial License

Sourcerer is completely free and you DON'T need a Commercial License Code to use it.

However, if you use my extensions on websites that you make money from, I would appreciate it if you purchase a License Code.
The License Code will remove the license message from the extensions administrator screens.

Note: If you don't want to pay for the License Code and want to continue to use the extension for free, please do. You will just have to ignore the license message in the administrator.

Note: If you have donated before and feel you should get some reduction on the price, please contact me about it... we'll sort it out :)

more information...

 

 

Here you can see the difference between the use of the extensions without and with Commercial License Code.

WITHOUT Commercial License CodeWITH Commercial License Code
Full version download yes YES yes YES
Full functionality yes YES yes YES
Message in administrator license_invalid license_valid
Encrypted no NO no NO
Free updates yes YES yes YES
Free support yes YES yes YES
Free RSS news subscription yes YES yes YES
Free holiday to Barbados no NO no NO

Download

Downloads

Sourcerer is compatible with Joomla 1.5, Joomla 1.7 and Joomla 2.5

NOTE: Sourcerer needs PHP 5.3+. Please see the specs for more requirements.

  • Are you going to use this extension on a commercial website? Please consider buying a License Code

More downloads...

Please clear your browsers cache after updating an extension.

NOTE: Joomla 1.6 is no longer supported. Joomla 1.6 reached end-of-life in August 2011. If you have a site running on Joomla 1.6 you are urged to upgrade to Joomla! 2.5. Sourcerer will probably still work on Joomla 1.6, but any issues specific to Joomla 1.6 will not be fixed.

Tip!

Are you using multiple NoNumber! extensions?
Install the NoNumber! Extension Manager to easily keep them up-to-date.

Languages

This extension comes with the following languages:

  • [pt-BR] Brazilian Portuguese
  • [bg-BG] Bulgarian
  • [ca-ES] Catalan
  • [nl-NL] Dutch
  • [en-GB] English
  • [fr-FR] French
  • [de-DE] German
  • [el-GR] Greek
  • [it-IT] Italian
  • [ja-JP] Japanese
  • [lt-LT] Lithuanian
  • [pl-PL] Polish
  • [pt-PT] Portuguese
  • [ru-RU] Russian
  • [sl-SI] Slovenian
  • [th-TH] Thai

No language pack for your language?

I welcome you to help out and get involved with translations for NoNumber! extensions.

I am using Transifex for the translations of all NoNumber! extensions. So I kindly ask you to join Transifex.

There is a translation team/group set up especially for Joomla projects: OpenTranslators.

To join, see the different steps on the right under: Translator Guide: http://opentranslators.org/en/how-to

You can find all the NoNumber! projects here: https://www.transifex.net/projects/tag/nonumber/

All language files will be updated and packed with every new release of the individual extensions.

OpenTranslators

 
Open Source Training | Online Joomla! Training and Support
hosting joomla
MaxCDN | Content Delivery Network | Accelerate your site to the max