balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-redux-extension-my-extension.php (2169B)


      1 <?php
      2 /**
      3  * Redux My Extension Extension Class
      4  * Short description.
      5  *
      6  * @package Redux Extentions
      7  * @class   Redux_Extension_My_Extension
      8  * @version 1.0.0
      9  *
     10  * There is no free support for extension development.  This example is 'as is'.  If you need assitance,
     11  * please consider a Premium Support purchase: https://redux.io/extension/premium-support
     12  *
     13  * Please be sure to replce ALL instances of "My Extension" and "My_Extension" with the name of your actual
     14  * extension.  Please also change the file name so the 'my-extension' portion is also the name of your extension.
     15  * Please use dashes and not underscores in the filename.  Please use underscores instead of dashes in the classname.
     16  *
     17  * Thanks!  :)
     18  */
     19 
     20 defined( 'ABSPATH' ) || exit;
     21 
     22 // Don't duplicate me!
     23 if ( ! class_exists( 'Redux_Extension_My_Extension', false ) ) {
     24 
     25 	/**
     26 	 * Class Redux_Extension_My_Extension
     27 	 */
     28 	class Redux_Extension_My_Extension extends Redux_Extension_Abstract {
     29 		/**
     30 		 * Set extension version.
     31 		 *
     32 		 * @var string
     33 		 */
     34 		public static $version = '1.0.0';
     35 
     36 		/**
     37 		 * Set the name of the field.  Ideally, this will also be your extension's name.
     38 		 * Please use underscores and NOT dashes.
     39 		 *
     40 		 * @var string
     41 		 */
     42 		private $field_name = 'my_field';
     43 
     44 		/**
     45 		 * Set the friendly name of the extension.  This is for display purposes.  No underscores or dashes are required.
     46 		 *
     47 		 * @var string
     48 		 */
     49 		private $extension_name = 'My Extension';
     50 
     51 		/**
     52 		 * Set the minumum required version of Redux here (optional).
     53 		 *
     54 		 * Leave blank to require no minimum version.  This allows you to specify a minimum required version of
     55 		 * Redux in the event you do not want to support older versions.
     56 		 *
     57 		 * @var string
     58 		 */
     59 		private $minimum_redux_version = '4.0.0';
     60 
     61 		/**
     62 		 * Redux_Extension_my_extension constructor.
     63 		 *
     64 		 * @param object $parent ReduxFramework pointer.
     65 		 */
     66 		public function __construct( $parent ) {
     67 			parent::__construct( $parent, __FILE__ );
     68 
     69 			if ( is_admin() && ! $this->is_minimum_version( $this->minimum_redux_version, self::$version, $this->extension_name ) ) {
     70 				return;
     71 			}
     72 
     73 			$this->add_field( 'my_field' );
     74 		}
     75 	}
     76 }