Skip to content

Commit aece2ef

Browse files
committed
Merge pull request #188 from zackkatz/master
Add filters to enable more customization
2 parents a307067 + efd3724 commit aece2ef

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

class-tgm-plugin-activation.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,26 @@ public function admin_menu() {
351351

352352
foreach ( $this->plugins as $plugin ) {
353353
if ( ! is_plugin_active( $plugin['file_path'] ) ) {
354-
add_theme_page(
355-
$this->strings['page_title'], // Page title.
356-
$this->strings['menu_title'], // Menu title.
357-
'edit_theme_options', // Capability.
358-
$this->menu, // Menu slug.
359-
array( $this, 'install_plugins_page' ) // Callback.
360-
);
361-
break;
354+
355+
$args = apply_filters(
356+
'tgmpa_admin_menu_args',
357+
array(
358+
'parent_slug'=> 'themes.php', // Parent Menu slug.
359+
'page_title' => $this->strings['page_title'], // Page title.
360+
'menu_title' => $this->strings['menu_title'], // Menu title.
361+
'capability' => 'edit_theme_options', // Capability.
362+
'menu_slug' => $this->menu, // Menu slug.
363+
'function' => array( $this, 'install_plugins_page' ) // Callback.
364+
)
365+
);
366+
367+
if( apply_filters( 'tgmpa_admin_menu_use_add_theme_page', true ) ) {
368+
add_theme_page($args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']);
369+
} else {
370+
add_submenu_page( $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']);
371+
}
372+
373+
break;
362374
}
363375
}
364376

@@ -748,7 +760,7 @@ public function notices() {
748760

749761
$action_links = array_filter( $action_links ); // Remove any empty array items.
750762
if ( $action_links ) {
751-
$rendered .= '<p>' . implode( ' | ', $action_links ) . '</p>';
763+
$rendered .= apply_filters( 'tgmpa_notice_rendered_action_links', '<p>' . implode( ' | ', $action_links ) . '</p>' );
752764
}
753765

754766
// Register the nag messages and prepare them to be processed.
@@ -1193,6 +1205,8 @@ protected function _gather_plugin_data() {
11931205
$table_data[$i]['file_path'] = $plugin['file_path'];
11941206
$table_data[$i]['url'] = isset( $plugin['source'] ) ? $plugin['source'] : 'repo';
11951207

1208+
$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
1209+
11961210
$i++;
11971211
}
11981212

@@ -1380,7 +1394,7 @@ public function get_columns() {
13801394
'status' => __( 'Status', 'tgmpa' )
13811395
);
13821396

1383-
return $columns;
1397+
return apply_filters( 'tgmpa_table_columns', $columns );
13841398

13851399
}
13861400

0 commit comments

Comments
 (0)