0` lifts
* `get_sites()`'s default cap of 100.
*
* @param bool $network_wide Whether the plugin is being network-deactivated.
* @return void
*/
function agentency_chatbot_deactivate( $network_wide = false ) {
if ( is_multisite() && $network_wide ) {
$site_ids = get_sites(
array(
'fields' => 'ids',
'number' => 0,
)
);
foreach ( $site_ids as $site_id ) {
switch_to_blog( (int) $site_id );
wp_clear_scheduled_hook( Agentency_Settings::HEARTBEAT_HOOK );
restore_current_blog();
}
return;
}
wp_clear_scheduled_hook( Agentency_Settings::HEARTBEAT_HOOK );
}
register_deactivation_hook( __FILE__, 'agentency_chatbot_deactivate' );
/**
* Add a Settings shortcut to the plugin row.
*
* @param array $links Existing action links.
* @return array
*/
function agentency_chatbot_action_links( $links ) {
$settings = sprintf(
'%s',
esc_url( admin_url( 'options-general.php?page=' . Agentency_Settings::PAGE_SLUG ) ),
esc_html__( 'Settings', 'agentency-chatbot' )
);
array_unshift( $links, $settings );
return $links;
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'agentency_chatbot_action_links' );
/**
* Add Documentation and Support links under the plugin description.
*
* The Plugins screen is where an admin looks first when something goes wrong,
* and wordpress.org has no Agentency-specific support channel to point them
* at — so the row itself says where the setup guide and the help desk are.
* `plugin_row_meta` fires for every plugin, hence the basename check.
*
* @param array $links Existing row meta links.
* @param string $file Plugin file relative to the plugins directory.
* @return array
*/
function agentency_chatbot_row_meta( $links, $file ) {
if ( plugin_basename( AGENTENCY_CHATBOT_FILE ) !== $file ) {
return $links;
}
$links[] = sprintf(
'%s',
esc_url( Agentency_Settings::DOCS_URL ),
esc_html__( 'Documentation', 'agentency-chatbot' )
);
$links[] = sprintf(
'%s',
esc_url( Agentency_Settings::SUPPORT_URL ),
esc_html__( 'Support', 'agentency-chatbot' )
);
return $links;
}
add_filter( 'plugin_row_meta', 'agentency_chatbot_row_meta', 10, 2 );