本文整理汇总了PHP中avia_backend_safe_string函数的典型用法代码示例。如果您正苦于以下问题:PHP avia_backend_safe_string函数的具体用法?PHP avia_backend_safe_string怎么用?PHP avia_backend_safe_string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avia_backend_safe_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: avia_meta_box
/**
* The constructor
* checks if we are currently viewing a post creation site and hooks into the admin_menu as well as into the save_post to create and safe the meta boxes
* It also creates the html object necessary to render the boxes
*/
function avia_meta_box($avia_superobject)
{
if (basename($_SERVER['PHP_SELF']) == "post-new.php" || basename($_SERVER['PHP_SELF']) == "post.php") {
$this->superobject = $avia_superobject;
$this->html = new avia_htmlhelper($avia_superobject);
$this->html->context = "metabox";
$this->meta_prefix = avia_backend_safe_string($avia_superobject->base_data['prefix']);
add_action('admin_menu', array(&$this, 'init_boxes'));
add_action('save_post', array(&$this, 'save_post'));
}
}
示例2: avia_woocommerce_first_activation
function avia_woocommerce_first_activation()
{
if (!is_admin()) {
return;
}
$themeNice = avia_backend_safe_string(THEMENAME);
if (get_option("{$themeNice}_woo_settings_enabled")) {
return;
}
update_option("{$themeNice}_woo_settings_enabled", '1');
avia_woocommerce_set_defaults();
}
示例3: get_custom_post
/**
* The avia media get_custom_post function gets a custom post based on a post title. if no post cold be found it creates one
* @param string $post_title the title of the post
* @package AviaFramework
*/
public static function get_custom_post($post_title)
{
$save_title = avia_backend_safe_string($post_title);
$args = array('post_type' => 'avia_framework_post', 'post_title' => 'avia_' . $save_title, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed');
$avia_post = avia_media::get_post_by_title($args['post_title']);
if (!isset($avia_post['ID'])) {
$avia_post_id = wp_insert_post($args);
} else {
$avia_post_id = $avia_post['ID'];
}
return $avia_post_id;
}
示例4: __construct
public function __construct(&$avia_superobject, $print_styles = true, $print_extra_output = true, $addaction = true)
{
$this->print_styles = $print_styles;
$this->print_extra_output = $print_extra_output;
//check if stylesheet exists...
$safe_name = avia_backend_safe_string($avia_superobject->base_data['prefix']);
if (get_option('avia_stylesheet_exists' . $safe_name) == 'true') {
$this->print_styles = false;
}
if ($addaction) {
add_action('wp_head', array(&$this, 'create_styles'), 1000);
}
}
示例5: avia_superobject
/**
* The constructor sets up $base_data and $option_prefix. It then gets database values and if we are viewing the backend it calls the option page creator as well
*/
public function avia_superobject($base_data)
{
$this->base_data = $base_data;
$this->option_prefix = 'avia_options_' . avia_backend_safe_string($this->base_data['prefix']);
//set option array
$this->_create_option_arrays();
if (current_theme_supports('avia_mega_menu')) {
new avia_megamenu($this);
}
$this->style = new avia_style_generator($this);
add_action('wp_footer', array(&$this, 'set_javascript_framework_url'));
if (is_admin()) {
add_action('admin_print_scripts', array(&$this, 'set_javascript_framework_url'));
new avia_adminpages($this);
new avia_meta_box($this);
new avia_wp_export($this);
}
}
示例6: avia_wpml_copy_options
function avia_wpml_copy_options()
{
global $avia, $avia_config;
$key = isset($avia->base_data['prefix_origin']) ? $avia->base_data['prefix_origin'] : $avia->base_data['prefix'];
$original_key = 'avia_options_' . avia_backend_safe_string($key);
$language_key = 'avia_options_' . avia_backend_safe_string($avia->base_data['prefix']);
if ($original_key !== $language_key) {
$lang_set = get_option($language_key);
if (empty($lang_set)) {
$lang_set = get_option($original_key);
update_option($language_key, $lang_set);
wp_redirect($_SERVER['REQUEST_URI']);
exit;
}
}
}
示例7: avia_register_frontend_scripts
function avia_register_frontend_scripts()
{
$template_url = get_template_directory_uri();
$child_theme_url = get_stylesheet_directory_uri();
//register js
wp_enqueue_script('avia-compat', $template_url . '/js/avia-compat.js', array('jquery'), 2, false);
//needs to be loaded at the top to prevent bugs
wp_enqueue_script('avia-default', $template_url . '/js/avia.js', array('jquery'), 3, true);
wp_enqueue_script('avia-shortcodes', $template_url . '/js/shortcodes.js', array('jquery'), 3, true);
wp_enqueue_script('avia-popup', $template_url . '/js/aviapopup/jquery.magnific-popup.min.js', array('jquery'), 2, true);
wp_enqueue_script('jquery');
wp_enqueue_script('wp-mediaelement');
if (is_singular() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
//register styles
wp_register_style('avia-style', $child_theme_url . "/style.css", array(), '2', 'all');
//register default style.css file. only include in childthemes. has no purpose in main theme
wp_register_style('avia-custom', $template_url . "/css/custom.css", array(), '2', 'all');
wp_enqueue_style('avia-grid', $template_url . "/css/grid.css", array(), '2', 'all');
wp_enqueue_style('avia-base', $template_url . "/css/base.css", array(), '2', 'all');
wp_enqueue_style('avia-layout', $template_url . "/css/layout.css", array(), '2', 'all');
wp_enqueue_style('avia-scs', $template_url . "/css/shortcodes.css", array(), '2', 'all');
wp_enqueue_style('avia-popup-css', $template_url . "/js/aviapopup/magnific-popup.css", array(), '1', 'screen');
wp_enqueue_style('avia-media', $template_url . "/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen');
wp_enqueue_style('avia-print', $template_url . "/css/print.css", array(), '1', 'print');
if (is_rtl()) {
wp_enqueue_style('avia-rtl', $template_url . "/css/rtl.css", array(), '1', 'all');
}
global $avia;
$safe_name = avia_backend_safe_string($avia->base_data['prefix']);
$safe_name = apply_filters('avf_dynamic_stylesheet_filename', $safe_name);
if (get_option('avia_stylesheet_exists' . $safe_name) == 'true') {
$avia_upload_dir = wp_upload_dir();
if (is_ssl()) {
$avia_upload_dir['baseurl'] = str_replace("http://", "https://", $avia_upload_dir['baseurl']);
}
$avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/' . $safe_name . '.css';
$version_number = get_option('avia_stylesheet_dynamic_version' . $safe_name);
if (empty($version_number)) {
$version_number = '1';
}
wp_enqueue_style('avia-dynamic', $avia_dyn_stylesheet_url, array(), $version_number, 'all');
}
wp_enqueue_style('avia-custom');
if ($child_theme_url != $template_url) {
wp_enqueue_style('avia-style');
}
}
示例8: avia_generate_stylesheet
function avia_generate_stylesheet($options = false)
{
global $avia;
$safe_name = avia_backend_safe_string($avia->base_data['prefix']);
$safe_name = apply_filters('avf_dynamic_stylesheet_filename', $safe_name);
if (defined('AVIA_CSSFILE') && AVIA_CSSFILE === FALSE) {
$dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'false');
$stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'false');
return;
}
$wp_upload_dir = wp_upload_dir();
$stylesheet_dir = $wp_upload_dir['basedir'] . '/dynamic_avia';
$stylesheet_dir = str_replace('\\', '/', $stylesheet_dir);
$stylesheet_dir = apply_filters('avia_dyn_stylesheet_dir_path', $stylesheet_dir);
$isdir = avia_backend_create_folder($stylesheet_dir);
/*
* directory could not be created (WP upload folder not write able)
* @todo save error in db and output error message for user.
* @todo maybe add mkdirfix: http://php.net/manual/de/function.mkdir.php
*/
if ($isdir === false) {
$dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'false');
$stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'false');
return;
}
/*
* Go ahead - WP managed to create the folder as expected
*/
$stylesheet = trailingslashit($stylesheet_dir) . $safe_name . '.css';
$stylesheet = apply_filters('avia_dyn_stylesheet_file_path', $stylesheet);
//import avia_superobject and reset the options array
$avia_superobject = $GLOBALS['avia'];
$avia_superobject->reset_options();
//regenerate style array after saving options page so we can create a new css file that has the actual values and not the ones that were active when the script was called
avia_prepare_dynamic_styles();
//generate stylesheet content
$generate_style = new avia_style_generator($avia_superobject, false, false, false);
$styles = $generate_style->create_styles();
$created = avia_backend_create_file($stylesheet, $styles, true);
if ($created === true) {
$dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'true');
$stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'true');
$dynamic_id = update_option('avia_stylesheet_dynamic_version' . $safe_name, uniqid());
}
}
示例9: page_header
/**
*
* The page_header method renders the beginning of the option page, with header area, logo and various other informations
* @return string $output the string returned contains the html code generated within the method
*/
function page_header()
{
$the_title = apply_filters('avia_filter_backend_page_title', $this->avia_superobject->base_data['Title']);
$output = '<form id="avia_options_page" action="#" method="post">';
$output .= ' <div class="avia_options_page_inner avia_sidebar_active">';
$output .= ' <div class="avia_options_page_sidebar"><div class="avia_header">';
$output .= apply_filters('avia_options_page_header', "");
$output .= ' </div><div class="avia_sidebar_content"></div></div>';
$output .= ' <div class="avia_options_page_content">';
$output .= ' <div class="avia_header">';
$output .= ' <h2 class="avia_logo">' . $the_title . ' ' . $this->avia_superobject->currentpage . '</h2>';
$output .= ' <ul class="avia_help_links">';
$output .= ' <li><a class="thickbox" onclick="return false;" href="http://docs.kriesi.at/' . avia_backend_safe_string($this->avia_superobject->base_data['prefix']) . '/changelog/index.php?TB_iframe=1">Changelog</a> |</li>';
$output .= ' <li><a target="_blank" href="http://docs.kriesi.at/' . avia_backend_safe_string($this->avia_superobject->base_data['prefix']) . '/documentation/">Docs</a></li>';
$output .= ' </ul>';
$output .= ' <a class="avia_shop_option_link" href="#">Show all Options [+]</a>';
$output .= ' <span class="avia_loading"></span>';
$output .= $this->save_button();
$output .= ' </div>';
$output .= ' <div class="avia_options_container">';
return $output;
}
示例10: avia_backend_admin_bar_menu
function avia_backend_admin_bar_menu()
{
if (!current_user_can('manage_options')) {
return;
}
global $avia, $wp_admin_bar;
$real_id = is_admin() ? false : avia_get_the_ID();
//home edit button for frontpage
if (is_front_page()) {
$front_id = avia_get_option('frontpage');
$parent = "";
if ($front_id && $real_id == $front_id) {
$menu = array('id' => 'edit', 'title' => __('Edit Frontpage', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'));
$wp_admin_bar->add_menu($menu);
}
}
//dynamic tempalte edit for current entry, in case a dynamic tempalte is applied
if ($real_id && ($template = avia_is_dynamic_template())) {
$safeSlug = avia_backend_safe_string($template);
$menu = array('id' => 'avia_edit', 'title' => __('Edit this entry', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
$wp_admin_bar->add_menu($menu);
$menu = array('id' => 'avia_edit_dynamic', 'title' => __('Edit Dynamic Template of this entry', 'avia_framework'), 'href' => admin_url("admin.php?page=templates#goto_" . $safeSlug), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
$wp_admin_bar->add_menu($menu);
}
// add all option pages
if (empty($avia->option_pages)) {
return;
}
$urlBase = admin_url('admin.php');
foreach ($avia->option_pages as $avia_page) {
$safeSlug = avia_backend_safe_string($avia_page['title']);
$menu = array('id' => $avia_page['slug'], 'title' => strip_tags($avia_page['title']), 'href' => $urlBase . "?page=" . $avia_page['slug'], 'meta' => array('target' => 'blank'));
if ($avia_page['slug'] != $avia_page['parent']) {
$menu['parent'] = $avia_page['parent'];
$menu['href'] = $urlBase . "?page=" . $avia_page['parent'] . "#goto_" . $avia_page['slug'];
}
if (is_admin()) {
$menu['meta'] = array('onclick' => 'self.location.replace(encodeURI("' . $menu['href'] . '")); window.location.reload(true); ');
}
$wp_admin_bar->add_menu($menu);
}
}
示例11: add_option_page
function add_option_page($data)
{
$data['slug'] = avia_backend_safe_string(trim($data['name']));
$data_to_check = array($data['parent'], $data['name'], $data['slug']);
//check for invalid data
foreach ($data_to_check as $input) {
if (!avia_backend_check_by_regex($input, 'safe_data')) {
return 'invalid_data';
}
}
//check if the name already exists
foreach ($this->avia_superobject->option_pages as $existing_page) {
if ($existing_page['title'] == trim($data['name']) || $existing_page['slug'] == $data['slug']) {
return 'name_already_exists';
}
}
$page_key = $data['prefix'] . "_dynamic_pages";
$current_options = get_option($page_key);
if ($current_options == "") {
$current_options = array();
}
$result = array('slug' => avia_backend_safe_string($data['slug']), 'parent' => $data['parent'], 'icon' => $data['icon'], 'title' => trim($data['name']), 'removable' => $data['remove_label']);
if (isset($data['sortable'])) {
$result['sortable'] = $data['sortable'];
}
$current_options[] = $result;
update_option($page_key, $current_options);
return $result;
}
示例12: send
/**
* Send the form
*
* The send method tries to send the form. It builds the necessary email and submits it via wp_mail
*/
function send()
{
$new_post = array();
foreach ($_POST as $key => $post) {
$new_post[str_replace('avia_', '', $key)] = $post;
}
$mymail = empty($this->form_params['myemail']) ? $new_post['myemail'] : $this->form_params['myemail'];
$myblogname = empty($this->form_params['myblogname']) ? $new_post['myblogname'] : $this->form_params['myblogname'];
if (empty($new_post['subject_' . $this->formID]) && !empty($this->form_params['subject'])) {
$new_post['subject_' . $this->formID] = $this->form_params['subject'];
}
$subject = empty($new_post['subject_' . $this->formID]) ? __("New Message", 'avia_framework') . " (" . __('sent by contact form at', 'avia_framework') . " " . $myblogname . ")" : $new_post['subject_' . $this->formID];
$default_from = parse_url(home_url());
//hook to stop execution here and do something different with the data
$proceed = apply_filters('avf_form_send', true, $new_post, $this->form_params);
if (!$proceed) {
return true;
}
//set the email adress
$from = "no-reply@wp-message.com";
$usermail = false;
if (!empty($default_from['host'])) {
$from = "no-reply@" . $default_from['host'];
}
if (!empty($this->autoresponder[0])) {
$from = $_POST[$this->autoresponder[0]];
$usermail = true;
} else {
$email_variations = array('e-mail', 'email', 'mail');
foreach ($email_variations as $key) {
foreach ($new_post as $current_key => $current_post) {
if (strpos($current_key, $key) !== false) {
$from = $new_post[$current_key];
$usermail = true;
break;
}
}
if ($usermail == true) {
break;
}
}
}
$to = urldecode($mymail);
$delimiter = ",";
if (strpos($to, ',') === false && strpos($to, ' ') !== false) {
$delimiter = " ";
}
$to = array_filter(array_map('trim', explode($delimiter, $to)));
$to = apply_filters("avf_form_sendto", $to, $new_post, $this->form_params);
$from = urldecode($from);
$from = apply_filters("avf_form_from", $from, $new_post, $this->form_params);
$subject = urldecode($subject);
$subject = apply_filters("avf_form_subject", $subject, $new_post, $this->form_params);
$message = "";
$iterations = 0;
foreach ($this->form_elements as $key => $element) {
$key = avia_backend_safe_string($key, '_', true);
if (empty($key)) {
$iterations++;
$key = $iterations;
}
// substract 5 characters from the string length because we removed the avia_ prefix with 5 characters at the beginning of the send() function
$key = avia_backend_truncate($key, $this->length - 5, "_", "", false, '', false);
$key .= $this->id_sufix;
if (!empty($new_post[$key])) {
if ($element['type'] != 'hidden' && $element['type'] != 'decoy') {
if ($element['type'] == 'textarea') {
$message .= " <br/>";
}
$field_value = apply_filters("avf_form_mail_field_values", nl2br(urldecode($new_post[$key])), $new_post, $this->form_elements, $this->form_params);
$message .= $element['label'] . ": " . $field_value . " <br/>";
if ($element['type'] == 'textarea') {
$message .= " <br/>";
}
}
}
}
$use_wpmail = apply_filters("avf_form_use_wpmail", true, $new_post, $this->form_params);
//$header = 'MIME-Version: 1.0' . "\r\n";
$header = 'Content-type: text/html; charset=utf-8' . "\r\n";
$header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params);
$copy = apply_filters("avf_form_copy", $to, $new_post, $this->form_params);
$message = stripslashes($message);
foreach ($copy as $send_to_mail) {
if ($use_wpmail) {
$header .= 'From: ' . $from . " <" . $from . "> \r\n";
wp_mail($send_to_mail, $subject, $message, $header);
} else {
$header .= 'From:' . $from . " \r\n";
mail($send_to_mail, $subject, $message, $header);
}
}
//autoresponder?
if ($usermail && !empty($this->form_params['autoresponder'])) {
//$header = 'MIME-Version: 1.0' . "\r\n";
//.........这里部分代码省略.........
示例13: avia_ajax_import_parent_data
function avia_ajax_import_parent_data()
{
//check if user is allowed to save and if its his intention with a nonce check
if (function_exists('check_ajax_referer')) {
check_ajax_referer('avia_nonce_import_parent_settings');
}
if (is_child_theme()) {
global $avia;
$theme = wp_get_theme();
$parent = wp_get_theme($theme->get('Template'));
$parent_option_prefix = 'avia_options_' . avia_backend_safe_string($parent->get('Name'));
$parent_options = get_option($parent_option_prefix);
if (empty($parent_options)) {
die('No Parent Theme Options Found. There is nothing to import');
}
update_option($avia->option_prefix, $parent_options);
} else {
die('No Parent Theme found');
}
die('avia_import');
}
示例14: register_custom_sidebars
function register_custom_sidebars()
{
if (empty($this->sidebars)) {
$this->sidebars = get_option($this->stored);
}
$args = array('before_widget' => '<div id="%1$s" class="widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>');
$args = apply_filters('avia_custom_widget_args', $args);
if (is_array($this->sidebars)) {
foreach ($this->sidebars as $sidebar) {
$args['name'] = $sidebar;
$args['id'] = avia_backend_safe_string($sidebar, '-');
$args['class'] = 'avia-custom';
register_sidebar($args);
}
}
}
示例15: send
/**
* Send the form
*
* The send method tries to send the form. It builds the necessary email and submits it via wp_mail
*/
function send()
{
$new_post = array();
foreach ($_POST as $key => $post) {
$new_post[str_replace('avia_', '', $key)] = $post;
}
$mymail = empty($this->form_paramas['myemail']) ? $new_post['myemail'] : $this->form_paramas['myemail'];
$myblogname = empty($this->form_paramas['myblogname']) ? $new_post['myblogname'] : $this->form_paramas['myblogname'];
$subject = empty($new_post['subject']) ? __("New Message", 'avia_framework') : $new_post['subject'];
$default_from = parse_url(get_option('home'));
//set the email adress
$from = "no-reply@wp-message.com";
$usermail = false;
if (!empty($default_from['host'])) {
$from = "no-reply@" . $default_from['host'];
}
if (!empty($this->autoresponder[0])) {
$from = $_POST[$this->autoresponder[0]];
$usermail = true;
} else {
$email_variations = array('e-mail', 'email', 'mail');
foreach ($email_variations as $key) {
foreach ($new_post as $current_key => $current_post) {
if (strpos($current_key, $key) !== false) {
$from = $new_post[$current_key];
$usermail = true;
break;
}
}
if ($usermail == true) {
break;
}
}
}
$to = urldecode($mymail);
$from = urldecode($from);
$subject = urldecode($subject . " (" . __('sent by contact form at ', 'avia_framework') . $myblogname . ")");
$message = "";
$iterations = 0;
foreach ($this->form_elements as $key => $element) {
$key = avia_backend_safe_string($key);
if (empty($key)) {
$iterations++;
$key = $iterations;
}
if (!empty($new_post[$key])) {
if ($element['type'] != 'hidden' && $element['type'] != 'decoy') {
if ($element['type'] == 'textarea') {
$message .= "<br/>";
}
$message .= $element['label'] . ": " . nl2br(urldecode($new_post[$key])) . "<br/>";
if ($element['type'] == 'textarea') {
$message .= "<br/>";
}
}
}
}
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$header .= 'From:' . $from . " \r\n";
mail($to, $subject, $message, $header);
//autoresponder?
if ($usermail && !empty($this->form_paramas['autoresponder'])) {
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$header .= 'From:' . urldecode($this->form_paramas['autoresponder_email']) . " \r\n";
$message = nl2br($this->form_paramas['autoresponder']) . "<br/><br/><br/><strong>Your Message:</strong><br/><br/>" . $message;
mail($from, $this->form_paramas['autoresponder_subject'], $message, $header);
}
return true;
//return wp_mail( $to, $subject, $message , $header);
}