Advertisement
Guest User

Updated Admin Options for AuthorBox Lite

a guest
Jun 5th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.63 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.     ReduxFramework Sample Config File
  5.     For full documentation, please visit: https://github.com/ReduxFramework/ReduxFramework/wiki
  6. **/
  7.  
  8. if ( !class_exists( "ReduxFramework" ) ) {
  9.     return;
  10. }
  11.  
  12. if ( !class_exists( "Redux_Framework_wpauthbox_config" ) ) {
  13.     /*
  14.      * Fix issue with custom post types
  15.      * Load custom config last
  16.      */
  17.     add_action( 'init', 'wpauthbox_settings_init', 999 );
  18.     function wpauthbox_settings_init()
  19.     {
  20.         new Redux_Framework_wpauthbox_config();
  21.     }
  22.  
  23.     class Redux_Framework_wpauthbox_config {
  24.  
  25.         public $args = array();
  26.         public $sections = array();
  27.         public $theme;
  28.         public $ReduxFramework;
  29.  
  30.         public function __construct( ) {
  31.  
  32.  
  33.             // Set the default arguments
  34.             $this->setArguments();
  35.            
  36.             // Set a few help tabs so you can see how it's done
  37.             $this->setHelpTabs();
  38.  
  39.             // Create the sections and fields
  40.             $this->setSections();
  41.            
  42.             if ( !isset( $this->args['opt_name'] ) ) { // No errors please
  43.                 return;
  44.             }
  45.            
  46.             $this->ReduxFramework = new ReduxFramework($this->sections, $this->args);
  47.            
  48.  
  49.             // If Redux is running as a plugin, this will remove the demo notice and links
  50.             //add_action( 'redux/plugin/hooks', array( $this, 'remove_demo' ) );
  51.            
  52.             // Function to test the compiler hook and demo CSS output.
  53.             //add_filter('redux/options/'.$this->args['opt_name'].'/compiler', array( $this, 'compiler_action' ), 10, 2);
  54.             // Above 10 is a priority, but 2 in necessary to include the dynamically generated CSS to be sent to the function.
  55.  
  56.             // Change the arguments after they've been declared, but before the panel is created
  57.             //add_filter('redux/options/'.$this->args['opt_name'].'/args', array( $this, 'change_arguments' ) );
  58.            
  59.             // Change the default value of a field after it's been set, but before it's been used
  60.             //add_filter('redux/options/'.$this->args['opt_name'].'/defaults', array( $this,'change_defaults' ) );
  61.  
  62.             // Dynamically add a section. Can be also used to modify sections/fields
  63.             add_filter('redux/options/'.$this->args['opt_name'].'/sections', array( $this, 'dynamic_section' ) );
  64.             add_action('redux/options/' . $this->args['opt_name'] . '/validate',  array( $this, "on_redux_save" ) );
  65.             add_action('redux/options/' . $this->args['opt_name'] . '/saved',  array( $this, "on_redux_save" ) );
  66.             do_action( "redux-saved-{$this->args['opt_name']}", array( $this, "on_redux_save" ) );
  67.             //add entypo font
  68.             add_action( 'redux/page/'. $this->args['opt_name'] .'/enqueue', array( $this, 'wpautbox_entypo' ) );
  69.         }
  70.  
  71.  
  72.         /**
  73.  
  74.             This is a test function that will let you see when the compiler hook occurs.
  75.             It only runs if a field set with compiler=>true is changed.
  76.  
  77.         **/
  78.  
  79.         function compiler_action($options, $css) {
  80.             echo "<h1>The compiler hook has run!";
  81.             //print_r($options); //Option values
  82.            
  83.             // print_r($css); // Compiler selector CSS values  compiler => array( CSS SELECTORS )
  84.             /*
  85.             // Demo of how to use the dynamic CSS and write your own static CSS file
  86.             $filename = dirname(__FILE__) . '/style' . '.css';
  87.             global $wp_filesystem;
  88.             if( empty( $wp_filesystem ) ) {
  89.                 require_once( ABSPATH .'/wp-admin/includes/file.php' );
  90.                 WP_Filesystem();
  91.             }
  92.  
  93.             if( $wp_filesystem ) {
  94.                 $wp_filesystem->put_contents(
  95.                     $filename,
  96.                     $css,
  97.                     FS_CHMOD_FILE // predefined mode settings for WP files
  98.                 );
  99.             }
  100.             */
  101.         }
  102.  
  103.         /*
  104.          * Add Entypo Icon
  105.          */
  106.         function wpautbox_entypo() {
  107.             // Uncomment this to remove elusive icon from the panel completely
  108.             //wp_deregister_style( 'redux-elusive-icon' );
  109.             //wp_deregister_style( 'redux-elusive-icon-ie7' );
  110.  
  111.             wp_register_style(
  112.                 'wpautbox-entypo',
  113.                 plugins_url( '../lib/fonts/entypo.css' , __FILE__ ),
  114.                 array(),
  115.                 time(),
  116.                 'all'
  117.             ); 
  118.             wp_enqueue_style( 'wpautbox-entypo' );
  119.         }
  120.  
  121.  
  122.  
  123.         /**
  124.          
  125.             Custom function for filtering the sections array. Good for child themes to override or add to the sections.
  126.             Simply include this function in the child themes functions.php file.
  127.          
  128.             NOTE: the defined constants for URLs, and directories will NOT be available at this point in a child theme,
  129.             so you must use get_template_directory_uri() if you want to use any of the built in icons
  130.          
  131.          **/
  132.  
  133.         function dynamic_section($sections){
  134.             //$sections = array();
  135.             $sections[] = array(
  136.                 'title' => __('Section via hook', 'wpautbox'),
  137.                 'desc' => __('<p class="description">This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.</p>', 'redux-framework-demo'),
  138.                 'icon' => 'el-icon-paper-clip',
  139.                     // Leave this as a blank section, no options just some intro text set above.
  140.                 'fields' => array()
  141.             );
  142.  
  143.             return $sections;
  144.         }
  145.        
  146.        
  147.         /**
  148.  
  149.             Filter hook for filtering the args. Good for child themes to override or add to the args array. Can also be used in other functions.
  150.  
  151.         **/
  152.        
  153.         function change_arguments($args){
  154.             //$args['dev_mode'] = true;
  155.            
  156.             return $args;
  157.         }
  158.            
  159.        
  160.         /**
  161.  
  162.             Filter hook for filtering the default value of any given field. Very useful in development mode.
  163.  
  164.         **/
  165.  
  166.         function change_defaults($defaults){
  167.             $defaults['str_replace'] = "Testing filter hook!";
  168.            
  169.             return $defaults;
  170.         }
  171.  
  172.  
  173.         // Remove the demo link and the notice of integrated demo from the redux-framework plugin
  174.         function remove_demo() {
  175.            
  176.             // Used to hide the demo mode link from the plugin page. Only used when Redux is a plugin.
  177.             if ( class_exists('ReduxFrameworkPlugin') ) {
  178.                 remove_filter( 'plugin_row_meta', array( ReduxFrameworkPlugin::get_instance(), 'plugin_meta_demo_mode_link'), null, 2 );
  179.             }
  180.  
  181.             // Used to hide the activation notice informing users of the demo panel. Only used when Redux is a plugin.
  182.             remove_action('admin_notices', array( ReduxFrameworkPlugin::get_instance(), 'admin_notices' ) );   
  183.  
  184.         }
  185.  
  186.  
  187.         public function setSections() {
  188.  
  189.             /**
  190.                 Used within different fields. Simply examples. Search for ACTUAL DECLARATION for field examples
  191.              **/
  192.  
  193.  
  194.  
  195.             // ACTUAL DECLARATION OF SECTIONS
  196.  
  197.             //get custom post type
  198.             $get_cpt_args = array(
  199.                 'public'   => true,
  200.                 '_builtin' => false
  201.             );
  202.             $custom_post_types = get_post_types( $get_cpt_args, 'names', 'and');
  203.             $section_post_type = array();
  204.             $post_types = array( 'post' => 'Posts', 'page' => 'Pages' );
  205.  
  206.             $section_post_type[] = array(
  207.                                     'id'=>'show_in_post',
  208.                                     'type' => 'select',
  209.                                     'title' => __('Show in Posts', 'wpautbox'),
  210.                                     'options' => array('no'=>'No', 'above'=>'Above', 'below'=>'Below', 'both'=>'Both'),
  211.                                     'default' => 'below',
  212.                                     );
  213.             $section_post_type[] = array(
  214.                                     'id'=>'show_in_page',
  215.                                     'type' => 'select',
  216.                                     'title' => __('Show in Pages', 'wpautbox'),
  217.                                     'options' => array('no'=>'No', 'above'=>'Above', 'below'=>'Below', 'both'=>'Both'),
  218.                                     'default' => 'no',
  219.                                     );
  220.             if(!empty($custom_post_types)):
  221.                 foreach ( $custom_post_types  as $custom_post_type ) {
  222.                     $custom_post_type_object = get_post_type_object( $custom_post_type );
  223.                     $section_post_type[] = array(
  224.                         'id'=>'show_in_' . $custom_post_type_object->name,
  225.                         'type' => 'select',
  226.                         'title' => __('Show in '. $custom_post_type_object->label, 'wpautbox'),
  227.                         'options' => array('no'=>'No', 'above'=>'Above', 'below'=>'Below', 'both'=>'Both'),
  228.                         'default' => 'no',
  229.                         );
  230.                     $post_types[ $custom_post_type_object->name ] = $custom_post_type_object->label;
  231.                 }
  232.             endif;
  233.             $this->sections[] = array(
  234.                 'title' => __('Display Settings', 'wpautbox'),
  235.                 'desc' => __('Select where you want the author box to appear on your posts, pages and custom posts.', 'wpautbox'),
  236.                 'icon' => 'el-icon-cogs',
  237.                 // 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
  238.                 'fields' => $section_post_type
  239.             );
  240.  
  241.             $this->sections[] = array(
  242.                 'title' => __('Appearance Settings', 'wpautbox'),
  243.                 'desc' => __('Change author box color to match your theme :)', 'wpautbox'),
  244.                 'icon' => 'el-icon-eye-open',
  245.                 // 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
  246.                 'fields' => array(
  247.                                 //active tab
  248.                                 array(
  249.                                     'id'=>'active_title',
  250.                                     'type' => 'info',
  251.                                     'raw_html'=> true,
  252.                                     'desc' => '<h3 style="border:0px;margin-bottom:-20px;">'. __('Active Tab','wpautbox') .'</h3><br />' . __('Select Custom Skin to Enable Edit on this Section','wpautbox'),
  253.                                    
  254.                                 ),
  255.                                 array(
  256.                                     'id'=>'active-color',
  257.                                     'type' => 'color',
  258.                                     'output' => array('.active-color'),
  259.                                     'title' => __('Text Color', 'wpautbox'),
  260.                                     'subtitle' => __('Pick a text color for active tab', 'wpautbox'),
  261.                                     'default' => 'default',
  262.                                     'validate' => 'color',
  263.                                 ),
  264.                                 array(
  265.                                     'id'=>'active-bgcolor',
  266.                                     'type' => 'color',
  267.                                     'output' => array('.active-bgcolor'),
  268.                                     'title' => __('Background Color', 'wpautbox'),
  269.                                     'subtitle' => __('Pick a background color for active tab', 'wpautbox'),
  270.                                     'default' => 'default',
  271.                                     'validate' => 'color',
  272.                                 ),
  273.                                 array(
  274.                                     'id'=>'active-bordercolor',
  275.                                     'type' => 'color',
  276.                                     'output' => array('.active-bordercolor'),
  277.                                     'title' => __('Border Color', 'wpautbox'),
  278.                                     'subtitle' => __('Pick a border color for active tab', 'wpautbox'),
  279.                                     'default' => 'default',
  280.                                     'validate' => 'color',
  281.                                 ), 
  282.  
  283.                                 //inactive tab
  284.                                 array(
  285.                                     'id'=>'inactive_title',
  286.                                     'type' => 'info',
  287.                                     'raw_html'=> true,
  288.                                     'desc' => '<h3 style="border:0px;margin-bottom:-20px;">'. __('Inactive Tab', 'wpautbox') .'</h3><br />' . __('Select Custom Skin to Enable Edit on this Section','wpautbox'),
  289.                                 ),
  290.                                 array(
  291.                                     'id'=>'inactive-color',
  292.                                     'type' => 'color',
  293.                                     'output' => array('.inactive-color'),
  294.                                     'title' => __('Text Color', 'wpautbox'),
  295.                                     'subtitle' => __('Pick a text color for inactive tabs', 'wpautbox'),
  296.                                     'default' => 'default',
  297.                                     'validate' => 'color',
  298.                                 ),
  299.                                 array(
  300.                                     'id'=>'inactive-bgcolor',
  301.                                     'type' => 'color',
  302.                                     'output' => array('.inactive-bgcolor'),
  303.                                     'title' => __('Background Color', 'wpautbox'),
  304.                                     'subtitle' => __('Pick a background color for inactive tabs', 'wpautbox'),
  305.                                     'default' => 'default',
  306.                                     'validate' => 'color',
  307.                                 ),
  308.                                 array(
  309.                                     'id'=>'inactive-bordercolor',
  310.                                     'type' => 'color',
  311.                                     'output' => array('.inactive-bordercolor'),
  312.                                     'title' => __('Border Color', 'wpautbox'),
  313.                                     'subtitle' => __('Pick a border color for inactive tabs', 'wpautbox'),
  314.                                     'default' => 'default',
  315.                                     'validate' => 'color',
  316.                                 ),
  317.  
  318.                                 //tabcontents
  319.                                 array(
  320.                                     'id'=>'tabcontent_title',
  321.                                     'type' => 'info',
  322.                                     'raw_html'=> true,
  323.                                     'desc' => '<h3 style="border:0px;margin-bottom:-20px;">'. __('Tab Contents', 'wpautbox') .'</h3><br />' . __('Select Custom Skin to Enable Edit on this Section','wpautbox'),
  324.                                 ),
  325.                                 array(
  326.                                     'id'=>'tabcontent-color',
  327.                                     'type' => 'color',
  328.                                     'output' => array('.tabcontent-color'),
  329.                                     'title' => __('Text Color', 'wpautbox'),
  330.                                     'subtitle' => __('Pick a text color for tab contents', 'wpautbox'),
  331.                                     'default' => 'default',
  332.                                     'validate' => 'color',
  333.                                 ),
  334.                                 array(
  335.                                     'id'=>'tabcontent-bgcolor',
  336.                                     'type' => 'color',
  337.                                     'output' => array('.tabcontent-bgcolor'),
  338.                                     'title' => __('Background Color', 'wpautbox'),
  339.                                     'subtitle' => __('Pick a background color for tab contents', 'wpautbox'),
  340.                                     'default' => 'default',
  341.                                     'validate' => 'color',
  342.                                 ),
  343.                                 array(
  344.                                     'id'=>'tabcontent-bordercolor',
  345.                                     'type' => 'color',
  346.                                     'output' => array('.tabcontent-bordercolor'),
  347.                                     'title' => __('Border Color', 'wpautbox'),
  348.                                     'subtitle' => __('Pick a border color for tab contents', 'wpautbox'),
  349.                                     'default' => 'default',
  350.                                     'validate' => 'color',
  351.                                 ),
  352.                                 array(
  353.                                     'id'=>'tab_footer_title',
  354.                                     'type' => 'info',
  355.                                     'raw_html'=> true,
  356.                                     'desc' => '<h3 style="border:0px;margin-bottom:-20px;">'. __('Tab Footer', 'wpautbox') .'</h3><br />' . __('Select Custom Skin to Enable Edit on this Section','wpautbox'),
  357.                                 ),
  358.                                 array(
  359.                                     'id'=>'tabfooter-bgcolor',
  360.                                     'type' => 'color',
  361.                                     'output' => array('.tabfooter-bgcolor'),
  362.                                     'title' => __('Background Color', 'wpautbox'),
  363.                                     'subtitle' => __('Pick a background color for tab footer', 'wpautbox'),
  364.                                     'default' => 'default',
  365.                                     'validate' => 'color',
  366.                                 ),
  367.                                 array(
  368.                                     'id'=>'tabfooter-bordercolor',
  369.                                     'type' => 'color',
  370.                                     'output' => array('.tabfooter-bordercolor'),
  371.                                     'title' => __('Top Border Color', 'wpautbox'),
  372.                                     'subtitle' => __('Pick a border color for tab footer', 'wpautbox'),
  373.                                     'default' => 'default',
  374.                                     'validate' => 'color',
  375.                                 ),
  376.                             )
  377.             );
  378.  
  379.             $this->sections[] = array(
  380.                 'title' => __('Tab Settings', 'wpautbox'),
  381.                 'desc' => __(' Globally set which tab you want to display on the author box.', 'wpautbox'),
  382.                 'icon' => 'el-icon-website',
  383.                 // 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
  384.                 'fields' => array(
  385.                                 array(
  386.                                     'id'=>'show-about',
  387.                                     'type' => 'switch',
  388.                                     'title' => __('Show About Tab', 'wpautbox'),
  389.                                     'subtitle' => __('Switch On to show about the author tab', 'wpautbox'),
  390.                                     "default"       => 1,
  391.                                 ),
  392.                                 array(
  393.                                         'id'=>'about-tab-label',
  394.                                         'type' => 'text',
  395.                                         'title' => __('About Tab Label', 'wpautbox'),
  396.                                         'subtitle' => __('This will appear as tab label value', 'wpautbox'),
  397.                                         'default' => __('About the Author', 'wpautbox')
  398.                                     ),
  399.                                 array(
  400.                                     'id'=>'show-latest-posts',
  401.                                     'type' => 'switch',
  402.                                     'title' => __('Show Latest Posts Tab', 'wpautbox'),
  403.                                     'subtitle' => __('Switch On to show latest posts tab', 'wpautbox'),
  404.                                     "default"       => 1,
  405.                                 ),
  406.                                 array(
  407.                                         'id'=>'latest-tab-label',
  408.                                         'type' => 'text',
  409.                                         'title' => __('Latest Posts', 'wpautbox'),
  410.                                         'subtitle' => __('This will appear as tab label value', 'wpautbox'),
  411.                                         'default' => __('Latest Posts', 'wpautbox')
  412.                                     ),
  413.                                 array(
  414.                                     'id'=>'latest-posts-num',
  415.                                     'type' => 'text',
  416.                                     'title' => __('Number of latest posts to show', 'wpautbox'),
  417.                                     'subtitle' => __('Set how many posts you want to show on latest posts tab', 'wpautbox'),
  418.                                     "default"       => 10,
  419.                                 ),
  420.                 )
  421.             );
  422.  
  423.             $wpautbox_socials = apply_filters('wpautbox-socials',array()); // REMOVE LATER
  424.             $wpautbox_socials = apply_filters('wpautbox/socials',$wpautbox_socials);
  425.             $wpautbox_socials_defaults = array();
  426.             foreach ($wpautbox_socials as $wpautbox_socials_key => $wpautbox_socials_value) {
  427.                 $wpautbox_socials_defaults[ $wpautbox_socials_key ] = '1';
  428.             }
  429.            
  430.             $this->sections[] = array(
  431.                 'title' => __('Social Settings', 'wpautbox'),
  432.                 'desc' => __('Select social profiles you want to show on the author box', 'wpautbox'),
  433.                 'icon' => 'el-icon-star',
  434.                 // 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
  435.                 'fields' => array(
  436.                                 array(
  437.                                     'id'=>'social_display',
  438.                                     'type' => 'switch',
  439.                                     'title' => __('Display Social Links', 'wpautbox'),
  440.                                     'subtitle'=> __('Show social link/icons on author box', 'wpautbox'),
  441.                                     "default"       => 1,
  442.                                     ),
  443.                                 array(
  444.                                     'id'=>'socials',
  445.                                     'type' => 'sortable',
  446.                                     'mode' => 'checkbox', // checkbox or text
  447.                                     'title' => __('Social Profiles', 'wpautbox'),
  448.                                     'subtitle' => __('Select Social Media Profile allowed on author box', 'wpautbox'),
  449.                                     'desc' => __('Checked Fields will appear on the author edit fields', 'redux-framework-demo'),
  450.                                     'options' => $wpautbox_socials, //Must provide key => value pairs for multi checkbox options
  451.                                     'default' => $wpautbox_socials_defaults, //See how std has changed? you also don't need to specify opts that are 0.
  452.                                 ),
  453.                 )
  454.             );
  455.  
  456.         }  
  457.  
  458.         public function setHelpTabs() {
  459.  
  460.             // Custom page help tabs, displayed using the help API. Tabs are shown in order of definition.
  461.             $this->args['help_tabs'][] = array(
  462.                 'id' => 'redux-opts-1',
  463.                 'title' => __('Theme Information 1', 'redux-framework-demo'),
  464.                 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'redux-framework-demo')
  465.             );
  466.  
  467.             $this->args['help_tabs'][] = array(
  468.                 'id' => 'redux-opts-2',
  469.                 'title' => __('Theme Information 2', 'redux-framework-demo'),
  470.                 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'redux-framework-demo')
  471.             );
  472.  
  473.             // Set the help sidebar
  474.             $this->args['help_sidebar'] = __('<p>This is the sidebar content, HTML is allowed.</p>', 'redux-framework-demo');
  475.  
  476.         }
  477.  
  478.  
  479.         /**
  480.            
  481.             All the possible arguments for Redux.
  482.             For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
  483.  
  484.          **/
  485.         public function setArguments() {
  486.            
  487.             $this->args = array(
  488.                
  489.                 // TYPICAL -> Change these values as you need/desire
  490.                 'opt_name'              => 'wpautbox_lite', // This is where your data is stored in the database and also becomes your global variable name.
  491.                 'display_name'          => __('WP Author Box Lite','wpautbox'), // Name that appears at the top of your panel
  492.                 'display_version'       => '1.0', // Version that appears at the top of your panel
  493.                 'menu_type'             => 'submenu', //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)
  494.                 'allow_sub_menu'        => true, // Show the sections below the admin menu item or not
  495.                 'menu_title'            => __( 'Author Box Lite', 'wpautbox' ),
  496.                 'page'                  => __( 'Author Box Lite', 'wpautbox' ),
  497.                 'google_api_key'        => '', // Must be defined to add google fonts to the typography module
  498.                 'global_variable'       => '', // Set a different name for your global variable other than the opt_name
  499.                 'dev_mode'              => false, // Show the time the page took to load, etc
  500.                 'customizer'            => true, // Enable basic customizer support
  501.  
  502.                 // OPTIONAL -> Give you extra features
  503.                 'page_priority'         => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
  504.                 'page_parent'           => 'options-general.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
  505.                 'page_permissions'      => 'manage_options', // Permissions needed to access the options panel.
  506.                 'menu_icon'             => '', // Specify a custom URL to an icon
  507.                 'last_tab'              => '', // Force your panel to always open to a specific tab (by id)
  508.                 'page_icon'             => 'icon-themes', // Icon displayed in the admin panel next to your menu_title
  509.                 'page_slug'             => 'wpautbox_options', // Page slug used to denote the panel
  510.                 'save_defaults'         => true, // On load save the defaults to DB before user clicks save or not
  511.                 'default_show'          => false, // If true, shows the default value next to each field that is not the default value.
  512.                 'default_mark'          => '', // What to print by the field's title if the value shown is default. Suggested: *
  513.  
  514.  
  515.                 // CAREFUL -> These options are for advanced use only
  516.                 'transient_time'        => 60 * MINUTE_IN_SECONDS,
  517.                 'output'                => true, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
  518.                 'output_tag'            => true, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
  519.                 //'domain'              => 'redux-framework', // Translation domain key. Don't change this unless you want to retranslate all of Redux.
  520.                 //'footer_credit'       => '', // Disable the footer credit of Redux. Please leave if you can help it.
  521.                
  522.  
  523.                 // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
  524.                 'database'              => '', // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
  525.                
  526.            
  527.                 'show_import_export'    => false, // REMOVE
  528.                 'system_info'           => false, // REMOVE
  529.                
  530.                 'help_tabs'             => array(),
  531.                 'help_sidebar'          => '', // __( '', $this->args['domain'] );            
  532.                 );
  533.  
  534.  
  535.             // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.    
  536.             $this->args['share_icons'][] = array(
  537.                 'url' => 'http://codecanyon.net/user/phpbits?ref=phpbits',
  538.                 'title' => 'Follow me on Envato',
  539.                 'icon' => 'el-icon-user'
  540.             );
  541.  
  542.            
  543.      
  544.             // Panel Intro text -> before the form
  545.             if (!isset($this->args['global_variable']) || $this->args['global_variable'] !== false ) {
  546.                 if (!empty($this->args['global_variable'])) {
  547.                     $v = $this->args['global_variable'];
  548.                 } else {
  549.                     $v = str_replace("-", "_", $this->args['opt_name']);
  550.                 }
  551.                 $this->args['intro_text'] = sprintf( __('<p>Awesome Author box that you\'ll fall inlove with. Fall a lot more by upgrading to <a href="http://codecanyon.net/item/wp-author-box/6815678?ref=phpbits" target="_blank">WP Author Box Pro</a>.</p>', 'wpautbox' ), $v );
  552.             } else {
  553.                 $this->args['intro_text'] = __('<p>Awesome Author box that you\'ll fall inlove with.</p>', 'wpautbox' );
  554.             }
  555.  
  556.             // Add content after the form.
  557.             $this->args['footer_text'] = __('<p>If you need any help feel free to contact me using my <a href="http://codecanyon.net/user/phpbits?ref=phpbits" target="_blank">profile page.</a></p>', 'wpautbox');
  558.  
  559.         }
  560.        
  561.         public static function on_redux_save( $values ) {
  562.             // var_dump($values);
  563.             // die("SAVED");  
  564.         }
  565.     }
  566. }
  567.  
  568.  
  569. /**
  570.  
  571.     Custom function for the callback referenced above
  572.  
  573.  */
  574. if ( !function_exists( 'wpautbox_custom_field' ) ):
  575.     function wpautbox_custom_field($field, $value) {
  576.         print_r($field);
  577.         print_r($value);
  578.     }
  579. endif;
  580.  
  581. /**
  582.  
  583.     Custom function for the callback validation referenced above
  584.  
  585. **/
  586. if ( !function_exists( 'wpautbox_validate_callback_function' ) ):
  587.     function wpautbox_validate_callback_function($field, $value, $existing_value) {
  588.         $error = false;
  589.         $value =  'just testing';
  590.         /*
  591.         do your validation
  592.        
  593.         if(something) {
  594.             $value = $value;
  595.         } elseif(something else) {
  596.             $error = true;
  597.             $value = $existing_value;
  598.             $field['msg'] = 'your custom error message';
  599.         }
  600.         */
  601.        
  602.         $return['value'] = $value;
  603.         if($error == true) {
  604.             $return['error'] = $field;
  605.         }
  606.         return $return;
  607.     }
  608. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement