',
sprintf(
/* translators: %s: Login URL. */
__('You must be logged in to post a comment.', 'attire'),
/** This filter is documented in wp-includes/link-template.php */
wp_login_url(apply_filters('the_permalink', get_permalink($post_id), $post_id))
)
),
'logged_in_as' => sprintf(
'
%s
',
sprintf(
/* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */
'' . __('Logged in as %3$s', 'attire') . '' . __('Log out?', 'attire') . '',
get_edit_user_link(),
/* translators: %s: User name. */
esc_attr(sprintf(__('Logged in as %s. Edit your profile.', 'attire'), $user_identity)),
$user_identity,
/** This filter is documented in wp-includes/link-template.php */
wp_logout_url(apply_filters('the_permalink', get_permalink($post_id), $post_id))
)
),
'comment_notes_before' => sprintf(
'
%s%s
',
sprintf(
'%s',
__('Your email address will not be published.', 'attire')
),
($req ? $required_text : '')
),
'comment_notes_after' => '',
'action' => site_url('/wp-comments-post.php'),
'id_form' => 'commentform',
'id_submit' => 'submit',
'class_form' => 'comment-form',
'class_submit' => 'btn btn-primary btn-lg',
'name_submit' => 'submit',
'title_reply' => __('Leave a Reply', 'attire'),
/* translators: %s: Author of the comment being replied to. */
'title_reply_to' => __('Leave a Reply to %s', 'attire'),
'title_reply_before' => '
',
'title_reply_after' => '
',
'cancel_reply_before' => ' ',
'cancel_reply_after' => '',
'cancel_reply_link' => __('Cancel reply', 'attire'),
'label_submit' => __('Post Comment', 'attire'),
'submit_button' => '',
'submit_field' => '%1$s %2$s',
'format' => 'xhtml',
);
/**
* Filters the comment form default arguments.
*
* Use {@see 'comment_form_default_fields'} to filter the comment fields.
*
* @param array $defaults The default comment form arguments.
* @since 3.0.0
*
*/
$args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
// Ensure that the filtered args contain all required default values.
$args = array_merge($defaults, $args);
// Remove `aria-describedby` from the email field if there's no associated description.
if (isset($args['fields']['email']) && false === strpos($args['comment_notes_before'], 'id="email-notes"')) {
$args['fields']['email'] = str_replace(
' aria-describedby="email-notes"',
'',
$args['fields']['email']
);
}
/**
* Fires before the comment form.
*
* @since 3.0.0
*/
do_action('comment_form_before');
?>
',
esc_url($args['action']),
esc_attr($args['id_form']),
esc_attr($args['class_form']),
($html5 ? ' novalidate' : '')
);
/**
* Fires at the top of the comment form, inside the form tag.
*
* @since 3.0.0
*/
do_action('comment_form_top');
if (is_user_logged_in()) :
/**
* Filters the 'logged in' message for the comment form for display.
*
* @param string $args_logged_in The logged-in-as HTML-formatted message.
* @param array $commenter An array containing the comment author's
* username, email, and URL.
* @param string $user_identity If the commenter is a registered user,
* the display name, blank otherwise.
* @since 3.0.0
*
*/
echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
/**
* Fires after the is_user_logged_in() check in the comment form.
*
* @param array $commenter An array containing the comment author's
* username, email, and URL.
* @param string $user_identity If the commenter is a registered user,
* the display name, blank otherwise.
* @since 3.0.0
*
*/
do_action('comment_form_logged_in_after', $commenter, $user_identity);
else :
echo $args['comment_notes_before'];
endif;
// Prepare an array of all fields, including the textarea.
$comment_fields = array('comment' => $args['comment_field']) + (array)$args['fields'];
/**
* Filters the comment form fields, including the textarea.
*
* @param array $comment_fields The comment fields.
* @since 4.4.0
*
*/
$comment_fields = apply_filters('comment_form_fields', $comment_fields);
// Get an array of field names, excluding the textarea.
$comment_field_keys = array_diff(array_keys($comment_fields), array('comment'));
// Get the first and the last field name, excluding the textarea.
$first_field = reset($comment_field_keys);
$last_field = end($comment_field_keys);
echo "
";
foreach ($comment_fields as $name => $field) {
if ('comment' === $name) {
echo "
";
/**
* Filters the content of the comment textarea field for display.
*
* @param string $args_comment_field The content of the comment textarea field.
* @since 3.0.0
*
*/
echo apply_filters('comment_form_field_comment', $field);
echo $args['comment_notes_after'];
echo "
";
if ($first_field === $name) {
/**
* Fires before the comment fields in the comment form, excluding the textarea.
*
* @since 3.0.0
*/
do_action('comment_form_before_fields');
}
/**
* Filters a comment form field for display.
*
* The dynamic portion of the filter hook, `$name`, refers to the name
* of the comment form field. Such as 'author', 'email', or 'url'.
*
* @param string $field The HTML-formatted output of the comment form field.
* @since 3.0.0
*
*/
echo apply_filters("comment_form_field_{$name}", $field) . "\n";
if ($last_field === $name) {
/**
* Fires after the comment fields in the comment form, excluding the textarea.
*
* @since 3.0.0
*/
do_action('comment_form_after_fields');
}
echo "
";
}
}
echo "
";
/**
* Fires at the bottom of the comment form, inside the closing form tag.
*
* @param int $post_id The post ID.
* @since 1.5.0
*
*/
do_action('comment_form', $post_id);
echo '';
endif;
?>
1) {
$val = $var;
foreach ($index as $key) {
$val = is_array($val) && isset($val[$key]) ? $val[$key] : '__not__set__';
if ($val === '__not__set__') return $default;
}
} else
$val = isset($var[$index[0]]) ? $var[$index[0]] : $default;
if (is_array($params) && isset($params['validate'])) {
if (!is_array($val))
$val = $this->sanitizeVar($val, $params['validate']);
else
$val = $this->sanitizeArray($val, $params['validate']);
}
return $val;
}
/**
* @usage Validate and sanitize input data
* @param $var
* @param array $params
* @return int|null|string
*/
function queryVar($var, $params = array())
{
$_var = explode("/", $var);
if (count($_var) > 1) {
$val = $_REQUEST;
foreach ($_var as $key) {
$val = is_array($val) && isset($val[$key]) ? $val[$key] : false;
}
} else
$val = isset($_REQUEST[$var]) ? $_REQUEST[$var] : (isset($params['default']) ? $params['default'] : null);
$validate = is_string($params) ? $params : '';
$validate = is_array($params) && isset($params['validate']) ? $params['validate'] : $validate;
if (!is_array($val))
$val = $this->sanitizeVar($val, $validate);
else
$val = $this->sanitizeArray($val, $validate);
return $val;
}
/**
* Sanitize an array or any single value
* @param $array
* @return mixed
*/
function sanitizeArray($array, $sanitize = 'kses')
{
if (!is_array($array)) return esc_attr($array);
foreach ($array as $key => &$value) {
$validate = is_array($sanitize) && isset($sanitize[$key]) ? $sanitize[$key] : $sanitize;
if (is_array($value))
$this->sanitizeArray($value, $validate);
else {
$value = $this->sanitizeVar($value, $validate);
}
$array[$key] = &$value;
}
return $array;
}
/**
* Sanitize any single value
* @param $value
* @return string
*/
function sanitizeVar($value, $sanitize = 'kses')
{
if (is_array($value))
return $this->sanitizeArray($value, $sanitize);
else {
switch ($sanitize) {
case 'int':
case 'num':
return (int)$value;
break;
case 'double':
case 'float':
return (double)($value);
break;
case 'txt':
case 'str':
$value = esc_attr($value);
break;
case 'kses':
$allowedtags = wp_kses_allowed_html();
$allowedtags['div'] = array('class' => true);
$allowedtags['strong'] = array('class' => true);
$allowedtags['b'] = array('class' => true);
$allowedtags['i'] = array('class' => true);
$allowedtags['a'] = array('class' => true, 'href' => true);
$value = wp_kses($value, $allowedtags);
break;
case 'serverpath':
$value = realpath($value);
$value = str_replace("\\", "/", $value);
break;
case 'txts':
$value = sanitize_textarea_field($value);
break;
case 'url':
$value = esc_url($value);
break;
case 'filename':
$value = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '_', $value);
$value = mb_ereg_replace("([\.]+)", '_', $value);
break;
case 'html':
break;
default:
$value = esc_sql(esc_attr($value));
break;
}
}
return $value;
}
}
function attire_class_init() {
global $__attire;
$__attire = new Attire();
}
add_action('after_setup_theme', 'attire_class_init', 2);
function WPATTIRE()
{
global $__attire;
return $__attire;
}