PluginProbe ʕ •ᴥ•ʔ
Custom Post Type Permalinks / trunk
Custom Post Type Permalinks vtrunk
1.2.0 1.3.0 1.3.1 1.4.0 1.5.1 1.5.2 1.5.4 2.0.0 2.0.1 2.0.2 2.1.1 2.1.2 2.1.3 2.2.0 3.0.0 3.0.1 3.1.0 3.1.1 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.3.0 3.3.1 3.3.4 3.3.5 3.4.0 3.4.0-rc.1 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.5.2 3.5.3 3.5.4 3.5.5 trunk 0.6 0.6.1 0.6.2 0.7 0.7.1 0.7.10 0.7.2 0.7.2.1 0.7.3 0.7.3.1 0.7.4 0.7.4.1 0.7.5 0.7.5.1 0.7.5.2 0.7.5.6 0.7.6 0.7.8 0.7.9 0.7.9.1 0.7.9.2 0.8 0.8.1 0.8.6 0.8.7 0.8.7.1 0.8.7.5 0.8.7.6 0.9 0.9.1 0.9.2.1 0.9.3.1 0.9.3.2 0.9.3.3 0.9.5 0.9.5.1 0.9.5.2 0.9.5.3 0.9.5.4 0.9.5.6 0.9.6 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0
custom-post-type-permalinks / CPTP / Module / Setting.php
custom-post-type-permalinks / CPTP / Module Last commit date
Admin.php 1 month ago FlushRules.php 8 years ago GetArchives.php 5 years ago Option.php 5 years ago Permalink.php 1 year ago Rewrite.php 1 year ago Setting.php 6 years ago
Setting.php
68 lines
1 <?php
2 /**
3 * Management Setting.
4 *
5 * @package Custom_Post_Type_Permalinks
6 */
7
8 /**
9 * For load plugin.
10 *
11 * @since 0.9.4
12 * */
13 class CPTP_Module_Setting extends CPTP_Module {
14
15 /**
16 * Module hooks.
17 */
18 public function add_hook() {
19 $this->update_version();
20 add_action( 'init', array( $this, 'load_textdomain' ) );
21 add_action( 'upgrader_process_complete', array( $this, 'upgrader_process_complete' ), 10, 2 );
22 }
23
24 /**
25 * Save CPTP version.
26 *
27 * @since 0.8.6
28 */
29 public function update_version() {
30 update_option( 'cptp_version', CPTP_VERSION );
31 }
32
33 /**
34 * After update complete.
35 *
36 * @since 3.0.0
37 *
38 * @param object $wp_upgrader WP_Upgrader instance.
39 * @param array $options Extra information about performed upgrade.
40 */
41 public function upgrader_process_complete( $wp_upgrader, $options ) {
42 if ( empty( $options['plugins'] ) ) {
43 return;
44 }
45
46 if ( ! is_array( $options['plugins'] ) ) {
47 return;
48 }
49
50 if ( 'update' === $options['action'] && 'plugin' === $options['type'] ) {
51 $plugin_path = plugin_basename( CPTP_PLUGIN_FILE );
52 if ( in_array( $plugin_path, $options['plugins'], true ) ) {
53 // for update code.
54 add_option( 'no_taxonomy_structure', false );
55 }
56 }
57 }
58
59 /**
60 * Load textdomain
61 *
62 * @since 0.6.2
63 */
64 public function load_textdomain() {
65 load_plugin_textdomain( 'custom-post-type-permalinks', false, 'custom-post-type-permalinks/language' );
66 }
67 }
68