X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FWordPress.php;h=73c6f54d904da1e311ce0f92e260f37925039aa7;hb=5a4f674292060ff1f07ec653e2ec4bf915f6f6ef;hp=a656a44be122c7ba55a25b182d7f00226fbc4e78;hpb=5667521530926d61b370a4bb0806b7e5ad63ccbc;p=civicrm-core.git diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index a656a44be1..73c6f54d90 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -75,14 +75,15 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { // yes, set page title, depending on context $context = civi_wp()->civicrm_context_get(); - switch ( $context ) { + switch ($context) { case 'admin': case 'shortcode': $template = CRM_Core_Smarty::singleton(); $template->assign('pageTitle', $pageTitle); } - } elseif (civicrm_wp_in_civicrm()) { + } + elseif (civicrm_wp_in_civicrm()) { // legacy pre-4.6 behaviour global $civicrm_wp_title; @@ -143,7 +144,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Append a string to the head of the html file * - * @param string $head the new string to be appended + * @param string $head + * The new string to be appended. * * @return void * @static @@ -172,7 +174,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Add a script file * * @param $url: string, absolute path to file - * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer' + * @param string $region + * location within the document: 'html-header', 'page-header', 'page-footer'. * * Note: This function is not to be called directly * @see CRM_Core_Region::render() @@ -187,7 +190,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Add an inline script * * @param $code: string, javascript code - * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer' + * @param string $region + * location within the document: 'html-header', 'page-header', 'page-footer'. * * Note: This function is not to be called directly * @see CRM_Core_Region::render() @@ -202,7 +206,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Add a css file * * @param $url: string, absolute path to file - * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer' + * @param string $region + * location within the document: 'html-header', 'page-header', 'page-footer'. * * Note: This function is not to be called directly * @see CRM_Core_Region::render() @@ -217,7 +222,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * Add an inline style * * @param $code: string, css code - * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer' + * @param string $region + * location within the document: 'html-header', 'page-header', 'page-footer'. * * Note: This function is not to be called directly * @see CRM_Core_Region::render() @@ -244,7 +250,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Figure out the post url for the form * - * @param mix $action the default action if one is pre-specified + * @param mix $action + * The default action if one is pre-specified. * * @return string the url to post the form * @static @@ -260,14 +267,20 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url) * - * @param $path string The path being linked to, such as "civicrm/add" - * @param $query string A query string to append to the link. - * @param $absolute boolean Whether to force the output to be an absolute link (beginning with http:). + * @param string $path + * The path being linked to, such as "civicrm/add". + * @param string $query + * A query string to append to the link. + * @param bool $absolute + * Whether to force the output to be an absolute link (beginning with http:). * Useful for links that will be displayed outside the site, such as in an * RSS feed. - * @param $fragment string A fragment identifier (named anchor) to append to the link. - * @param $htmlize boolean whether to convert to html eqivalant - * @param $frontend boolean a gross joomla hack + * @param string $fragment + * A fragment identifier (named anchor) to append to the link. + * @param bool $htmlize + * whether to convert to html eqivalant. + * @param bool $frontend + * a gross joomla hack. * * @param bool $forceBackend * @@ -304,7 +317,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { // when shortcode is included in page // also make sure we have valid query object global $wp_query; - if ( method_exists( $wp_query, 'get' ) ) { + if (method_exists($wp_query, 'get')) { if (get_query_var('page_id')) { $wpPageParam = "page_id=" . get_query_var('page_id'); } @@ -380,8 +393,10 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Authenticate the user against the wordpress db * - * @param string $name the user name - * @param string $password the password for the above user name + * @param string $name + * The user name. + * @param string $password + * The password for the above user name. * * @param bool $loadCMSBootstrap * @param null $realPath @@ -416,7 +431,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Set a message in the UF to display to a user * - * @param string $message the message to set + * @param string $message + * The message to set. * * @static */ @@ -428,8 +444,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * * @return bool */ - public function loadUser( $user ) { - return true; + public function loadUser($user) { + return TRUE; } public function permissionDenied() { @@ -445,7 +461,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { wp_redirect(wp_login_url()); } - public function updateCategories() {} + public function updateCategories() { + } /** * Get the locale set in the hosting CMS @@ -462,7 +479,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { if (isset($language)) { return CRM_Core_I18n_PseudoConstant::longForShort(substr($language, 0, 2)); - } else { + } + else { return NULL; } } @@ -470,8 +488,10 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Load wordpress bootstrap * - * @param $name string optional username for login - * @param $pass string optional password for login + * @param string $name + * optional username for login. + * @param string $pass + * optional password for login. * * @return bool */ @@ -483,13 +503,13 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { CRM_Core_Error::fatal("Could not find the install directory for WordPress"); } - require_once ($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php'); + require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php'; $wpUserTimezone = get_option('timezone_string'); if ($wpUserTimezone) { date_default_timezone_set($wpUserTimezone); CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone(); } - require_once ($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-includes/pluggable.php'); + require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-includes/pluggable.php'; $uid = CRM_Utils_Array::value('uid', $name); if ($uid) { $account = wp_set_current_user($uid); @@ -499,7 +519,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { return TRUE; } } - return true; + return TRUE; } /** @@ -596,8 +616,10 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Change user name in host CMS * - * @param integer $ufID User ID in CMS - * @param string $ufName User name + * @param int $ufID + * User ID in CMS. + * @param string $ufName + * User name. */ public function updateCMSName($ufID, $ufName) { // CRM-10620 @@ -605,9 +627,9 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $ufID = CRM_Utils_Type::escape($ufID, 'Integer'); $ufName = CRM_Utils_Type::escape($ufName, 'String'); - $values = array ('ID' => $ufID, 'user_email' => $ufName); - if( $ufID ) { - wp_update_user( $values ) ; + $values = array('ID' => $ufID, 'user_email' => $ufName); + if ($ufID) { + wp_update_user($values); } } } @@ -693,7 +715,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Get User ID from UserFramework system (Joomla) - * @param object $user object as described by the CMS + * @param object $user + * Object as described by the CMS. * @return mixed */ public function getUserIDFromUserObject($user) { @@ -702,7 +725,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Get Unique Identifier from UserFramework system (CMS) - * @param object $user object as described by the User Framework + * @param object $user + * Object as described by the User Framework. * @return mixed $uniqueIdentifer Unique identifier from the user Framework system * */ @@ -713,7 +737,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Get user login URL for hosting CMS (method declared in each CMS system class) * - * @param string $destination - if present, add destination to querystring (works for Drupal only) + * @param string $destination + * If present, add destination to querystring (works for Drupal only). * * @return string - loginURL for the current CMS * @@ -757,7 +782,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { /** * Get Url to view user record - * @param integer $contactID Contact ID + * @param int $contactID + * Contact ID. * * @return string */