Disable Right Click, View Source, Inspect Element For WordPress

AMM 😂😹🏆

Disable Right Click For WP

Hello friends,

I have developed a WordPress plugin which is used to disable right click on website to prevent cut, copy, paste, save image, view source, inspect element etc. But when Administrator or Site Editor is logged in, he can access everything without any of the above restrictions.

MAIN FEATURES “Disable Right Click For WP” FOR FREE

  • Disable Right Click.
  • Disable View Source With Shortcut (CTRL+U).
  • Disable Inspect Element With Shortcut (F12/CTRL+SHIFT+I/CTRL+SHIFT+K).
  • Disable Copy (CTRL+C), Cut (CTRL+X), Paster( CTRL+V).
  • Disable Text Selection.
  • Disable Image drag-n-drop.

Download it from: https://wordpress.org/plugins/disable-right-click-for-wp/

Note: For any customization or help please do contact me on aftabmuni.ljmca@gmail.com or create ticket at support page of this plugin.

WordPress add active class to Menu item – Plugin

Hello friends,

I have developed a simple WordPress plugin to add active class to menu item li tag. Currently it is current-menu-item or current_page_parent. You can even set custom class to li tag if your need is other than active class. Hope you will like it.

Download it from: https://wordpress.org/plugins/wp-add-active-class-to-menu-item/

Note: For any customization or help please do contact me on my mail or at plugins support page.

indian rupee symbol not showing

Indian Rupee Symbol For Woocommerce – Plugin

I was facing a issue in displaying new Indian Rupee Symbol in Woocommerce. In my shopping page, cart, filters etc. the rupee symbol was not showing. It was display a square box (error). So with the help of google and other means I have developed new plugin as a solution to this problem. Hope you will like and it will be really helpful.

Check it out on: https://wordpress.org/plugins/indian-rupee-symbol-for-woocommerce/

Note: For any type of customization or help please do contact me or at plugins support page.

How to convert number to words in PHP

For example you need to convert a particular amount number into a word, let say

55892 – “fifty five thousand eight hundred ninety two”

To achieve this we can use below given code:

<?php
$ones = array(
“”,
” one”,
” two”,
” three”,
” four”,
” five”,
” six”,
” seven”,
” eight”,
” nine”,
” ten”,
” eleven”,
” twelve”,
” thirteen”,
” fourteen”,
” fifteen”,
” sixteen”,
” seventeen”,
” eighteen”,
” nineteen”
);
$tens = array(
“”,
“”,
” twenty”,
” thirty”,
” forty”,
” fifty”,
” sixty”,
” seventy”,
” eighty”,
” ninety”
);
$triplets = array(
“”,
” thousand”,
” million”,
” billion”,
” trillion”,
” quadrillion”,
” quintillion”,
” sextillion”,
” septillion”,
” octillion”,
” nonillion”
);
// recursive fn, converts three digits per pass
function convertTri($num, $tri) {
global $ones, $tens, $triplets;
// chunk the number, …rxyy
$r = (int) ($num / 1000);
$x = ($num / 100) % 10;
$y = $num % 100;
// init the output string
$str = “”;
// do hundreds
if ($x > 0)
$str = $ones[$x] . ” hundred”;
// do ones and tens
if ($y < 20)
$str .= $ones[$y];
else
$str .= $tens[(int) ($y / 10)] . $ones[$y % 10];
// add triplet modifier only if there
// is some output to be modified…
if ($str != “”)
$str .= $triplets[$tri];
// continue recursing?
if ($r > 0)
return convertTri($r, $tri+1).$str;
else
return $str;
}
// returns the number as an anglicized string
function convertNum($num) {
$num = (int) $num; // make sure it’s an integer
if ($num < 0)
return “negative”.convertTri(-$num, 0);
if ($num == 0)
return “zero”;
return convertTri($num, 0);
}
// Returns an integer in -10^9 .. 10^9
// with log distribution
function makeLogRand() {
$sign = mt_rand(0,1)*2 – 1;
$val = randThousand() * 1000000
+ randThousand() * 1000
+ randThousand();
$scale = mt_rand(-9,0);
return $sign * (int) ($val * pow(10.0, $scale));
}
// example of usage
echo “-5564 : “.convertNum(-5564).”<br>”;
echo “55892 : “.convertNum(55892);
?>

How to install Codeigniter in Xampp localhost

1. Download Latest Version 3.0.0 : Download Zip
2. Unzip it at your server in folder “codeigniter”. for example :xampp/htaccess/codeigniter
3. Now go to – application/config/config.php Here add base url ie. Base path of your application directory.


Get Best Multi-Purpose WordPress Theme

Get Best WordPress Theme

For example :

4. Now to go the : application/config/database.php Add database settings here :

For Example :

5 . (Optional) : Remove Index.php from url

Create a .htaccess file at the root of the application for example at :xampp/htaccess/codeigniter – add here .htaccess file

Add the following code in the .htaccess file :

6. You are done : Now your application is ready : Hit the url : http://localhost/codeigniter you will see default welcome message

Setup Maintenance Mode Using Hooks in Codeigniter

image1 (1)

There are so many ways to achieve maintenance mode in codeigniter. Codeigniter itself doesn`t provide such kind of functionality as other framework supports. This post supports how to setup maintenance mode using hooks.

Following are the steps to achieve this:

  1. Enable Hooks in the config.php file
  2. Create a custom config file for maintenance settings i.e maintenance_config.php
  3. Create an html called maintenance_view.php page under views or in root folder
  4. Create a Hook file called maintenance.php
  5. In the hooks config setup your hooks call to run on post_controller

application/views/maintenance_view.php

<!DOCTYPE html>
<html>
  <head>
    <title>Maintenance</title>
    <style>Style your page</style>
  </head>
  <body>
    <p>We apologize but our site is currently undergoing maintenance at this time.</p>
    <p>Please check back later.</p>
  </body>
</html>

application/config/maintenance_config.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['site_under_maintenance'] = TRUE;
?>

application/hooks/maintenance.php

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Maintenance {
  var $CI;
  public function maintenance() {
     $this->CI = & get_instance();
     $this->CI->config->load('maintenance_config'); // Load custom config file
     if ($this->CI->config->item("site_under_maintenance")) {
        include(APPPATH . '/views/maintenance_view.php');
        die();
     }
  }
}
?>

application/config/hooks.php

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
$hook['post_controller'][] = array(
  'class' => 'maintenance',
  'function' => 'maintenance',
  'filename' => 'maintenance.php',
  'filepath' => 'hooks',
  'params' => array()
);
?>

Output

Maintenance

Extras: Addicted Upcoming

Session based flash messages

Quite a while ago, I grew tired of trying to come up with new and creative ways to display simple, one-time messages to users without crazy amounts of code for something that was frequently as trivial as “Saved!”.

Sessions are the obvious solution, however, without a single function that could both generate, AND display the messages, it still wasn’t any better.  And as usual, where there’s a will, and some code- there’s a way!


Get Best Multi-Purpose WordPress Theme

Get Best WordPress Theme

Before we get started, make sure that a session is started, otherwise a) no message will be displayed, and b) super fun headers already sent messages.

//Ensure that a session exists (just in case)
if( !session_id() )
{
    session_start();
}

//Actual function

/**
 * Function to create and display error and success messages
 * @access public
 * @param string session name
 * @param string message
 * @param string display class
 * @return string message
 */
function flash( $name = '', $message = '', $class = 'success fadeout-message' )
{
    //We can only do something if the name isn't empty
    if( !empty( $name ) )
    {
        //No message, create it
        if( !empty( $message ) &amp;& empty( $_SESSION[$name] ) )
        {
            if( !empty( $_SESSION[$name] ) )
            {
                unset( $_SESSION[$name] );
            }
            if( !empty( $_SESSION[$name.'_class'] ) )
            {
                unset( $_SESSION[$name.'_class'] );
            }

            $_SESSION[$name] = $message;
            $_SESSION[$name.'_class'] = $class;
        }
        //Message exists, display it
        elseif( !empty( $_SESSION[$name] ) &amp;& empty( $message ) )
        {
            $class = !empty( $_SESSION[$name.'_class'] ) ? $_SESSION[$name.'_class'] : 'success';
            echo '
.$class.‘” id=”msg-flash”>’.$_SESSION[$name].

;
            unset($_SESSION[$name]);
            unset($_SESSION[$name.'_class']);
        }
    }
}
//Set the first flash message with default class
flash( 'example_message', 'This content will show up on example2.php' );

//Set the second flash with an error class
flash( 'example_class', 'This content will show up on example2.php with the error class', 'error' );
//Displaying the messages
<?php flash( 'example_message' ); ?>
<?php flash( 'example_class' ); ?>

You can download the source from here

From: http://www.phpdevtips.com/

Extras: Addicted Upcoming

Add Extra Charges In Woocommerce Cart

If you want to apply extra fee in the cart then Woocommerce provide an action for applying a fee on the cart.

The fee can be used as shipping fee, installation fee or whatever as per your requirement.

add_action( ‘woocommerce_cart_calculate_fees’, ‘add_extra_cart_fee’ ,10,1 );
This action calculates the total fee and adds into the cart amount.

This Woocommerce function is used to add the fee to Woocommerce cart.

How to use it ?

<?php
add_action( ‘woocommerce_cart_calculate_fees’, ‘add_extra_cart_fee’ ,10,1 );
function add_extra_cart_fee( $cart_object ) {

global $woocommerce;
$spfee = 14.00; // initialize special fee
$woocommerce-&gt;cart-&gt;add_fee( ‘Extra Tax Fee’, $spfee, true, ‘standard’ );

}
?>

From: https://www.linkedin.com/pulse/add-fee-woocommerce-cart-vishal-patel

Implement Parent/Child Theme in Magento

At some point you will need to modify the code of the theme to customize a particular page to your needs. On Magento this is easily done by creating a child theme and modifying its files instead. This will protect the changes from being overwritten when you upgrade Magento or Intenso theme to a new version.

Like other popular CMS systems, Magento is based on a fall-back hierarchy, which means that if you have set a custom child theme, Magento will use the files of your child theme, and if it doesn’t find some of the necessary files it will use the ones from Intenso (and if the file is not present on Intenso it will use the Base default theme)

Instead of opening the template file and making modification to it, it is recommended to make a copy of that file and place it on your own child theme. In this article you will learn how to create a child theme and add to it the files you need to modify.

Magento consists of multiple template files, each one used to render a block of content in the frontend of the store. When you want to customize some section of a theme, you need to find first what is the name and route of the template file rendering that specific block. You can display the name of the template files of every block in the frontend by enabling Magento’s Template Path Hints.

To enable Magento’s Template Path Hints go to System > Configuration > Developer. Select your current website under Current Configuration Scope in the top left corner of the admin panel, and set Debug > Template Path Hints to Yes.

Now open the page you want to customize and find the path to the template. This way you can easily check which template files you need to edit to customize specific sections of Magento. Files that need to be modified can be copied to your custom sub-theme.

Child-Theme folder structure

The child-theme folder structure should be as follows:

sub-theme-tree

In this case we named the folder “custom”, but you can use any name you like.

Once you have identified the right template to edit, you have to make a copy of the original file and paste it into your sub-theme directory. The directory structure inside the sub-theme must replicate the directory structure of the default theme.

When you’re creating a sub-theme in Magento you should only copy the files which you want to modify. Do not copy all files. Otherwise you will have tons of additional work in the future with any theme upgrade.

Activating the Child-Theme

You need to perform one additional step to let know Magento where to find your modified files. Just go to System > Configuration > Design, click the Themes tab and enter the name of your child-theme folder in the Default field.

sub-theme-design-settings

Note: design changes made in System > Design overrides theme configurations made in System > Configuration > Design
Only use the System > Design menu to set seasonal design themes.