本文整理汇总了PHP中_wpsf__函数的典型用法代码示例。如果您正苦于以下问题:PHP _wpsf__函数的具体用法?PHP _wpsf__怎么用?PHP _wpsf__使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_wpsf__函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auditPostStatus
/**
* @param string $sNewStatus
* @param string $sOldStatus
* @param WP_Post $oPost
* @return bool
*/
public function auditPostStatus($sNewStatus, $sOldStatus, $oPost)
{
if (!$oPost instanceof WP_Post || $this->getIsIgnoredPostType($oPost) || in_array($sNewStatus, array('auto-draft', 'inherit'))) {
return;
}
if ($sNewStatus == 'trash') {
$sEvent = 'post_trashed';
$sHumanEvent = _wpsf__('moved to trash');
} else {
if ($sOldStatus == 'trash' && $sNewStatus != 'trash') {
$sEvent = 'post_recovered';
$sHumanEvent = _wpsf__('recovered from trash');
} else {
if (in_array($sNewStatus, array('publish', 'private'))) {
$sEvent = 'post_published';
$sHumanEvent = _wpsf__('published');
} else {
if (in_array($sOldStatus, array('publish', 'private')) && $sNewStatus == 'draft') {
$sEvent = 'post_unpublished';
$sHumanEvent = _wpsf__('unpublished');
} else {
$sEvent = 'post_updated';
$sHumanEvent = _wpsf__('updated');
}
}
}
}
$oAuditTrail = $this->getAuditTrailEntries();
$oAuditTrail->add('posts', $sEvent, 1, sprintf(_wpsf__('Post entitled "%s" was %s.'), $oPost->post_title, $sHumanEvent));
}
示例2: checkLoginInterval
/**
* Should be a filter added to WordPress's "authenticate" filter, but before WordPress performs
* it's own authentication (theirs is priority 30, so we could go in at around 20).
*
* @param null|WP_User|WP_Error $oUserOrError
* @param string $sUsername
* @return WP_User|WP_Error
*/
public function checkLoginInterval($oUserOrError, $sUsername)
{
// No login attempt was made and we do nothing
if (empty($sUsername)) {
return $oUserOrError;
}
// If we're outside the interval, let the login process proceed as per normal and
// update our last login time.
$bWithinCooldownPeriod = $this->getIsWithinCooldownPeriod();
if (!$bWithinCooldownPeriod) {
$this->updateLastLoginTime();
$this->doStatIncrement('login.cooldown.success');
return $oUserOrError;
}
// At this point someone has attempted to login within the previous login wait interval
// So we remove WordPress's authentication filter and our own user check authentication
// And finally return a WP_Error which will be reflected back to the user.
$this->doStatIncrement('login.cooldown.fail');
remove_filter('authenticate', 'wp_authenticate_username_password', 20);
// wp-includes/user.php
$oWp = $this->loadWpFunctionsProcessor();
$sErrorString = _wpsf__("Login Cooldown in effect.") . ' ' . sprintf(_wpsf__("You must wait %s seconds before attempting to %s again."), $this->getLoginCooldownInterval() - $this->getSecondsSinceLastLoginTime(), $oWp->getIsLoginRequest() ? _wpsf__('login') : _wpsf__('register'));
if (!is_wp_error($oUserOrError)) {
$oUserOrError = new WP_Error();
}
$oUserOrError->add('wpsf_logininterval', $sErrorString);
// We now black mark this IP
add_filter($this->getFeatureOptions()->doPluginPrefix('ip_black_mark'), '__return_true');
return $oUserOrError;
}
示例3: secXss64kb
/**
* Addresses this vulnerability: http://klikki.fi/adv/wordpress2.html
*
* @param string $sCommentContent
* @return string
*/
public function secXss64kb($sCommentContent)
{
// Comments shouldn't be any longer than 64KB
if (strlen($sCommentContent) >= 64 * 1024) {
$sCommentContent = sprintf(_wpsf__('%s escaped HTML the following comment due to its size: %s'), $this->getController()->getHumanName(), esc_html($sCommentContent));
}
return $sCommentContent;
}
示例4: widget
/**
* @param array $aWidgetArguments
* @param array $aWidgetInstance
*/
public function widget($aWidgetArguments, $aWidgetInstance)
{
$oCon = self::$oFeatureOptions->getController();
$oRender = self::$oFeatureOptions->loadRenderer($oCon->getPath_Templates() . 'php');
$aData = array('strings' => array('plugin_name' => $oCon->getHumanName()), 'hrefs' => array('img_src' => $oCon->getPluginUrl_Image('pluginlogo_32x32.png')));
$sContents = $oRender->setRenderVars($aData)->setTemplate('snippets' . ICWP_DS . 'plugin_badge_widget')->setTemplateEnginePhp()->render();
$this->standardRender($aWidgetArguments, _wpsf__('Site Secured'), $sContents);
}
示例5: addNotice_plugin_mailing_list_signup
/**
* @see autoAddToAdminNotices()
* @param array $aNoticeAttributes
*/
protected function addNotice_plugin_mailing_list_signup($aNoticeAttributes)
{
$nDays = $this->getInstallationDays();
if ($this->getIfShowAdminNotices() && $nDays >= 5) {
$aRenderData = array('notice_attributes' => $aNoticeAttributes, 'strings' => array('yes' => "Yes please! I'd love to join in and learn more", 'no' => "No thanks, I'm not interested in such groups", 'we_dont_spam' => "( Fear not! SPAM is for losers. And we're not losers! )", 'your_name' => _wpsf__('Your Name'), 'your_email' => _wpsf__('Your Email'), 'dismiss' => "No thanks, I'm not interested in such informative groups", 'summary' => 'The WordPress Simple Firewall team is running an initiative (with currently 1500+ members) to raise awareness of WordPress Security
and to provide further help with the WordPress Simple Firewall plugin. Get Involved here:'), 'hrefs' => array('form_action' => '//hostliketoast.us2.list-manage.com/subscribe/post?u=e736870223389e44fb8915c9a&id=0e1d527259'), 'install_days' => $nDays);
$this->insertAdminNotice($aRenderData);
}
}
示例6: auditEditedPluginFile
/**
* @param string $sAction
* @param boolean $bResult
*/
public function auditEditedPluginFile($sAction, $bResult)
{
$sStub = 'edit-plugin_';
if (strpos($sAction, $sStub) !== 0) {
return;
}
$sFileName = str_replace($sStub, '', $sAction);
$oAuditTrail = $this->getAuditTrailEntries();
$oAuditTrail->add('plugins', 'file_edited', 2, sprintf(_wpsf__('An attempt was made to edit the plugin file "%s" directly through the WordPress editor.'), $sFileName));
}
示例7: checkForUnsupportedConfiguration
/**
* @return bool
*/
protected function checkForUnsupportedConfiguration()
{
$oDp = $this->loadDataProcessor();
$aRequestParts = $oDp->getRequestUriParts();
if ($aRequestParts === false || empty($aRequestParts['path'])) {
$sNoticeMessage = sprintf('<strong>%s</strong>: %s', _wpsf__('Warning'), _wpsf__('Your login URL is unchanged because your current hosting/PHP configuration cannot parse the necessary information.'));
$this->loadAdminNoticesProcessor()->addRawAdminNotice($sNoticeMessage, 'error');
return true;
}
return false;
}
示例8: addNotice_akismet_running
/**
* @param array $aNoticeAttributes
*/
protected function addNotice_akismet_running($aNoticeAttributes)
{
// We only warn when the human spam filter is running
if ($this->getIsOption('enable_comments_human_spam_filter', 'Y') && $this->getController()->getIsValidAdminArea()) {
$oWp = $this->loadWpFunctionsProcessor();
$sActivePluginFile = $oWp->getIsPluginActive('Akismet');
if ($sActivePluginFile) {
$aRenderData = array('notice_attributes' => $aNoticeAttributes, 'strings' => array('appears_running_akismet' => _wpsf__('It appears you have Akismet Anti-SPAM running alongside the our human Anti-SPAM filter.'), 'not_recommended' => _wpsf__('This is not recommended and you should disable Akismet.'), 'click_to_deactivate' => _wpsf__('Click to deactivate Akismet now.')), 'hrefs' => array('deactivate' => $oWp->getPluginDeactivateLink($sActivePluginFile)));
$this->insertAdminNotice($aRenderData);
}
}
}
示例9: printOptionsPageHeader
function printOptionsPageHeader($insSection = '')
{
$sLinkedIcwp = '<a href="http://icwp.io/3a" target="_blank">iControlWP</a>';
echo '<div class="page-header">';
echo '<h2><a id="pluginlogo_32" class="header-icon32" href="http://icwp.io/2k" target="_blank"></a>';
$sBaseTitle = sprintf(_wpsf__('WordPress Simple Firewall (from %s)'), $sLinkedIcwp);
if (!empty($insSection)) {
echo sprintf('%s :: %s', $insSection, $sBaseTitle);
} else {
echo $sBaseTitle;
}
echo '</h2></div>';
}
示例10: auditDeleteUser
/**
* @param int $nUserId
* @param int $nReassigned
*/
public function auditDeleteUser($nUserId, $nReassigned)
{
if (empty($nUserId)) {
return;
}
$oWpUsers = $this->loadWpUsersProcessor();
$oDeletedUser = $oWpUsers->getUserById($nUserId);
$oReassignedUser = empty($nReassigned) ? null : $oWpUsers->getUserById($nReassigned);
// Build the audit message
$sAuditMessage = _wpsf__('WordPress user deleted.') . ' ' . sprintf(_wpsf__('Username was "%s" with email address "%s".'), empty($oDeletedUser) ? 'unknown' : $oDeletedUser->get('user_login'), empty($oDeletedUser) ? 'unknown' : $oDeletedUser->get('user_email')) . ' ';
if (empty($oReassignedUser)) {
$sAuditMessage .= _wpsf__('Their posts were not reassigned to another user.');
} else {
$sAuditMessage .= sprintf(_wpsf__('Their posts were reassigned to user "%s".'), $oReassignedUser->get('user_login'));
}
$oAuditTrail = $this->getAuditTrailEntries();
$oAuditTrail->add('users', 'user_deleted', 2, $sAuditMessage);
}
示例11: loadStrings_Options
/**
* @param array $aOptionsParams
* @return array
* @throws Exception
*/
protected function loadStrings_Options($aOptionsParams)
{
$sKey = $aOptionsParams['key'];
switch ($sKey) {
case 'enable_statistics':
$sName = sprintf(_wpsf__('Enable %s'), $this->getMainFeatureName());
$sSummary = sprintf(_wpsf__('Enable (or Disable) The %s Feature'), $this->getMainFeatureName());
$sDescription = sprintf(_wpsf__('Checking/Un-Checking this option will completely turn on/off the whole %s feature.'), $this->getMainFeatureName());
break;
case 'enable_stats_sharing':
$sName = _wpsf__('Enable Statistic Sharing');
$sSummary = _wpsf__('The plugin will share its statistics to allow for global data gathering and analysis');
$sDescription = _wpsf__('Sharing the statistics garnered from the plugin will help show how effective we are and areas we can improve.');
break;
default:
throw new Exception(sprintf('An option has been defined but without strings assigned to it. Option key: "%s".', $sKey));
}
$aOptionsParams['name'] = $sName;
$aOptionsParams['summary'] = $sSummary;
$aOptionsParams['description'] = $sDescription;
return $aOptionsParams;
}
示例12: loadStrings_Options
/**
* @param array $aOptionsParams
* @return array
* @throws Exception
*/
protected function loadStrings_Options($aOptionsParams)
{
$sKey = $aOptionsParams['key'];
switch ($sKey) {
case 'block_send_email_address':
$sName = _wpsf__('Report Email');
$sSummary = _wpsf__('Where to send email reports');
$sDescription = _wpsf__('If this is empty, it will default to the blog admin email address.');
break;
case 'send_email_throttle_limit':
$sName = _wpsf__('Email Throttle Limit');
$sSummary = _wpsf__('Limit Emails Per Second');
$sDescription = _wpsf__('You throttle emails sent by this plugin by limiting the number of emails sent every second. This is useful in case you get hit by a bot attack. Zero (0) turns this off. Suggested: 10');
break;
default:
throw new Exception(sprintf('An option has been defined but without strings assigned to it. Option key: "%s".', $sKey));
}
$aOptionsParams['name'] = $sName;
$aOptionsParams['summary'] = $sSummary;
$aOptionsParams['description'] = $sDescription;
return $aOptionsParams;
}
示例13: query_addNewManualWhiteListIp
/**
* @param string $sIp
* @param string $sLabel
* @return bool|int
*/
protected function query_addNewManualWhiteListIp($sIp, $sLabel = '')
{
// Now add new entry
$aNewData = array();
$aNewData['ip'] = $sIp;
$aNewData['label'] = empty($sLabel) ? _wpsf__('No Label') : $sLabel;
$aNewData['list'] = self::LIST_MANUAL_WHITE;
$aNewData['ip6'] = $this->loadDataProcessor()->getIpAddressVersion($sIp) == 6;
$aNewData['transgressions'] = 0;
$aNewData['is_range'] = strpos($sIp, '/') !== false;
$aNewData['last_access_at'] = 0;
$aNewData['created_at'] = $this->time();
$mResult = $this->insertData($aNewData);
return $mResult ? $aNewData : $mResult;
}
示例14: addNotice_post_plugin_update
/**
* @see autoAddToAdminNotices()
* @param array $aNoticeAttributes
*/
protected function addNotice_post_plugin_update($aNoticeAttributes)
{
$oFO = $this->getFeatureOptions();
$oWpUsers = $this->loadWpUsersProcessor();
$sAdminNoticeMetaKey = $oFO->doPluginPrefix('post-plugin-update');
if ($this->loadAdminNoticesProcessor()->getAdminNoticeIsDismissed('post-plugin-update')) {
$oWpUsers->updateUserMeta($sAdminNoticeMetaKey, $oFO->getVersion());
// so they've hidden it. Now we set the current version so it doesn't display
return;
}
if (!$this->getIfShowAdminNotices()) {
return;
}
$sHumanName = $this->getController()->getHumanName();
if ($this->getInstallationDays() <= 1) {
$sMessage = sprintf(_wpsf__("Notice - %s"), sprintf(_wpsf__("The %s plugin does not automatically turn on certain features when you install."), $sHumanName));
} else {
$sMessage = sprintf(_wpsf__("Notice - %s"), sprintf(_wpsf__("The %s plugin has been recently upgraded, but please remember that new features may not be automatically enabled."), $sHumanName));
}
$aRenderData = array('notice_attributes' => $aNoticeAttributes, 'strings' => array('main_message' => $sMessage, 'read_homepage' => _wpsf__('Click to read about any important updates from the plugin home page.'), 'link_title' => $sHumanName, 'dismiss' => _wpsf__('Dismiss this notice')), 'hrefs' => array('read_homepage' => 'http://icwp.io/27'));
$this->insertAdminNotice($aRenderData);
}
示例15: interceptCanonicalRedirects
/**
* @uses wp_die()
*/
public function interceptCanonicalRedirects()
{
$oDp = $this->loadDataProcessor();
if ($this->getIsOption('block_author_discovery', 'Y') && !is_user_logged_in()) {
$sAuthor = $oDp->FetchGet('author', '');
if (!empty($sAuthor)) {
$this->loadWpFunctionsProcessor()->wpDie(sprintf(_wpsf__('The "author" query parameter has been blocked by %s to protect against user login name fishing.') . '<br /><a href="" target="_blank">' . _wpsf__('Learn More.') . '</a>', $this->getController()->getHumanName()));
}
}
}