本文整理汇总了PHP中snp_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP snp_get_option函数的具体用法?PHP snp_get_option怎么用?PHP snp_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snp_get_option函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Field Render Function.
*
* Takes the vars and outputs the HTML for the field in the settings
*
* @since SNP_NHP_Options 1.0
*/
function render()
{
$class = isset($this->field['class']) ? 'class="' . $this->field['class'] . '" ' : '';
echo '<input class="snp-button-preview" type="button" id="' . $this->field['id'] . '_button" value="Preview" />';
echo '<br /><br />';
echo '<b>Clear Your Cookies to test the popup on your live website.</b><br />';
echo '<input type="button" id="' . $this->field['id'] . '_button_cookie" class="button" value="Clear my cookie" />';
echo '<script type="text/javascript">';
echo 'jQuery(document).ready(function(){';
echo ' jQuery("#' . $this->field['id'] . '_button").click(function(){';
echo ' jQuery("#post").attr("target","_blank");';
echo ' jQuery("#post").attr("action","admin-ajax.php");';
echo ' jQuery("#hiddenaction").val("snp_preview_popup");';
echo ' jQuery("#originalaction").val("snp_preview_popup");';
echo "\t\tjQuery('<input>').attr('type','hidden').attr('name','action').attr('id','snp_preview_popup_i').val('snp_preview_popup').appendTo('#post');";
echo ' jQuery("#post").submit();';
echo ' jQuery("#hiddenaction").val("editpost");';
echo ' jQuery("#originalaction").val("editpost");';
echo ' jQuery("#snp_preview_popup_i").remove();';
echo ' jQuery("#post").attr("target","");';
echo ' jQuery("#post").attr("action","post.php");';
echo ' });';
echo ' jQuery("#' . $this->field['id'] . '_button_cookie").click(function(){';
echo ' jQuery.cookie("snp_' . snp_get_option('class_popup', 'snppopup') . '-welcome",null, { path: "/"});';
echo ' jQuery.cookie("snp_' . snp_get_option('class_popup', 'snppopup') . '-exit",null, { path: "/"});';
echo ' alert("Done!");';
echo ' });';
echo '});';
echo '</script>';
}
示例2: search_callback
public function search_callback($match)
{
if (!trim($match[2])) {
return $match[0];
}
$quot = '"';
if (strpos($match[1], '"') !== FALSE) {
$quot = '"';
} elseif (strpos($match[1], '\'') !== FALSE) {
$quot = '\'';
}
$match['attr'] = shortcode_parse_atts($match[1]);
// has href?
if (!$match['attr']['href']) {
return $match[0];
}
// is local?
if (self::is_local_url($match['attr']['href'])) {
return $match[0];
}
// is excluded?
if (empty($match['attr']['class'])) {
$match['attr']['class'] = '';
}
if (strpos($match['attr']['class'], snp_get_option('class_no_popup', 'nosnppopup')) !== FALSE) {
return $match[0];
}
// is graphic?
if (self::is_image_url($match['attr']['href'])) {
return $match[0];
}
$attrs = '';
if (!$match['attr']['class']) {
$match['attr']['class'] = '';
}
foreach ($match['attr'] as $k => $v) {
if ($k == 'class') {
$v .= ' ' . snp_get_option('class_popup', 'snppopup');
}
$attrs .= $k . '=' . $quot . trim($v) . $quot . '';
}
return '<a ' . $attrs . '>' . $match[2] . '</a>';
}
示例3: snp_plugin_api_call
function snp_plugin_api_call($def, $action, $args)
{
global $snp_plugin_slug, $snp_api_url, $wp_version;
if (!isset($args->slug) || $args->slug != $snp_plugin_slug || !function_exists('snp_get_option') || snp_get_option('autoupdates') != 1) {
return false;
}
// Get the current version
$plugin_info = get_site_transient('update_plugins');
$current_version = $plugin_info->checked[$snp_plugin_slug . '/' . $snp_plugin_slug . '.php'];
$args->version = $current_version;
$request_string = array('body' => array('action' => $action, 'request' => serialize($args), 'site' => get_bloginfo('url'), 'purchasecode' => snp_get_option('purchasecode')), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
$request = wp_remote_post($snp_api_url, $request_string);
if (is_wp_error($request)) {
$res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message());
} else {
$res = unserialize($request['body']);
if ($res === false) {
$res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
}
}
return $res;
}
示例4: urlencode
if ($POPUP_META['snp_show_li_button'] == 'yes') {
echo '<div class="snp-share snp-share-li"><script type="IN/Share" data-showzero="true" data-url="' . $POPUP_META['snp_li_url'] . '" data-onsuccess="snp_onshare_li" data-counter="right"></script></div>';
}
if ($POPUP_META['snp_show_pi_button'] == 'yes') {
echo '<div class="snp-share snp-share-pi"><a href="http://pinterest.com/pin/create/button/?url=' . urlencode($POPUP_META['snp_pi_url'] ? $POPUP_META['snp_pi_url'] : $CURRENT_URL) . '&media=' . urlencode($POPUP_META['snp_pi_image_url']) . '&description=' . urlencode($POPUP_META['snp_pi_description']) . '" class="pin-it-button" target="_blank" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a></div>';
}
}
//echo '<br style="clear: both;" />';
?>
</div>
</div>
</div>
</div>
<?php
if (snp_get_option('PROMO_ON') && snp_get_option('PROMO_REF') && SNP_PROMO_LINK != '') {
$PROMO_LINK = SNP_PROMO_LINK . snp_get_option('PROMO_REF');
echo '<div class="snp-powered">';
echo '<a href="' . $PROMO_LINK . '" target="_blank">Powered by <strong>Ninja Popups</strong></a>';
echo '</div>';
}
?>
</div>
<?php
$POPUP_META['snp_header_font'] = unserialize($POPUP_META['snp_header_font']);
$POPUP_META['snp_lefttext_font'] = unserialize($POPUP_META['snp_lefttext_font']);
$POPUP_META['snp_rightheader_font'] = unserialize($POPUP_META['snp_rightheader_font']);
$POPUP_META['snp_righttext_font'] = unserialize($POPUP_META['snp_righttext_font']);
$POPUP_META['snp_submit_button_color'] = unserialize($POPUP_META['snp_submit_button_color']);
echo '<style>';
if (!empty($POPUP_META['snp_width']) && intval($POPUP_META['snp_width'])) {
echo '.snp-pop-' . $ID . ' .snp-theme2 { width: ' . $POPUP_META['snp_width'] . 'px;}';
示例5: snp_get_option
<?php
if (!empty($POPUP_META['snp_img'])) {
?>
<div class="snp-half snp-left"><div class="snp-image"><img src="<?php
echo $POPUP_META['snp_img'];
?>
" alt="" /></div></div>
<div class="snp-half snp-right">
<?php
}
?>
<?php
if (isset($POPUP_META['snp_cf'])) {
$name_field = '<input type="text" name="' . (snp_get_option('ml_manager') == 'html' && snp_get_option('ml_html_name') ? snp_get_option('ml_html_name') : 'name') . '" id="snp-name" placeholder="' . $POPUP_META['snp_name_placeholder'] . '" class="snp-field snp-field-name" />';
$email_field = '<input type="text" name="' . (snp_get_option('ml_manager') == 'html' && snp_get_option('ml_html_email') ? snp_get_option('ml_html_email') : 'email') . '" id="snp_email" placeholder="' . $POPUP_META['snp_email_placeholder'] . '" class="snp-field snp-field-email" />';
$tpl_field = '%FIELD%';
snp_custom_fields(unserialize($POPUP_META['snp_cf']), array('email_field' => $email_field, 'name_field' => $name_field, 'tpl_field' => $tpl_field, 'snp_name_disable' => $POPUP_META['snp_name_disable']));
}
?>
<input type="submit" class="snp-subscribe-button snp-submit" data-loading="<?php
echo $POPUP_META['snp_submit_button_loading'];
?>
" data-success="<?php
echo $POPUP_META['snp_submit_button_success'];
?>
" value="<?php
echo $POPUP_META['snp_submit_button'];
?>
">
示例6: snp_run
function snp_run()
{
global $post;
if (is_404()) {
return;
}
if (snp_get_option('enable') == 'disabled') {
return;
}
// mobile device?
//if (snp_get_option('enable_mobile') == 'disabled' && snp_detect_mobile($_SERVER['HTTP_USER_AGENT']))
//{
//return;
//}
if (isset($_REQUEST['nphide']) && $_REQUEST['nphide'] == 1 || isset($_COOKIE['nphide']) && $_COOKIE['nphide'] == 1) {
setcookie('nphide', 1, 0, COOKIEPATH, COOKIE_DOMAIN, false);
return;
}
$WELCOME_ID = 'global';
$EXIT_ID = 'global';
if (isset($post->ID) && (is_page() || is_single())) {
$WELCOME_ID = get_post_meta($post->ID, 'snp_p_welcome_popup', true);
$WELCOME_ID = $WELCOME_ID ? $WELCOME_ID : 'global';
$EXIT_ID = get_post_meta($post->ID, 'snp_p_exit_popup', true);
$EXIT_ID = $EXIT_ID ? $EXIT_ID : 'global';
//echo 'post='.$WELCOME_ID.'<br />'; //DEL
//echo 'post='.$EXIT_ID.'<br />'; //DEL
if ($WELCOME_ID == 'global' || $EXIT_ID == 'global') {
if ($post->post_type == 'post') {
$POST_CATS = wp_get_post_categories($post->ID);
}
$enable_taxs = snp_get_option('enable_taxs');
if (is_array($enable_taxs)) {
foreach ((array) $enable_taxs as $k => $v) {
$POST_CATS = array_merge((array) $POST_CATS, wp_get_object_terms($post->ID, $k, array('fields' => 'ids')));
}
}
if (is_array($POST_CATS)) {
foreach ($POST_CATS as $term_id) {
$term_meta = get_option("snp_taxonomy_" . $term_id);
if (isset($term_meta['welcome']) && $WELCOME_ID == 'global') {
$WELCOME_ID = $term_meta['welcome'];
}
if (isset($term_meta['exit']) && $EXIT_ID == 'global') {
$EXIT_ID = $term_meta['exit'];
}
}
}
// tax
}
} elseif (is_category() || is_tax() || is_tag() || is_archive()) {
$category = get_queried_object();
$term_meta = get_option("snp_taxonomy_" . $category->term_id);
if (isset($term_meta['welcome'])) {
$WELCOME_ID = $term_meta['welcome'];
} else {
$WELCOME_ID = 'global';
}
if (isset($term_meta['exit'])) {
$EXIT_ID = $term_meta['exit'];
} else {
$EXIT_ID = 'global';
}
}
if (defined('ICL_LANGUAGE_CODE')) {
$snp_var_sufix = '_' . ICL_LANGUAGE_CODE;
} else {
$snp_var_sufix = '';
}
// WELCOME
if (snp_get_option('welcome_disable_for_logged') == 1 && is_user_logged_in()) {
} else {
if ($WELCOME_ID !== 'disabled' && $WELCOME_ID !== 'global') {
snp_run_popup($WELCOME_ID, 'welcome');
} elseif ($WELCOME_ID === 'global') {
$WELCOME_ID = snp_get_option('welcome_popup' . $snp_var_sufix);
if ($WELCOME_ID === 'global' && defined('ICL_LANGUAGE_CODE')) {
$WELCOME_ID = snp_get_option('welcome_popup');
}
if ($WELCOME_ID !== 'disabled') {
$welcome_display_in = snp_get_option('welcome_display_in');
if (is_front_page() && isset($welcome_display_in['home']) && $welcome_display_in['home'] == 1) {
snp_run_popup($WELCOME_ID, 'welcome');
} elseif (is_page() && isset($welcome_display_in['pages']) && $welcome_display_in['pages'] == 1) {
snp_run_popup($WELCOME_ID, 'welcome');
} elseif (is_single() && isset($welcome_display_in['posts']) && $welcome_display_in['posts'] == 1) {
snp_run_popup($WELCOME_ID, 'welcome');
} elseif (isset($welcome_display_in['others']) && $welcome_display_in['others'] == 1 && !is_front_page() && !is_page() && !is_single()) {
snp_run_popup($WELCOME_ID, 'welcome');
}
}
}
}
// EXIT
if (snp_get_option('exit_disable_for_logged') == 1 && is_user_logged_in()) {
} else {
if ($EXIT_ID != 'disabled' && $EXIT_ID != 'global') {
snp_run_popup($EXIT_ID, 'exit');
} elseif ($EXIT_ID === 'global') {
$EXIT_ID = snp_get_option('exit_popup' . $snp_var_sufix);
//.........这里部分代码省略.........
示例7: snp_ml_get_egoi_lists
function snp_ml_get_egoi_lists($ml_egoi_apikey = '')
{
$list = array();
if (snp_get_option('ml_egoi_apikey') || $ml_egoi_apikey) {
if (!$ml_egoi_apikey) {
$ml_egoi_apikey = snp_get_option('ml_egoi_apikey');
}
$params = array('apikey' => $ml_egoi_apikey);
try {
$client = new SoapClient('http://api.e-goi.com/v2/soap.php?wsdl');
$result = $client->getLists($params);
if (is_array($result)) {
foreach ($result as $l) {
$list[$l['listnum']] = array('name' => $l['title']);
}
}
} catch (Exception $e) {
//die($e->getMessage());
// Error
}
}
if (count($list) == 0) {
$list[0] = array('name' => 'Nothing Found...');
}
return $list;
}
示例8: snp_affiliate_message
function snp_affiliate_message()
{
if (snp_get_option('disable_affiliate_message') == 1) {
return;
}
echo "<div id=\"snp_afm\" style=\"padding: 5px 20px 20px 20px; background-color: #c0f796; margin: 40px; border: 1px solid #7AD03A; \">";
echo "<h2>Earn with Ninja Popups and Envato Affiliate Program!</h2><br/>";
echo '<a class="button button-primary" href="edit.php?post_type=snp_popups&page=snp_opt&tab=4">Tell me more</a> ';
echo '<a class="button" id="snp_afm_d" href="#">Dismiss this notice</a>';
echo "</div>";
echo "<script>jQuery(document).ready(function(\$){ \$('#snp_afm_d').click(function(){ jQuery.ajax({type: 'POST', url: 'admin-ajax.php', data: { action: 'snp_disable_affiliate_message'}}); \$('#snp_afm').hide(); return false;});});</script>";
}