PluginProbe
Uji Countdown / 1.3
Uji Countdown v1.3
3.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 36 releases
uji-countdown / uji-countdown.php

uji-countdown.php in Uji Countdown 1.3, at uji-countdown.php

159 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Uji Countdown
4 Plugin URI: http://www.wpmanage.com/uji-countdown/
5 Description: HTML5 Countdown.
6 Version: 1.3
7 Author: Ujog Raul
8 Author URI: http://www.wpmanage.com
9
10 Copyright (c) 2012-2013
11 */
12
13 if (!defined('UJI_PLUGIN_NAME'))
14 define('UJI_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/'));
15
16 if (!defined('UJI_PLUGIN_BASE'))
17 define('UJI_PLUGIN_BASE', plugin_basename(__FILE__));
18
19 if (!defined('UJI_PLUGIN_URL'))
20 define('UJI_PLUGIN_URL', WP_PLUGIN_URL . '/' . UJI_PLUGIN_NAME);
21
22 if (!defined('UJI_PLUGIN_DIR'))
23 define('UJI_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . UJI_PLUGIN_NAME);
24
25 if(!defined("UJI_CURRENT_PAGE"))
26 define("UJI_CURRENT_PAGE", basename($_SERVER['PHP_SELF']));
27
28 if (!defined('UJI_VERSION_KEY'))
29 define('UJI_VERSION_KEY', 'UJI_version');
30
31 if (!defined('UJI_VERSION_NUM'))
32 define('UJI_VERSION_NUM', '1.1');
33
34 ///////////////////////////////////DB///////////////////////////////////////
35
36
37 function create_ujic_db(){
38 global $wpdb;
39 $sql = "CREATE TABLE " . $wpdb->prefix ."uji_counter (
40 id int(9) unsigned NOT NULL AUTO_INCREMENT,
41 time datetime not null,
42 title varchar(128) not null,
43 size int(2) not null,
44 col_dw varchar(7) not null,
45 col_up varchar(7) not null,
46 ujic_pos varchar(10) not null,
47 col_txt varchar(7) not null,
48 col_sw varchar(7) not null,
49 ujic_ani int(1) not null,
50 ujic_txt int(1) not null,
51 PRIMARY KEY (id)
52 ) ENGINE=MyISAM DEFAULT CHARSET=$wpdb->charset AUTO_INCREMENT=0;";
53 require_once(ABSPATH . '/wp-admin/includes/upgrade.php');
54 dbDelta($sql);
55 add_option("UJI_VERSION", UJI_VERSION_KEY);
56 }
57 register_activation_hook(__FILE__,'create_ujic_db');
58
59 ////////////////////////////////////Add/Edit////////////////////////////////////
60
61 require_once(dirname( __FILE__ ) . "/uji-countdown-add.php");
62
63 ////////////////////////////////////Front////////////////////////////////////
64
65 require_once(dirname( __FILE__ ) . "/uji-countdown-front.php");
66
67 ////////////////////////////////////Widget//////////////////////////////////////
68
69 require_once(dirname( __FILE__ ) . "/uji-countdown-widget.php");
70
71 ///////////////////////////////////CSS///////////////////////////////////////
72
73 function UJI__stylesheet() {
74 $myStyleUrl = UJI_PLUGIN_URL . '/css/admin.countdown.css';
75 $myStyleFile = UJI_PLUGIN_DIR . '/css/admin.countdown.css';
76 if ( file_exists($myStyleFile) ) {
77 wp_register_style('ujiStyleSheet', $myStyleUrl);
78 wp_enqueue_style( 'ujiStyleSheet');
79 wp_register_style('ujiStyleCount', UJI_PLUGIN_URL . '/css/jquery.countdown.css');
80 wp_enqueue_style( 'ujiStyleCount');
81 wp_enqueue_style('dashboard');
82 }
83 }
84 function UJI__colopick() {
85 $colUrl = UJI_PLUGIN_URL . '/inc/css/colorpicker.css';
86 $colFile = UJI_PLUGIN_DIR . '/inc/css/colorpicker.css';
87 if ( file_exists($colFile) ) {
88 wp_register_style('ujiCol', $colUrl);
89 wp_enqueue_style( 'ujiCol');
90 wp_register_style('ujiColLay', UJI_PLUGIN_URL . '/inc/css/layout.css');
91 wp_enqueue_style( 'ujiColLay');
92 }
93 }
94
95 ///////////////////////////////////JS////////////////////////////////////////
96
97 function UJI_js() {
98 wp_enqueue_script ('UJI_js_count', UJI_PLUGIN_URL . '/js/prev.countdown.js', array('jquery'), '1.0', true);
99 wp_enqueue_script( 'postbox' );
100 wp_enqueue_script( 'dashboard' );
101 }
102 function UJI_color_js() {
103 wp_enqueue_script ('UJI_color_js', UJI_PLUGIN_URL . '/inc/js/colorpicker.js', array('jquery'), '1.0', true);
104 wp_enqueue_script ('UJI_acolor_js', UJI_PLUGIN_URL . '/inc/js/admin.color.js', array('jquery'), '1.0', true);
105 }
106
107 ////////////////////////////////////LOCALIZATION////////////////////////////////
108
109 function ujic_init() {
110 load_plugin_textdomain( 'uji-countdown', false, '/uji-countdown/languages' );
111 }
112 add_action('init', 'ujic_init');
113
114 ////////////////////////////////////MENU////////////////////////////////////
115
116 add_action('admin_menu', 'my_UJI_menu');
117 function my_UJI_menu() {
118
119 $UJI_edit = add_submenu_page('options-general.php', 'Countdown', 'Countdown', 'manage_options', 'ujic-count', 'ujic_add_new');
120
121 add_action('admin_print_styles-'. $UJI_edit, 'UJI__stylesheet');
122 add_action('admin_print_styles-'. $UJI_edit, 'UJI__colopick');
123 add_action('admin_print_scripts-'. $UJI_edit, 'UJI_js');
124 add_action('admin_print_scripts-'. $UJI_edit, 'UJI_color_js');
125 }
126
127 ////////////////////////////////////INIT////////////////////////////////////////
128
129 function UJI_set_links($links) {
130 array_unshift($links, '<a class="edit" href="options-general.php?page=ujic-count">Settings</a>');
131 return $links;
132 }
133
134 add_filter('plugin_action_links_'.UJI_PLUGIN_BASE, 'UJI_set_links', 10, 2 );
135
136 ////////////////////////////////////POST BUTTON////////////////////////////////////////
137
138 function ujic_form_button($context){
139 $image_btn = UJI_PLUGIN_URL. '/images/icon.png';
140 $out = '<a href="#TB_inline?width=300&height=480&inlineId=select_countdown_form" class="thickbox" id="add_ujic" title="Add Countdown"><img src="'.$image_btn.'" alt="Add Counter" /></a>';
141 return $context . $out;
142 }
143 add_action('media_buttons_context', 'ujic_form_button');
144
145 if(in_array(UJI_CURRENT_PAGE, array('post.php', 'page.php', 'page-new.php', 'post-new.php'))){
146 add_action('admin_footer', 'add_ujic_popup');
147 }
148
149 ////////////////////////////////////ENQUIRE SCRIPT////////////////////////////////////////
150
151 function ujic_scripts_register() {
152 wp_register_style('ujiStyleCount', UJI_PLUGIN_URL . '/css/jquery.countdown.css');
153 wp_enqueue_script('jquery');
154 wp_register_script('UJI_js_countdown', UJI_PLUGIN_URL . '/js/jquery.countdown.js', array('jquery'), '1.0', true);
155 wp_register_script('js_countdown', UJI_PLUGIN_URL . '/js/countdown.js', array('jquery'), '1.0', true);
156 }
157 add_action('wp_enqueue_scripts', 'ujic_scripts_register');
158
159 ?>