本文整理汇总了PHP中FrmAppHelper::site_name方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::site_name方法的具体用法?PHP FrmAppHelper::site_name怎么用?PHP FrmAppHelper::site_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::site_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_single_field
/**
* Format individual email fields
*
* @since 2.0
* @param array $atts pass by reference
* @param string $f (to, from, reply_to, etc)
* @param string $val value saved in field
* @param int $key if in array, this will be set
*/
private static function format_single_field(&$atts, $f, $val, $key = false)
{
$val = trim($val);
// If just a plain email is used
if (is_email($val)) {
// add sender's name if not included in $from
if ($f == 'from') {
$part_2 = $atts[$f];
$part_1 = $atts['from_name'] ? $atts['from_name'] : wp_specialchars_decode(FrmAppHelper::site_name(), ENT_QUOTES);
} else {
return;
}
} else {
$parts = explode(' ', $val);
$part_2 = end($parts);
// If inputted correcly, $part_2 should be an email
if (is_email($part_2)) {
$part_1 = trim(str_replace($part_2, '', $val));
} else {
if (in_array($f, array('from', 'reply_to'))) {
// In case someone just puts a name in the From or Reply To field
$part_1 = $val;
$part_2 = get_option('admin_email');
} else {
// In case someone just puts a name in any other email field
if (false !== $key) {
unset($atts[$f][$key]);
return;
}
$atts[$f] = '';
return;
}
}
}
// if sending the email from a yahoo address, change it to the WordPress default
if ($f == 'from' && strpos($part_2, '@yahoo.com')) {
// Get the site domain and get rid of www.
$sitename = strtolower(FrmAppHelper::get_server_value('SERVER_NAME'));
if (substr($sitename, 0, 4) == 'www.') {
$sitename = substr($sitename, 4);
}
$part_2 = 'wordpress@' . $sitename;
}
// Set up formatted value
$final_val = '"' . str_replace('"', '', $part_1) . '" <' . $part_2 . '>';
// If value is an array
if (false !== $key) {
$atts[$f][$key] = $final_val;
return;
}
$atts[$f] = $final_val;
}
示例2: dynamic_default_values
/**
* Get the value to replace a few standard shortcodes
*
* @since 2.0
* @return string
*/
public static function dynamic_default_values($tag, $atts = array(), $return_array = false)
{
$new_value = '';
switch ($tag) {
case 'admin_email':
$new_value = get_option('admin_email');
break;
case 'siteurl':
$new_value = FrmAppHelper::site_url();
break;
case 'frmurl':
$new_value = FrmAppHelper::plugin_url();
break;
case 'sitename':
$new_value = FrmAppHelper::site_name();
break;
case 'get':
$new_value = self::process_get_shortcode($atts, $return_array);
break;
}
return $new_value;
}