PluginProbe
Boxzilla – WordPress Popup Builder / 3.2
Boxzilla – WordPress Popup Builder v3.2
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/default-actions.php +41 -2 3.13.2 View file →
@@ -25,9 +25,48 @@
25 25 ),
26 26 'show_ui' => true,
27 27 'menu_position' => '108.1337133',
28 28 'menu_icon' => $boxzilla->plugin->url( '/assets/img/menu-icon.png' ),
29 - 'query_var' => false
29 + 'query_var' => false,
30 + 'capability_type' => 'box',
31 + 'capabilities' => array(
32 + 'edit_post' => 'edit_box',
33 + 'edit_posts' => 'edit_boxes',
34 + 'edit_others_posts' => 'edit_other_boxes',
35 + 'publish_posts' => 'publish_boxes',
36 + 'read_post' => 'read_box',
37 + 'read_private_posts' => 'read_private_box',
38 + 'delete_posts' => 'delete_box',
39 + ),
30 40 );
31 41
32 42 register_post_type( 'boxzilla-box', $args );
33 -});
43 +
44 + add_shortcode( 'boxzilla_link', 'boxzilla_get_link_html' );
45 +});
46 +
47 +add_action( 'admin_init', function() {
48 + $admins = get_role( 'administrator' );
49 +
50 + if( ! $admins->has_cap( 'edit_box' ) ) {
51 + $admins->add_cap('edit_box');
52 + $admins->add_cap('edit_boxes');
53 + $admins->add_cap('edit_other_boxes');
54 + $admins->add_cap('publish_boxes');
55 + $admins->add_cap('read_box');
56 + $admins->add_cap('read_private_box');
57 + $admins->add_cap('delete_box');
58 + }
59 +});
60 +
61 +function boxzilla_get_link_html( $args = array(), $content = '' ) {
62 + $valid_actions = array(
63 + 'show',
64 + 'toggle',
65 + 'hide',
66 + 'dismiss'
67 + );
68 + $box_id = empty( $args['box'] ) ? '' : absint( $args['box'] );
69 + $class_attr = empty( $args['class'] ) ? '' : esc_attr( $args['class'] );
70 + $action = empty( $args['action'] ) || ! in_array( $args['action'], $valid_actions ) ? 'show' : $args['action'];
71 + return sprintf( '<a href="javascript:Boxzilla.%s(%s)" class="%s">', $action, $box_id, $class_attr ) . $content . '</a>';
72 +}