mirror of
https://github.com/ulaulaman/book-template.git
synced 2025-02-03 18:07:33 +01:00
2018.0213 sistemazione codice per traduzioni
This commit is contained in:
parent
58104a9dc0
commit
4e54d841b2
@ -1,49 +1,56 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Book template
|
Plugin Name: Book template dev
|
||||||
Description: Plugin in italiano che aggiunge uno shortcode per la creazione di un box con i dati editoriali di un libro o di un fumetto.
|
Description: Plugin in italiano che aggiunge uno shortcode per la creazione di un box con i dati editoriali di un libro o di un fumetto.
|
||||||
Version: 0.5.2
|
Version: 2018.0213
|
||||||
Author: Gianluigi Filippelli
|
Author: Gianluigi Filippelli
|
||||||
Author URI: http://dropseaofulaula.blogspot.it/
|
Author URI: http://dropseaofulaula.blogspot.it/
|
||||||
Plugin URI: https://github.com/ulaulaman/book-template
|
Plugin URI: https://ulaulaman.github.io/book-template/
|
||||||
GitHub Plugin URI: https://github.com/ulaulaman/book-template
|
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
*/
|
*/
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
# Load translations
|
||||||
|
add_action('plugins_loaded', 'bt_load_translations');
|
||||||
|
function bt_load_translations() {
|
||||||
|
load_plugin_textdomain( 'book-template', false, dirname( plugin_basename(__FILE__) ) . '/lang/' );
|
||||||
|
}
|
||||||
|
|
||||||
# Aggiunta metabox
|
# Aggiunta metabox
|
||||||
add_action( 'load-post.php', 'bookdata_meta_box_setup' );
|
add_action( 'load-post.php', 'bookdata_meta_box_setup' );
|
||||||
add_action( 'load-post-new.php', 'bookdata_meta_box_setup' );
|
add_action( 'load-post-new.php', 'bookdata_meta_box_setup' );
|
||||||
|
|
||||||
/* Meta box setup function. */
|
# Setup metabox
|
||||||
function bookdata_meta_box_setup() {
|
function bookdata_meta_box_setup() {
|
||||||
|
|
||||||
/* Add meta boxes on the 'add_meta_boxes' hook. */
|
# aggiunta del metabox
|
||||||
add_action( 'add_meta_boxes', 'bookdata_meta_box' );
|
add_action( 'add_meta_boxes', 'bookdata_meta_box' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function bookdata_meta_box() {
|
function bookdata_meta_box() {
|
||||||
|
|
||||||
|
$intro = __( 'Inserimento dati editoriali', 'book-template' );
|
||||||
|
|
||||||
add_meta_box(
|
add_meta_box(
|
||||||
'bookdata-post-class', // Unique ID
|
'bookdata-post-class', // ID unico
|
||||||
esc_html__( 'Inserimento dati editoriali', 'example' ), // Title
|
esc_html__( $intro, 'example' ), // Titolo
|
||||||
'bookdata_class_meta_box', // Callback function
|
'bookdata_class_meta_box', // funzione
|
||||||
'post', // Admin page (or post type)
|
'post', // associato a
|
||||||
'side', // Context
|
'side', // contesto
|
||||||
'high' // Priority
|
'high' // priorità
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the post meta box. */
|
# mostra il metabox
|
||||||
function bookdata_class_meta_box( $post ) { ?>
|
function bookdata_class_meta_box( $post ) { ?>
|
||||||
|
|
||||||
<?php wp_nonce_field( basename( __FILE__ ), 'bookdata_class_nonce' ); ?>
|
<?php wp_nonce_field( basename( __FILE__ ), 'bookdata_class_nonce' ); ?>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="bookdata-post-class">Esempio generico [bookdata title="Titolo" author="Autori" publisher="Editore" date="Data" pages ="numero pagine" type="brossurato,cartonato,digitale/on-line" price="prezzo valuta/gratuito"]<br/>In caso di fumetto o libro illustrato, inserire il colore [bookdata ... col="colore,b/n"]<br/>Possono essere inseriti opzionalmente ISBN [bookdata ... isbn="codice"] o ISSN [bookdata ... issn="codice"], il traduttore [bookdata ... translator="Traduttore"] ed eventuali note aggiuntive [dati_editoriali ... notes="Note aggiuntive"]<br/>I dati possono essere inseriti anche in maniera disordinata: ci penserà il plugin a riordinarli.</label></p>
|
<label for="bookdata-post-class"><?php _e( 'Esempio generico [bookdata title="Titolo" author="Autori" publisher="Editore" date="Data" pages ="numero pagine" type="brossurato,cartonato,digitale/on-line" price="prezzo valuta/gratuito"]', 'book-template' ); ?><br/><?php _e(' In caso di fumetto o libro illustrato, inserire il colore [bookdata ... col="colore,b/n"]', 'book-template' ); ?><br/><?php _e( 'Possono essere inseriti opzionalmente ISBN [bookdata ... isbn="codice"] o ISSN [bookdata ... issn="codice"], il traduttore [bookdata ... translator="Traduttore"] ed eventuali note aggiuntive [dati_editoriali ... notes="Note aggiuntive"]', 'book-template' ); ?><br/><?php _e( 'I dati possono essere inseriti anche in maniera disordinata: ci penserà il plugin a riordinarli.', 'book-template' ); ?></label></p>
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
# Creazione shortcode dati editoriali
|
# creazione shortcode dati editoriali
|
||||||
add_shortcode('bookdata', 'bookdata');
|
add_shortcode( 'bookdata', 'bookdata' );
|
||||||
|
|
||||||
function bookdata ($atts, $content = null) {
|
function bookdata ($atts, $content = null) {
|
||||||
|
|
||||||
@ -67,12 +74,17 @@ add_shortcode('bookdata', 'bookdata');
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$book = '<p><strong>Abbiamo parlato di</strong>:<br/><em>'.$title.'</em><br/>'.$author;
|
$intro = __( 'Abbiamo parlato di', 'book-template' );
|
||||||
|
|
||||||
|
$book = '<p><strong>'.$intro.'</strong>:<br/><em>'.$title.'</em><br/>'.$author;
|
||||||
|
|
||||||
if ( $translator <> null )
|
if ( $translator <> null )
|
||||||
{$book = $book.'<br/>Traduzione di '.$translator;}
|
{$translator = __( 'Traduzione di ', 'book-template' ).$translator;
|
||||||
|
$book = $book.'<br/>'.$translator;}
|
||||||
else
|
else
|
||||||
{$book = $book;}
|
{$book = $book;}
|
||||||
|
|
||||||
|
$pages = $pages.' '.__( 'pagine', 'book-template' );
|
||||||
|
|
||||||
if ( $col <> null )
|
if ( $col <> null )
|
||||||
{$book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.' pagine, '.$type.', '.$col.' - '.$price;}
|
{$book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.' pagine, '.$type.', '.$col.' - '.$price;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user