CM On Demand Search And Replace Shortcodes

Below, you’ll find a detailed guide on how to add the CM On Demand Search And Replace 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 CM On Demand Search And Replace Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the CM On Demand Search And Replace Plugin and the shortcodes it provides:

Plugin Icon
CM On Demand Search And Replace

"CM On Demand Search And Replace is a powerful WordPress plugin designed to streamline and automate the process of searching and replacing content on your website without any coding required."

★★★★✩ (15) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [cminds_free_author]
  • [cminds_free_registration]
  • [cminds_free_guide]
  • [cminds_upgrade_box]
  • [cminds_free_activation]

CM On Demand Search And Replace [cminds_free_author] Shortcode

The cm-on-demand-search-and-replace plugin shortcode, ‘cminds_free_author’, is designed to display authorship credits for a WordPress plugin. It generates a styled text link that credits CreativeMinds, the plugin’s creator, and directs users to their website and plugin store.

Shortcode: [cminds_free_author]

Parameters

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

  • id – It refers to the specific plugin’s unique identifier

Examples and Usage

Basic example – Displays the author information using the plugin ID as the parameter.

[cminds_free_author id=1 /]

Advanced examples

Displaying the author information without any plugin ID. In this case, the current plugin is used to fetch the author information.

[cminds_free_author /]

Displaying the author information using a different plugin ID. The plugin ID used here is ‘2’.

[cminds_free_author id=2 /]

PHP Function Code

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

Shortcode line:

add_shortcode('cminds_free_author', array($this, 'showAuthor'));

Shortcode PHP function:

function showAuthor($atts = array()) {
            $authorUrl = '';
            global $cmindsPluginPackage;

            $atts = shortcode_atts(array('id' => null), $atts);
            $currentPlugin = !empty($atts['id']) ? $cmindsPluginPackage[$atts['id']] : $this;

            if (!$currentPlugin->isPoweredByEnabled()) {
                return;
            }
            ob_start();
            ?>
            <style>
                .cminds_poweredby {clear:both;float:none;font-size:11px;line-height:1.5;display: inline-block;padding: 3px;margin-top:20px;color:#bbb;text-decoration:none;font-weight:bold}
                .cminds_poweredby:before {content:'Powered by ';}
                .cminds_poweredbylink:link{color:#bbb;text-decoration:none;}
                .cminds_poweredbylink:visited{color:#bbb;text-decoration:none;}
                .cminds_poweredbylink:hover{color:#bbb;text-decoration:none;}
            </style>

            <?php
            $authorUrl .= ob_get_clean();
            /*
             * By leaving following snippet in the code, you're expressing your gratitude to creators of this plugin. Thank You!
             */
            $authorUrl .= '<div style="display:block;clear:both;"></div><span class="cminds_poweredby">';
            $authorUrl .= '<a href="' . $currentPlugin->addAffiliateCode('https://www.cminds.com/') . '" target="_blank" class="cminds_poweredbylink">CreativeMinds</a> ';
            $authorUrl .= ' <a href="' . $currentPlugin->addAffiliateCode('https://www.cminds.com/wordpress-plugins/') . '" target="_blank" class="cminds_poweredbylink">WordPress Plugin</a>';
            $authorUrl .= ' <a href="' . $currentPlugin->addAffiliateCode($currentPlugin->getOption('plugin-store-url')) . '" target="_blank" class="cminds_poweredbylink">' . $currentPlugin->getOption('plugin-name') . '</a>';
            $authorUrl .= '</span><div style="display:block;clear:both;"></div>';

            return $authorUrl;
        }

Code file location:

cm-on-demand-search-and-replace/cm-on-demand-search-and-replace/package/cminds-free.php

CM On Demand Search And Replace [cminds_free_registration] Shortcode

The cm-on-demand-search-and-replace plugin shortcode allows you to register your plugin copy. It enables updates and special offers to be sent to your administrator’s email. It also provides an option to hide the registration box. If hidden, links to various CreativeMinds plugins, bundles, add-ons, and services are displayed.

Shortcode: [cminds_free_registration]

Parameters

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

  • id – It is used to specify the plugin for which registration form is to be displayed.

Examples and Usage

Basic example – This shortcode allows you to display the registration form on a page or post.

[cminds_free_registration id=1 /]

Advanced examples

Using the shortcode to display the registration form by referencing the plugin’s ID. This will allow you to display a specific plugin’s registration form.

[cminds_free_registration id="plugin_id" /]

Here is an example of using the shortcode without specifying the plugin’s ID. In this case, the registration form for the current plugin will be displayed.

[cminds_free_registration /]

It’s important to note that the ‘id’ attribute in the shortcode corresponds to the ‘id’ key in the $atts array within the showRegistration function. This ‘id’ is used to select the specific plugin for which the registration form should be displayed.

PHP Function Code

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

Shortcode line:

add_shortcode('cminds_free_registration', array($this, 'showRegistration'));

Shortcode PHP function:

function showRegistration($atts = array()) {
            global $cmindsPluginPackage;

            $atts = shortcode_atts(array('id' => null), $atts);
            $currentPlugin = !empty($atts['id']) ? $cmindsPluginPackage[$atts['id']] : $this;

            $optionName = 'cminds-' . $currentPlugin->getOption('plugin-short-slug') . '-registration-hidden';
            $registrationHide = filter_input(INPUT_GET, 'cminds_registration_hide');
            if ($registrationHide) {
                update_option($optionName, 1);
            }
            $registrationShow = filter_input(INPUT_GET, 'cminds_registration_show');
            if ($registrationShow) {
                delete_option($optionName);
            }
            $registrationHidden = get_option($optionName);

            $this->registerUser($atts);

            $optionName = 'cminds-' . $currentPlugin->getOption('plugin-short-slug') . '-registered';
            $isRegistered = $this->isRegistered();

            if ($isRegistered) :
                return $this->showAds($atts);
            else :
                ob_start();
                ?>
                <style type="text/css">

                    div.cminds_registration_wrapper {
                        display: inline-block;
                        padding: 1em;
                        background: #FFF;
                        margin: 1em 1em 0 0;
                        width: 1004px;
                    }

                    div.cminds_registration_wrapper * {
                        vertical-align: top;
                    }

                    .cminds_registration{
                        display: inline-block;
                        margin: 1em;
                        padding: 1em 58px;
                    }

                    .cminds_registration form{
                        display: inline-block;
                        margin: 1em;
                    }
                    .cminds_registration form .no-registration{
                        margin: 5px 0 0;
                        text-align: center;
                    }

                    .cminds_registration form input[type="submit"]{
                        font-size: 16pt;
                        padding: 7px;
                        height: auto;
                    }

                    .cminds_registration_text{
                        display: inline-block;
                        margin: 1em;
                    }

                    .cminds_registration_text > span{
                        text-align: left;
                        display: block;
                    }

                    .cminds_registration_text .row_1{
                        font-size: 12pt;
                        padding-bottom: 5px;
                    }
                    .cminds_registration_text .row_2{
                        font-size: 10pt;
                    }

                    .cminds_link{
                        color: #555;
                        border-color: rgba(204,204,204,0.8);
                        background: #f7f7f7;
                        -webkit-box-shadow: 0 1px 0 #ccc;
                        box-shadow: 0 1px 0 #ccc;
                        display: inline-block;
                        text-decoration: none;
                        line-height: 26px;
                        height: 28px;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        border-width: 1px;
                        border-style: solid;
                        -webkit-border-radius: 3px;
                        border-radius: 3px;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing: border-box;
                        box-sizing: border-box;
                    }

                    .cminds_link:active {
                        background: #eee;
                        border-color: #999;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .cminds_link:hover {
                        background: #eee;
                        border-color: #999;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .cminds_link.blue{
                        color: #fff;
                        border-color: #33ace7;
                        background: #66c1ed;
                        -webkit-box-shadow: 0 1px 0 #ccc;
                        box-shadow: 0 1px 0 #ccc;
                        display: inline-block;
                        text-decoration: none;
                        line-height: 26px;
                        height: 28px;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        border-width: 1px;
                        border-style: solid;
                        -webkit-border-radius: 3px;
                        border-radius: 3px;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing: border-box;
                        box-sizing: border-box;

                    }

                    .cminds_link.blue:active {
                        background: #0198e1;
                        border-color: #66c1ed;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .cminds_link.blue:hover {
                        background: #005b87;
                        border-color: #0198e1;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .cminds_link.orange{
                        color: #fff;
                        border-color: #ffb752;
                        background: #ffb752;
                        -webkit-box-shadow: 0 1px 0 #ccc;
                        box-shadow: 0 1px 0 #ccc;
                        display: inline-block;
                        text-decoration: none;
                        line-height: 26px;
                        height: 28px;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        border-width: 1px;
                        border-style: solid;
                        -webkit-border-radius: 3px;
                        border-radius: 3px;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing: border-box;
                        box-sizing: border-box;

                    }

                    .cminds_link.orange:active {
                        background: #e5a449;
                        border-color: #ffc574;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .cminds_link.orange:hover {
                        background: #e5a449;
                        border-color: #ffc574;
                        -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
                        -webkit-transform: translateY(1px);
                        -ms-transform: translateY(1px);
                        transform: translateY(1px);
                    }

                    .clear, .clearfix{
                        clear:both;
                    }
                    .cmclearfix{
                        clear:both !important;
                    }

                </style>

                <?php if (!$registrationHidden) : ?>

                    <div class="cminds_registration_wrapper">
                        <div class="cminds_registration">
                            <table><tr>
                                    <td>
                                        <form method="post" action="">
                                            <?php
                                            wp_nonce_field('cminds_register_free', 'cminds_nonce');
                                            echo $currentPlugin->getRegistrationFields();
                                            ?>
                                            <input class="button button-primary" style="background-color:green;" type="submit" value="Register Your Copy" />
                                            <div class="no-registration">
                                                <a class="cminds-registration-hide-button button" href="<?php echo add_query_arg(array('cminds_registration_hide' => 1), remove_query_arg('cminds_registration_show')); ?>">I don't want to register now</a>
                                            </div>
                                        </form>
                                    </td>
                                    <td>
                                        <div class="cminds_registration_text">
                                            <span class="row_1">
                                                Once registered, you will receive updates and special offers.
                                            </span>
                                            <span class="row_2">
                                                <p>We will only send once, your administrator's e-mail and site URL to CreativeMinds server.<br /> No additional information will be ever collected or sent.</p>
                                            </span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    </div>
                <?php else : ?>
                    <div class="cminds_registration_wrapper">
                        <div>
                            <a class="cminds-registration-hide-button button" href="<?php echo add_query_arg(array('cminds_registration_show' => 1), remove_query_arg('cminds_registration_hide')); ?>">Show registration box</a>
                            <a href="<?php echo $this->getStoreUrl(); ?>" class="cminds_link orange" target="_blank">View all CreativeMidns Plugins</a>
                            <a href="<?php echo $this->getStoreUrl(array('category' => 'Bundle')); ?>" class="cminds_link blue" target="_blank">View Bundles</a>
                            <a href="<?php echo $this->getStoreUrl(array('category' => 'Add-On')); ?>" class="cminds_link blue" target="_blank">View Add-Ons</a>
                            <a href="<?php echo $this->getStoreUrl(array('category' => 'Service')); ?>" class="cminds_link blue" target="_blank">View Services</a>
                        </div>
                    </div>
                <?php
                endif;
                echo $this->showUpgrade($atts);
                ?>
                <div class="clear clearfix cmclearfix"></div>
                <?php
                $content = ob_get_clean();
                return $content;
            endif;
        }

Code file location:

cm-on-demand-search-and-replace/cm-on-demand-search-and-replace/package/cminds-free.php

CM On Demand Search And Replace [cminds_free_guide] Shortcode

The cm-on-demand-search-and-replace plugin shortcode displays a guide. It checks if the guide is hidden or shown based on user input. If hidden, it provides an option to show it again.

Shortcode: [cminds_free_guide]

Parameters

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

  • id – The unique identifier of the plugin used.

Examples and Usage

Basic Example – Displays the guide for a plugin using its ID.

[cminds_free_guide id=2 /]

Advanced Examples

Displays the guide for a plugin using its ID, and hides or shows the guide based on the ‘cminds_guide_hide’ or ‘cminds_guide_show’ parameters in the URL.

[cminds_free_guide id=2 cminds_guide_hide=1 /]

Or

[cminds_free_guide id=2 cminds_guide_show=1 /]

Note: In the advanced examples, ‘1’ is used to signify true. Therefore, cminds_guide_hide=1 means the guide is hidden, and cminds_guide_show=1 means the guide is shown.

PHP Function Code

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

Shortcode line:

add_shortcode('cminds_free_guide', array($this, 'showGuide'));

Shortcode PHP function:

<pre class="wp-block-syntaxhighlighter-code">function showGuide($atts = array()) {
            global $cmindsPluginPackage;

            $atts = shortcode_atts(array('id' => null), $atts);
            $currentPlugin = !empty($atts['id']) ? $cmindsPluginPackage[$atts['id']] : $this;

            $optionName = 'cminds-' . $currentPlugin->getOption('plugin-short-slug') . '-guide-hidden';
            $guideHide = filter_input(INPUT_GET, 'cminds_guide_hide');
            if ($guideHide) {
                update_option($optionName, 1);
            }
            $guideShow = filter_input(INPUT_GET, 'cminds_guide_show');
            if ($guideShow) {
                update_option($optionName, 0);
            }
            $guideHidden = get_option($optionName, 0);

            $showGuide = $currentPlugin->getOption('plugin-show-guide');
            if ($showGuide) :
                ob_start();
                ?><style type="text/css">

                    div.cminds_guide_wrapper {
                        display: inline-block;
                        padding: 0em 0em 1em 1em;
                        background: #FFF;
                        margin: 0em 0em 0 0;
                        vertical-align: top;
                    }

                    div.cminds_guide_wrapper * {
                        vertical-align: top;
                    }

                    .cminds_guide{
                        display: inline-block;
                        margin: 1em;
                        padding: 1em;
                    }

                    .cminds_guide_text{
                        display: inline-block;
                        margin: 1em;
                    }

                    .cminds_guide_text > span{
                        text-align: left;
                        display: block;
                    }

                    .clear, .clearfix{
                        clear: both;
                    }

                    .cmclearfix{
                        clear: both !important;
                    }

                    .cminds_guide .guide_header{
                        font-size: 14pt;
                        font-weight: bold;
                    }

                    .cminds_guide .guide_text{
                        display: inline-block;
                        width: 509px;
                        max-width: 100%;
                        margin-right: 40px;
                    }

                    .cminds_guide .guide_videos{
                        display: inline-block;
                        max-width: 100%;
                        overflow: hidden;
                    }

                    .cminds_guide .guide_videos .guide_videos_inner{
                    }

                    .cminds_guide .guide_videos > div{
                        display: inline-block;
                    }
                    .cminds_guide .guide_videos > div.guide_videos_after{
                        display: block;
                        margin: 10px 0 0 52px;
                    }
                    .prev_video,
                    .next_video {
                        margin-top: 85px;
                    }

                    .guide_video_title {
                        font-size: 13pt;
                        font-weight: bold;
                        margin: 0 0 10px 0px;
                    }

                    .cminds_link.blue {
                        color: #fff;
                        border-color: #33ace7;
                        background: #66c1ed;
                        -webkit-box-shadow: 0 1px 0 #ccc;
                        box-shadow: 0 1px 0 #ccc;
                        display: inline-block;
                        text-decoration: none;
                        line-height: 26px;
                        height: 28px;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        border-width: 1px;
                        border-style: solid;
                        -webkit-border-radius: 3px;
                        border-radius: 3px;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing: border-box;
                        box-sizing: border-box;
                    }

                    .cminds_guide .guide_videos .guide_video{
                        display: none;
                    }
                    .cminds_guide .guide_videos .guide_video.active{
                        display: inline-block;
                    }

                    .cminds_guide .guide_video_content > a{
                        display: block;
                    }
                    .install-guide-video {max-height: 160px;}
                    .upgrage-guide-video {max-height: 255px;}
                </style>
                <?php
                if (!$guideHidden) :
                    ?>
                    <script>
                        jQuery(document).ready(function () {

                            jQuery.fn.visible = function () {
                                return this.css('visibility', 'visible');
                            };

                            jQuery.fn.invisible = function () {
                                return this.css('visibility', 'hidden');
                            };

                            jQuery.fn.visibilityToggle = function () {
                                return this.css('visibility', function (i, visibility) {
                                    return (visibility === 'visible') ? 'hidden' : 'visible';
                                });
                            };
                            var cminds_video_prev_next_toggle = function () {
                                var prevVisible = jQuery('.guide_videos .guide_video.active').prev('.guide_video').length;
                                var nextVisible = jQuery('.guide_videos .guide_video.active').next('.guide_video').length;

                                if (prevVisible) {
                                    jQuery('.guide_videos .prev_video').visible();
                                } else {
                                    jQuery('.guide_videos .prev_video').invisible();
                                }

                                if (nextVisible) {
                                    jQuery('.guide_videos .next_video').visible();
                                } else {
                                    jQuery('.guide_videos .next_video').invisible();
                                }
                            };

                            cminds_video_prev_next_toggle();

                            jQuery('.guide_videos .prev_video').on('click', function () {
                                var prevVideo = jQuery('.guide_videos .guide_video.active').prev('.guide_video');
                                if (prevVideo.length)
                                {
                                    jQuery('.guide_videos .guide_video.active').removeClass('active');
                                    prevVideo.addClass('active');
                                }
                                cminds_video_prev_next_toggle();
                            });

                            jQuery('.guide_videos .next_video').on('click', function () {
                                var nextVideo = jQuery('.guide_videos .guide_video.active').next('.guide_video');
                                if (nextVideo.length)
                                {
                                    jQuery('.guide_videos .guide_video.active').removeClass('active');
                                    nextVideo.addClass('active');
                                }
                                cminds_video_prev_next_toggle();
                            });
                        });
                    </script>
                    <div class="clear clearfix cmclearfix"></div>
                    <div class="cminds_guide_wrapper">
                        <div class="cminds_guide">

                            <?php
                            $guideText = $currentPlugin->getOption('plugin-guide-text');
                            if (!empty($guideText)) :
                                ?>
                                <div class="guide_text">
                                    <div class="guide_header">
                                        Initial Installation Guide
                                    </div>
                                    <?php echo $guideText; ?>
                                </div>
                            <?php endif; ?>

                            <?php
                            $videos = $currentPlugin->getOption('plugin-guide-videos');
                            if (!empty($videos) && is_array($videos)) :
                                ?>
                                <div class="guide_videos">
                                    <div class="prev_video cminds_link blue" style="visibility: hidden">Prev</div>
                                    <div class="guide_videos_inner">
                                        <?php foreach ($videos as $key => $video) : ?>
                                            <div class="guide_video <?php echo!$key ? 'active' : ''; ?>">
                                                <div class="guide_video_title"><?php echo $video['title']; ?></div>
                                                <?php
                                                // echo do_shortcode('[video src="https://player.vimeo.com/video/' . $video['video_id'] . '?portrait=0&responsive=0&maxwidth=290&maxheight=160&player_id=player_2" width="290" height="160" id="palyer_2"][/video]');
                                                echo $GLOBALS['wp_embed']->run_shortcode('<a href="https://player.vimeo.com/video/'%20.%20$video%5B'video_id'%5D%20.%20'">https://player.vimeo.com/video/' . $video['video_id'] . '</a>');
//														echo wp_video_shortcode(array('src' =>"https://player.vimeo.com/video/" . $video['video_id'] . "?portrait=0&responsive=1&maxheight=160&player_id=player_2", 'width' => 463, 'height' => 255, 'class' => "install-guide-video wp-video-shortcode", 'id' => "palyer_2"));
                                                ?>
                                            </div>
                                        <?php endforeach; ?>
                                    </div>
                                    <div class="next_video cminds_link blue" style="visibility: hidden">Next</div>
                                    <div class="guide_videos_after">
                                        <a href="<?php echo $currentPlugin->getPageUrl('about'); ?>" class="cminds_link blue" target="_blank">Open Plugin User Guide</a>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="clear clearfix cmclearfix"></div>
                <?php else : ?>
                    <div class="cminds_guide_wrapper">
                        <div>
                            <a class="cminds-guide-hide-button button" href="<?php echo add_query_arg(array('cminds_guide_show' => 1), remove_query_arg('cminds_guide_hide')); ?>">Show Installation Guide Box</a>
                        </div>
                    </div>
                    <div class="clear clearfix cmclearfix"></div>
                <?php
                endif;
                ?>

                <?php
                $content = ob_get_clean();
                return $content;
            endif;
        }</pre>

Code file location:

cm-on-demand-search-and-replace/cm-on-demand-search-and-replace/package/cminds-free.php

CM On Demand Search And Replace [cminds_upgrade_box] Shortcode

The cm-on-demand-search-and-replace plugin shortcode ‘cminds_upgrade_box’ is designed to display a customizable upgrade box. It’s used to encourage users to upgrade their current plugin version to the premium one. The function ‘showUpgrade’ is responsible for displaying the upgrade box. It checks if the plugin is registered and if the upgrade box should be shown. The box includes upgrade text, a list of upgrade features, and related videos. The box also has a ‘hide’ option.

Shortcode: [cminds_upgrade_box]

Parameters

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

  • id – Identifies the plugin package to be upgraded

Examples and Usage

Basic example – The shortcode ‘cminds_upgrade_box’ is used to display the upgrade box for a specific plugin. The ‘id’ parameter is used to specify the plugin.

[cminds_upgrade_box id="plugin_id"]

Advanced examples

Using the shortcode to display the upgrade box for a specific plugin and hiding the upgrade box if the ‘cminds_upgrade_hide’ parameter is set to true.

[cminds_upgrade_box id="plugin_id" cminds_upgrade_hide="true"]

Using the shortcode to display the upgrade box for a specific plugin and showing the upgrade box if the ‘cminds_upgrade_show’ parameter is set to true.

[cminds_upgrade_box id="plugin_id" cminds_upgrade_show="true"]

Using the shortcode to display the upgrade box for a specific plugin, hiding the upgrade box if the ‘cminds_upgrade_hide’ parameter is set to true and showing the upgrade box if the ‘cminds_upgrade_show’ parameter is set to true.

[cminds_upgrade_box id="plugin_id" cminds_upgrade_hide="true" cminds_upgrade_show="true"]

PHP Function Code

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

Shortcode line:

add_shortcode('cminds_upgrade_box', array($this, 'showUpgrade'));

Shortcode PHP function:

<pre class="wp-block-syntaxhighlighter-code">function showUpgrade($atts = array()) {
            global $cmindsPluginPackage;

            $atts = shortcode_atts(array('id' => null), $atts);
            $currentPlugin = !empty($atts['id']) ? $cmindsPluginPackage[$atts['id']] : $this;

            $optionName = 'cminds-' . $currentPlugin->getOption('plugin-short-slug') . '-upgrade-hidden';
            $upgradeHide = filter_input(INPUT_GET, 'cminds_upgrade_hide');
            if ($upgradeHide) {
                update_option($optionName, 1);
            }
            $upgradeShow = filter_input(INPUT_GET, 'cminds_upgrade_show');
            if ($upgradeShow) {
                update_option($optionName, 0);
            }
            $upgradeHidden = get_option($optionName, 0);
            $isRegistered = $currentPlugin->isRegistered();

            $showUpgrade = $currentPlugin->getOption('plugin-show-upgrade', TRUE);
            if ($showUpgrade) :
                ob_start();
                ?><style type="text/css">

                    div.cminds_upgrade_wrapper {
                        display: block;
                        padding: 0em 0em 1em 1em;
                        background: #FFF;
                        margin: 0em 1em 0 0;
                        vertical-align: top;
                    }

                    div.cminds_upgrade_wrapper * {
                        vertical-align: top;
                    }

                    .cminds_upgrade{
                        display: inline-block;
                        margin: 1em;
                        padding: 1em;
                        width: 100%;
                    }

                    .cminds_upgrade_text{
                        display: inline-block;
                        margin: 1em;
                    }

                    .cminds_upgrade_text > span{
                        text-align: left;
                        display: block;
                    }

                    .clear, .clearfix{
                        clear: both;
                    }

                    .cmclearfix{
                        clear: both !important;
                    }

                    .cminds_upgrade .upgrade_header{
                        font-size: 14pt;
                        font-weight: bold;
                    }

                    .cminds_upgrade .upgrade_text{
                        display: inline-block;
                        max-width: 45%;
                        margin-right: 40px;
                    }

                    .cminds_upgrade .upgrade_videos{
                        display: inline-flex;
                        max-width: 50%;
                        min-width: 520px;
                        overflow: hidden;
                    }

                    .cminds_upgrade .upgrade_videos .upgrade_videos_inner{
                    }

                    .cminds_upgrade .upgrade_videos > div{
                        display: inline-block;
                    }
                    .cminds_upgrade .upgrade_videos > div.upgrade_videos_after{
                        display: block;
                        margin: 10px 0 0 0px;
                    }
                    .prev_video,
                    .next_video {
                        margin-top: 15px;
                    }

                    .upgrade_video_title {
                        font-size: 13pt;
                        font-weight: bold;
                        margin: 0 0 10px 0px;
                    }

                    .cminds_link.blue {
                        color: #fff;
                        border-color: #33ace7;
                        background: #66c1ed;
                        -webkit-box-shadow: 0 1px 0 #ccc;
                        box-shadow: 0 1px 0 #ccc;
                        display: inline-block;
                        text-decoration: none;
                        line-height: 26px;
                        height: 28px;
                        padding: 0 10px 1px;
                        cursor: pointer;
                        border-width: 1px;
                        border-style: solid;
                        -webkit-border-radius: 3px;
                        border-radius: 3px;
                        -webkit-box-sizing: border-box;
                        -moz-box-sizing: border-box;
                        box-sizing: border-box;
                    }

                    .cminds_upgrade .upgrade_videos .upgrade_video{
                        display: none;
                    }
                    .cminds_upgrade .upgrade_videos .upgrade_video.active{
                        display: inline-block;
                    }

                    .cminds_upgrade .upgrade_video_content > a{
                        display: block;
                    }
                </style>
                <?php
                if (!$upgradeHidden) :
                    ?>
                    <script>
                        jQuery(document).ready(function () {

                            jQuery.fn.visible = function () {
                                return this.css('visibility', 'visible');
                            };

                            jQuery.fn.invisible = function () {
                                return this.css('visibility', 'hidden');
                            };

                            jQuery.fn.visibilityToggle = function () {
                                return this.css('visibility', function (i, visibility) {
                                    return (visibility === 'visible') ? 'hidden' : 'visible';
                                });
                            };
                            var cminds_video_prev_next_toggle = function () {
                                var prevVisible = jQuery('.upgrade_videos .upgrade_video.active').prev('.upgrade_video').length;
                                var nextVisible = jQuery('.upgrade_videos .upgrade_video.active').next('.upgrade_video').length;

                                if (prevVisible) {
                                    jQuery('.upgrade_videos .prev_video').visible();
                                } else {
                                    jQuery('.upgrade_videos .prev_video').invisible();
                                }

                                if (nextVisible) {
                                    jQuery('.upgrade_videos .next_video').visible();
                                } else {
                                    jQuery('.upgrade_videos .next_video').invisible();
                                }
                            };

                            cminds_video_prev_next_toggle();

                            jQuery('.upgrade_videos .prev_video').on('click', function () {
                                var prevVideo = jQuery('.upgrade_videos .upgrade_video.active').prev('.upgrade_video');
                                if (prevVideo.length)
                                {
                                    jQuery('.upgrade_videos .upgrade_video.active').removeClass('active');
                                    prevVideo.addClass('active');
                                }
                                cminds_video_prev_next_toggle();
                            });

                            jQuery('.upgrade_videos .next_video').on('click', function () {
                                var nextVideo = jQuery('.upgrade_videos .upgrade_video.active').next('.upgrade_video');
                                if (nextVideo.length)
                                {
                                    jQuery('.upgrade_videos .upgrade_video.active').removeClass('active');
                                    nextVideo.addClass('active');
                                }
                                cminds_video_prev_next_toggle();
                            });
                        });</script>
                    <script type="text/javascript" src="<?php echo plugin_dir_url(__FILE__); ?>js/froogaloop.js"></script>
                    <script>
                        jQuery(document).ready(function ( ) {
                            // Message displayed when link is playing
                            var links = jQuery('.cm-video-bookmark-link');
                            var playNotice = ' - <strong><i><spam style="color:darkgreen;">Now playing</span></i></strong>';
                            // Function to hide all status messages
                            hidePlayNoticeAll = function ( ) {
                                jQuery('.cm-video-bookmark-link .link_status').html("");
                            }

                    //                             Load Vimeo API for the embedded video
                            var iframe_player = jQuery('.upgrade_video_content iframe')[0];
                            var frogaloopPlayer = $f(iframe_player);
                            // Option listeners for pause, finish, and playProgress
                            //
                            // Note: If you want to use this, you must define the functions or links wont work
                            frogaloopPlayer.addEvent('ready', function ( ) {
                                frogaloopPlayer.addEvent('pause', onPause);
                                frogaloopPlayer.addEvent('finish', onFinish);
                                frogaloopPlayer.addEvent('playProgress', onPlayProgress);
                            });

                            // Functions for each listener event
                            function onPause(id) { // When the video is paused, do this.
                                jQuery(".main_status").html('Paused');
                            }

                            function onFinish(id) { // When the video is finished, do this.
                                jQuery(".main_status").html('Finished');
                            }

                            function onPlayProgress(data, id) { // While the video is playing, do this.
                                jQuery(".main_status").html('Playing - ' + data.seconds + 's played'); // data.percent can also be used.
                            }

                            // Function to control what happens when each lesson link is clicked
                            function setupLinks( ) {

                                links.on('click', function ( ) {
                                    var track = jQuery(this).data('timestamp'); //Timestamp stored as a data attribute

                                    hidePlayNoticeAll( ); // Hide all status messages before displaying (to prevent them from sticking)
                                    if (true === jQuery(this).data('active')) {
                                        frogaloopPlayer.api('pause'); //Play the video
                                        jQuery(this).data('active', false);
                                    } else {
                                        frogaloopPlayer.api('play'); //Play the video
                                        frogaloopPlayer.api('seekTo', track); //Seek to the number of seconds in the variable link_1_track
                                        jQuery(this).find('.link_status').html(playNotice); //Display status message (playNotice) within span with class link_1_status
                                        jQuery(this).data('active', true);
                                    }
                                });
                            }
                            setupLinks( );
                        });</script>
                    <div class="clear clearfix cmclearfix"></div>
                    <div class="cminds_upgrade_wrapper">
                        <div class="cminds_upgrade">

                            <?php
                            $upgradeText = $currentPlugin->getOption('plugin-upgrade-text');
                            if (!empty($upgradeText)) :
                                ?>
                                <div class="upgrade_text">
                                    <div class="upgrade_header">
                                        Why you Should Upgrade
                                    </div>
                                    <div style="display:block">
                                        <p><?php echo $upgradeText; ?></p>
                                        <div class="links">

                                            <?php
                                            $upgradel = $currentPlugin->getOption('plugin-upgrade-text-list');
                                            if (!empty($upgradel) && is_array($upgradel)) :
                                                foreach ($upgradel as $key => $listitem) :
                                                    $linknum = $key + 1;
                                                    echo $listitem['video_time'];
                                                    if ('More' !== $listitem['video_time']) :
                                                        ?>
                                                        - <a class="cm-video-bookmark-link link_<?php echo $linknum; ?>" data-timestamp="<?php echo $this->time_to_decimal($listitem['video_time']); ?>" href="javascript:void(0);" target="_self"><?php echo $listitem['title']; ?><span class="link_status"></span></a>
                                                    <?php else: ?>
                                                        - <span class="cm-video-bookmark bookmark_<?php echo $linknum; ?>" style="color:green;"><?php echo $listitem['title']; ?></span>
                                                    <?php endif; ?>
                                                    <br/>
                                                <?php endforeach; ?>
                                            <?php endif ?>
                                        </div>
                                    </div>
                                </div>
                            <?php endif; ?>

                            <?php
                            $videos = $currentPlugin->getOption('plugin-upgrade-videos');
                            if (!empty($videos) && is_array($videos)) :
                                ?>
                                <div class="upgrade_videos">
                                    <div class="prev_video cminds_link blue" style="visibility: hidden">Prev</div>
                                    <div class="upgrade_videos_inner">
                                        <?php
                                        foreach ($videos as $key => $video) :
                                            if (!empty($video)) :
                                                ?>

                                                <div class="upgrade_video <?php echo!$key ? 'active' : ''; ?>">
                                                    <div class="upgrade_video_title"><?php echo $video['title']; ?></div>
                                                    <div class="upgrade_video_content">
                                                        <?php
                                                        echo $GLOBALS['wp_embed']->run_shortcode('<a href="https://player.vimeo.com/video/'%20.%20$video%5B'video_id'%5D%20.%20'">https://player.vimeo.com/video/' . $video['video_id'] . '</a>');
                                                        ?>
                                                        <br /><br /><a href="<?php echo esc_url(get_admin_url('', 'admin.php?page=' . $currentPlugin->getOption('plugin-abbrev') . '_pro')); ?>" class="button button-primary" style="background-color:green; width:220px;" title="Click to Buy PRO">Show me Upgrade Options >></a>

                                                    </div>
                                                </div>
                                                <?php
                                            endif;
                                        endforeach;
                                        ?>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </div>                    </div>
                    <?php
                    echo $this->showAds($atts);
                    ?>
                    <div class="clear clearfix cmclearfix"></div>
                <?php else : ?>
                    <div class="cminds_upgrade_wrapper">
                        <div>
                            <a class="cminds-upgrade-hide-button button" href="<?php echo add_query_arg(array('cminds_upgrade_show' => 1), remove_query_arg('cminds_upgrade_hide')); ?>">Why you shoud have the Premium Edition>></a>
                        </div>
                    </div>
                    <div class="clear clearfix cmclearfix"></div>
                <?php
                endif;
                ?>

                <?php
                $content = ob_get_clean();
                return $content;
            endif;
        }</pre>

Code file location:

cm-on-demand-search-and-replace/cm-on-demand-search-and-replace/package/cminds-free.php

CM On Demand Search And Replace [cminds_free_activation] Shortcode

The ‘cminds_free_activation’ shortcode is a part of the cm-on-demand-search-and-replace plugin. It displays a registration form if the plugin isn’t registered. This shortcode checks the registration status of the plugin. If not registered, it includes the ‘registration.php’ view file, displaying a form for the user to register the plugin.

Shortcode: [cminds_free_activation]

Parameters

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

  • id – Identifies the specific plugin to activate

Examples and Usage

Basic example – Displays the plugin activation status based on the plugin ID provided.

[cminds_free_activation id="1" /]

Advanced examples

Using the shortcode without providing an ID. In this case, the shortcode will display the activation status of the current plugin.

[cminds_free_activation /]

Using the shortcode with a non-existent ID. If the ID does not exist in the array of plugins, the shortcode will still display the activation status of the current plugin.

[cminds_free_activation id="999" /]

PHP Function Code

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

Shortcode line:

add_shortcode('cminds_free_activation', array($this, 'showActivation'));

Shortcode PHP function:

function showActivation($atts = array()) {
            global $cmindsPluginPackage;

            $atts = shortcode_atts(array('id' => null), $atts);
            $currentPlugin = !empty($atts['id']) ? $cmindsPluginPackage[$atts['id']] : $this;

            ob_start();
            $isRegistered = $currentPlugin->isRegistered();
            $isSkipped = $currentPlugin->isSkipped();
            $isRegistered = false;
            if (!$isRegistered) :
                include_once 'views/registration.php';
            else:
                ?>
                <br/>
                <br/>
            <?php
            endif;
            $content = ob_get_clean();
            return $content;
        }

Code file location:

cm-on-demand-search-and-replace/cm-on-demand-search-and-replace/package/cminds-free.php

Conclusion

Now that you’ve learned how to embed the CM On Demand Search And Replace 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 *