What's New Generator - Version 1.11.0

Version Description

  • 1-30
Download this release

Release Info

Developer hidaka.bizplugin
Plugin Icon wp plugin What's New Generator
Version 1.11.0
Comparing to
See all releases

Code changes from version 1.10.0 to 1.11.0

Files changed (4) hide show
  1. admin-ui.php +14 -16
  2. readme.txt +5 -2
  3. whats-new-generator.php +6 -6
  4. whats-new.css +5 -3
admin-ui.php CHANGED
@@ -33,19 +33,22 @@ class WNGAdminUi {
33
  include_once( dirname(__FILE__) . '/whatsnew-view.php');
34
  }
35
 
36
- function validate($input) {
37
- if(!preg_match('/^#[a-f0-9]{6}$/i', $input['wng_font_color'])){
38
- $input['wng_font_color'] = "#000";
39
  }
40
- if(!preg_match('/^#[a-f0-9]{6}$/i', $input['wng_background_color'])){
41
- $input['wng_background_color'] = "#f5f5f5";
 
 
 
 
 
 
42
  }
43
- if ( !is_numeric( $input['wng_newmark']) || $input['wng_newmark'] < 0){
44
  $input['wng_newmark'] = 0;
45
  }
46
- if ($input['wng_newmark'] > 30 ){
47
- $input['wng_newmark'] = 30;
48
- }
49
  $input['wng_title'] = esc_html( $input['wng_title'] );
50
  $input['wng_category_name'] = trim(esc_html( $input['wng_category_name'] ));
51
  $input['wng_postlist_url'] = esc_url( $input['wng_postlist_url'] );
@@ -100,13 +103,8 @@ class WNGAdminUi {
100
 
101
  function setting_number() {
102
  $options = WNG::get_option();
103
- $items = array("3", "5", "7","10", "15", "20");
104
- echo "<select id='wng_number' name='whats_new_options[wng_number]'>";
105
- foreach($items as $item) {
106
- $selected = ($options['wng_number']==$item) ? 'selected="selected"' : '';
107
- echo "<option value='$item' $selected>$item</option>";
108
- }
109
- echo "</select>";
110
  }
111
 
112
  function setting_content_type() {
33
  include_once( dirname(__FILE__) . '/whatsnew-view.php');
34
  }
35
 
36
+ private function is_color( $code ) {
37
+ if( preg_match('/^#[a-f0-9]{6}$/i', $code ) ){
38
+ return true;
39
  }
40
+ return false;
41
+ }
42
+
43
+ function validate($input) {
44
+ $this->is_color( $input['wng_font_color'] ) or $input['wng_font_color'] = "#000";
45
+ $this->is_color( $input['wng_background_color'] ) or $input['wng_background_color'] = "#f1f5f5";
46
+ if ( !is_numeric( $input['wng_number']) || $input['wng_number'] < 1 || $input['wng_number'] > 30){
47
+ $input['wng_number'] = 10;
48
  }
49
+ if ( !is_numeric( $input['wng_newmark']) || $input['wng_newmark'] < 0 || $input['wng_newmark'] > 30){
50
  $input['wng_newmark'] = 0;
51
  }
 
 
 
52
  $input['wng_title'] = esc_html( $input['wng_title'] );
53
  $input['wng_category_name'] = trim(esc_html( $input['wng_category_name'] ));
54
  $input['wng_postlist_url'] = esc_url( $input['wng_postlist_url'] );
103
 
104
  function setting_number() {
105
  $options = WNG::get_option();
106
+ $value = $options["wng_number"];
107
+ echo "<input id='wng_number' name='whats_new_options[wng_number]' size='2' type='text' value='{$value}' />個";
 
 
 
 
 
108
  }
109
 
110
  function setting_content_type() {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: WordPress BizPlugin
3
  Donate link:
4
  Tags: what's new, update Post page
5
  Requires at least: 3.5
6
- Tested up to: 3.8.1
7
- Stable tag: 1.10.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -39,6 +39,9 @@ What’s New Generatorは、投稿、固定ページ、ウィジェットに新
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 1.10.0 =
43
  * 最新記事にNEW!マークをつける機能追加
44
 
3
  Donate link:
4
  Tags: what's new, update Post page
5
  Requires at least: 3.5
6
+ Tested up to: 4.1
7
+ Stable tag: 1.11.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
39
 
40
  == Changelog ==
41
 
42
+ = 1.11.0 =
43
+ * 最新記事の件数を1-30まで設定できるようにしました
44
+
45
  = 1.10.0 =
46
  * 最新記事にNEW!マークをつける機能追加
47
 
whats-new-generator.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: What's New Generator
4
  Plugin URI: http://residentbird.main.jp/bizplugin/
5
  Description: What's New(新着情報)を指定した固定ページや投稿に自動的に表示するプラグインです。
6
- Version: 1.10.0
7
- Author:WordPress Biz Plugin
8
  Author URI: http://residentbird.main.jp/bizplugin/
9
  */
10
 
@@ -13,7 +13,7 @@ new WhatsNewPlugin();
13
 
14
  class WNG
15
  {
16
- const VERSION = "1.10.0";
17
  const SHORTCODE = "showwhatsnew";
18
  const OPTIONS = "whats_new_options";
19
 
@@ -51,7 +51,7 @@ class WhatsNewPlugin{
51
  register_activation_hook(__FILE__, array(&$this,'on_activation'));
52
  add_action( 'admin_init', array(&$this,'on_admin_init') );
53
  add_action( 'admin_menu', array(&$this, 'on_admin_menu'));
54
- add_action( 'wp_enqueue_scripts', array(&$this,'on_enqueue_scripts'));
55
  add_shortcode( WNG::SHORTCODE, array(&$this,'show_shortcode'));
56
  add_filter( 'widget_text', 'do_shortcode');
57
  }
@@ -86,7 +86,7 @@ class WhatsNewPlugin{
86
  add_options_page("What's New 設定", "What's New 設定", 'administrator', __FILE__, array(&$this->adminUi, 'show_admin_page'));
87
  }
88
 
89
- function on_enqueue_scripts() {
90
  if ( is_admin() ){
91
  return;
92
  }
@@ -122,7 +122,7 @@ class WhatsNewInfo{
122
  $this->title = esc_html( $options['wng_title'] );
123
  $this->background_color = isset($options['wng_background_color']) ? $options['wng_background_color'] : "#f5f5f5";
124
  $this->font_color = isset($options['wng_font_color']) ? $options['wng_font_color'] : "#000000";
125
- $this->postlist_url = $options['wng_postlist_url'];
126
 
127
  $condition = array();
128
  if ( $options['wng_content_type'] == '投稿'){
3
  Plugin Name: What's New Generator
4
  Plugin URI: http://residentbird.main.jp/bizplugin/
5
  Description: What's New(新着情報)を指定した固定ページや投稿に自動的に表示するプラグインです。
6
+ Version: 1.11.0
7
+ Author:Hideki Tanaka
8
  Author URI: http://residentbird.main.jp/bizplugin/
9
  */
10
 
13
 
14
  class WNG
15
  {
16
+ const VERSION = "1.11.0";
17
  const SHORTCODE = "showwhatsnew";
18
  const OPTIONS = "whats_new_options";
19
 
51
  register_activation_hook(__FILE__, array(&$this,'on_activation'));
52
  add_action( 'admin_init', array(&$this,'on_admin_init') );
53
  add_action( 'admin_menu', array(&$this, 'on_admin_menu'));
54
+ add_action( 'wp_enqueue_scripts', array(&$this,'on_enqueue_css_js'));
55
  add_shortcode( WNG::SHORTCODE, array(&$this,'show_shortcode'));
56
  add_filter( 'widget_text', 'do_shortcode');
57
  }
86
  add_options_page("What's New 設定", "What's New 設定", 'administrator', __FILE__, array(&$this->adminUi, 'show_admin_page'));
87
  }
88
 
89
+ function on_enqueue_css_js() {
90
  if ( is_admin() ){
91
  return;
92
  }
122
  $this->title = esc_html( $options['wng_title'] );
123
  $this->background_color = isset($options['wng_background_color']) ? $options['wng_background_color'] : "#f5f5f5";
124
  $this->font_color = isset($options['wng_font_color']) ? $options['wng_font_color'] : "#000000";
125
+ $this->postlist_url = esc_url( $options['wng_postlist_url'] );
126
 
127
  $condition = array();
128
  if ( $options['wng_content_type'] == '投稿'){
whats-new.css CHANGED
@@ -33,15 +33,16 @@ div.wn-head .wn-title {
33
  text-align: left;
34
  float: left;
35
  overflow: hidden;
 
36
  }
37
  div.wn-head .wn-postlist {
38
  background: transparent url("./image/list.png") left center no-repeat;
39
- padding-left: 1.3em;
40
  font-weight: normal;
41
  font-size: 90%;
42
  text-align: right;
43
  cursor: pointer;
44
  float: right;
 
45
  }
46
 
47
  div.wn-item {
@@ -55,12 +56,13 @@ div.wn-item .wn-date {
55
  padding: 0;
56
  border: 0;
57
  float: left;
58
- width: 8.7em;
59
  font-weight: normal;
60
  overflow: hidden;
 
61
  }
62
  div.wn-item .wn-article {
63
- margin: 0;
64
  padding: 0 2px;
65
  overflow: hidden;
66
  }
33
  text-align: left;
34
  float: left;
35
  overflow: hidden;
36
+ width: auto;
37
  }
38
  div.wn-head .wn-postlist {
39
  background: transparent url("./image/list.png") left center no-repeat;
 
40
  font-weight: normal;
41
  font-size: 90%;
42
  text-align: right;
43
  cursor: pointer;
44
  float: right;
45
+ width: 4em;
46
  }
47
 
48
  div.wn-item {
56
  padding: 0;
57
  border: 0;
58
  float: left;
59
+ width: 8.1em;
60
  font-weight: normal;
61
  overflow: hidden;
62
+ white-space: nowrap;
63
  }
64
  div.wn-item .wn-article {
65
+ margin: 0 0 0 8.1em;
66
  padding: 0 2px;
67
  overflow: hidden;
68
  }