Changeset 1719156
- Timestamp:
- 08/25/2017 04:23:40 AM (9 years ago)
- Location:
- ticker-pro/trunk
- Files:
-
- 1 added
- 6 edited
-
includes/form-handler.php (modified) (3 diffs)
-
includes/form-view.php (modified) (4 diffs)
-
includes/plugin-options.php (added)
-
includes/plugin_init.php (modified) (1 diff)
-
plugin_script.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
ticker-pro.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ticker-pro/trunk/includes/form-handler.php
r1717700 r1719156 2 2 if (is_admin() && 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['ticker_pro_nonce'])) { 3 3 4 5 if (!empty($_POST['ticker_text']) && wp_verify_nonce($_POST['ticker_pro_nonce'], 'ticker_pro_nonce_add')) {4 // ---------------Add section Form Handaller------------ 5 if (!empty($_POST['ticker_text']) && wp_verify_nonce($_POST['ticker_pro_nonce'], 'ticker_pro_nonce_add')) { 6 6 7 7 global $wpdb; … … 17 17 ); 18 18 } 19 } elseif (!empty($_POST['delete_ticker']) && !empty($_POST['ticker_id']) && is_numeric($_POST['ticker_id']) && wp_verify_nonce($_POST['ticker_pro_nonce'],'ticker_pro_nonce_delete')) {19 } elseif (!empty($_POST['delete_ticker']) && !empty($_POST['ticker_id']) && is_numeric($_POST['ticker_id']) && wp_verify_nonce($_POST['ticker_pro_nonce'], 'ticker_pro_nonce_delete')) { 20 20 21 21 global $wpdb; … … 23 23 $ticker_id = $_POST['ticker_id']; 24 24 $wpdb->delete($table_name, array('id' => $ticker_id), array('%d')); 25 } elseif (empty($_POST['ticker_text']) && wp_verify_nonce($_POST['ticker_pro_nonce'],'ticker_pro_nonce_add')) {25 } elseif (empty($_POST['ticker_text']) && wp_verify_nonce($_POST['ticker_pro_nonce'], 'ticker_pro_nonce_add')) { 26 26 add_action('admin_notices', 'ticker_pro_error_massage'); 27 27 } 28 // ---------------Add section Form Handaller End------------ 29 // 30 // -----------------Option section controll-------- 31 if (wp_verify_nonce($_POST['ticker_pro_nonce'], 'ticker_pro_nonce_options')) { 32 $options = $_POST['ticker_pro']; 33 34 if (empty($options['itemSpeed']) or empty($options['cursorSpeed']) or !is_numeric($options['itemSpeed']) or !is_numeric($options['cursorSpeed'])) { 35 // Cheking the user input 36 // 37 // ---------Admin notice-------- 38 add_action('admin_notices', function() { 39 ?> 40 <div class="notice notice-success is-dismissible"> 41 <p><?php _e('Please! Enter a valid text format', 'sample-text-domain'); ?></p> 42 </div> 43 <?php 44 }); 45 } else { 46 // Update options 47 isset($options['pauseOnHover']) ? $options['pauseOnHover'] = true : $options['pauseOnHover'] = false; 48 update_option('ticker_pro_options', $options); 49 } 50 } 51 // -----------------Option section controll ens-------- 28 52 } 53 54 //-----------form handeller end 29 55 30 56 function ticker_pro_error_massage() { -
ticker-pro/trunk/includes/form-view.php
r1717700 r1719156 13 13 <div class="containerpostbox " id="ticker_pro_container"> 14 14 <div class="row"> 15 <div class="col-md-3"></div> 15 <div class="col-md-1"></div> 16 17 <!--------------------Options Sections----------------> 18 <div class="col-md-4"> 19 <form method="POST" action> 20 <?php 21 wp_nonce_field('ticker_pro_nonce_options', 'ticker_pro_nonce'); 22 $option = get_option('ticker_pro_options'); 23 ?> 24 <h2>Ticker Pro Options</h2> 25 <table class="table"> 26 <tr> 27 <th> 28 <label for="itemSpeed">Ticker Item Speed</label> 29 </th> 30 <td> 31 <input type="" required id="itemSpeed" name="ticker_pro[itemSpeed]" value="<?php echo $option['itemSpeed'] ?>"/> 32 </td> 33 34 </tr> 35 <tr> 36 <th><label for="cursorSpeed">Ticker Cursor Speed</label></th> 37 <td> 38 <input id="cursorSpeed" required name="ticker_pro[cursorSpeed]" value="<?php echo $option['cursorSpeed'] ?>"/> 39 </td> 40 </tr> 41 <tr> 42 <th> 43 <label for="pauseOnHover">Ticker Pushe On Hover</label> 44 </th> 45 <td> 46 <input type="checkbox" id="pauseOnHover" name="ticker_pro[pauseOnHover]" <?php echo checked($option['pauseOnHover']) ?> /> 47 </td> 48 </tr> 49 <tr> 50 51 <td></td> 52 <td><?php submit_button(); ?></td> 53 </tr> 54 </table> 55 </form> 56 57 </div> 58 <!--------------------Options section End-----------------> 59 60 <div class="col-md-1"></div> 61 62 <!------------------------------Add section---------------------> 16 63 <div class="col-md-5"> 17 <form id="new_ticker" name="new_ticker" method="post" action ="">18 <?php wp_nonce_field('ticker_pro_nonce_add', 'ticker_pro_nonce'); ?>64 <form id="new_ticker" name="new_ticker" method="post" action> 65 <?php wp_nonce_field('ticker_pro_nonce_add', 'ticker_pro_nonce'); ?> 19 66 <div class="form-group"> 20 67 <label for="title">Add Ticker Text</label><br /> … … 28 75 <h3 class="text-center">All Tickers</h3> 29 76 <table class="table table-hover"> 30 <?php foreach ($results as $result) { 77 <?php foreach ($results as $result) { 31 78 ?> 32 33 <tr>79 80 <tr> 34 81 <td class="text-left" style="width: 100%"><?php echo $result->name ?></td> 35 82 <!--<td class="text-right"><input class="btn btn-warning" type="submit" name="edit_ticker" value="Edit"/></td>--> 36 <td class="text-right"><form method="post" action =""> <?php wp_nonce_field('ticker_pro_nonce_delete','ticker_pro_nonce'); ?><input type="hidden" name="ticker_id" value="<?php echo $result->id ?>" /><input class="btn btn-danger" name="delete_ticker" type="submit" value="Delete" /></form></td>83 <td class="text-right"><form method="post" action> <?php wp_nonce_field('ticker_pro_nonce_delete', 'ticker_pro_nonce'); ?><input type="hidden" name="ticker_id" value="<?php echo $result->id ?>" /><input class="btn btn-danger" name="delete_ticker" type="submit" value="Delete" /></form></td> 37 84 </tr> 38 85 <?php } ?> … … 40 87 </div> 41 88 </div> 42 < div class="col-md-3"></div>89 <!------------------------------Add section en---------------------> 43 90 44 91 </div> … … 46 93 </div> 47 94 48 49 50 51 52 95 <?php 53 96 } -
ticker-pro/trunk/includes/plugin_init.php
r1717700 r1719156 23 23 24 24 // Insert initial data to a database 25 if($wpdb->get_results('SELECT * FROM '.$table_name)==null){ 26 27 $ticker_text = 'Dummy Ticker Text'; 28 $wpdb->insert( 29 $table_name, array( 30 'name' => $ticker_text, 31 )); 32 25 if ($wpdb->get_results('SELECT * FROM ' . $table_name) == null) { 26 27 $ticker_text = 'Dummy Ticker Text'; 28 $wpdb->insert( 29 $table_name, array( 30 'name' => $ticker_text, 31 )); 33 32 } 34 33 34 35 36 // Option registration 37 $options = array( 38 'itemSpeed' => '3000', // The pause on each ticker item before being replaced 39 'cursorSpeed' => '50', // Speed at which the characters are typed 40 'pauseOnHover' => true, // Whether to pause when the mouse hovers over the ticker 41 'finishOnHover' => true, // Whether or not to complete the ticker item instantly when moused over 42 'fadeInSpeed' => 600, // Speed of the fade-in animation 43 'fadeOutSpeed' => 300 // Speed of the fade-out animation 44 ); 45 46 update_option('ticker_pro_options',$options); 35 47 36 48 } -
ticker-pro/trunk/plugin_script.php
r1717700 r1719156 2 2 3 3 function ticker_pro_admin_style($hook) { 4 5 if($hook != 'toplevel_page_ticker-pro/ticker-pro') { 6 return; 7 } 8 wp_enqueue_style( 'ticker_pro_admin_css',plugin_dir_url(__FILE__).'css/main.css'); 9 wp_enqueue_style( 'bootstrap_admin_css',plugin_dir_url(__FILE__).'css/bootstrap.min.css'); 10 4 5 if ($hook != 'toplevel_page_ticker-pro/ticker-pro') { 6 return; 7 } 8 wp_enqueue_style('ticker_pro_admin_css', plugin_dir_url(__FILE__) . 'css/main.css'); 9 wp_enqueue_style('bootstrap_admin_css', plugin_dir_url(__FILE__) . 'css/bootstrap.min.css'); 11 10 } 12 add_action( 'admin_enqueue_scripts', 'ticker_pro_admin_style' );13 11 12 add_action('admin_enqueue_scripts', 'ticker_pro_admin_style'); 14 13 15 14 function ticker_plugin_script() { 16 15 17 16 wp_enqueue_script('jquery'); 18 wp_enqueue_script('jquery_ticker', plugin_dir_url(__FILE__) .'js/jquery.ticker.js', array('jquery'), 2.1, true);17 wp_enqueue_script('jquery_ticker', plugin_dir_url(__FILE__) . 'js/jquery.ticker.js', array('jquery'), 2.1, true); 19 18 } 19 20 20 add_action('init', 'ticker_plugin_script'); 21 21 22 22 function ticker_init_script() { 23 $option = get_option('ticker_pro_options'); 24 $itemSpeed =$option['itemSpeed']; 25 $cursorSpeed=$option['cursorSpeed']; 26 $pauseOnHover=$option['pauseOnHover']; 27 $pauseOnHover?$pauseOnHover='true':$pauseOnHover='false'; 28 // $finishOnHover=$option['finishOnHover']; 29 // 30 // $fade=$option['fade=$option']; 31 // $fadeInSpeed=$option['fadeInSpeed']; 32 // $fadeOutSpeed=$option['fadeOutSpeed']; 23 33 ?> 24 34 <script type="text/javascript"> 25 35 jQuery(document).ready(function () { 26 jQuery('.ticker').ticker(); 27 36 jQuery('.ticker').ticker( 37 { 38 itemSpeed: <?php echo $itemSpeed ?>, // The pause on each ticker item before being replaced 39 cursorSpeed: <?php echo $cursorSpeed ?>, // Speed at which the characters are typed 40 pauseOnHover: <?php echo $pauseOnHover ?>, // Whether to pause when the mouse hovers over the ticker 41 finishOnHover: true, // Whether or not to complete the ticker item instantly when moused over 42 cursorOne: '_', // The symbol for the first part of the cursor 43 cursorTwo: '-', // The symbol for the second part of the cursor 44 fade: true, // Whether to fade between ticker items or not 45 fadeInSpeed: 600, // Speed of the fade-in animation 46 fadeOutSpeed: 300 // Speed of the fade-out animation 47 }); 28 48 }); 29 49 … … 33 53 34 54 } 55 35 56 add_action('wp_head', 'ticker_init_script', 1000); 36 37 38 57 39 58 function ticker_style() { … … 55 74 56 75 } 76 57 77 add_action('wp_head', 'ticker_style'); -
ticker-pro/trunk/readme.txt
r1717706 r1719156 3 3 Requires at least: 3.0.1 4 4 Tested up to: 4.8.1 5 Stable tag: 1.05 Stable tag: 2.0 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
ticker-pro/trunk/ticker-pro.php
r1717740 r1719156 1 1 <?php 2 2 3 /* 3 4 Plugin Name:Ticker Pro 4 5 Plugin URI: https://github.com/mirajnetxp/ticker-pro/blob/master/ticker-pro.zip 5 6 Description:Ticker Pro probably the simplest and lightweight ticker in the world. Which display your ticker ony any page or post. 6 Version: 1.07 Version: 2.0 7 8 Author: Md Miraj Khan 8 Author URI: https://www. linkedin.com/in/md-miraj-khan-51120110b/9 Author URI: https://www.upwork.com/o/profiles/users/_~012282969fe4714e35/ 9 10 License: License: GPLv2 or later 10 11 11 12 */ 12 13 /* 13 This program is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.14 This program is free software; you can redistribute it and/or 15 modify it under the terms of the GNU General Public License 16 as published by the Free Software Foundation; either version 2 17 of the License, or (at your option) any later version. 17 18 18 This program is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 22 23 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 26 27 27 Copyright 2005-2015 Automattic, Inc.28 */28 Copyright 2005-2015 Automattic, Inc. 29 */ 29 30 30 31 // Make sure we don't expose any info if called directly … … 33 34 exit; 34 35 } 35 if (!function_exists('wp_get_current_user')) {36 include(ABSPATH . "wp-includes/pluggable.php"); 36 if (!function_exists('wp_get_current_user')) { 37 include(ABSPATH . "wp-includes/pluggable.php"); 37 38 } 38 39 … … 41 42 42 43 43 require_once( TICKER_PRO_PLUGIN_DIR.'/includes/form-handler.php' ); 44 require_once( TICKER_PRO_PLUGIN_DIR.'/includes/plugin_init.php' ); 45 include_once( TICKER_PRO_PLUGIN_DIR.'/plugin_script.php'); 46 require_once( TICKER_PRO_PLUGIN_DIR.'/includes/plugin_shortcode.php' ); 47 require_once( TICKER_PRO_PLUGIN_DIR.'/includes/form-view.php' ); 44 require_once( TICKER_PRO_PLUGIN_DIR . '/includes/form-handler.php' ); 45 require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin_init.php' ); 46 include_once( TICKER_PRO_PLUGIN_DIR . '/plugin_script.php'); 47 require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin_shortcode.php' ); 48 require_once( TICKER_PRO_PLUGIN_DIR . '/includes/form-view.php' ); 49 require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin-options.php' ); 48 50 49 51 … … 57 59 58 60 59 if(is_super_admin() && current_user_can( 'publish_pages' )){ 61 62 63 64 if (is_admin() && current_user_can('publish_pages')) { 65 60 66 // create custom plugin settings menu 61 add_action('admin_menu', 'ticker_pro_menu'); 62 function ticker_pro_menu() { 63 //create new top-level menu 64 add_menu_page('My Cool Plugin Settings', 'Ticker Pro', 'administrator', __FILE__, 'ticker_pro_settings_page_view', 'dashicons-hammer'); 67 function ticker_pro_menu() { 68 //create new top-level menu 69 add_menu_page('My Cool Plugin Settings', 'Ticker Pro', 'administrator', __FILE__, 'ticker_pro_settings_page_view', 'dashicons-hammer'); 70 } 71 72 add_action('admin_menu', 'ticker_pro_menu'); 73 74 75 76 65 77 } 66 }
Note: See TracChangeset
for help on using the changeset viewer.