Changeset 472014
- Timestamp:
- 12/07/2011 02:53:58 PM (14 years ago)
- Location:
- volleytnt/trunk
- Files:
-
- 1 added
- 2 edited
-
core/table.php (modified) (5 diffs)
-
core/the_plugin.php (added)
-
volleytnt.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
volleytnt/trunk/core/table.php
r471987 r472014 155 155 $html_total_pages = $total_pages = round( $total_items / $this->pagination ); 156 156 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>'; 158 158 159 159 $page_links = array(); … … 167 167 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 168 168 'first-page' . $disable_first, 169 esc_attr__( ' Go to the first page' ),169 esc_attr__( 'Vai alla prima pagina', 'volleytnt' ), 170 170 esc_url( $this->url( array( 'p' => 0 ) ) ), 171 171 '«' … … 174 174 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 175 175 'prev-page' . $disable_first, 176 esc_attr__( ' Go to the previous page' ),176 esc_attr__( 'Vai alla pagina precedente', 'volleytnt' ), 177 177 esc_url( $this->url( array( 'p' => $this->get['p'] - 1 ) ) ), 178 178 '‹' … … 183 183 184 184 $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>'; 186 186 187 187 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 188 188 'next-page' . $disable_last, 189 esc_attr__( ' Go to the next page' ),189 esc_attr__( 'Vai alla prossima pagina', 'volleytnt' ), 190 190 esc_url( $this->url( array( 'p' => $this->get['p'] + 1 ) ) ), 191 191 '›' … … 194 194 $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", 195 195 'last-page' . $disable_last, 196 esc_attr__( 'Go to the last page' ),196 esc_attr__( "Vai all'ultima pagina", 'volleytnt' ), 197 197 esc_url( $this->url( array( 'p' => $total_pages ) ) ), 198 198 '»' -
volleytnt/trunk/volleytnt.php
r472000 r472014 1 1 <?php 2 2 /* 3 Plugin Name: Volley TNT3 Plugin Name: VolleyTNT 4 4 Plugin URI: http://volleytnt.belinde.net 5 Description: Management system for volley tournament5 Description: Gestione di tornei di Beach Volley e Pallavolo 6 6 Author: Franco Traversaro 7 7 Version: 0.1 … … 12 12 define( 'VOLLEYTNT_URL', WP_PLUGIN_URL . '/volleytnt' ); 13 13 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' ); 14 global $wp_version; 38 15 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 16 if ( 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>\';') ); 134 20 } 135 136 global $VolleyTNT;137 if ( !isset( $VolleyTNT ) or !( $VolleyTNT instanceof VolleyTNT ) ) $VolleyTNT = new VolleyTNT();138 21 ?>
Note: See TracChangeset
for help on using the changeset viewer.