PHPEnkoder Shortcodes

Below, you’ll find a detailed guide on how to add the PHPEnkoder Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the PHPEnkoder Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the PHPEnkoder Plugin and the shortcodes it provides:

Plugin Icon
PHPEnkoder

"PHPEnkoder is a robust WordPress plugin that efficiently encrypts your PHP code. With the php-enkoder plugin, protect your website's sensitive data from bots and hackers, ensuring maximum security."

★★★★★ (8) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [enkode]
  • [noenkode]

PHPEnkoder [enkode] Shortcode

The ‘enkode’ shortcode is a part of the PHP-Enkoder plugin. It encodes email addresses to protect them from spambots. The shortcode handler function ‘enk_shortcode_handler’ takes attributes and content. If no content is provided, it returns an empty string. The function then sets options using ‘shortcode_atts’, defaulting to the ‘enkode_msg’ option, ‘MAX_PASSES’, and ‘MAX_LENGTH’. It returns the encoded content.

Shortcode: [enkode]

Parameters

Here is a list of all possible enkode shortcode parameters and attributes:

  • text – The custom message to be encrypted by the enkoder
  • passes – Maximum number of iterations for the encoding process
  • length – Maximum length of the encoded message

Examples and Usage

Basic example – Utilizes the ‘enkode’ shortcode without any additional parameters. The content inside the shortcode will be encrypted based on the default settings defined in the plugin.

[enkode]Your text here[/enkode]

Advanced examples

Encrypts the content using a custom text message. This text message will be used as a part of the encryption process, providing an additional layer of security.

[enkode text="custom message"]Your text here[/enkode]

Defines the number of passes for the encryption process. A higher number of passes will result in a more secure encryption, but it may also increase the loading time of your webpage.

[enkode passes=5]Your text here[/enkode]

Defines the maximum length for the encryption. This can be useful if you are dealing with very long texts that may exceed the default maximum length.

[enkode length=5000]Your text here[/enkode]

Combines all the above parameters to provide a highly customized encryption process.

[enkode text="custom message" passes=5 length=5000]Your text here[/enkode]

PHP Function Code

In case you have difficulties debugging what causing issues with [enkode] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('enkode', 'enk_shortcode_handler');

Shortcode PHP function:

                    function enk_shortcode_handler($atts, $content = NULL) {
  if (is_null($content)) return '';

  $opts = shortcode_atts(array('text'   => get_option("enkode_msg"),
                               'passes' => MAX_PASSES,
                               'length' => MAX_LENGTH),
                         $atts);

  return enkode(do_shortcode($content), $opts['text'], $opts['passes'], $opts['length']);
}
                    

Code file location:

php-enkoder/php-enkoder/enkoder.php

PHPEnkoder [noenkode] Shortcode

The PHP Enkoder shortcode ‘noenkode’ is designed to disable the Enkoder filters. . This shortcode allows users to control when the Enkoder plugin will not encode email addresses, providing flexibility.

Shortcode: [noenkode]

Examples and Usage

Basic example – The basic usage of the ‘noenkode’ shortcode does not require any parameters or attributes. It simply calls the ‘enk_noenkode_handler’ function when the shortcode is used.

[noenkode /]

Advanced examples

Even though the ‘noenkode’ shortcode does not accept parameters in its default state, you can modify the ‘enk_noenkode_handler’ function to accept parameters. For example, you could modify the function to accept a ‘filter’ parameter that controls which filters are unregistered when the function is called.

Here is a potential modification to the ‘enk_noenkode_handler’ function:


function enk_noenkode_handler($atts, $content = NULL) {
  $atts = shortcode_atts(array(
    'filter' => 'default'
  ), $atts);

  switch($atts['filter']) {
    case 'all':
      enkoder_unregister_all_filters();
      break;
    case 'default':
    default:
      enkoder_unregister_filters();
      break;
  }
}

With this modification, you can use the ‘noenkode’ shortcode with a ‘filter’ parameter to control which filters are unregistered:

[noenkode filter="all" /]

This will call the ‘enk_noenkode_handler’ function with the ‘filter’ attribute set to ‘all’, causing all filters to be unregistered.

PHP Function Code

In case you have difficulties debugging what causing issues with [noenkode] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('noenkode', 'enk_noenkode_handler');

Shortcode PHP function:

                    function enk_noenkode_handler($atts, $content = NULL) {
  enkoder_unregister_filters();
}
                    

Code file location:

php-enkoder/php-enkoder/enkoder.php

Conclusion

Now that you’ve learned how to embed the PHPEnkoder Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *