Uname: Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: 6036 (villadal)
Group: 100 (users)
Disabled functions: NONE
Safe mode: On[ PHPinfo ]
//home/villadal/www/wp-content/plugins///emme_gallery/includes/      ( Reset | Go to )
File Name: class-plugin.php
Edit
<?php

/**
* classe principale plugin
**/
namespace emme_gallery;
require_once 
PLUGIN_EMME_GALLERY_PATH'/includes/class-info.php';
require_once 
PLUGIN_EMME_GALLERY_PATH'/gallery-metabox/gallery.php'
require_once 
PLUGIN_EMME_GALLERY_PATH'/includes/class-shortcode.php';

class 
emme_gallery{

  private 
$versione;


      function 
__construct(){
        
$this->versione Info::VERSIONE;

        
//aggiungo il post type della gallery
        
add_action'init', array($this'emme_gallery_posttype') ); 

        
//aggiungo il metabox per lo shortcode
        
add_action'add_meta_boxes', array($this 'metabox_gallery_shortcode') ); 


        
// creo la colonna shortcode nel post type gallery
        
add_filter'manage_emme_gallery_posts_columns', array($this ,'add_shortcode_gallery_posts_columns' )); 

        
//inserisco i valori all'interno della colonna shortcode nel post type gallery
        
add_action'manage_emme_gallery_posts_custom_column', array($this ,'content_shortcode_gallery_column')); 

        
//ordino le colonne del post type gallery
        
add_filter'manage_emme_gallery_posts_columns', array($this ,'order_gallery_columns' ));
       

        
$this->loadshortcode(); //richiamo la funzione per istanziare la classe dello shortcode (contenuto)
          
          //aggiungo le thumb della gallery
        
add_action'init', array($this'emme_gallery_thumb') ); 
        
      }


      function 
emme_gallery_posttype() {
        
$labels = array(
            
'name'                  => _x'Gallery''Post type general name''emme_gallery' ),
            
'singular_name'         => _x'Gallery''Post type singular name''emme_gallery' ),
            
'menu_name'             => _x'Gallery''Admin Menu text''emme_gallery' ),
            
'name_admin_bar'        => _x'Gallery''Add New on Toolbar''emme_gallery' ),
            
'add_new'               => __'Aggiungi nuovo''emme_gallery' ),
            
'add_new_item'          => __'Aggiungi nuova Gallery''emme_gallery' ),
            
'new_item'              => __'Aggiungi Gallery''emme_gallery' ),
            
'edit_item'             => __'Modifica Gallery''emme_gallery' ),
            
'view_item'             => __'Guarda Gallery''emme_gallery' ),
            
'all_items'             => __'Tutte le Gallery''emme_gallery' ),
            
'search_items'          => __'Cerca Gallery''emme_gallery' ),
            
'parent_item_colon'     => __'Parent Gallery:''emme_gallery' ),
            
'not_found'             => __'Nessuna Gallery trovata.''emme_gallery' ),
            
'not_found_in_trash'    => __'Nessuna Gallery trovata nel cestino.''emme_gallery' ),
            
'filter_items_list'     => _x'Filtra lista Gallery''Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4''emme_gallery' ),
            
'items_list_navigation' => _x'Lista navigazione Gallery''Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4''emme_gallery' ),
            
'items_list'            => _x'Lista Gallery''Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4''emme_gallery' ),
        );     
        
$args = array(
            
'labels'             => $labels,
            
'description'        => 'Gallery custom post type.',
            
'public'             => false,
            
'publicly_queryable' => false,
            
'show_ui'            => true,
            
'show_in_menu'       => true,
            
'query_var'          => true,
            
'rewrite'            => array( 'slug' => 'emme-gallery' ),
            
'capability_type'    => 'post',
            
'has_archive'        => false,
            
'hierarchical'       => false,
            
'menu_position'      => 20,
            
'supports'           => array( 'title''thumbnail' ),
            
'show_in_rest'       => false,
            
'menu_icon' => 'dashicons-images-alt2'
        
);
          
        
register_post_type'emme_gallery'$args );
    }


    
//funzione per il metabox dello shortcode
    
public function metabox_gallery_shortcode(){
      
add_meta_box(
        
'shortcode-gallery-metabox',
        
'Shortcode',
        array(
$this 'gallery_shortcode_metabox_cb'),
        
'emme_gallery',
        
'side',
        
'default'
         
);
    }

    public function 
gallery_shortcode_metabox_cb(){
     echo 
'[emme_gallery id="'.get_the_ID().'"]';
 
    }


    
// funzione per creare la colonna shortcode nel post type gallery
    
public function add_shortcode_gallery_posts_columns$columns ) {
      
$columns['shortcode'] = __'Shortcode' );
      return 
$columns;
    }

    
// funcione per riemire la colonna shortcode nel post type gallery
    
public function content_shortcode_gallery_column( ){
      
      echo 
'[emme_gallery id="'.get_the_ID().'"]';
      
    }

    
//funzione per ordinare le colonne del post type gallery
    
public function order_gallery_columns($columns ){

      
$columns = array(
        
'cb' => $columns['cb'], //checkbox per selezionare
        
'title' => __'Title' ),
        
'shortcode' => __'Shortcode''emme_gallery' ),
        
'date' => __'Data''emme_gallery' ),
      );

      return 
$columns;

    }

    
// funzione dove viene istanziata la classe dello shortcode presente nel file class-shortcode.php
    
public function loadshortcode(){
      
$shortcode = new Shortcodes();
    }
    
        
//Funzione per aggiunger le thumb della gallery
    
public function emme_gallery_thumb() {
    
add_image_size'emme-gallery-thumb'450300true); 
    
add_image_size'emme-gallery-square'400400true );
    
add_image_size'emme-gallery-medium'600400true);  
    
add_image_size'emme-gallery-big'900600true); 
}
    
    

}

All system for education purposes only. For more tools: Telegram @jackleet

Mr.X Private Shell

Logo
-
New File | New Folder
Command
SQL