Plugin Directory

Changeset 472014


Ignore:
Timestamp:
12/07/2011 02:53:58 PM (14 years ago)
Author:
belinde
Message:
 
Location:
volleytnt/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • volleytnt/trunk/core/table.php

    r471987 r472014  
    155155        $html_total_pages = $total_pages = round( $total_items / $this->pagination );
    156156               
    157         $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
     157        $output = '<span class="displaying-num">' . sprintf( _n( '1 elemento', '%s elementi', $total_items, 'volleytnt' ), number_format_i18n( $total_items ) ) . '</span>';
    158158
    159159        $page_links = array();
     
    167167        $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
    168168            'first-page' . $disable_first,
    169             esc_attr__( 'Go to the first page' ),
     169            esc_attr__( 'Vai alla prima pagina', 'volleytnt' ),
    170170            esc_url( $this->url( array( 'p' => 0 ) ) ),
    171171            '&laquo;'
     
    174174        $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
    175175            'prev-page' . $disable_first,
    176             esc_attr__( 'Go to the previous page' ),
     176            esc_attr__( 'Vai alla pagina precedente', 'volleytnt' ),
    177177            esc_url( $this->url( array( 'p' => $this->get['p'] - 1 ) ) ),
    178178            '&lsaquo;'
     
    183183
    184184        $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
    185         $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
     185        $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s di %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
    186186
    187187        $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
    188188            'next-page' . $disable_last,
    189             esc_attr__( 'Go to the next page' ),
     189            esc_attr__( 'Vai alla prossima pagina', 'volleytnt' ),
    190190            esc_url( $this->url( array( 'p' => $this->get['p'] + 1 ) ) ),
    191191            '&rsaquo;'
     
    194194        $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
    195195            'last-page' . $disable_last,
    196             esc_attr__( 'Go to the last page' ),
     196            esc_attr__( "Vai all'ultima pagina", 'volleytnt' ),
    197197            esc_url( $this->url( array( 'p' => $total_pages ) ) ),
    198198            '&raquo;'
  • volleytnt/trunk/volleytnt.php

    r472000 r472014  
    11<?php
    22/*
    3 Plugin Name: Volley TNT
     3Plugin Name: VolleyTNT
    44Plugin URI: http://volleytnt.belinde.net
    5 Description: Management system for volley tournament
     5Description: Gestione di tornei di Beach Volley e Pallavolo
    66Author: Franco Traversaro
    77Version: 0.1
     
    1212define( 'VOLLEYTNT_URL', WP_PLUGIN_URL . '/volleytnt' );
    1313
    14 class VolleyTNT {
    15     public $path = '';
    16     public $url = '';
    17     public $prefix = '';
    18     public $opts = array();
    19     private $pages = array();
    20     private $wp_tnt_pages = array();
    21     private $scripts = array();
    22    
    23     public $l_categorie = array();
    24     public $l_set_partita = array();
    25     public $l_finali = array();
    26     private $l_js = array();
    27    
    28     public function __construct() {
    29         global $wpdb;
    30         $this->path = VOLLEYTNT_PATH;
    31         $this->url = VOLLEYTNT_URL;
    32         $this->prefix = $wpdb->prefix . 'volleytnt_';
    33        
    34         require_once( $this->path . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'functions.php' );
    35         require_once( $this->path . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'table.php' );
    36         require_once( $this->path . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'form.php' );
    37         require_once( $this->path . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'adminpage.php' );
     14global $wp_version;
    3815
    39         add_action( 'init',                                 array( $this, 'init' ) );
    40         add_action( 'admin_menu',                           array( $this, 'admin_menu' ) );
    41         add_action( 'admin_enqueue_scripts',                array( $this, 'admin_enqueue_scripts' ) );
    42 
    43         $this->register_page('VolleyTNT_Home');
    44         $this->register_page('VolleyTNT_Squadre');
    45         $this->register_page('VolleyTNT_Options');
    46        
    47     }
    48    
    49     public function init() {
    50         global $wpdb;
    51         load_plugin_textdomain('volleytnt', false , basename( $this->path ) . '/langs');
    52        
    53         $this->l_js['date_format'] = volleytnt_date_format( 'js' );
    54        
    55         $this->l_categorie = array(     'M' => __("Maschile", 'volleytnt'),
    56                                         'F' => __("Femminile", 'volleytnt'),
    57                                         'X' => __("Misto", 'volleytnt') );
    58         $this->l_set_partita = array(   '3' => __("Alla meglio dei 3", 'volleytnt'),
    59                                         '5' => __("Alla meglio dei 5", 'volleytnt') );
    60         $this->l_finali = array(        '32'=> __("Trentaduesimi di finale", 'volleytnt'),
    61                                         '16'=> __("Sedicesimi di finale", 'volleytnt'),
    62                                         '8' => __("Ottavi di finale", 'volleytnt'),
    63                                         '4' => __("Quarti di finale", 'volleytnt'),
    64                                         '2' => __("Semifinali", 'volleytnt'),
    65                                         '1' => __("Finale", 'volleytnt') );
    66 
    67         wp_register_style( 'volleytnt_common', $this->url . '/style/common.css' );
    68         wp_register_style( 'volleytnt_jqueryui', $this->url . '/style/jqueryui_gray/jquery-ui-1.8.15.custom.css' );
    69         wp_register_style( 'volleytnt_admin', $this->url . '/style/admin.css', array( 'volleytnt_common', 'volleytnt_jqueryui' ) );
    70        
    71         $this->opts = (object) get_option( 'volleytnt_opts', array( 'nome'  => 'Torneo',
    72                                                                     'corrente'      => 0 ) );
    73         $this->torneo = $wpdb->get_row("SELECT * FROM `{$this->prefix}tornei` WHERE `id`={$this->opts->corrente}");
    74         $this->torneo->categorie = explode( ',', $this->torneo->categorie );
    75        
    76         VolleyTNT_Form::manage_cbs_save();
    77         foreach ( $this->pages as $page ) $page->do_triggers();
    78     }
    79 
    80     public function admin_enqueue_scripts( $hook ) {
    81         if ( isset( $this->wp_tnt_pages[ $hook ] ) ) {
    82             wp_register_script( 'volleytnt', $this->url . '/js/common.js' );
    83             wp_enqueue_script( 'volleytnt' );
    84             wp_enqueue_style( 'volleytnt_admin' );
    85             $page = $this->pages[ $this->wp_tnt_pages[ $hook ] ];
    86             if ( $page->js_files ) foreach ( $page->js_files as $file ) {
    87                 $file['dependencies'][] = 'volleytnt';
    88                 wp_register_script( $file['file'], $this->url . '/js/' . $file['file'], $file['dependencies'] );
    89                 wp_enqueue_script( $file['file'] );
    90             }
    91             if ( $page->js_strings ) wp_localize_script( 'volleytnt', 'volleytnt', array_merge( $this->l_js, $page->js_strings ) );
    92         }       
    93     }
    94    
    95     public function admin_menu() {
    96         global $wp_admin_bar;
    97         static $counter = 0;
    98         foreach ( $this->pages as $slug => $page ) {
    99             if ( $page->menu_child_of ) {
    100                 $page->wp_slug = add_submenu_page( $page->menu_child_of, __('VolleyTNT', 'volleytnt') . ' | ' . $page->get_title(), $page->get_title(), 'edit_pages', $slug, array( $this, 'admin_page' ) );
    101             } else {
    102                 $page->wp_slug = add_menu_page( $page->get_title(), $page->get_title(), 'edit_pages', $slug, array( $this, 'admin_page' ), $this->url . '/style/Volleyball_16x16.png', 4 );
    103             }
    104             $this->wp_tnt_pages[ $page->wp_slug ] = $slug;
    105             if ( $page->help_tabs ) {
    106                 add_action( 'load-' . $page->wp_slug, array( $page, 'do_help_tabs' ) );
    107             }
    108             if ( $page->menubar_newlinks ) foreach ( $page->menubar_newlinks as $link ) {
    109                 $wp_admin_bar->add_menu( array(
    110                     'parent'    => 'new-content',
    111                     'id'        => get_class( $this ) . '_' . ++$counter,
    112                     'title'     => $link['label'],
    113                     'href'      => $link['url']
    114                 ) );
    115             }
    116         }
    117     }
    118    
    119     private function register_page( $classname ) {
    120         require_once( $this->path . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . strtolower( $classname ) . '.php' );
    121         $this->pages[ $classname ] = new $classname();
    122     }
    123    
    124     public function admin_page() {
    125         global $current_screen;
    126         $page = $this->pages[ $this->wp_tnt_pages[ $current_screen->id ] ];
    127         echo '<div class="wrap">';
    128         screen_icon('volleytnt');
    129         echo '<h2>' . $page->get_title() . $page->get_title_action() . '</h2>';
    130         $page->do_page( $this );
    131         echo '</div>';
    132     }
    133    
     16if ( version_compare( $wp_version, '3.3-RC1', '>=' ) ) {
     17    require_once( VOLLEYTNT_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'the_plugin.php' );
     18} else {
     19    add_action( 'pre_current_active_plugins', create_function( '', 'echo \'<div class="error fade"><p><strong>Whoa! There is an error!</strong></p><p>VolleyTNT requires at least Wordpress 3.3 RC1. Please disable the plugin and upgrade your installation.</p></div>\';') );
    13420}
    135 
    136 global $VolleyTNT;
    137 if ( !isset( $VolleyTNT ) or !( $VolleyTNT instanceof VolleyTNT ) ) $VolleyTNT = new VolleyTNT();
    13821?>
Note: See TracChangeset for help on using the changeset viewer.