Plugin Directory

Changeset 1719156


Ignore:
Timestamp:
08/25/2017 04:23:40 AM (9 years ago)
Author:
mirajnetxp
Message:

vertion 2

Location:
ticker-pro/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • ticker-pro/trunk/includes/form-handler.php

    r1717700 r1719156  
    22if (is_admin() && 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['ticker_pro_nonce'])) {
    33
    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')) {
    66
    77        global $wpdb;
     
    1717            );
    1818        }
    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')) {
    2020
    2121        global $wpdb;
     
    2323        $ticker_id = $_POST['ticker_id'];
    2424        $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')) {
    2626        add_action('admin_notices', 'ticker_pro_error_massage');
    2727    }
     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--------
    2852}
     53
     54//-----------form handeller end
    2955
    3056function ticker_pro_error_massage() {
  • ticker-pro/trunk/includes/form-view.php

    r1717700 r1719156  
    1313    <div class="containerpostbox " id="ticker_pro_container">
    1414        <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--------------------->
    1663            <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'); ?>
    1966                    <div class="form-group">
    2067                        <label  for="title">Add Ticker Text</label><br />
     
    2875                    <h3 class="text-center">All Tickers</h3>
    2976                    <table class="table table-hover">
    30                         <?php foreach ($results as $result) {   
     77                        <?php foreach ($results as $result) {
    3178                            ?>
    32                        
    33                              <tr>
     79
     80                            <tr>
    3481                                <td class="text-left" style="width: 100%"><?php echo $result->name ?></td>
    3582                                <!--<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>
    3784                            </tr>
    3885                        <?php } ?>
     
    4087                </div>
    4188            </div>
    42             <div class="col-md-3"></div>
     89            <!------------------------------Add section en--------------------->
    4390
    4491        </div>
     
    4693    </div>
    4794
    48 
    49 
    50 
    51 
    5295    <?php
    5396}
  • ticker-pro/trunk/includes/plugin_init.php

    r1717700 r1719156  
    2323
    2424//    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        ));
    3332    }
    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);
    3547   
    3648}
  • ticker-pro/trunk/plugin_script.php

    r1717700 r1719156  
    22
    33function 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');
    1110}
    12 add_action( 'admin_enqueue_scripts', 'ticker_pro_admin_style' );
    1311
     12add_action('admin_enqueue_scripts', 'ticker_pro_admin_style');
    1413
    1514function ticker_plugin_script() {
    1615
    1716    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);
    1918}
     19
    2020add_action('init', 'ticker_plugin_script');
    2121
    2222function 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'];
    2333    ?>
    2434    <script type="text/javascript">
    2535        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            });
    2848        });
    2949
     
    3353
    3454}
     55
    3556add_action('wp_head', 'ticker_init_script', 1000);
    36 
    37 
    3857
    3958function ticker_style() {
     
    5574
    5675}
     76
    5777add_action('wp_head', 'ticker_style');
  • ticker-pro/trunk/readme.txt

    r1717706 r1719156  
    33Requires at least: 3.0.1
    44Tested up to: 4.8.1
    5 Stable tag: 1.0
     5Stable tag: 2.0
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • ticker-pro/trunk/ticker-pro.php

    r1717740 r1719156  
    11<?php
     2
    23/*
    34  Plugin Name:Ticker Pro
    45  Plugin URI: https://github.com/mirajnetxp/ticker-pro/blob/master/ticker-pro.zip
    56  Description:Ticker Pro probably the simplest and lightweight ticker in the world. Which display your ticker ony any page or post.
    6   Version: 1.0
     7  Version: 2.0
    78  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/
    910  License: License: GPLv2 or later
    10  
     11
    1112 */
    1213/*
    13 This program is free software; you can redistribute it and/or
    14 modify it under the terms of the GNU General Public License
    15 as published by the Free Software Foundation; either version 2
    16 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.
    1718
    18 This program is distributed in the hope that it will be useful,
    19 but WITHOUT ANY WARRANTY; without even the implied warranty of
    20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21 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.
    2223
    23 You should have received a copy of the GNU General Public License
    24 along with this program; if not, write to the Free Software
    25 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.
    2627
    27 Copyright 2005-2015 Automattic, Inc.
    28 */
     28  Copyright 2005-2015 Automattic, Inc.
     29 */
    2930
    3031// Make sure we don't expose any info if called directly
     
    3334    exit;
    3435}
    35 if(!function_exists('wp_get_current_user')) {
    36     include(ABSPATH . "wp-includes/pluggable.php"); 
     36if (!function_exists('wp_get_current_user')) {
     37    include(ABSPATH . "wp-includes/pluggable.php");
    3738}
    3839
     
    4142
    4243
    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' );
     44require_once( TICKER_PRO_PLUGIN_DIR . '/includes/form-handler.php' );
     45require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin_init.php' );
     46include_once( TICKER_PRO_PLUGIN_DIR . '/plugin_script.php');
     47require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin_shortcode.php' );
     48require_once( TICKER_PRO_PLUGIN_DIR . '/includes/form-view.php' );
     49require_once( TICKER_PRO_PLUGIN_DIR . '/includes/plugin-options.php' );
    4850
    4951
     
    5759
    5860
    59 if(is_super_admin() && current_user_can( 'publish_pages' )){
     61
     62
     63
     64if (is_admin() && current_user_can('publish_pages')) {
     65
    6066// 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   
    6577}
    66 }
Note: See TracChangeset for help on using the changeset viewer.