Code Duplication    Length = 17-19 lines in 3 locations

components/Helpers.php 1 location

@@ 71-87 (lines=17) @@
68
69
        register_post_type( $this->object_type, apply_filters( 'pods_internal_register_post_type_object_helper', $args ) );
70
71
        if ( is_admin() ) {
72
            add_filter( 'post_updated_messages', array( $this, 'setup_updated_messages' ), 10, 1 );
73
74
            add_action( 'dbx_post_advanced', array( $this, 'edit_page_form' ) );
75
76
            add_action( 'pods_meta_groups', array( $this, 'add_meta_boxes' ) );
77
            add_filter( 'get_post_metadata', array( $this, 'get_meta' ), 10, 4 );
78
            add_filter( 'update_post_metadata', array( $this, 'save_meta' ), 10, 4 );
79
80
            add_action( 'pods_meta_save_pre_post__pods_helper', array( $this, 'fix_filters' ), 10, 5 );
81
            add_action( 'post_updated', array( $this, 'clear_cache' ), 10, 3 );
82
            add_action( 'delete_post', array( $this, 'clear_cache' ), 10, 1 );
83
            add_filter( 'post_row_actions', array( $this, 'remove_row_actions' ), 10, 2 );
84
            add_filter( 'bulk_actions-edit-' . $this->object_type, array( $this, 'remove_bulk_actions' ) );
85
86
            add_filter( 'builder_layout_filter_non_layout_post_types', array( $this, 'disable_builder_layout' ) );
87
        }
88
    }
89
90
    public function disable_builder_layout ( $post_types ) {

components/Pages.php 1 location

@@ 108-124 (lines=17) @@
105
106
		if ( ! is_admin() ) {
107
			add_action( 'load_textdomain', array( $this, 'page_check' ), 12 );
108
		} else {
109
			add_filter( 'post_updated_messages', array( $this, 'setup_updated_messages' ), 10, 1 );
110
111
			add_action( 'dbx_post_advanced', array( $this, 'edit_page_form' ) );
112
113
			add_action( 'pods_meta_groups', array( $this, 'add_meta_boxes' ) );
114
			add_filter( 'get_post_metadata', array( $this, 'get_meta' ), 10, 4 );
115
			add_filter( 'update_post_metadata', array( $this, 'save_meta' ), 10, 4 );
116
117
			add_action( 'pods_meta_save_pre_post__pods_page', array( $this, 'fix_filters' ), 10, 5 );
118
			add_action( 'post_updated', array( $this, 'clear_cache' ), 10, 3 );
119
			add_action( 'delete_post', array( $this, 'clear_cache' ), 10, 1 );
120
			add_filter( 'post_row_actions', array( $this, 'remove_row_actions' ), 10, 2 );
121
			add_filter( 'bulk_actions-edit-' . $this->object_type, array( $this, 'remove_bulk_actions' ) );
122
123
			add_filter( 'builder_layout_filter_non_layout_post_types', array( $this, 'disable_builder_layout' ) );
124
		}
125
126
		add_filter( 'members_get_capabilities', array( $this, 'get_capabilities' ) );
127
	}

components/Templates/Templates.php 1 location

@@ 102-120 (lines=19) @@
99
100
		register_post_type( $this->object_type, apply_filters( 'pods_internal_register_post_type_object_template', $args ) );
101
102
		if ( is_admin() ) {
103
			add_filter( 'post_updated_messages', array( $this, 'setup_updated_messages' ), 10, 1 );
104
105
			add_action( 'dbx_post_advanced', array( $this, 'edit_page_form' ) );
106
107
			add_action( 'pods_meta_groups', array( $this, 'add_meta_boxes' ) );
108
109
			add_filter( 'get_post_metadata', array( $this, 'get_meta' ), 10, 4 );
110
			add_filter( 'update_post_metadata', array( $this, 'save_meta' ), 10, 4 );
111
112
			add_action( 'pods_meta_save_pre_post__pods_template', array( $this, 'fix_filters' ), 10, 5 );
113
			add_action( 'post_updated', array( $this, 'clear_cache' ), 10, 3 );
114
			add_action( 'delete_post', array( $this, 'clear_cache' ), 10, 1 );
115
			add_filter( 'post_row_actions', array( $this, 'remove_row_actions' ), 10, 2 );
116
			add_filter( 'bulk_actions-edit-' . $this->object_type, array( $this, 'remove_bulk_actions' ) );
117
118
			add_filter( 'builder_layout_filter_non_layout_post_types', array( $this, 'disable_builder_layout' ) );
119
120
		}
121
122
		add_filter( 'members_get_capabilities', array( $this, 'get_capabilities' ) );
123
	}