VK All in One Expansion Unit - Version 5.4.6

Version Description

  • [ CTA Widget ][ add function ] Random display
Download this release

Release Info

Developer kurudrive
Plugin Icon 128x128 VK All in One Expansion Unit
Version 5.4.6
Comparing to
See all releases

Code changes from version 5.4.5 to 5.4.6

plugins/call_to_action/class.call_to_action.php CHANGED
@@ -335,6 +335,8 @@ if ( $target_blank == "window_self") {
335
  {
336
  if ( ! $id ) { return ''; }
337
  $post = self::get_cta_post( $id );
 
 
338
  if ( ! $post ) { return ''; }
339
 
340
  include vkExUnit_get_directory() . '/plugins/call_to_action/view.actionbox.php';
@@ -367,7 +369,7 @@ if ( $target_blank == "window_self") {
367
 
368
  // 「共通設定を使用」じゃなかった場合
369
  if ( $post_config ) {
370
-
371
  // 「表示しない」が選択されていたら $id には nullを返す( CTAは表示されない )
372
  if ( $post_config == 'disable' ) { return null; }
373
 
@@ -388,9 +390,9 @@ if ( $target_blank == "window_self") {
388
 
389
  // 今表示している記事の投稿タイプのとき どのCTAを表示するかの設定が
390
  // 定義されており なおかつ 数字で入っている場合
391
- if (
392
- isset( $option[ $post_type ] ) &&
393
- is_numeric( $option[ $post_type ] )
394
  // $option[ $post_type ] > 0
395
  ) {
396
  // その数字(表示するCTAの投稿ID)を返す
335
  {
336
  if ( ! $id ) { return ''; }
337
  $post = self::get_cta_post( $id );
338
+
339
+ // たぶん何か必ず $post にはデータが返ってくるので事実上不要
340
  if ( ! $post ) { return ''; }
341
 
342
  include vkExUnit_get_directory() . '/plugins/call_to_action/view.actionbox.php';
369
 
370
  // 「共通設定を使用」じゃなかった場合
371
  if ( $post_config ) {
372
+
373
  // 「表示しない」が選択されていたら $id には nullを返す( CTAは表示されない )
374
  if ( $post_config == 'disable' ) { return null; }
375
 
390
 
391
  // 今表示している記事の投稿タイプのとき どのCTAを表示するかの設定が
392
  // 定義されており なおかつ 数字で入っている場合
393
+ if (
394
+ isset( $option[ $post_type ] ) &&
395
+ is_numeric( $option[ $post_type ] )
396
  // $option[ $post_type ] > 0
397
  ) {
398
  // その数字(表示するCTAの投稿ID)を返す
plugins/call_to_action/widget.call_to_action.php CHANGED
@@ -26,6 +26,9 @@ class Widget_CTA extends \WP_Widget
26
  {
27
  if ( isset( $instance['id'] ) && $instance['id'] ) {
28
  echo $args['before_widget'];
 
 
 
29
  echo CTA::render_cta_content($instance['id']);
30
  echo $args['before_widget'];
31
  }
@@ -33,9 +36,14 @@ class Widget_CTA extends \WP_Widget
33
  }
34
 
35
 
36
- function update( $new_instance, $old_instance )
37
- {
38
- return array( 'id' => (CTA::POST_TYPE == get_post_type( $new_instance['id']))? $new_instance['id'] : Null);
 
 
 
 
 
39
  }
40
 
41
 
@@ -52,6 +60,11 @@ class Widget_CTA extends \WP_Widget
52
  <?php _e( 'Please select CTA to display.', 'vkExUnit' );?>
53
  </div>
54
  <div style="padding-bottom: 0.5em;">
 
 
 
 
 
55
  <select name="<?php echo $this->get_field_name( 'id' ); ?>" style="width: 100%" >
56
  <option value="">[ <?php _e('Please select', 'vkExUnit' ) ?> ]</option>
57
  <?php foreach ( $ctas as $cta ) : ?>
@@ -67,4 +80,3 @@ class Widget_CTA extends \WP_Widget
67
  return $instance;
68
  }
69
  }
70
-
26
  {
27
  if ( isset( $instance['id'] ) && $instance['id'] ) {
28
  echo $args['before_widget'];
29
+ if ( $instance['id'] == 'random' ){
30
+ $instance['id'] = CTA::cta_id_random();
31
+ }
32
  echo CTA::render_cta_content($instance['id']);
33
  echo $args['before_widget'];
34
  }
36
  }
37
 
38
 
39
+ function update( $new_instance, $old_instance ) {
40
+ $cta_wid = array();
41
+ if ( $new_instance['id'] == 'random' ){
42
+ $cta_wid['id'] = 'random';
43
+ } else {
44
+ $cta_wid['id'] = ( CTA::POST_TYPE == get_post_type( $new_instance['id'] ) ) ? $new_instance['id'] : Null;
45
+ }
46
+ return $cta_wid;
47
  }
48
 
49
 
60
  <?php _e( 'Please select CTA to display.', 'vkExUnit' );?>
61
  </div>
62
  <div style="padding-bottom: 0.5em;">
63
+ <?php
64
+ // ランダムを先頭に追加
65
+ array_unshift( $ctas, array( 'key' => 'random', 'label' => __( 'Random', 'vkExUnit' ) ) );
66
+ ?>
67
+ <input type="hidden" name="_vkExUnit_cta_switch" value="cta_number" />
68
  <select name="<?php echo $this->get_field_name( 'id' ); ?>" style="width: 100%" >
69
  <option value="">[ <?php _e('Please select', 'vkExUnit' ) ?> ]</option>
70
  <?php foreach ( $ctas as $cta ) : ?>
80
  return $instance;
81
  }
82
  }
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 4.2
6
  Tested up to: 4.8.1
7
- Stable tag: 5.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,9 @@ e.g.
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 5.4.5 =
78
  * [ 3PR Widget ][ add filter ] read more text
79
 
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 4.2
6
  Tested up to: 4.8.1
7
+ Stable tag: 5.4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 5.4.6 =
78
+ * [ CTA Widget ][ add function ] Random display
79
+
80
  = 5.4.5 =
81
  * [ 3PR Widget ][ add filter ] read more text
82
 
vkExUnit.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: VK All in One Expansion Unit
4
  * Plugin URI: http://ex-unit.vektor-inc.co.jp
5
  * Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
6
- * Version: 5.4.5
7
  * Author: Vektor,Inc.
8
  * Text Domain: vkExUnit
9
  * Domain Path: /languages
3
  * Plugin Name: VK All in One Expansion Unit
4
  * Plugin URI: http://ex-unit.vektor-inc.co.jp
5
  * Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
6
+ * Version: 5.4.6
7
  * Author: Vektor,Inc.
8
  * Text Domain: vkExUnit
9
  * Domain Path: /languages