Commit 37f3b2d5 authored by haystack's avatar haystack

add docbocks to actions and filters that previously had none

parent 97a9ce07
......@@ -362,7 +362,11 @@ class CiviCRM_For_WordPress {
// Register all hooks on init
add_action( 'init', array( $this, 'register_hooks' ) );
// Notify plugins
/**
* Broadcast that this plugin is now loaded.
*
* @since 4.4
*/
do_action( 'civicrm_instance_loaded' );
}
......@@ -808,7 +812,6 @@ class CiviCRM_For_WordPress {
'civicrm', // Unique name
FALSE, // Deprecated argument
dirname( plugin_basename( __FILE__ ) ) . '/languages/' // Relative path to translation files
);
}
......@@ -825,6 +828,18 @@ class CiviCRM_For_WordPress {
$civilogo = file_get_contents( plugin_dir_path( __FILE__ ) . 'assets/civilogo.svg.b64' );
/**
* Filter the position of the CiviCRM menu item.
*
* Currently set to 3.9 + some random digits to reduce risk of conflict.
*
* @since 4.4
*
* @param float The default menu position.
* @return float The modified menu position..
*/
$position = apply_filters( 'civicrm_menu_item_position', '3.904981' );
// Check for settings file
if ( CIVICRM_INSTALLED ) {
......@@ -836,7 +851,7 @@ class CiviCRM_For_WordPress {
'CiviCRM',
array( $this, 'invoke' ),
$civilogo,
apply_filters( 'civicrm_menu_item_position', '3.904981' ) // 3.9 + random digits to reduce risk of conflict
$position
);
// Add core resources prior to page load
......@@ -852,14 +867,14 @@ class CiviCRM_For_WordPress {
'civicrm-install',
array( $this, 'run_installer' ),
$civilogo,
apply_filters( 'civicrm_menu_item_position', '3.904981' ) // 3.9 + random digits to reduce risk of conflict
$position
);
/*
// Add scripts and styles like this
add_action( 'admin_print_scripts-' . $options_page, array( $this, 'admin_installer_js' ) );
add_action( 'admin_print_styles-' . $options_page, array( $this, 'admin_installer_css' ) );
add_action( 'admin_head-' . $options_page, array( $this, 'admin_installer_head' ), 50 );
add_action( 'admin_print_scripts-' . $menu_page, array( $this, 'admin_installer_js' ) );
add_action( 'admin_print_styles-' . $menu_page, array( $this, 'admin_installer_css' ) );
add_action( 'admin_head-' . $menu_page, array( $this, 'admin_installer_head' ), 50 );
*/
}
......@@ -962,7 +977,14 @@ class CiviCRM_For_WordPress {
return;
}
// Default page slug, but allow overrides
/**
* Filter the default page slug.
*
* @since 4.6
*
* @param str The default basepage slug.
* @return str The modified basepage slug.
*/
$slug = apply_filters( 'civicrm_basepage_slug', 'civicrm' );
// Get existing page with that slug
......@@ -1037,13 +1059,27 @@ class CiviCRM_For_WordPress {
'post_name' => $slug,
);
// Default page title, but allow overrides
/**
* Filter the default page title.
*
* @since 4.6
*
* @param str The default base page title.
* @return str The modified base page title.
*/
$page['post_title'] = apply_filters( 'civicrm_basepage_title', __( 'CiviCRM', 'civicrm' ) );
// Default content
$content = __( 'Do not delete this page. Page content is generated by CiviCRM.', 'civicrm' );
// Set, but allow overrides
/**
* Filter the default page content.
*
* @since 4.6
*
* @param str $content The default base page content.
* @return str $content The modified base page content.
*/
$page['post_content'] = apply_filters( 'civicrm_basepage_content', $content );
// Insert the post into the database
......@@ -1353,7 +1389,11 @@ class CiviCRM_For_WordPress {
// Restore WP's arrays
$this->restore_wp_magic_quotes();
// Notify plugins
/**
* Broadcast that CiviCRM has been invoked.
*
* @since 4.4
*/
do_action( 'civicrm_invoked' );
}
......
......@@ -148,7 +148,15 @@ class CiviCRM_For_WordPress_Shortcodes_Modal {
// Default allowed to true on all capable post types
$allowed = ( in_array( $screen->post_type, $capable_post_types ) ) ? true : false;
// Allow plugins to override
/**
* Filter the appearance of the CiviCRM button.
*
* @since 4.6
*
* @param bool $allowed True if the button is allowed, false otherwise.
* @param object $screen The current WordPress screen object.
* @return bool $allowed True if the button is allowed, false otherwise.
*/
$allowed = apply_filters( 'civicrm_restrict_button_appearance', $allowed, $screen );
return $allowed;
......
......@@ -460,7 +460,17 @@ class CiviCRM_For_WordPress_Shortcodes {
$more_link = sprintf(
'<a href="%s">%s</a>',
$link,
/**
* Filter the CiviCRM shortcode more link text.
*
* @since 4.6
*
* @param str The existing shortcode more link text.
* @return str The modified shortcode more link text.
*/
apply_filters( 'civicrm_shortcode_more_link', __( 'Find out more...', 'civicrm' ) )
);
// Assume CiviCRM footer is not enabled
......@@ -475,6 +485,15 @@ class CiviCRM_For_WordPress_Shortcodes {
$logo = '<div class="empowered-by-logo"><span>' . __( 'CiviCRM', 'civicrm' ) . '</span></div>';
$civi_link = '<a href="http://civicrm.org/" title="' . $civi . '" target="_blank" class="empowered-by-link">' . $logo . '</a>';
$empowered = sprintf( __( 'Empowered by %s', 'civicrm' ), $civi_link );
/**
* Filter the CiviCRM shortcode footer text.
*
* @since 4.6
*
* @param str $empowered The existing shortcode footer.
* @return str $empowered The modified shortcode footer.
*/
$footer = apply_filters( 'civicrm_shortcode_footer', $empowered );
$empowered_enabled = TRUE;
......@@ -490,7 +509,16 @@ class CiviCRM_For_WordPress_Shortcodes {
// Save the output and flush the buffer
$markup = ob_get_clean();
// Allow plugins to override
/**
* Filter the computed CiviCRM shortcode markup.
*
* @since 4.6
*
* @param str $markup The computed shortcode markup.
* @param int $post_id The numeric ID of the WordPress post.
* @param string $shortcode The shortcode being parsed.
* @return str $markup The modified shortcode markup.
*/
return apply_filters( 'civicrm_shortcode_render_multiple', $markup, $post_id, $shortcode );
}
......
......@@ -315,8 +315,20 @@ class CiviCRM_For_WordPress_Users {
$wp_roles = new WP_Roles();
}
// Give access to civicrm page menu link to particular roles
/**
* Filter the default roles with access to CiviCRM.
*
* The 'access_civicrm' capability is the most basic CiviCRM capability and
* is required to see the CiviCRM menu link in the WordPress Admin menu.
*
* @since 4.6
*
* @param array The default roles with access to CiviCRM.
* @return array The modified roles with access to CiviCRM.
*/
$roles = apply_filters( 'civicrm_access_roles', array( 'super admin', 'administrator' ) );
// Give access to CiviCRM to particular roles.
foreach ( $roles as $role ) {
$roleObj = $wp_roles->get_role( $role );
if (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment