| 1 |
<?php |
| 2 |
/** |
| 3 |
* Simple Ticker |
| 4 |
* |
| 5 |
* @package SimpleTicker |
| 6 |
* @subpackage SimpleTicker registered in the database |
| 7 |
Copyright (c) 2016- Katsushi Kawamori (email : dodesyoswift312@gmail.com) |
| 8 |
This program is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; version 2 of the License. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program; if not, write to the Free Software |
| 19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
$simpletickerregist = new SimpleTickerRegist(); |
| 23 |
|
| 24 |
class SimpleTickerRegist { |
| 25 |
|
| 26 |
/* ================================================== |
| 27 |
* Construct |
| 28 |
* @since 1.06 |
| 29 |
*/ |
| 30 |
public function __construct() { |
| 31 |
|
| 32 |
add_action('admin_init', array($this, 'register_settings')); |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
/* ================================================== |
| 37 |
* Settings register |
| 38 |
* @since 1.0 |
| 39 |
*/ |
| 40 |
public function register_settings(){ |
| 41 |
|
| 42 |
$woo_sales_text_tag = '%regular_price% %sale_price% %dis_rate_price% %dis_rate_percent% %to_date% %interval_day% %interval_time%'; |
| 43 |
|
| 44 |
$simple_ticker_tbl = array( |
| 45 |
'speed' => 150, |
| 46 |
'ticker1' => array( |
| 47 |
'text' => '', |
| 48 |
'color' => '#ff0000' |
| 49 |
), |
| 50 |
'ticker2' => array( |
| 51 |
'text' => '', |
| 52 |
'color' => '#ffff00' |
| 53 |
), |
| 54 |
'ticker3' => array( |
| 55 |
'text' => '', |
| 56 |
'color' => '#008000' |
| 57 |
), |
| 58 |
'sticky_posts' => array( |
| 59 |
'display' => TRUE, |
| 60 |
'title_color' => '#ff0000', |
| 61 |
'content_color' => '#000000' |
| 62 |
), |
| 63 |
'woo_sales' => array( |
| 64 |
'display' => FALSE, |
| 65 |
'color' => '#000000', |
| 66 |
'text' => $woo_sales_text_tag |
| 67 |
) |
| 68 |
); |
| 69 |
|
| 70 |
if ( get_option('simple_ticker') ) { |
| 71 |
$simple_ticker_settings = get_option('simple_ticker'); |
| 72 |
if ( !array_key_exists( "speed", $simple_ticker_settings ) ) { |
| 73 |
// ver 2.00 later |
| 74 |
$simple_ticker_settings['speed'] = 150; |
| 75 |
update_option( 'simple_ticker', $simple_ticker_settings ); |
| 76 |
} |
| 77 |
if ( !array_key_exists( "display", $simple_ticker_settings["woo_sales"] ) ) { |
| 78 |
// ver 2.00 later |
| 79 |
$simple_ticker_settings['woo_sales']['display'] = FALSE; |
| 80 |
update_option( 'simple_ticker', $simple_ticker_settings ); |
| 81 |
} |
| 82 |
if ( !array_key_exists( "color", $simple_ticker_settings["woo_sales"] ) ) { |
| 83 |
// ver 2.00 later |
| 84 |
$simple_ticker_settings['woo_sales']['color'] = '#000000'; |
| 85 |
update_option( 'simple_ticker', $simple_ticker_settings ); |
| 86 |
} |
| 87 |
if ( !array_key_exists( "text", $simple_ticker_settings["woo_sales"] ) ) { |
| 88 |
// ver 2.00 later |
| 89 |
$simple_ticker_settings['woo_sales']['text'] = $woo_sales_text_tag; |
| 90 |
update_option( 'simple_ticker', $simple_ticker_settings ); |
| 91 |
} |
| 92 |
} else { |
| 93 |
update_option( 'simple_ticker', $simple_ticker_tbl ); |
| 94 |
} |
| 95 |
|
| 96 |
} |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
?> |