Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
<?php
/**
* Activator for the Business Panda.
*
* @see Factory325_Activator
* @since 1.0.0
*/
class OPanda_Activation extends Factory325_Activator {
/**
* Runs activation actions.
*
* @since 1.0.0
*/
public function activate() {
global $bizpanda;
do_action('before_bizpanda_activation', $bizpanda, $this);
$this->importOptions();
$this->presetOptions();
$this->createPolicies();
$this->createTables();
do_action('after_bizpanda_activation', $bizpanda, $this);
}
/**
* Converts options starting with 'optinpanda_' to 'opanda_'.
*
* @since 1.0.0
*/
protected function importOptions() {
global $wpdb;
$wpdb->query("UPDATE {$wpdb->options} SET option_name = REPLACE(option_name, 'optinpanda_', 'opanda_') WHERE option_name LIKE 'optinpanda_%'");
$wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key = REPLACE(meta_key, 'optinpanda_', 'opanda_') WHERE meta_key LIKE 'optinpanda_%'");
// Convers options of the Social Locker to the options of the Opt-In Panda
$wpdb->query("UPDATE {$wpdb->options} SET option_name = REPLACE(option_name, 'sociallocker_', 'opanda_') WHERE option_name LIKE 'sociallocker_%'");
$wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key = REPLACE(meta_key, 'sociallocker_', 'opanda_') WHERE meta_key LIKE 'sociallocker_%'");
}
/**
* Presets some options required for the plugin.
*
* @since 1.0.0
*/
protected function presetOptions() {
add_option('opanda_facebook_app_id', '117100935120196');
add_option('opanda_facebook_version', 'v7.0');
add_option('opanda_lang', 'en_US');
add_option('opanda_short_lang', 'en');
add_option('opanda_tracking', 'true');
add_option('opanda_subscription_service', 'database');
}
/**
* Creates pages containing the default policies.
*
* @since 1.0.0
*/
protected function createPolicies() {
add_option('opanda_terms_enabled', 1);
add_option('opanda_privacy_enabled', 1);
add_option('opanda_terms_use_pages', 0);
add_option('opanda_terms_of_use_text', file_get_contents( OPANDA_BIZPANDA_DIR . '/content/terms-of-use.html' ));
add_option('opanda_privacy_policy_text', file_get_contents( OPANDA_BIZPANDA_DIR . '/content/privacy-policy.html' ));
}
/**
* Creates table required for the plugin.
*
* @since 1.0.0
*/
protected function createTables() {
global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
// leads
$leads = "
CREATE TABLE {$wpdb->prefix}opanda_leads (
ID int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
lead_display_name varchar(255) DEFAULT NULL,
lead_name varchar(100) DEFAULT NULL,
lead_family varchar(100) DEFAULT NULL,
lead_email varchar(50) NOT NULL,
lead_date int(11) NOT NULL,
lead_email_confirmed int(1) NOT NULL DEFAULT 0 COMMENT 'email',
lead_subscription_confirmed int(1) NOT NULL DEFAULT 0 COMMENT 'subscription',
lead_ip varchar(45) DEFAULT NULL,
lead_item_id int(11) DEFAULT NULL,
lead_post_id int(11) DEFAULT NULL,
lead_item_title varchar(255) DEFAULT NULL,
lead_post_title varchar(255) DEFAULT NULL,
lead_referer text DEFAULT NULL,
lead_confirmation_code varchar(32) DEFAULT NULL,
lead_temp text DEFAULT NULL,
PRIMARY KEY (ID),
UNIQUE KEY lead_email (lead_email)
);";
dbDelta($leads);
// leads fields
$leadsFields = "
CREATE TABLE {$wpdb->prefix}opanda_leads_fields (
lead_id int(10) UNSIGNED NOT NULL,
field_name varchar(150) NOT NULL,
field_value text NOT NULL,
field_custom bit(1) NOT NULL DEFAULT b'0',
KEY IDX_wp_opanda_leads_fields_field_name (field_name),
UNIQUE KEY UK_wp_opanda_leads_fields (lead_id,field_name)
);";
dbDelta($leadsFields);
// stats
$stats = "
CREATE TABLE {$wpdb->prefix}opanda_stats_v2 (
ID bigint(20) NOT NULL AUTO_INCREMENT,
aggregate_date date NOT NULL,
post_id bigint(20) NOT NULL,
item_id int(11) NOT NULL,
metric_name varchar(50) NOT NULL,
metric_value int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (ID),
UNIQUE KEY UK_opanda_stats_v2 (aggregate_date,item_id,post_id,metric_name)
);";
dbDelta($stats);
}
}
$bizpanda->registerActivation('OPanda_Activation');
function bizpanda_cancel_plugin_deactivation( $cancel ) {
if ( !BizPanda::isSinglePlugin() ) return true;
return $cancel;
}
add_filter('factory_cancel_plugin_deactivation_bizpanda', 'bizpanda_cancel_plugin_deactivation');

View File

@@ -0,0 +1,59 @@
<?php
add_action('wp_ajax_opanda_avatar', 'opanda_avatar');
function opanda_avatar() {
$leadId = isset( $_GET['opanda_lead_id'] ) ? intval( $_GET['opanda_lead_id'] ) : 0;
if ( empty( $leadId) ) exit;
$size = isset( $_GET['opanda_size'] ) ? intval( $_GET['opanda_size'] ) : 40;
if ( $size > 500 ) $size = 500;
if ( $size <= 0 ) $size = 40;
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/leads.php';
$imageSource = OPanda_Leads::getLeadField( $leadId, 'externalImage' );
if ( empty( $imageSource ) || !function_exists('wp_get_image_editor') ) exit;
$upload_dir = wp_upload_dir();
$basePath = $upload_dir['path'] . '/bizpanda/avatars/';
if (!file_exists($basePath) && !is_dir($basePath)) mkdir($basePath, 0777, true );
$pathAvatar = $basePath . $leadId . 'x' . $size . '.jpeg';
$pathOriginal = $basePath . $leadId . 'x' . $size . '_org.jpeg';
$response = wp_remote_get($imageSource);
if (
is_wp_error( $response ) ||
!isset( $response['headers']['content-type'] ) ||
!isset( $response['body'] ) ||
empty( $response['body'] ) ||
!preg_match( "/image/i", $response['headers']['content-type'] ) ) {
OPanda_Leads::removeLeadField($leadId, 'externalImage');
exit;
}
file_put_contents($pathOriginal, $response['body']);
$image = wp_get_image_editor( $pathOriginal );
if ( is_wp_error( $image ) ) {
OPanda_Leads::removeLeadField($leadId, 'externalImage');
exit;
}
$image->resize( $size, $size, true );
$image->set_quality( 90 );
$image->save( $pathAvatar );
$imageSource = OPanda_Leads::updateLeadField( $leadId, '_image' . $size, $leadId . 'x' . $size . '.jpeg' );
$image->stream();
exit;
}

View File

@@ -0,0 +1,27 @@
<?php
function opanda_debug_log() {
// this feature is not ready yet
return;
$dsid = isset( $_POST['opanda_dsid'] ) ? $_POST['opanda_dsid'] : null;
$message = isset( $_POST['opanda_message'] ) ? $_POST['opanda_message'] : null;
if ( empty( $dsid ) ) return;
global $wpdb;
$wpdb->insert(
$wpdb->prefix . 'opanda_debug_log',
array(
'SessionId' => $dsid,
'Message' => $message,
'RecordTime' => time()
),
array( '%s', '%s', '%d' )
);
}
add_action('wp_ajax_opanda_debug_log', 'opanda_debug_log');
add_action('wp_ajax_nopriv_opanda_debug_log', 'opanda_debug_log');

View File

@@ -0,0 +1,47 @@
<?php
/**
* Ajax requests to get a list of Panda Items to insert.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* Returns a list of the lockers.
*/
function opanda_ajax_get_lockers() {
$lockers = get_posts(array(
'post_type' => OPANDA_POST_TYPE,
'meta_key' => 'opanda_item',
'meta_value' => OPanda_Items::getAvailableNames(),
'numberposts' => -1
));
$shortcode = isset( $_REQUEST['shortcode'] ) ? $_REQUEST['shortcode'] : false;
$result = array();
foreach($lockers as $locker)
{
$itemType = get_post_meta( $locker->ID, 'opanda_item', true );
$item = OPanda_Items::getItem($itemType);
if ( !empty( $shortcode ) && $shortcode !== $item['shortcode'] ) continue;
$result[] = array(
'id' => $locker->ID,
'title' => empty( $locker->post_title ) ? '(no titled, ID=' . $locker->ID . ')' : $locker->post_title,
'shortcode' => $item['shortcode'],
'isDefault' => get_post_meta( $locker->ID, 'opanda_is_default', true )
);
}
echo json_encode($result);
die();
}
add_action('wp_ajax_get_opanda_lockers', 'opanda_ajax_get_lockers');

View File

@@ -0,0 +1,306 @@
<?php
add_action("wp_ajax_onp_sl_preview", 'onp_lock_preview');
function onp_lock_preview()
{
$resOptions = array(
'confirm_like_screen_header',
'confirm_like_screen_message',
'confirm_like_screen_button',
'confirm_screen_title',
'confirm_screen_instructiont',
'confirm_screen_note1',
'confirm_screen_note2',
'confirm_screen_cancel',
'confirm_screen_open',
'misc_data_processing',
'misc_or_enter_email',
'misc_enter_your_email',
'misc_enter_your_name',
'misc_your_agree_with',
'misc_terms_of_use',
'misc_privacy_policy',
'misc_or_wait',
'misc_close',
'misc_or',
'errors_empty_email',
'errors_inorrect_email',
'errors_empty_name',
'errors_subscription_canceled',
'misc_close',
'misc_or',
'onestep_screen_title',
'onestep_screen_instructiont',
'onestep_screen_button',
'errors_not_signed_in',
'errors_not_granted',
'signin_long',
'signin_short',
'signin_facebook_name',
'signin_twitter_name',
'signin_google_name',
'signin_linkedin_name'
);
$resources = array();
foreach($resOptions as $resName) {
$resValue = get_option('opanda_res_' . $resName, false);
if( empty($resValue) )
continue;
$resources[$resName] = $resValue;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
body {
padding: 0px;
margin: 0px;
font: normal normal 400 14px/170% Arial;
color: #333333;
text-align: justify;
}
* {
padding: 0px;
margin: 0px;
}
#wrap {
padding: 20px;
overflow: hidden;
}
p {
margin: 0px;
}
p + p {
margin-top: 8px;
}
.content-to-lock a {
color: #3185AB;
}
.content-to-lock {
text-shadow: 1px 1px 1px #fff;
padding: 20px 40px;
}
.content-to-lock .header {
margin-bottom: 20px;
}
.content-to-lock .header strong {
font-size: 16px;
text-transform: capitalize;
}
.content-to-lock .image {
text-align: center;
background-color: #f9f9f9;
border-bottom: 3px solid #f1f1f1;
margin: auto;
padding: 30px 20px 20px 20px;
}
.content-to-lock .image img {
display: block;
margin: auto;
margin-bottom: 15px;
max-width: 460px;
max-height: 276px;
height: 100%;
width: 100%;
}
.content-to-lock .footer {
margin-top: 20px;
}
</style>
<?php if( !empty($resources) ) { ?>
<script>
window.__pandalockers = {};
window.__pandalockers.lang = <?php echo json_encode($resources) ?>;
</script>
<?php } ?>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/jquery.js"></script>
<?php if( file_exists(includes_url() . 'js/jquery/ui/jquery.ui.core.min.js') ) { ?>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/jquery.ui.effect.min.js"></script>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js"></script>
<?php } else { ?>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/core.min.js"></script>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/effect.min.js"></script>
<script type="text/javascript" src="<?php echo get_site_url() ?>/wp-includes/js/jquery/ui/effect-highlight.min.js"></script>
<?php } ?>
<script type="text/javascript" src="<?php echo OPANDA_BIZPANDA_URL ?>/assets/admin/js/libs/json2.js"></script>
<?php ?>
<script type="text/javascript" src="<?php echo OPANDA_BIZPANDA_URL ?>/assets/js/lockers.min.js?<?php echo BIZPANDA_VERSION ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo OPANDA_BIZPANDA_URL ?>/assets/css/lockers.min.css?<?php echo BIZPANDA_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo OPANDA_BIZPANDA_URL ?>/assets/css/theme.all.min.css?<?php echo BIZPANDA_VERSION ?>">
<?php
?>
<?php do_action('onp_sl_preview_head') ?>
</head>
<body class="onp-sl-demo factory-fontawesome-320">
<div id="wrap" style="text-align: center; margin: 0 auto; max-width: 800px;">
<div class="content-to-lock" style="text-align: center; margin: 0 auto; max-width: 700px;">
<div class="header">
<p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing</strong></p>
<p>
Maecenas sed consectetur tortor. Morbi non vestibulum eros, at posuere nisi praesent consequat.
</p>
</div>
<div class="image">
<img src="<?php echo OPANDA_BIZPANDA_URL ?>/assets/admin/img/preview-image.jpg" alt="Preview image"/>
<i>Aenean vel sodales sem. Morbi et felis eget felis vulputate placerat.</i>
</div>
<div class="footer">
<p>Curabitur a rutrum enim, sit amet ultrices quam.
Morbi dui leo, euismod a diam vitae, hendrerit ultricies arcu.
Suspendisse tempor ultrices urna ut auctor.</p>
</div>
</div>
</div>
<div style="clear: both;"></div>
</body>
<?php do_action('opanda_preview_print_scripts', !empty($_GET)
? $_GET
: null); ?>
<script>
(function($) {
var callback = '<?php echo(isset($_POST['callback'])
? $_POST['callback']
: '') ?>';
var $originalContent = $("#wrap").clone();
window.setOptions = function(options) {
$("#wrap").remove();
$("body").prepend($originalContent.clone());
options.demo = true;
var locker = $(".content-to-lock").pandalocker(options);
locker.bind('opanda-unlock', function() {
window.alertFrameSize();
});
locker.bind('opanda-size-changed', function() {
window.alertFrameSize();
});
window.alertFrameSize();
setTimeout(function() {
window.alertFrameSize();
}, 300);
};
window.alertFrameSize = function() {
if( !parent || !callback ) {
return;
}
var height = jQuery("#wrap").height();
height += 50;
if( parent[callback] ) {
parent[callback](height);
}
};
window.dencodeOptions = function(options) {
for( var optionName in options ) {
if( !$.isPlainObject(options[optionName]) ) {
continue;
}
if( typeof options[optionName] === 'object' ) {
options[optionName] = dencodeOptions(options[optionName]);
} else {
if( options[optionName] ) {
options[optionName] = decodeURI(options[optionName]);
}
}
}
return options;
};
window.defaultOptions = {
demo: true,
text: {},
locker: {},
overlap: {},
groups: {},
socialButtons: {
buttons: {},
effects: {}
},
connectButtons: {
facebook: {},
twitter: {},
google: {},
linkedin: {}
},
subscrioption: {},
events: {
ready: function() {
alertFrameSize();
},
unlock: function() {
alertFrameSize();
},
unlockByTimer: function() {
alertFrameSize();
},
unlockByClose: function() {
alertFrameSize();
}
}
};
$(document).trigger('onp-sl-filter-preview-options-php');
$(function() {
setTimeout(function() {
alertFrameSize(true);
}, 2000);
});
var postOptions = dencodeOptions(JSON.parse('<?php echo $_POST['options'] ?>'));
var options = $.extend(window.defaultOptions, postOptions);
$(function() {
var locker = $(".content-to-lock").pandalocker(options);
locker.bind('opanda-unlock', function() {
window.alertFrameSize();
});
locker.bind('opanda-size-changed', function() {
window.alertFrameSize();
});
});
jQuery(document).click(function() {
if( parent && window.removeProfilerSelector ) {
window.removeProfilerSelector();
}
});
})(jQuery);
</script>
</html>
<?php
exit;
}

View File

@@ -0,0 +1,257 @@
<?php
add_action('wp_ajax_opanda_connect', 'opanda_connect');
add_action('wp_ajax_nopriv_opanda_connect', 'opanda_connect');
/**
* Handles requests from the jQuery version of the locker plugin.
*/
function opanda_connect() {
// shows errors in the development mode
if ( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE ) {
error_reporting(E_ALL);
ini_set('display_errors', 'On');
} else {
error_reporting(-1);
}
$handlerName = isset( $_REQUEST['opandaHandler'] ) ? $_REQUEST['opandaHandler'] : null;
$requestType = isset( $_REQUEST['opandaRequestType'] ) ? $_REQUEST['opandaRequestType'] : null;
$socialHandlers = ['facebook', 'twitter', 'google', 'linkedin', 'fblike', 'fbshare'];
$actionHandlers = ['subscription', 'signup', 'lead'];
$isSocialHandler = in_array( $handlerName, $socialHandlers );
$allowed = array_merge($socialHandlers, $actionHandlers);
if ( empty( $handlerName ) || !in_array( $handlerName, $allowed ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit;
}
if ( 'fblike' === $handlerName ) {
include OPANDA_BIZPANDA_DIR . "/includes/gates/facebook/LikeDialog.html";
exit;
} elseif ( 'fbshare' === $handlerName ) {
include OPANDA_BIZPANDA_DIR . "/includes/gates/facebook/ShareDialog.html";
exit;
}
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/Gate.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/GateBridge.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/ActionGate.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/OAuthGate.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/OAuthGateBridge.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/context/IContextReader.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/context/IContextReaderWriter.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/context/ConfigService.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/context/RequestService.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/context/SessionService.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/exceptions/GateExceptionPriority.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/exceptions/GateException.php";
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/exceptions/GateBridgeException.php";
if ( 'linkedin' === $handlerName ) {
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/$handlerName/LinkedinScope.php";
}
if ( $isSocialHandler ) {
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/$handlerName/" . ucwords( $handlerName ) . "Bridge.php";
}
require_once OPANDA_BIZPANDA_DIR . "/includes/gates/$handlerName/" . ucwords( $handlerName ) . "Gate.php";
$handlerClass = 'bizpanda\\includes\\gates\\' . $handlerName . '\\' . ucwords( $handlerName ) . 'Gate';
try {
if ( $isSocialHandler ) {
if ( empty( $requestType ) ) {
include OPANDA_BIZPANDA_DIR . "/includes/gates/$handlerName/OAuthDialog.html";
exit;
}
}
@header('Content-Type: application/json');
$gate = new $handlerClass();
$result = $gate->handleRequest();
$result['success'] = true;
echo json_encode( $result );
} catch ( Exception $exception ) {
if (
$exception instanceof bizpanda\includes\gates\exceptions\GateBridgeException ||
$exception instanceof bizpanda\includes\gates\exceptions\GateException ) {
$result = [
'success' => false,
'code' => $exception->getExceptionCode(),
'error' => $exception->getExceptionVisibleMessage(),
'details' => $exception->getExceptionDetails()
];
} else {
$result = [
'success' => false,
'error' => __('Something weird happened. We will fix it soon. Please try again later.', 'bizpanda'),
'details' => [
'clarification' => $exception->getMessage()
]
];
}
if ( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE ) {
$result['trace'] = $exception->getTraceAsString();
}
echo json_encode( $result );
}
exit;
}
/**
* Returns the handler options.
* @param $handlerName string
* @return array
*/
function opanda_get_handler_options( $handlerName ) {
switch ( $handlerName ) {
case 'facebook':
$callbackUrl = !( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE )
? opanda_local_proxy_url(['opandaHandler' => $handlerName])
: 'https://gate.sociallocker.app/fauth-wp-dev';
return [
'clientId' => get_option('opanda_facebook_app_id'),
'clientSecret' => get_option('opanda_facebook_secret'),
'callbackUrl' => $callbackUrl
];
case 'twitter':
$callbackUrl = !( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE )
? opanda_local_proxy_url(['opandaHandler' => $handlerName])
: 'https://gate.sociallocker.app/tauth-wp-dev';
$params = [
'read' => [
'clientId' => get_option('opanda_twitter_social_app_consumer_key'),
'clientSecret' => get_option('opanda_twitter_social_app_consumer_secret')
],
'write' => [
'clientId' => get_option('opanda_twitter_signin_app_consumer_key'),
'clientSecret' => get_option('opanda_twitter_signin_app_consumer_secret'),
],
'callbackUrl' => $callbackUrl
];
if ( empty( $params['read']['clientId'] ) ) {
$params['read'] = $params['write'];
}
return $params;
case 'google':
$callbackUrl = !( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE )
? opanda_local_proxy_url(['opandaHandler' => $handlerName])
: 'https://gate.sociallocker.app/gauth-wp-dev';
return [
'clientId' => get_option('opanda_google_client_id'),
'clientSecret' => get_option('opanda_google_client_secret'),
'callbackUrl' => $callbackUrl
];
case 'linkedin':
$callbackUrl = !( defined('ONP_DEVELOPING_MODE') && ONP_DEVELOPING_MODE )
? opanda_local_proxy_url(['opandaHandler' => $handlerName])
: 'https://gate.sociallocker.app/lauth-wp-dev';
return [
'clientId' => get_option('opanda_linkedin_client_id'),
'clientSecret' => get_option('opanda_linkedin_client_secret'),
'callbackUrl' => $callbackUrl
];
case 'subscription':
return array(
'service' => get_option('opanda_subscription_service', 'database')
);
case 'signup':
return array();
}
}
/**
* Returns the lists available for the current subscription service.
*
* @since 1.0.0
* @return void
*/
function opanda_get_subscrtiption_lists() {
require OPANDA_BIZPANDA_DIR.'/admin/includes/subscriptions.php';
try {
$service = OPanda_SubscriptionServices::getCurrentService();
$lists = $service->getLists();
echo json_encode($lists);
} catch (Exception $ex) {
echo json_encode( array('error' => 'Unable to get the lists: ' . $ex->getMessage() ) );
}
exit;
}
add_action( 'wp_ajax_opanda_get_subscrtiption_lists', 'opanda_get_subscrtiption_lists' );
/**
* Returns the lists available for the current subscription service.
*
* @since 1.0.0
* @return void
*/
function opanda_get_custom_fields() {
require OPANDA_BIZPANDA_DIR.'/admin/includes/subscriptions.php';
try {
$listId = isset( $_POST['opanda_list_id'] ) ? $_POST['opanda_list_id'] : null;
$service = OPanda_SubscriptionServices::getCurrentService();
$fields = $service->getCustomFields( $listId );
echo json_encode($fields);
} catch (Exception $ex) {
echo json_encode( array('error' => $ex->getMessage() ) );
}
exit;
}
add_action( 'wp_ajax_opanda_get_custom_fields', 'opanda_get_custom_fields' );

View File

@@ -0,0 +1,40 @@
<?php
/**
* Ajax requests linked with shortcodes.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
add_action('wp_ajax_opanda_loader', 'onp_sl_load_ajax_content');
add_action('wp_ajax_nopriv_opanda_loader', 'onp_sl_load_ajax_content');
/**
* Returns content of a locker shortcode.
*
* @since 1.0.0
* @return void
*/
function onp_sl_load_ajax_content() {
$hash = isset( $_POST['hash'] ) ? $_POST['hash'] : null;
$lockerId = isset( $_POST['lockerId'] ) ? intval( $_POST['lockerId'] ) : 0;
if (empty($hash) || empty($lockerId)) return;
global $wpdb;
$content = $wpdb->get_var( $wpdb->prepare(
"SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = %s",
'opanda_locker_content_hash_' . $hash
));
$content = apply_filters('opanda_ajax_content', $content);
echo $content;
exit;
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* Ajax requests linked with collecting statistics.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
add_action('wp_ajax_opanda_statistics', 'opanda_statistics');
add_action('wp_ajax_nopriv_opanda_statistics', 'opanda_statistics');
/**
* Increases counters in a database after unlocking content.
*
* @since 1.0.0
* @return void
*/
function opanda_statistics() {
global $wpdb;
$statsItem = isset( $_POST['opandaStats'] ) ? $_POST['opandaStats'] : array();
$contextData = isset( $_POST['opandaContext'] ) ? $_POST['opandaContext'] : array();
// event name
$eventName = isset( $statsItem['eventName'] ) ? $statsItem['eventName'] : null;
$eventName = opanda_normilize_value( $eventName );
// sender type
$eventType = isset( $statsItem['eventType'] ) ? $statsItem['eventType'] : null;
$eventType = opanda_normilize_value( $eventType );
// visitor id
$visitorId = isset( $statsItem['visitorId'] ) ? $statsItem['visitorId'] : null;
$visitorId = opanda_normilize_value( $visitorId );
// context data
$context = isset( $_POST['opandaContext'] ) ? $_POST['opandaContext'] : array();
$context = opanda_normilize_values( $context );
$itemId = isset( $context['itemId'] ) ? $context['itemId'] : null;
$postId = isset( $context['postId'] ) ? $context['postId'] : null;
if ( empty( $itemId ) ) {
echo json_encode( array( 'error' => __('Item ID is not specified.', 'bizpanda') ) );
exit;
}
// stats for form unlocks is counted only once for a give visitor ID,
// against multiple counting when the confirmation is used
if ( $eventName == 'form' && $eventType == 'unlock' ) {
$key = 'opanda_' . md5($visitorId . $eventName . $eventType );
$unlocked = get_transient($key);
if ( $unlocked ) return json_encode( array( 'error' => __('Already counted.', 'bizpanda') ) );
set_transient($key, 1, 10);
}
// counts the stats
include_once(OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php');
OPanda_Stats::processEvent( $itemId, $postId, $eventName, $eventType );
echo json_encode( array('success' => true) );
exit;
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Returns a list of available roles.
*/
function bp_ajax_get_user_roles() {
global $wp_roles;
$roles = $wp_roles->roles;
$values = array();
foreach( $roles as $roleId => $role ) {
$values[] = array(
'value' => $roleId,
'title' => $role['name']
);
}
$values[] = array(
'value' => 'guest',
'title' => __('Guest', 'bizpanda')
);
$result = array(
'values' => $values
);
echo json_encode($result);
exit;
}
add_action('wp_ajax_bp_ajax_get_user_roles', 'bp_ajax_get_user_roles');

View File

@@ -0,0 +1,432 @@
<?php
require_once OPANDA_BIZPANDA_DIR . '/admin/activation.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/troubleshooting.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/bulk-lock.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/helpers.php';
require_once OPANDA_BIZPANDA_DIR . '/extras/visual-composer/boot.php';
// ---
// Pages
//
#comp merge
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/base.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/new-item.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/leads.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/stats.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/settings.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use.php';
#endcomp
// ---
// Constants
//
define('OPANDA_DEPENDS_ON_LIST', 'DEPENDS_ON_LIST');
// ---
// Ajax
//
// we include a handler only if the current actions points to a given handler
if ( isset( $_REQUEST['action'] ) ) {
switch ( $_REQUEST['action'] ) {
case 'onp_sl_preview':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/preview.php';
break;
case 'opanda_avatar':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/avatar.php';
break;
case 'opanda_debug_log':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/debug.php';
break;
case 'opanda_connect':
case 'opanda_get_subscrtiption_lists':
case 'opanda_get_custom_fields':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/proxy.php';
break;
case 'opanda_loader':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/shortcode.php';
break;
case 'opanda_statistics':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/stats.php';
break;
case 'get_opanda_lockers':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/editor.php';
case 'bp_ajax_get_user_roles':
require OPANDA_BIZPANDA_DIR . '/admin/ajax/visibility.php';
}
}
// ---
// Assets
//
// ---
// Admin Menu
//
/**
* Removes the default 'new item' from the admin menu to add own pgae 'new item' later.
*
* @see menu_order
* @since 1.0.0
*/
function opanda_remove_new_item( $menu ) {
global $submenu;
if ( !isset( $submenu['edit.php?post_type=' . OPANDA_POST_TYPE] ) ) return $menu;
unset( $submenu['edit.php?post_type=' . OPANDA_POST_TYPE][10] );
return $menu;
}
add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', 'opanda_remove_new_item');
/**
* If the user tried to get access to the default 'new item',
* redirects forcibly to our page 'new item'.
*
* @see current_screen
* @since 1.0.0
*/
function opanda_redirect_to_new_item() {
$screen = get_current_screen();
if ( empty( $screen) ) return;
if ( 'add' !== $screen->action || 'post' !== $screen->base || OPANDA_POST_TYPE !== $screen->post_type ) return;
if ( isset( $_GET['opanda_item'] ) ) return;
global $bizpanda;
$url = admin_url('edit.php?post_type=' . OPANDA_POST_TYPE . '&page=new-item-' . $bizpanda->pluginName );
wp_redirect( $url );
exit;
}
add_action('current_screen', 'opanda_redirect_to_new_item');
// ---
// Editor
//
/**
* Registers the BizPanda button for the TinyMCE
*
* @see mce_buttons
* @since 1.0.0
*/
function opanda_register_button($buttons) {
if ( !current_user_can('edit_' . OPANDA_POST_TYPE) ) return $buttons;
array_push($buttons, "optinpanda");
return $buttons;
}
add_filter('mce_buttons', 'opanda_register_button');
/**
* Registers the BizPanda plugin for the TinyMCE
*
* @see mce_external_plugins
* @since 1.0.0
*/
function opanda_add_plugin($plugin_array) {
if ( !current_user_can('edit_' . OPANDA_POST_TYPE) ) return $plugin_array;
global $wp_version;
if ( version_compare( $wp_version, '3.9', '<' ) ) {
$plugin_array['optinpanda'] = OPANDA_BIZPANDA_URL . '/assets/admin/js/optinpanda.tinymce3.js';
} else {
$plugin_array['optinpanda'] = OPANDA_BIZPANDA_URL . '/assets/admin/js/optinpanda.tinymce4.010.js';
}
return $plugin_array;
}
add_filter('mce_external_plugins', 'opanda_add_plugin');
/**
* Adds js variable required for shortcodes.
*
* @see before_wp_tiny_mce
* @since 1.1.0
*/
function opanda_tinymce_data() {
// styles for the plugin shorcodes
$shortcodeIcon = BizPanda::getShortCodeIcon();
$shortcodeTitle = strip_tags( BizPanda::getMenuTitle() );
?>
<style>
i.onp-sl-shortcode-icon {
background: url("<?php echo $shortcodeIcon ?>");
}
</style>
<script>
var bizpanda_shortcode_title = '<?php echo $shortcodeTitle ?>';
</script>
<?php
}
add_action( 'admin_print_scripts', 'opanda_tinymce_data' );
// ---
// Key Events
//
/**
* Calls when anyone subscribed.
* Adds the subsriber to the table 'leads & emails' and collects some stats data.
*
* @since 1.0.0
* @return void
*/
/**
* Calls always when we subscribe an user.
*/
function opanda_subscribe( $status, $identity, $context, $isWpSubscription ) {
if ( $isWpSubscription ) return;
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/leads.php';
if ( 'subscribed' == $status ) {
// if the current service is 'database',
// then all emails should be added as unconfirmed
$serviceName = BizPanda::getSubscriptionServiceName();
$confirmed = $serviceName === 'database' ? false : true;
OPanda_Leads::add( $identity, $context, $confirmed, $confirmed );
} elseif ( 'pending' == $status ) {
OPanda_Leads::add($identity, $context, false, false);
}
}
add_action('opanda_subscribe', 'opanda_subscribe', 10, 4);
/**
* Calls always when we check the subscription status of the user.
*/
function opanda_check( $status, $identity, $context, $isWpSubscription ) {
if ( 'subscribed' == $status ) {
OPanda_Leads::add( $identity, $context, true, true );
}
}
add_action('opanda_check', 'opanda_check', 10, 4);
/**
* Calls when a new user is registered.
*/
function opanda_registered( $identity, $context = array() ) {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
$itemId = isset( $context['itemId'] ) ? intval( $context['itemId'] ) : 0;
$postId = isset( $context['postId'] ) ? intval( $context['postId'] ) : null;
OPanda_Stats::countMetrict( $itemId, $postId, 'account-registered');
}
add_action('opanda_registered', 'opanda_registered', 10, 2 );
// ---
// View Table
//
// includes the view table only if the current page is the list of panda items
if ( isset( $_GET['post_type'] ) && OPANDA_POST_TYPE === $_GET['post_type'] ) {
function opanda_filter_panda_items_in_view_table() {
global $wp_query;
$names = OPanda_Items::getAvailableNames();
$wp_query->query_vars['meta_key'] = 'opanda_item';
$wp_query->query_vars['meta_value'] = OPanda_Items::getAvailableNames();
}
add_action( 'pre_get_posts', 'opanda_filter_panda_items_in_view_table' );
require OPANDA_BIZPANDA_DIR . '/admin/includes/classes/class.lockers.viewtable.php';
}
// ---
// Post Row Actions
//
function opanda_clone_item() {
if ( !isset($_GET['action']) || $_GET['action'] !== 'opanda-clone-item' ) return;
if ( !isset($_GET['post_type']) || $_GET['post_type'] !== 'opanda-item' ) return;
if ( !isset($_GET['_wpnonce'] ) ) return;
if ( !wp_verify_nonce($_GET['_wpnonce'], 'opanda-clone-item-nonce') ) return;
global $wpdb;
$postId = (isset($_GET['post'])
? $_GET['post']
: $_POST['post']);
$post = get_post($postId);
if( isset($post) && $post != null ) {
$currentUser = wp_get_current_user();
$postAuthor = $currentUser->ID;
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $postAuthor,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => 'publish',
'post_title' => $post->post_title . " " . __('Copy', 'bizpanda'),
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order
);
$newPostId = wp_insert_post($args);
$sqlQuery = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
SELECT $newPostId as post_id, meta_key, meta_value
FROM $wpdb->postmeta WHERE post_id = {$postId}";
$wpdb->query($sqlQuery);
update_post_meta($newPostId, 'opanda_is_system', false);
update_post_meta($newPostId, 'opanda_is_default', false);
update_post_meta($newPostId, 'opanda_imperessions', 0);
update_post_meta($newPostId, 'opanda_unlocks', 0);
$bulkLockers = get_option('onp_sl_bulk_lockers', array());
if( array_key_exists($postId, $bulkLockers) ) {
$bulkLockers[$newPostId] = $bulkLockers[$postId];
update_option('onp_sl_bulk_lockers', $bulkLockers);
}
wp_redirect(admin_url('post.php?action=edit&post=' . $newPostId));
exit;
} else {
wp_die(__('Post creation failed, could not find original post!', 'opanda'));
}
}
add_action('admin_init', 'opanda_clone_item');
// ---
// Metaboxes
//
/**
* Registers default options (lockers, popups, forms).
*
* @since 1.0.0
*/
function opanda_add_meta_boxes() {
global $bizpanda;
$type = OPanda_Items::getCurrentItem();
if ( empty( $type ) ) return;
$typeName = $type['name'];
$data = array();
if ( OPanda_Items::isCurrentPremium() ) {
$data[] = array(
'class' => 'OPanda_BasicOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php'
);
$data[] = array(
'class' => 'OPanda_PreviewMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php'
);
$data[] = array(
'class' => 'OPanda_ManualLockingMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php'
);
$data[] = array(
'class' => 'OPanda_BulkLockingMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php'
);
$data[] = array(
'class' => 'OPanda_TermsOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/terms-privacy.php'
);
$data[] = array(
'class' => 'OPanda_VisabilityOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/visability-options.php'
);
$data[] = array(
'class' => 'OPanda_AdvancedOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/advanced-options.php'
);
} else {
$data[] = array(
'class' => 'OPanda_BasicOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php'
);
$data[] = array(
'class' => 'OPanda_PreviewMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php'
);
$data[] = array(
'class' => 'OPanda_ManualLockingMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php'
);
$data[] = array(
'class' => 'OPanda_BulkLockingMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php'
);
$data[] = array(
'class' => 'OPanda_TermsOptionsMetaBox',
'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/terms-privacy.php'
);
}
$data = apply_filters( "opanda_item_type_metaboxes", $data, $typeName );
$data = apply_filters( "opanda_{$typeName}_type_metaboxes", $data );
foreach( $data as $metabox ) {
require_once $metabox['path'];
FactoryMetaboxes321::registerFor( new $metabox['class']( $bizpanda ), OPANDA_POST_TYPE, $bizpanda);
}
}
add_action( 'init', 'opanda_add_meta_boxes' );

View File

@@ -0,0 +1,202 @@
<?php
/**
* Prints bulk lock status.
*
* @ToDo: Yes, this code repeats the code above.
*
* @param type $lockerId
*/
function opanda_print_bulk_locking_state( $lockerId ) {
$options = get_post_meta($lockerId, 'opanda_bulk_locking', true);
// gets values for the form
$setupStateClass = empty( $options ) ? 'onp-sl-empty-state' : 'onp-sl-has-options-state';
$wayStateClass = '';
if ( !empty($options) && isset( $options['way'] ) ) {
if ( $options['way'] == 'skip-lock' ) $wayStateClass = 'onp-sl-skip-lock-state';
elseif ( $options['way'] == 'more-tag' ) $wayStateClass = 'onp-sl-more-tag-state';
elseif ( $options['way'] == 'css-selector' ) $wayStateClass = 'onp-sl-css-selector-state';
}
$skipAndLockStateClass = '';
if ( !empty($options) && $options['way'] == 'skip-lock' ) {
if ( $options['skip_number'] == 0 ) $skipAndLockStateClass = 'onp-sl-skip-lock-0-state';
elseif ( $options['skip_number'] == 1 ) $skipAndLockStateClass = 'onp-sl-skip-lock-1-state';
elseif ( $options['skip_number'] > 1 ) $skipAndLockStateClass = 'onp-sl-skip-lock-2-state';
}
$ruleStateClass = '';
$defaultWay = 'skip-lock';
if ( !empty($options) ) $defaultWay = $options['way'];
$skipNumber = 1;
if ( !empty($options) && $options['way'] == 'skip-lock' ) {
$skipNumber = intval( $options['skip_number'] );
}
$cssSelector = '';
if ( !empty($options) && $options['way'] == 'css-selector' ) {
$cssSelector = urldecode( $options['css_selector'] );
}
$excludePosts = '';
if ( !empty($options) && !empty( $options['exclude_posts'] ) ) {
$excludePosts = implode(', ', $options['exclude_posts']);
$ruleStateClass .= ' onp-sl-exclude-post-ids-rule-state';
}
$excludeCategories = '';
if ( !empty($options) && !empty( $options['exclude_categories'] ) ) {
$excludeCategories = implode(', ', $options['exclude_categories']);
$ruleStateClass .= ' onp-sl-exclude-categories-ids-rule-state';
}
$postTypes = '';
if ( !empty($options) && !empty( $options['post_types'] ) ) {
$postTypes = implode(', ', $options['post_types'] );
$ruleStateClass .= ' onp-sl-post-types-rule-state';
}
?>
<div class="factory-bootstrap-331 factory-fontawesome-320">
<div class="onp-sl-setup-section <?php echo $setupStateClass ?>">
<div class="onp-sl-empty-content">
<span class="onp-sl-nolock">—</span>
</div>
<div class="onp-sl-has-options-content <?php echo $wayStateClass ?> <?php echo $ruleStateClass ?>">
<div class="onp-sl-way-description onp-sl-skip-lock-content <?php echo $skipAndLockStateClass ?>">
<span class="onp-sl-skip-lock-0-content">
<?php echo _e('Every post will be locked entirely.', 'bizpanda') ?>
</span>
<span class="onp-sl-skip-lock-1-content">
<?php echo _e('Every post will be locked entirely except the first paragraph.', 'bizpanda') ?>
</span>
<span class="onp-sl-skip-lock-2-content">
<?php echo sprintf( __('Every post will be locked entirely except %s paragraphs placed at the beginning.', 'bizpanda'), $skipNumber ) ?>
</span>
</div>
<div class="onp-sl-way-description onp-sl-more-tag-content">
<?php echo _e('Content placed after the More Tag will be locked in every post.', 'bizpanda') ?>
</div>
<div class="onp-sl-way-description onp-sl-css-selector-content">
<p><?php echo _e('Every content matching the CSS selector will be locked on every page:', 'bizpanda') ?></p>
<strong class="onp-sl-css-selector-view"><?php echo $cssSelector ?></strong>
</div>
<div class='onp-sl-rules'>
<span class='onp-sl-post-types-rule'>
<?php printf( __('Applies to types: %s', 'bizpanda'), $postTypes ) ?>
</span>
<span class='onp-sl-exclude-post-ids-rule'>
<?php printf( __('Excludes posts: %s', 'bizpanda'), $excludePosts ) ?>
</span>
<span class='onp-sl-exclude-categories-ids-rule'>
<?php printf( __('Excludes categories: %s', 'bizpanda'), $excludeCategories ) ?>
</span>
</div>
</div>
</div>
</div>
<?php
}
/**
* Removes the bulk locker options from the cache.
*
* @since 3.0.0
* @param integer $lockerId
* @return boolean
*/
function opanda_clear_batch_lock_cache( $lockerId ) {
$bulkLockers = get_option('onp_sl_bulk_lockers', array());
if ( !is_array($bulkLockers) ) $bulkLockers = array();
if ( isset( $bulkLockers[$lockerId] ) ) unset( $bulkLockers[$lockerId] );
delete_option('onp_sl_bulk_lockers');
add_option('onp_sl_bulk_lockers', $bulkLockers);
}
/**
* Updates the bulk locker options in the cache.
*
* @since 3.0.0
* @param integer $lockerId
* @return boolean
*/
function opanda_update_batch_lock_cache( $lockerId ) {
$data = get_post_meta($lockerId, 'opanda_bulk_locking', true);
$bulkLockers = get_option('onp_sl_bulk_lockers', array());
if ( !is_array($bulkLockers) ) $bulkLockers = array();
if ( empty( $data ) && isset( $bulkLockers[$lockerId] ) ) {
unset( $bulkLockers[$lockerId] );
delete_option('onp_sl_bulk_lockers');
add_option('onp_sl_bulk_lockers', $bulkLockers);
return;
}
if ( empty( $data ) ) return;
$bulkLockers[$lockerId] = $data;
delete_option('onp_sl_bulk_lockers');
add_option('onp_sl_bulk_lockers', $bulkLockers);
}
/**
* Deletes bulk locking options on a locker deletion.
*
* @since 3.0.0
* @return boolean
*/
function opanda_clear_bulk_locker_options_on_deletion( $postId ) {
if ( !current_user_can( 'delete_posts' ) ) return true;
$post = get_post( $postId );
if ( empty( $post) ) return true;
if ( $post->post_type !== OPANDA_POST_TYPE ) return true;
opanda_clear_batch_lock_cache($postId);
return true;
}
add_action('delete_post', 'opanda_clear_bulk_locker_options_on_deletion');
/**
* Update global bulk locker options on changing a locker status.
*
* Deletes bulk locking options on a locker deletion on moving to trash.
* And reset options on retoring from the trash.
*
* @since 3.0.0
* @return void
*/
function opanda_update_bulk_locker_options_on_changing_status( $new_status, $old_status, $post ) {
if ( empty( $post) ) return true;
if ( $post->post_type !== OPANDA_POST_TYPE ) return true;
if ( $new_status == 'trash' ) {
opanda_clear_batch_lock_cache($post->ID);
} elseif ( $new_status !== 'trash' ) {
opanda_update_batch_lock_cache($post->ID);
}
}
add_action('transition_post_status', 'opanda_update_bulk_locker_options_on_changing_status', 10, 3 );

View File

@@ -0,0 +1,281 @@
<?php
/**
* Returns an URL for purchasing a premium version of the plugin.
*
* @since 1.1.4
*
* @param string $name plugin or item name.
* @return string|false the URL to purchase
*/
function opanda_get_premium_url( $name = null, $campaign = 'na' ) {
if ( empty( $name ) ) $name = OPanda_Items::getCurrentItemName ();
$url = null;
$url = apply_filters('opanda_premium_url', $url, $name, $campaign );
if ( !empty( $url ) ) return $url;
$url = OPanda_Items::getPremiumUrl( $name );
if ( !empty( $url ) ) return $url;
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
$url = OPanda_Plugins::getPremiumUrl( $name );
if ( !empty( $url ) ) return $url;
return OPanda_Items::getPremiumUrl( $name );
}
/**
* Returns HTML offering to go premium.
*
* @since 1.1.4
*/
function opanda_get_premium_note( $wrap = true, $campaign = 'na' ) {
$url = opanda_get_premium_url( null, $campaign );
$content = '';
if ( $wrap ) {
$content .= '<div class="factory-fontawesome-320 opanda-overlay-note opanda-premium-note">';
}
$content .= sprintf( __( '<i class="fa fa-star-o"></i> <strong>Go Premium</strong> <i class="fa fa-star-o"></i><br />To Unlock These Features<br /><a href="%s" class="opnada-button" target="_blank">Learn More</a>', 'bizpanda' ), $url );
if ( $wrap ) {
$content .= '</div>';
}
return $content;
}
/**
* Prints simple visibility options
*
* @since 1.1.7
*/
function opanda_print_simple_visibility_options( $postId ) {
$hideForMember = get_post_meta($postId, 'opanda_hide_for_member', true);
$relock = get_post_meta($postId, 'opanda_relock', true);
$relockInterval = get_post_meta($postId, 'opanda_relock_interval', true);
$relockIntervalUnits = get_post_meta($postId, 'opanda_relock_interval_units', true);
$mobile = get_post_meta($postId, 'opanda_mobile', true);
$always = get_post_meta($postId, 'opanda_always', true);
$empty = !$hideForMember && !$relock && $mobile && !$always;
?>
<ul>
<?php if ( $hideForMember ) { ?>
<li><?php _e('Hide for members: <strong>yes</strong>', 'bizpanda') ?></li>
<?php } ?>
<?php if ( $relock ) { ?>
<li><?php printf( __('ReLock: <strong>%s</strong>', 'bizpanda'), ( $relock ? ( $relockInterval . ' ' . $relockIntervalUnits ) : 'no' ) ) ?></li>
<?php } ?>
<?php if ( !$mobile ) { ?>
<li><?php _e('Hide for mobile: <strong>yes</strong>', 'bizpanda') ?></li>
<?php } ?>
<?php if ( $always ) { ?>
<li><?php _e('Appears always: <strong>yes</strong>', 'bizpanda') ?></li>
<?php } ?>
<?php if ( $empty ) { ?>
<li>—</li>
<?php } ?>
</ul>
<?php
}
/**
* Prints visibility conditions
*
* @since 1.1.7
*/
function opanda_print_visibility_conditions( $postId ) {
$visibilityFilters = get_post_meta( $postId, 'opanda_visibility_filters', true );
?>
<div class="bp-visibility-conditions">
<?php
if ( empty( $visibilityFilters ) ) { ?>
-
<?php } else {
$filters = json_decode( $visibilityFilters, true );
echo '<ul class="bp-filters">';
foreach($filters as $filter) {
echo '<li class="bp-filter">';
$scopes = $filter['conditions'];
if ( empty($scopes) ) {
?>
<?php
} else {
$type = $filter['type'];
if ( 'showif' === $type ) {
echo '<div class="bp-filter-type">' . __('Show Locker IF', 'bizpanda') . '</div>';
} else {
echo '<div class="bp-filter-type">' .__('Hide Locker IF', 'bizpanda'). '</div>';
}
echo '<ul class="bp-scopes">';
foreach($scopes as $scope) {
echo '<li class="bp-scope">';
echo '<div class="bp-and"></div>';
echo '<ul class="bp-conditions">';
$conditions = $scope['conditions'];
foreach($conditions as $condition) {
$param = opanda_get_visibility_param_name( $condition['param'] );
$operator = $condition['operator'];
$value = $condition['value'];
$type = $condition['type'];
echo '<li class="bp-condition">';
echo '<div class="bp-or"></div>';
echo opanda_print_visibility_expression($param, $operator, $type, $value );
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
echo '</ul>';
}
?>
</div>
<?php
}
function opanda_get_visibility_param_name( $param ) {
switch ( $param ) {
case 'user-role':
return __('[User Role]', 'bizpanda');
case 'user-registered':
return __('[User Registered]', 'bizpanda');
case 'user-mobile':
return __('[User Mobile]', 'bizpanda');
case 'session-pageviews':
return __('[Total Pageviews]', 'bizpanda');
case 'session-locker-pageviews':
return __('[Locker Pageviews]', 'bizpanda');
case 'session-landing-page':
return __('[Landing Page]', 'bizpanda');
case 'session-referrer':
return __('[Referrer]', 'bizpanda');
case 'location-page':
return __('[Current Page]', 'bizpanda');
case 'location-referrer':
return __('[Current Referrer]', 'bizpanda');
case 'post-published':
return __('[Publication Date]', 'bizpanda');
}
return $param;
}
function opanda_print_visibility_expression( $param, $operation, $type, $value ) {
echo '<span class="bp-param">' . $param . '</span> ';
$operatorName = opanda_get_visibility_expression_operator( $operation, $type );
echo $operatorName . ' ';
if ( is_array( $value ) ) {
if ( 'date' === $type ) {
if ( isset( $value['start'] ) ) {
if ( 'relative' === $value['start']['type'] ) {
echo sprintf( __('older than <strong>%s %s</strong> but younger than <strong>%s %s</strong>', 'bizpanda'), $value['start']['unitsCount'], $value['start']['units'], $value['end']['unitsCount'], $value['end']['units'] );
} else {
echo sprintf( __('<strong>%s</strong> and <strong>%s</strong>', 'bizpanda'), date( 'd.m.Y', $value['start'] / 1000 ), date( 'd.m.Y', $value['end'] / 1000 ) );
}
} else {
if ( 'relative' === $value['type'] ) {
echo sprintf( __('<strong>%s %s</strong>', 'bizpanda'), $value['unitsCount'], $value['units'] );
} else {
echo sprintf( __('<strong>%s</strong>', 'bizpanda'), date( 'd.m.Y', $value / 1000 ) );
}
}
} else {
echo sprintf( __('<strong>%s</strong> and <strong>%s</strong>', 'bizpanda'), $value['start'], $value['end'] );
}
} else {
if ( 'date' === $type ) {
echo sprintf( __('<strong>%s</strong>', 'bizpanda'), date( 'd.m.Y', $value / 1000 ) );
} else {
echo '<strong>' . $value . '</strong>' ;
}
}
}
function opanda_get_visibility_expression_operator( $operation, $type ) {
switch( $operation ) {
case 'equals':
return __('equals', 'bizpanda');
case 'notequal':
return __('does not equal', 'bizpanda');
case 'greater':
return __('greater than', 'bizpanda');
case 'less':
return __('less than', 'bizpanda');
case 'older':
return __('older than', 'bizpanda');
case 'younger':
return __('younger than', 'bizpanda');
case 'contains':
return __('contains', 'bizpanda');
case 'notcontain':
return __('does not contain', 'bizpanda');
case 'between':
if ( $type === 'date') {
return '';
} else {
return __('between', 'bizpanda');
}
default:
return $operation;
}
}
function opanda_get_domain($url) {
$pieces = parse_url($url);
$domain = isset($pieces['host']) ? $pieces['host'] : $pieces['path'];
$domain = preg_replace('/^www\./i', '', $domain);
return $domain;
}

View File

@@ -0,0 +1,444 @@
<?php
class OPanda_LeadsListTable extends WP_List_Table
{
public function __construct( $options = array() ) {
$options['singular'] = __( 'Lead', 'bizpanda' );
$options['plural'] = __( 'Leads', 'bizpanda' );
$options['ajax'] = false;
parent::__construct( $options );
$this->bulk_delete();
}
public function get_views() {
$counts = OPanda_Leads::getCountByStatus();
$link = 'edit.php?post_type=' . OPANDA_POST_TYPE . '&page=leads-bizpanda';
$currentStatus = isset( $_GET['opanda_status'] ) ? $_GET['opanda_status'] : 'all';
if ( !in_array( $currentStatus, array('all', 'confirmed', 'not-confirmed') ) ) $currentStatus = 'all';
$items = array(
'view-all' => array(
'title' => __('All', 'bizpanda'),
'link' => $link,
'count' => array_sum($counts),
'current' => $currentStatus == 'all'
),
'view-confirmed' => array(
'title' => __('Confirmed', 'bizpanda'),
'link' => add_query_arg( 'opanda_status', 'confirmed', $link ),
'count' => $counts['confirmed'],
'current' => $currentStatus == 'confirmed'
),
'view-not-confirmed' => array(
'title' => __('Not Confirmed', 'bizpanda'),
'link' => add_query_arg( 'opanda_status', 'not-confirmed', $link ),
'count' => $counts['not-confirmed'],
'current' => $currentStatus == 'not-confirmed'
)
);
$views = array();
foreach( $items as $name => $data ) {
$views[$name] = "<a href='" . $data['link'] . "' class='" . ( $data['current'] ? 'current' : '' ) . "'>" . $data['title'] . " <span class='count'>(" . number_format_i18n( $data['count'] ) . ")</span></a>";
}
return $views;
}
public function no_items() {
echo __( 'No leads found. ', 'bizpanda');
$view = isset( $_GET['opanda_status'] ) ? $_GET['opanda_status'] : 'all';
if ( 'all' !== $view ) return;
if ( BizPanda::isSinglePlugin() ) {
if ( BizPanda::hasPlugin('optinpanda') ) {
printf('To start generating leads, create <a href="%s"><strong>Email Locker</strong></a> or <a href="%s"><strong>Sign-In Locker</strong></a> and lock with them some content on your website.', opanda_get_help_url('what-is-email-locker'), opanda_get_help_url('what-is-signin-locker'));
} else {
printf('To start generating leads, create <a href="%s"><strong>Sign-In Locker</strong></a> and lock with it some content on your website.', opanda_get_help_url('what-is-signin-locker'));
}
} else {
printf('To start generating leads, create <a href="%s"><strong>Email Locker</strong></a> or <a href="%s"><strong>Sign-In Locker</strong></a> and lock with them some content on your website.', opanda_get_help_url('what-is-email-locker'), opanda_get_help_url('what-is-signin-locker'));
}
}
public function search_box($text, $input_id) {
if( !count($this->items) && !isset($_GET['s']) ) return;
$postType = isset( $_GET['post_type'] ) ? htmlspecialchars( $_GET['post_type'] ) : '';
$page = isset( $_GET['page'] ) ? htmlspecialchars( $_GET['page'] ) : '';
$currentStatus = isset( $_GET['opanda_status'] ) ? htmlspecialchars( $_GET['opanda_status'] ) : 'all';
if ( !in_array( $currentStatus, array('all', 'confirmed', 'not-confirmed') ) ) $currentStatus = 'all';
$s = isset( $_GET['s'] ) ? htmlspecialchars( $_GET['s'] ) : '';
?>
<form id="searchform" action method="GET">
<?php if(isset($_GET['post_type'])) : ?><input type="hidden" name="post_type" value="<?php echo $postType ?>"><?php endif; ?>
<?php if(isset($_GET['page'])) : ?><input type="hidden" name="page" value="<?php echo $page ?>"><?php endif; ?>
<?php if(isset($_GET['opanda_status'])) : ?><input type="hidden" name="opanda_status" value="<?php echo $currentStatus ?>"><?php endif; ?>
<p class="search-box">
<label class="screen-reader-text" for="sa-search-input"><?php echo $text; ?></label>
<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php echo $s ?>">
<input type="submit" name="" id="search-submit" class="button" value="<?php echo $text; ?>">
</p>
</form>
<?php
}
/**
* Define the columns that are going to be used in the table
* @return array $columns, the array of columns to use with the table
*/
function get_columns() {
return $columns = array(
'cb' => '<input type="checkbox" />',
'avatar' => '',
'name' => __('Name', 'bizpanda'),
'channel' => __('Channel', 'bizpanda'),
'added' => __('Added', 'bizpanda'),
'status' => __('Status', 'bizpanda'),
);
}
/**
* Decide which columns to activate the sorting functionality on
* @return array $sortable, the array of columns that can be sorted by the user
*/
public function get_sortable_columns() {
return array(
'name' => 'name',
'channel' => 'channel',
'added' => 'added',
'status' => 'status'
);
}
public function get_bulk_actions() {
$actions = array(
'delete' => __('Delete', 'mymail')
);
return $actions;
}
/**
* Checks and runs the bulk action 'delete'.
*/
public function bulk_delete() {
$action = $this->current_action();
if ( 'delete' !== $action ) return;
if ( empty( $_POST['opanda_leads'] ) ) return;
$ids = array();
foreach( $_POST['opanda_leads'] as $leadId ) {
$ids[] = intval( $leadId );
}
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->prefix}opanda_leads WHERE ID IN (" . implode(',', $ids) . ")");
$wpdb->query("DELETE FROM {$wpdb->prefix}opanda_leads_fields WHERE lead_id IN (" . implode(',', $ids) . ")");
}
/**
* Prepare the table with different parameters, pagination, columns and table elements
*/
function prepare_items() {
global $wpdb;
$query = "SELECT * FROM {$wpdb->prefix}opanda_leads";
// where
$where = array();
if ( isset( $_GET['opanda_status'] ) && in_array( $_GET['opanda_status'], array('confirmed', 'not-confirmed') ) ) {
$where[] = 'lead_email_confirmed = ' . ( ( $_GET['opanda_status'] == 'confirmed' ) ? '1' : '0' );
}
if ( isset( $_GET['s'] ) ) {
$search = trim(addcslashes(esc_sql($_GET['s']), '%_'));
$search = explode(' ', $search);
$searchSql = " (";
$terms = array();
foreach($search as $term){
if(substr($term, 0,1) == '-'){
$term = substr($term,1);
$operator = 'AND';
$like = 'NOT LIKE';
$end = '(1=1)';
}else{
$operator = 'OR';
$like = 'LIKE';
$end = '(1=0)';
}
$termsql = " ( ";
$termsql .= " (lead_display_name $like '%".$term."%') $operator ";
$termsql .= " (lead_name $like '%".$term."%') $operator ";
$termsql .= " (lead_family $like '%".$term."%') $operator ";
$termsql .= " (lead_email $like '%".$term."%') $operator ";
$termsql .= " $end )";
$terms[] = $termsql;
}
$searchSql .= implode(' AND ', $terms) .')';
$where[] = $searchSql;
}
if ( !empty( $where ) ) {
$query .= ' WHERE ' . implode(' AND ', $where);
}
// order
$allowed = apply_filters( 'opanda_leads_allowed_orderby_columns', array( 'name', 'channel', 'added', 'status' ) );
$orderby = !empty($_GET["orderby"]) ? $_GET["orderby"] : 'added';
if ( !in_array( $orderby, $allowed ) ) $orderby = 'added';
$order = !empty($_GET["order"]) ? $_GET["order"] : 'desc';
if ( !in_array( $orderby, array('asc','desc') ) ) $order = 'desc';
if ( 'name' === $orderby ) $dbOrderBy = array( 'lead_display_name', 'lead_email');
elseif ( 'channel' === $orderby ) $dbOrderBy = array( 'lead_item_id' );
elseif ( 'added' === $orderby ) $dbOrderBy = array( 'lead_date' );
elseif ( 'status' === $orderby ) $dbOrderBy = array( 'lead_confirmed' );
else $dbOrderBy = array( $orderby );
foreach( $dbOrderBy as $index => $orderField ) {
$dbOrderBy[$index] .= ' ' . strtoupper( $order );
}
if( !empty($dbOrderBy) & !empty($order) )
$query.=' ORDER BY ' . implode ( ', ', $dbOrderBy );
$totalitems = $wpdb->get_var(str_replace("SELECT *", "SELECT COUNT(id)", $query));
$perpage = 20;
$paged = !empty($_GET["paged"]) ? intval($_GET["paged"]) : 1;
if(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }
$totalpages = ceil($totalitems/$perpage);
if(!empty($paged) && !empty($perpage)){
$offset=($paged-1)*$perpage;
$query.=' LIMIT '.(int)$offset.','.(int)$perpage;
}
$this->set_pagination_args( array(
"total_items" => $totalitems,
"total_pages" => $totalpages,
"per_page" => $perpage,
));
$this->items = $wpdb->get_results($query);
}
/**
* Shows a checkbox.
*
* @since 1.0.7
* @return void
*/
public function column_cb($record) {
return sprintf(
'<input type="checkbox" name="opanda_leads[]" value="%s" />', $record->ID
);
}
/**
* Shows an avatar of the lead.
*
* @since 1.0.7
* @return void
*/
public function column_avatar($record) {
$url = admin_url('/edit.php?post_type=opanda-item&page=leads-bizpanda&action=leadDetails&leadID=' . $record->ID);
$avatar = '';
if ( !empty( $url ) ) $avatar .= '<a href="' .$url . '" class="opanda-avatar">';
else $avatar .= '<span class="opanda-avatar">';
$avatar .= OPanda_Leads::getAvatar( $record->ID, $record->lead_email, 40 );
if ( !empty( $url ) ) $avatar .= '</a>';
else $avatar .= '</span>';
echo $avatar;
}
/**
* Shows a name of the lead.
*
* @since 1.0.7
* @return void
*/
public function column_name($record) {
$name = '';
$url = admin_url('/edit.php?post_type=opanda-item&page=leads-bizpanda&action=leadDetails&leadID=' . $record->ID);
if ( !empty( $url ) ) $name .= '<a href="' . $url . '" class="opanda-name">';
else $name .= '<strong class="opanda-name">';
if ( !empty( $record->lead_display_name ) ) {
$name .= htmlspecialchars( $record->lead_display_name );
} else {
$name .= htmlspecialchars( $record->lead_email );
}
if ( !empty( $url ) ) $name .= '</a>';
else $name .= '</strong>';
/**
Social Icons
*/
$fields = OPanda_Leads::getLeadFields( $record->ID );
if ( isset( $fields['facebookUrl'] ) ) {
$name .= sprintf( '<a href="%s" target="_blank" class="opanda-social-icon opanda-facebook-icon"><i class="fa fa-facebook"></i></a>', $fields['facebookUrl'] );
}
if ( isset( $fields['twitterUrl'] ) ) {
$name .= sprintf( '<a href="%s" target="_blank" class="opanda-social-icon opanda-twitter-icon"><i class="fa fa-twitter"></i></a>', $fields['twitterUrl'] );
}
if ( isset( $fields['googleUrl'] ) ) {
$name .= sprintf( '<a href="%s" target="_blank" class="opanda-social-icon opanda-google-icon"><i class="fa fa-google-plus"></i></a>', $fields['googleUrl'] );
}
if ( isset( $fields['linkedinUrl'] ) ) {
$name .= sprintf( '<a href="%s" target="_blank" class="opanda-social-icon opanda-linkedin-icon"><i class="fa fa-linkedin"></i></a>', $fields['linkedinUrl'] );
}
/**/
if ( !empty( $record->lead_display_name ) ) {
$name .= '<br />' . $record->lead_email;
}
echo $name;
}
/**
* Shows how the lead was generated.
*
* @since 1.0.7
* @return void
*/
public function column_channel($record) {
$itemId = $record->lead_item_id;
$itemTitle = $record->lead_item_title;
$item = get_post( $itemId );
$itemTitle = empty( $item )
? '<i>' . __('(unknown)', 'bizpanda') . '</i>'
: $item->post_title;
$via = empty( $item )
? $itemTitle
: '<a href="' . opanda_get_admin_url('stats', array('opanda_id' => $itemId)) . '"><strong>' . $itemTitle. '</strong></a>';
$via = sprintf( __("Via: %s", 'bizpanda'), $via );
$postUrl = $record->lead_referer;
$postTitle = $record->lead_post_title;
$post = get_post( $record->lead_post_id );
if ( !empty( $post) ){
$postUrl = get_permalink( $post->ID );
$postTitle = $post->post_title;
}
if ( empty( $postTitle) ) $postTitle = '<i>' . __('(no title)', 'bizpanda') . '</i>';
$referer = '<a href="' . $postUrl . '"><strong>' . $postTitle . '</strong></a>';
$where = sprintf( __("On Page: %s", 'bizpanda'), $referer );
$text = $via . '<br />' . $where;
echo $text;
}
/**
* Shows when the lead was added.
*
* @since 1.0.7
* @return void
*/
public function column_added($record) {
echo date_i18n( get_option('date_format') . ' ' . get_option('time_format'), $record->lead_date + (get_option('gmt_offset')*3600));
}
/**
* Shows a status of the lead.
*
* @since 1.0.7
* @return void
*/
public function column_status($record) {
if ( BizPanda::hasPlugin('optinpanda') ) {
if ( $record->lead_email_confirmed) { ?>
<span class="opanda-status-help" title="<?php _e('This email is real. It was received from social networks or the user confirmed it by clicking on the link inside the confirmation email.', 'bizpanda') ?>">
<i class="fa fa-check-circle-o"></i><i><?php _e('email', 'optinapnda') ?></i>
</span>
<?php } else { ?>
<span class="opanda-status-help" title="<?php _e('This email was not confirmed. It means that actually this email address may be owned by another user.', 'bizpanda') ?>">
<i class="fa fa-circle-o"></i><i><?php _e('email', 'optinapnda') ?></i>
</span>
<?php }
echo '<br />';
if ( $record->lead_subscription_confirmed) { ?>
<span class="opanda-status-help" title="<?php _e('This user confirmed his subscription.', 'bizpanda') ?>">
<i class="fa fa-check-circle-o"></i><i><?php _e('subscription', 'optinapnda') ?></i>
</span>
<?php } else { ?>
<span class="opanda-status-help" title="<?php _e('This user has not confirmed his subscription.', 'bizpanda') ?>">
<i class="fa fa-circle-o"></i><i><?php _e('subscription', 'optinapnda') ?></i>
</span>
<?php }
} else {
if ( $record->lead_email_confirmed) { ?>
<span class="opanda-status-help" title="<?php _e('This email is real. It was received from social networks.', 'bizpanda') ?>">
<i class="fa fa-check-circle-o"></i><i><?php _e('email', 'optinapnda') ?></i>
</span>
<?php } else { ?>
<span class="opanda-status-help" title="<?php _e('This email was not confirmed. It means that actually this email address may be owned by another user.', 'bizpanda') ?>">
<i class="fa fa-circle-o"></i><i><?php _e('email', 'optinapnda') ?></i>
</span>
<?php }
}
}
public function column_default( $item, $column_name ) {
$value = '';
return apply_filters('opanda_leads_column', $value, $item, $column_name );
}
}

View File

@@ -0,0 +1,163 @@
<?php
class OPanda_ItemsViewTable extends FactoryViewtables320_Viewtable
{
public function configure()
{
/**
* Columns
*/
$this->columns->clear();
$this->columns->add('stats', __('<span title="Unlocks / Impressions / Conversion">U / I / %', 'bizpanda'));
$this->columns->add('title', __('Locker Title', 'bizpanda'));
if ( !BizPanda::isSinglePlugin() ) {
$this->columns->add('type', __('Type', 'bizpanda'));
}
$this->columns->add('shortcode', __('Shortcode', 'bizpanda'));
$this->columns->add('theme', __('Theme', 'bizpanda'));
$this->columns->add('bulk', __('Bulk Lock', 'bizpanda'));
$this->columns->add('visibility', __('Visibility Conditions', 'bizpanda'));
/**
* Scripts & styles
*/
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/item-view.010000.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets//admin/css/item-view.010000.css');
}
/**
* Column 'Title'
*/
public function columnTitle( $post, $isFullMode ) {
if ($isFullMode ) {
$url = get_post_meta($post->ID, 'opanda_theme', true);
if ( empty($url) ) $url = '<i>[current page]</i>';
echo '<p>' . $post->post_title . '</p>';
echo '<p>' . $url . '</p>';
} else {
echo $post->post_title;
}
}
/**
* Column 'Type'
*/
public function columnType( $post, $isFullMode ) {
$item = get_post_meta($post->ID, 'opanda_item', true);
echo $item;
}
/**
* Column 'Shortcode'
*/
public function columnShortcode( $post, $isFullMode ) {
$isSystem = get_post_meta( $post->ID, 'opanda_is_system', true);
$itemTypeName = get_post_meta( $post->ID, 'opanda_item', true);
$item = OPanda_Items::getItem( $itemTypeName );
$shortcodeName = $item['shortcode'];
$shortcode = '[' . $shortcodeName . '] [/' . $shortcodeName . ']';
if (!$isSystem) $shortcode = '[' . $shortcodeName . ' id="' . $post->ID . '"] [/' . $shortcodeName . ']';
?>
<input class="shortcode" type="text" value='<?php echo $shortcode ?>' />
<?php
}
/**
* Column 'Shortcode'
*/
public function columnBulk( $post, $isFullMode ) {
?>
<div class='onp-sl-inner-wrap'>
<?php opanda_print_bulk_locking_state( $post->ID ); ?>
</div>
<?php
}
/**
* Column 'Theme'
*/
public function columnTheme( $post, $isFullMode ) {
$theme = get_post_meta($post->ID, 'opanda_style', true);
echo $theme;
}
/**
* Column 'Visibility Conditions'
*/
public function columnVisibility( $post, $isFullMode ) {
$mode = get_post_meta($post->ID, 'opanda_visibility_mode', true);
if ( empty( $mode) ) $mode = 'simple';
?>
<div class='onp-sl-inner-wrap'>
<?php if ( $mode === 'simple' ) { ?>
<?php opanda_print_simple_visibility_options( $post->ID ); ?>
<?php } else { ?>
<?php opanda_print_visibility_conditions( $post->ID ); ?>
<?php } ?>
</div>
<?php
}
/**
* Column 'Created'
*/
public function columnStats( $post ) {
global $optinpanda;
$imperessions = intval( get_post_meta($post->ID, 'opanda_imperessions', true) );
$conversion = '0';
$unlocks = intval( get_post_meta($post->ID, 'opanda_unlocks', true) );
if ( !empty( $imperessions )) {
$conversion = round( $unlocks / $imperessions * 100, 2 );
} elseif ( !empty( $unlocks ) ) {
$conversion = 100;
}
$strong = ( $unlocks > 0 );
$url = opanda_get_admin_url('stats', array('opanda_id' => $post->ID));
if ( $strong ) {
echo '<a href="' . $url . '"><strong>' . $unlocks . '</strong> / ' . $imperessions . ' / ' . sprintf( '%.02f', $conversion ) . '%' . '</a>';
} else {
echo '<a href="' . $url . '" class="opanda-empty">' . $unlocks . ' / ' . $imperessions . ' / ' . sprintf( '%.02f', $conversion ) . '%' . '</a>';
}
?>
<?php
}
public function actionPostRowActions( $actions ) {
global $post;
if( $post->post_type !== $this->type->name ) return $actions;
$temporaryActions = array(
'edit' => $actions['edit'],
'clone' => '<a href="' . wp_nonce_url( get_admin_url() . 'post.php?post_type=opanda-item&amp;post=' . $post->ID . '&amp;action=opanda-clone-item', 'opanda-clone-item-nonce' ) . '" title="' . __("Clone this element", 'optinpanda') . '">' . __("Clone", 'bizpanda') . '</a>',
'trash' => $actions['trash']
);
return parent::actionPostRowActions( $temporaryActions );
}
}

View File

@@ -0,0 +1,241 @@
<?php
class OPanda_StatsScreen {
public function __construct( $options ) {
$this->options = $options;
}
public function getChart( $options ) {
require_once (OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php');
$chartData = OPanda_Stats::getChartData( $options );
return new $this->options['chartClass']( $this, $chartData );
}
public function getTable( $options ) {
require_once (OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php');
$tableData = OPanda_Stats::getViewTable( $options );
return new $this->options['tableClass']( $this, $tableData );
}
}
class OPanda_StatsChart {
public $type = 'area';
public function __construct( $screen, $data ) {
$this->screen = $screen;
$this->data = $data;
}
public function getFields() {
return array();
}
public function getSelectors() {
$fields = $this->getFields();
unset($fields['aggregate_date']);
return $fields;
}
public function hasSelectors() {
$selectors = $this->getSelectors();
return !empty( $selectors );
}
public function getSelectorsNames() {
$selectors = $this->getSelectors();
if ( empty( $selectors ) ) return array();
$result = array();
foreach( $selectors as $key => $selector ) {
$result[] = "'" . $key . "'";
}
return $result;
}
public function printData() {
$fields = $this->getFields();
$output = '';
foreach ( $this->data as $rowIndex => $dataRow ) {
$dataToPrint = array();
foreach( $fields as $field => $fieldData) {
if ( 'aggregate_date' == $field ) {
$dataToPrint['date'] = array(
'value' => 'new Date('.$dataRow['year'].','.$dataRow['mon'].','.$dataRow['day'].')'
);
} else {
$dataToPrint[$field] = array(
'value' => $this->getValue( $rowIndex, $field ),
'title' => isset( $fieldData['title'] ) ? $fieldData['title'] : '',
'color' => isset( $fieldData['color'] ) ? $fieldData['color'] : null
);
}
}
$rowDataToPrint = '';
foreach( $dataToPrint as $key => $data ) {
if ( !isset( $data['title'] )) $data['title'] = '';
if ( !isset( $data['color'] )) $data['color'] = '';
$rowDataToPrint .= "'$key': {'value': {$data['value']}, 'title': '{$data['title']}', 'color': '{$data['color']}'},";
}
$rowDataToPrint = rtrim($rowDataToPrint, ',');
$output .= '{' . $rowDataToPrint . '},';
}
$output = rtrim($output, ',');
echo $output;
}
public function getValue( $rowIndex, $fieldName ) {
$camelCase = str_replace('-', ' ', $fieldName);
$camelCase = str_replace('_', ' ', $camelCase);
$camelCase = str_replace(' ', '', ucwords( $camelCase) );
$camelCase[0] = strtoupper($camelCase[0]);
if ( method_exists( $this, 'field' . $camelCase ) ) {
return call_user_func( array( $this, 'field' . $camelCase ), $this->data[$rowIndex], $rowIndex );
} else {
if ( isset( $this->data[$rowIndex][$fieldName] ) ) {
return $this->data[$rowIndex][$fieldName];
} else {
return 0;
}
}
}
}
class OPanda_StatsTable {
public $orderBy = 'unlock';
public function __construct( $screen, $data ) {
$this->screen = $screen;
$this->data = $data;
usort($data['data'], array( $this, '_usort') );
$this->data['data'] = array_reverse($data['data']);
}
public function _usort( $a, $b ) {
$orderBy = $this->orderBy;
if ( !isset( $a[$orderBy] ) && !isset( $b[$orderBy] ) ) return 0;
if ( !isset( $a[$orderBy] ) ) return -1;
if ( !isset( $b[$orderBy] ) ) return 1;
if ( $a[$orderBy] == $b[$orderBy] ) return 0;
return ($a[$orderBy] < $b[$orderBy]) ? -1 : 1;
}
public function getColumns() {
return array();
}
public function getHeaderColumns( $level = 1 ) {
$columns = $this->getColumns();
if ( 2 === $level) {
$result = array();
foreach( $columns as $column ) {
if ( !isset( $column['columns'] ) ) continue;
$result = array_merge( $result, $column['columns'] );
}
return $result;
} else {
foreach( $columns as $n => $column ) {
$columns[$n]['rowspan'] = isset( $column['columns'] ) ? 1 : 2;
$columns[$n]['colspan'] = isset( $column['columns'] ) ? count( $column['columns'] ) : 1;
}
return $columns;
}
}
public function hasComplexColumns() {
$columns = $this->getHeaderColumns( 2 );
return !empty( $columns );
}
public function getDataColumns() {
$result = array();
foreach( $this->getColumns() as $name => $column ) {
if ( isset( $column['columns'] ) ) {
$result = array_merge( $result, $column['columns'] );
} else {
$result[$name] = $column;
}
}
return $result;
}
public function getColumnsCount() {
return count( $this->getColumns() );
}
public function getRowsCount() {
return count( $this->data['data'] );
}
public function printValue( $rowIndex, $columnName, $column ) {
$camelCase = str_replace('-', ' ', $columnName);
$camelCase = str_replace('_', ' ', $camelCase);
$camelCase = str_replace(' ', '', ucwords( $camelCase) );
$camelCase[0] = strtoupper($camelCase[0]);
if ( method_exists( $this, 'column' . $camelCase ) ) {
call_user_func( array( $this, 'column' . $camelCase ), $this->data['data'][$rowIndex], $rowIndex );
} else {
$value = isset( $this->data['data'][$rowIndex][$columnName] ) ? $this->data['data'][$rowIndex][$columnName] : 0;
if ( isset( $column['prefix'] ) && $value !== 0 ) echo $column['prefix'] ;
echo $value;
}
}
public function columnIndex( $row, $rowIndex ) {
echo $rowIndex + 1;
}
public function columnTitle( $row ) {
$title = !empty( $row['title'] ) ? $row['title'] : '<i>' . __('(untitled post)', 'bizpanda') . '</i>';
if ( !empty( $row['id'] ) ) {
echo '<a href="' . get_permalink( $row['id'] ) . '" target="_blank">' . $title . ' </a>';
} else {
echo $title;
}
}
public function columnConversion( $row ) {
if ( !isset( $row['impress'] )) $row['impress'] = 0;
if ( !isset( $row['unlock'] )) $row['unlock'] = 0;
if ( $row['impress'] == 0 ) { echo '0%'; return;}
if ( $row['unlock'] > $row['impress'] ) { echo '100%'; return;}
echo ( ceil( $row['unlock'] / $row['impress'] * 10000 ) / 100 ) . '%';
}
}

View File

@@ -0,0 +1,234 @@
<?php
abstract class OPanda_Subscription {
public $name;
public $title;
public $data;
public $deliveryError;
public function __construct( $data = array() ) {
$this->data = $data;
if ( isset( $data['name']) ) $this->name = $data['name'];
if ( isset( $data['title']) ) $this->title = $data['title'];
}
public function isEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
public function isTransactional() {
return isset( $this->data['transactional'] ) && $this->data['transactional'];
}
public function hasSingleOptIn() {
return in_array('quick', $this->data['modes'] );
}
public abstract function getLists();
public abstract function subscribe( $identityData, $listId, $doubleOptin, $contextData, $verified );
public abstract function check( $identityData, $listId, $contextData );
public abstract function getCustomFields( $listId );
public function prepareFieldValueToSave( $mapOptions, $value ) {
return $value;
}
public function getNameFieldIds() {
return array();
}
public function slugify($text, $separator = ' ')
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', $separator, $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text))
{
return 'n-a';
}
return $text;
}
public function refine( $identityData, $clearEmpty = false ) {
if ( empty( $identityData ) ) return $identityData;
unset( $identityData['html'] );
unset( $identityData['label'] );
unset( $identityData['separator'] );
unset( $identityData['name'] );
unset( $identityData['family'] );
unset( $identityData['displayName'] );
unset( $identityData['fullname'] );
if ( $clearEmpty ) {
foreach ($identityData as $key => $value) {
if ( empty($value) ) unset( $identityData[$key] );
}
}
return $identityData;
}
/**
* The function to subscribe an user through Wordpress.
*/
public function wpSubscribe( $identity, $serviceReady, $context, $listId, $verified ) {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/leads.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
$email = $identity['email'];
if ( empty( $email ) ) {
throw new OPanda_SubscriptionException( __('The email is not specified.','optinpanda') );
}
$temp = array(
'identity' => $identity,
'serviceReady' => $serviceReady,
'context' => $context,
'listId' => $listId,
'verified' => $verified
);
$lead = OPanda_Leads::getByEmail($email);
// already exists
if ( $lead ) {
if ( $lead->lead_subscription_confirmed ) return array('status' => 'subscribed');
OPanda_Leads::setTempData( $lead, $temp );
$this->sendConfirmation( $lead, $context );
return array('status' => 'pending');
} else {
$leadId = OPanda_Leads::add( $identity, $context, $verified, false, $temp );
$lead = OPanda_Leads::getById($leadId);
$lead->lead_email = $email;
$this->sendConfirmation( $lead, $context );
return array('status' => 'pending');
}
}
/**
* The function to subscribe an user through Wordpress.
*/
public function wpCheck( $identity, $serviceReady, $context, $listId, $verified ) {
$email = $identity['email'];
if ( empty( $email ) ) {
throw new OPanda_SubscriptionException( __('The email is not specified.','optinpanda') );
}
$lead = OPanda_Leads::getByEmail($email);
if ( !$lead ) throw new OPanda_SubscriptionException( __('The email is not found. Please try again.','optinpanda') );
return array('status' => $lead->lead_subscription_confirmed ? 'subscribed' : 'pending');
}
/**
* The function sends the confirmation email.
*/
public function sendConfirmation( $lead, $context ) {
if ( empty( $context['itemId'] ) )
throw new OPanda_SubscriptionException( __('Invalid request. Please contact the OnePress support.', 'optinpanda') );
$lockerId = (int)$context['itemId'];
$emailSubject = get_post_meta($lockerId, 'opanda_confirm_email_subject', true);
$emailBody = get_post_meta($lockerId, 'opanda_confirm_email_body', true);
$link = $this->getConfirmationLink($lead, $context);
$emailBody = str_replace('[link]', '<a href="' . $link . '" target="_blank">' . $link . '</a>', $emailBody);
if ( $this->isTransactional() ) {
$this->send( $lead->lead_email, $emailSubject, $emailBody );
} else {
add_action( 'wp_mail_failed', array($this, 'handleDeliveryError') );
add_filter( 'wp_mail_from', array($this, 'mailFrom'), 99 );
add_filter( 'wp_mail_from_name', array($this, 'mailFromName'), 99 );
$this->deliveryError = false;
$headers[] = 'Content-type: text/html; charset=utf-8';
$result = wp_mail( $lead->lead_email, $emailSubject, $emailBody, $headers );
if ( !$result ) {
if ( $this->deliveryError ) throw new OPanda_SubscriptionException( $this->deliveryError->get_error_message() );
else throw new OPanda_SubscriptionException( __('Unable to send a confirmation email to the specified email address.', 'optinpanda') );
}
remove_action('wp_mail_failed', array($this, 'handleDeliveryError'));
remove_action('wp_mail_failed', array($this, 'wp_mail_from'));
remove_action('wp_mail_failed', array($this, 'wp_mail_from_name'));
}
}
public function handleDeliveryError( $error ) {
$this->deliveryError = $error;
}
public function mailFrom( $from ) {
$value = get_option('opanda_sender_email', null);
return empty( $value ) ? $from : $value;
}
public function mailFromName( $fromName ) {
$value = get_option('opanda_sender_name', null);
return empty( $value ) ? $fromName : $value;
}
public function getConfirmationLink( $lead, $context ) {
$uri = $context['postUrl'];
if ( empty( $uri ) ) $uri = home_url();
$code = $lead->lead_confirmation_code;
if ( empty( $code ) ) {
$code = md5( NONCE_SALT . $lead->lead_email . time() );
OPanda_Leads::setConfirmationCode($lead, $code);
}
$args = array(
'opanda_confirm' => 1,
'opanda_lead' => $lead->ID,
'opanda_code' => $code
);
return add_query_arg($args, $uri);
}
}
/**
* A subscription service exception.
*/
class OPanda_SubscriptionException extends Exception {
public function __construct ($message) {
parent::__construct($message, 0, null);
}
}

View File

@@ -0,0 +1,728 @@
<?php
class OPanda_Leads {
/**
* Adds a new lead.
*
* @since 1.0.7
* @param string[] $identity An array of the identity data.
* @param string[] $context An array of the context data.
* @param bool $confirmed Has a lead confirmed one's email address?
* @return int A lead ID.
*/
public static function add( $identity = array(), $context = array(), $emailConfirmed = false, $subscriptionConfirmed = false, $temp = null )
{
$itemId = isset( $context['itemId'] ) ? intval( $context['itemId'] ) : 0;
if ( !empty( $itemId ) && !get_post_meta($itemId, 'opanda_catch_leads', true) ) return false;
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/leads.php';
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
$email = isset( $identity['email'] ) ? $identity['email'] : false;
$lead = self::getByEmail( $email );
return self::save( $lead, $identity, $context, $emailConfirmed, $subscriptionConfirmed, $temp );
}
/**
* Inserts or updates a lead in the database.
*
* @since 1.0.7
* @param objecy $lead A lead to update.
* @param string[] $identity An array of the identity data.
* @param string[] $context An array of the context data.
* @param bool $confirmed Has a lead confirmed one's email address?
* @return int A lead ID.
*/
public static function save( $lead = null, $identity = array(), $context = array(), $emailConfirmed = false, $subscriptionConfirmed = false, $temp = null ) {
global $wpdb;
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
$email = isset( $identity['email'] ) ? $identity['email'] : false;
if ( isset( $identity['social'] ) ) $emailConfirmed = true;
$itemId = isset( $context['itemId'] ) ? intval( $context['itemId'] ) : 0;
$postId = isset( $context['postId'] ) ? intval( $context['postId'] ) : null;
$item = get_post( $itemId );
$itemTitle = !empty( $item ) ? $item->post_title : null;
$postTitle = self::extract('postTitle', $context);
$postUrl = self::extract('postUrl', $context);
$name = self::extract('name', $identity);
$family = self::extract('family', $identity);
$displayName = self::extract('displayName', $identity );
if ( empty( $displayName ) ) {
if ( !empty( $name ) && !empty( $family ) ) {
$displayName = $name . ' ' . $family;
} elseif ( !empty( $name ) ) {
$displayName = $name;
} elseif ( !empty( $family ) ) {
$displayName = $family;
} else {
$displayName = "";
}
}
$leadId = empty( $lead ) ? null : $lead->ID;
$isNew = empty( $leadId ) ? true : false;
// extra fields
$fields = array();
foreach( $identity as $itemName => $itemValue ) {
if ( in_array( $itemName, array( 'email', 'name', 'family', 'displayName' ) ) ) continue;
if ( 'image' === $itemName ) $itemName = 'externalImage';
$fields[trim( $itemName, '{}') ] = array('value' => $itemValue, 'custom' => ( strpos($itemName, '{') === 0 ) ? 1 : 0 );
}
// counts the number of confirmed emails (subscription)
if ( $subscriptionConfirmed && $leadId && !$lead->lead_subscription_confirmed ) {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
OPanda_Stats::countMetrict( $itemId, $postId, 'email-confirmed');
}
if ( !$leadId ) {
// counts the number of new recivied emails
OPanda_Stats::countMetrict( $itemId, $postId, 'email-received');
$postTitle = html_entity_decode($postTitle);
$postTitle = urldecode($postTitle);
$postTitle = preg_replace('/[^A-Za-z0-9\s\-\.\,]/', '', $postTitle);
$data = array(
'lead_display_name' => $displayName,
'lead_name' => $name,
'lead_family' => $family,
'lead_email' => $email,
'lead_date' => time(),
'lead_item_id' => $itemId,
'lead_post_id' => $postId,
'lead_item_title' => $itemTitle,
'lead_post_title' => $postTitle,
'lead_referer' => $postUrl,
'lead_email_confirmed' => $emailConfirmed ? 1 : 0,
'lead_subscription_confirmed' => $subscriptionConfirmed ? 1 : 0,
'lead_ip' => self::getIP(),
'lead_temp' => !empty( $temp ) ? json_encode( $temp ) : null
);
// else inserts a new lead
$result = $wpdb->insert( $wpdb->prefix . 'opanda_leads', $data, array(
'%s', '%s', '%s', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%s'
));
// sends a notification
if ( get_option('opanda_notify_leads', false) ) {
$receiver = trim ( get_option('opanda_leads_email_receiver') );
$subject = trim ( get_option('opanda_leads_email_subject') );
$message = trim ( get_option('opanda_leads_email_body') );
$post = get_post( $postId );
$locker = get_post( $itemId );
$eventContext = array(
sprintf ( __( 'Locker: %s', 'bizpanda' ), $locker->post_title ),
sprintf ( __( 'Where: <a href="%s">%s</a>', 'bizpanda' ), get_permalink( $postId ), $post->post_title ),
sprintf ( __( 'IP: %s', 'bizpanda' ), self::getIP() )
);
$eventContext = apply_filters('opanda_leads_notification_context', $eventContext);
$eventDetails = array(
sprintf ( __( 'Name: %s', 'bizpanda' ), $data['lead_display_name'] ),
sprintf ( __( 'Email: %s', 'bizpanda' ), $data['lead_email'] )
);
if ( count( $fields ) > 0 ) {
foreach( $fields as $fieldName => $field ) {
if ( !$field['custom'] ) continue;
$eventDetails[] = $fieldName . ': ' . $field['value'];
}
}
$eventDetails = apply_filters('opanda_leads_notification_details', $eventDetails, $data );
$replacements = array(
'sitename' => get_bloginfo('name'),
'siteurl' => get_bloginfo('url'),
'details' => implode('<br />', $eventDetails),
'context' => implode('<br />', $eventContext)
);
foreach( $replacements as $name => $replacement ) {
$subject = str_replace('{'. $name . '}', $replacement, $subject);
$message = str_replace('{'. $name . '}', $replacement, $message);
}
$headers = array();
$headers[] = 'content-type: text/html';
$subject = apply_filters('opanda_leads_notification_subject', $subject, $data );
$message = apply_filters('opanda_leads_notification_message', $message, $data );
wp_mail( $receiver, $subject, $message, $headers );
}
if ( $result ) $leadId = $wpdb->insert_id;
} else {
$data = array(
'lead_display_name' => $displayName,
'lead_email' => $email,
'lead_name' => $name,
'lead_family' => $family,
'lead_email_confirmed' => $emailConfirmed ? 1 : 0,
'lead_subscription_confirmed' => $subscriptionConfirmed ? 1 : 0,
'lead_temp' => !empty( $temp ) ? json_encode( $temp ) : null
);
$formats = array(
'lead_display_name' => '%s',
'lead_email' => '%s',
'lead_name' => '%s',
'lead_family' => '%s',
'lead_email_confirmed' => '%d',
'lead_subscription_confirmed' => '%d',
'lead_temp' => '%s'
);
// to void claring the temp data in sign in locker
// when several actions save a lead
if ( empty( $data['lead_temp'] ) ) {
unset( $data['lead_temp'] );
unset( $formats['lead_temp'] );
}
if ( empty( $displayName ) ) {
unset( $data['lead_display_name'] );
unset( $formats['lead_display_name'] );
}
if ( empty( $name ) ) {
unset( $data['lead_display_name'] );
unset( $formats['lead_display_name'] );
}
if ( empty( $family ) ) {
unset( $data['lead_display_name'] );
unset( $formats['lead_display_name'] );
}
if ( !$emailConfirmed || $lead->lead_email_confirmed ) {
unset( $data['lead_email_confirmed'] );
unset( $formats['lead_email_confirmed'] );
}
if ( !$subscriptionConfirmed || $lead->lead_subscription_confirmed ) {
unset( $data['lead_subscription_confirmed'] );
unset( $formats['lead_subscription_confirmed'] );
}
if ( !empty( $data ) ) {
$where = array(
'ID' => $leadId
);
$wpdb->update( $wpdb->prefix . 'opanda_leads', $data, $where, array_values( $formats ), array( '%s' ));
}
}
// saving extra fields
foreach( $fields as $fieldName => $fieldData ) {
$sql = $wpdb->prepare("
INSERT INTO {$wpdb->prefix}opanda_leads_fields
( lead_id, field_name, field_value, field_custom )
VALUES ( %d, %s, %s, %d ) ON DUPLICATE KEY UPDATE field_value = VALUES(field_value)
", $leadId, $fieldName, $fieldData['value'], $fieldData['custom'] );
$wpdb->query( $sql );
}
self::pushLeadToZapier( $leadId, $isNew );
return $leadId;
}
/**
* Sets a confirmation code for the lead.
*/
public static function setConfirmationCode( $lead, $code ) {
if ( empty( $lead ) ) return;
global $wpdb;
$sql = $wpdb->prepare("
UPDATE {$wpdb->prefix}opanda_leads
SET lead_confirmation_code = %s
WHERE ID = %d
", $code, $lead->ID );
$wpdb->query($sql);
}
/**
* Confirms a lead.
*/
public static function confirm( $emailOrID, $code, $push = false ) {
if ( empty( $emailOrID ) ) return;
if ( is_numeric($emailOrID) ) {
$lead = OPanda_Leads::getById($emailOrID);
} else {
$lead = OPanda_Leads::getByEmail($emailOrID);
}
if ( !$lead || $lead->lead_subscription_confirmed ) return;
if ( empty( $lead ) ) return;
if ( $code !== $lead->lead_confirmation_code ) return;
$temp = !empty( $lead->lead_temp ) ? json_decode( $lead->lead_temp, true ) : null;
$itemId = isset( $temp['context']['itemId'] ) ? $temp['context']['itemId'] : null;
$postId = isset( $temp['context']['postId'] ) ? $temp['context']['postId'] : null;
if ( $push ) {
try {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/subscriptions.php';
$serviceReady = isset( $temp['serviceReady'] ) ? $temp['serviceReady'] : null;
$context = isset( $temp['context'] ) ? $temp['context'] : null;
$listId = isset( $temp['listId'] ) ? $temp['listId'] : null;
$verified = isset( $temp['verified'] ) ? $temp['verified'] : null;
$service = OPanda_SubscriptionServices::getCurrentService();
if ( empty( $service) ) {
throw new Exception( sprintf( 'The subscription service is not set.' ));
}
$service->subscribe( $serviceReady, $listId, false, $context, $verified );
} catch (Exception $ex) {
printf ( __( "<strong>Error:</strong> %s", 'bizpanda' ), $ex->getMessage() );
exit;
}
}
global $wpdb;
$sql = $wpdb->prepare("
UPDATE {$wpdb->prefix}opanda_leads
SET lead_email_confirmed = 1, lead_subscription_confirmed = 1
WHERE ID = %d
", $lead->ID );
self::pushLeadToZapier( $lead->ID, false );
$wpdb->query($sql);
// counts the number of confirmed emails (subscription)
if ( $lead->ID && !$lead->lead_subscription_confirmed && $itemId && $postId ) {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/stats.php';
OPanda_Stats::countMetrict( $itemId, $postId, 'email-confirmed');
}
}
/**
* Sends data to Zapier if needed.
*/
public static function pushLeadToZapier( $leadId, $isNew ) {
global $wpdb;
$newLeadHookUrl = trim( get_option('opanda_zapier_hook_new_leads', "" ) );
if ( empty( $newLeadHookUrl )) return;
if ( empty( $leadId ) ) return;
$lead = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads WHERE ID = %d", $leadId ) );
if ( empty( $lead ) ) return;
$fields = self::getCustomFields( $leadId );
$onlyNewLeads = get_option('opanda_zapier_only_new', false );
$onlyConfirmed = get_option('opanda_zapier_only_confirmed', false );
if ( !(( $onlyNewLeads && $isNew ) || !$onlyNewLeads ) ) return;
if ( !(( $onlyConfirmed && $lead->lead_subscription_confirmed ) || !$onlyConfirmed ) ) return;
$zapierData = array(
'lead_email' => $lead->lead_email,
'lead_name' => $lead->lead_name,
'lead_family' => $lead->lead_family,
'lead_display_name' => $lead->lead_display_name,
'lead_ip' => $lead->lead_ip,
'post_title' => $lead->lead_post_title,
'post_url' => $lead->lead_referer
);
if ( !empty( $fields ) ) {
foreach( $fields as $name => $value ) {
$zapierData['custom_' . $name] = $value;
}
}
$zapierData = apply_filters('opanda_zapier_data', $zapierData );
$response = wp_remote_post( $newLeadHookUrl, array(
'method' => 'POST',
'timeout' => 10,
'headers' => array(
'Content-Type' => 'application/json',
'Accept' => 'application/json'
),
'body' => json_encode($zapierData)
));
}
public static function setTempData( $lead, $temp ) {
global $wpdb;
$sql = $wpdb->prepare("
UPDATE {$wpdb->prefix}opanda_leads
SET lead_temp = %s WHERE ID = %d
", json_encode($temp), $lead->ID );
$wpdb->query($sql);
}
private static $_leads = array();
/**
* Returns a lead.
*/
public static function get( $leadId ) {
if ( isset( self::$_leads[$leadId] ) ) return self::$_leads[$leadId];
global $wpdb;
$lead = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads WHERE ID = %d", $leadId ) );
self::$_leads[$leadId] = $lead;
return $lead;
}
/**
* Returns custom fields
*/
public static function getCustomFields( $leadId = null ) {
if ( !empty( $leadId )) {
global $wpdb;
$data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads_fields WHERE lead_id = %d AND field_custom = 1", $leadId ), ARRAY_A );
$customFields = array();
foreach( $data as $item ) {
$name = $item['field_name'];
if ( strpos( $name, '_' ) === 0 ) continue;
$customFields[$item['field_name']] = $item['field_value'];
$fields[$name] = strip_tags( $item['field_value'] );
}
return $customFields;
} else {
global $wpdb;
$fields = $wpdb->get_results( "SELECT field_name FROM {$wpdb->prefix}opanda_leads_fields WHERE field_custom = 1 GROUP BY field_name" );
return $fields;
}
}
private static $_fields = array();
/**
* Returns all fields of a given lead.
*
* @since 1.0.7
* @param int $leadId An id of a lead which contains fields to return.
* @return string[]
*/
public static function getLeadFields( $leadId ) {
if ( isset( self::$_fields[$leadId] ) ) return self::$_fields[$leadId];
global $wpdb;
$data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads_fields WHERE lead_id = %d", $leadId ), ARRAY_A );
$fields = array();
foreach( $data as $item ) {
$fields[$item['field_name']] = $item['field_value'];
}
self::$_fields[$leadId] = $fields;
return $fields;
}
/**
* Returns a given field of a lead.
*
* @since 1.0.7
* @param int $leadId An id of a lead which contains fields to return.
* @param string $fieldName A field name to return.
* @param mixed $default A default value to return if the field is not found in the database.
* @return string
*/
public static function getLeadField( $leadId, $fieldName, $default = null ) {
$fields = self::getLeadFields( $leadId );
return isset( $fields[$fieldName] ) ? $fields[$fieldName] : $default;
}
/**
* Removes a field of a given lead.
*
* @since 1.0.7
* @param int $leadId An id of a lead which contains a field to remove.
* @param string $fieldName A field name to remove.
* @return void
*/
public static function removeLeadField( $leadId, $fieldName ) {
self::updateLeadField( $leadId, $fieldName, null );
}
/**
* Updates a field of a given lead.
*
* @since 1.0.7
* @param int $leadId An id of a lead which contains a field to update.
* @param string $fieldName A field name to update.
* @param string $fieldValue A field value to set.
* @return void
*/
public static function updateLeadField( $leadId, $fieldName, $fieldValue ) {
global $wpdb;
if ( !isset( self::$_fields[$leadId] ) ) {
self::$_fields[$leadId] = self::getLeadFields( $leadId );
}
if ( empty( $fieldValue ) ) {
$wpdb->query( $wpdb->prepare("
DELETE FROM {$wpdb->prefix}opanda_leads_fields
WHERE lead_id = %d AND field_name = %s
", $leadId, $fieldName ));
unset( self::$_fields[$leadId][$fieldName] );
return;
}
$wpdb->query( $wpdb->prepare("
INSERT INTO {$wpdb->prefix}opanda_leads_fields
( lead_id, field_name, field_value )
VALUES ( %d, %s, %s )
ON DUPLICATE KEY UPDATE
field_value = VALUES(field_value)
", $leadId, $fieldName, $fieldValue ));
self::$_fields[$leadId][$fieldName] = $fieldValue;
}
/**
* Return an URL of the image to use as an avatar.
*
* @since 1.0.7
* @param int $leadId A lead ID for which we need to return the URL of the avatar.
* @param int $size A size of the avatar (px).
* @return string
*/
public static function getAvatarUrl( $leadId, $email = null, $size = 40 ) {
$imageSource = OPanda_Leads::getLeadField( $leadId, 'externalImage', null );
$image = OPanda_Leads::getLeadField( $leadId, '_image' . $size, null );
// getting an avatar from cache
if ( !empty( $image ) ) {
$upload_dir = wp_upload_dir();
$path = $upload_dir['path'] . '/bizpanda/avatars/' . $image;
$url = $upload_dir['url'] . '/bizpanda/avatars/' . $image;
if ( file_exists( $path ) ) return $url;
self::removeLeadField($leadId, '_image' . $size);
}
// trying to process an external image
if ( !empty( $imageSource ) && function_exists('wp_get_image_editor') ) {
return admin_url('admin-ajax.php?action=opanda_avatar&opanda_lead_id=' . $leadId) . '&opanda_size=' . $size;
}
// else return a gravatar
$gravatar = get_avatar( $email, $size );
if ( preg_match('/https?\:\/\/[^\'"]+/i', $gravatar, $match) ) {
return $match[0];
}
return null;
}
/**
* Return a HTML code markup to display avatar.
*
* @since 1.0.7
* @param int $leadId A lead ID for which we need to return the URL of the avatar.
* @param int $size A size of the avatar (px).
* @return string HTML
*/
public static function getAvatar( $leadId, $email = null, $size = 40 ) {
$url = self::getAvatarUrl( $leadId, $email, $size );
if ( empty( $url ) ) return null;
$alt = __('User Avatar', 'bizpanda');
return "<img src='$url' width='$size' height='$size' alt='$alt' />";
}
/**
* Returns an URL of the social profile of the lead.
*
* @since 1.0.7
* @param int $leadId A lead ID for which we need to return an URL of the social profile.
* @return string|false An URL of the social profile of the lead.
*/
public static function getSocialUrl( $leadId ) {
$fields = self::getLeadFields( $leadId );
if ( isset( $fields['facebookUrl'] )) return $fields['facebookUrl'];
if ( isset( $fields['twitterUrl'] )) return $fields['twitterUrl'];
if ( isset( $fields['googleUrl'] )) return $fields['googleUrl'];
if ( isset( $fields['linkedinUrl'] )) return $fields['linkedinUrl'];
return false;
}
/**
* Returns the following array:
*
* 'confirmed' => the number of leads (int),
* 'not-fonfirmed' => the number of leads (int)
*
* @since 1.0.7
*/
public static function getCountByStatus() {
global $wpdb;
$rows = $wpdb->get_results(
"SELECT COUNT(*) as status_count, lead_email_confirmed FROM {$wpdb->prefix}opanda_leads GROUP BY lead_email_confirmed",
ARRAY_A
);
$result = array();
foreach( $rows as $row ) {
$status = $row['lead_email_confirmed'] == 1 ? 'confirmed' : 'not-confirmed';
$result[$status] = intval( $row['status_count'] );
}
if ( !isset( $result['confirmed'] )) $result['confirmed'] = 0;
if ( !isset( $result['not-confirmed'] )) $result['not-confirmed'] = 0;
return $result;
}
/**
* Returns a lead by email or null.
*/
public static function getByEmail( $email ) {
global $wpdb;
return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads WHERE lead_email = %s", $email ));
}
/**
* Returns a lead by ID or null.
*/
public static function getById( $id ) {
global $wpdb;
return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}opanda_leads WHERE ID = %s", $id ));
}
protected static function extract( $name, $source, $default = null ) {
$value = isset( $source[$name] ) ? trim( $source[$name] ) : $default;
if ( empty( $value ) ) $value = $default;
return $value;
}
public static function getCount( $cache = true ) {
global $wpdb;
$count = null;
if ( $cache ) {
$count = get_transient('opanda_subscribers_count');
if ( $count === '0' || !empty( $count ) ) return intval( $count );
}
if( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}opanda_leads'") === $wpdb->prefix . 'opanda_leads' ) {
$count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}opanda_leads" );
set_transient('opanda_subscribers_count', $count, 60 * 5);
}
return $count;
}
public static function updateCount() {
self::getCount( false );
}
public static function getIP( ) {
$ip = '';
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key){
if ( array_key_exists($key, $_SERVER) !== true) continue;
foreach (explode(',', $_SERVER[$key]) as $ip){
$ip = trim($ip);
if ( !self::validateIP($ip) ) continue;
return $ip;
}
}
return $ip;
}
public static function validateIP($ip) {
if (strtolower($ip) === 'unknown') return false;
// generate ipv4 network address
$ip = ip2long($ip);
// if the ip is set and not equivalent to 255.255.255.255
if ($ip !== false && $ip !== -1) {
// make sure to get unsigned long representation of ip
// due to discrepancies between 32 and 64 bit OSes and
// signed numbers (ints default to signed in PHP)
$ip = sprintf('%u', $ip);
// do private network range checking
if ($ip >= 0 && $ip <= 50331647) return false;
if ($ip >= 167772160 && $ip <= 184549375) return false;
if ($ip >= 2130706432 && $ip <= 2147483647) return false;
if ($ip >= 2851995648 && $ip <= 2852061183) return false;
if ($ip >= 2886729728 && $ip <= 2887778303) return false;
if ($ip >= 3221225984 && $ip <= 3221226239) return false;
if ($ip >= 3232235520 && $ip <= 3232301055) return false;
if ($ip >= 4294967040) return false;
}
return true;
}
}

View File

@@ -0,0 +1,205 @@
<?php
class OPanda_Plugins {
public static function getAll() {
$items = array();
$items[] = array(
'name' => 'optinpanda',
'type' => 'free',
'title' => __('Opt-In Panda', 'bizpanda'),
'description' => __('<p>Get more email subscribers the most organic way without tiresome popups.</p><p>Opt-In Panda locks a portion of content on a webpage behind an attractive opt-in form.</p>', 'opanda'),
'url' => 'https://wordpress.org/plugins/opt-in-panda/',
'tags' => array('social', 'subscribers'),
'pluginName' => 'optinpanda'
);
$items[] = array(
'name' => 'optinpanda',
'type' => 'premium',
'title' => __('Opt-In Panda', 'bizpanda'),
'description' => __('<p>Get more email subscribers the most organic way without tiresome popups.</p><p>Also extends the Sign-In Locker by adding the subscription features.</p>', 'bizpanda'),
'url' => 'http://api.byonepress.com/public/1.0/get/?product=optinpanda',
'tags' => array('social', 'subscribers'),
'pluginName' => 'optinpanda'
);
$items[] = array(
'name' => 'sociallocker',
'type' => 'free',
'title' => __('Social Locker (Plugin)', 'bizpanda'),
'description' => __('<p>Helps to attract social traffic and improve spreading your content in social networks.</p>', 'bizpanda'),
'url' => 'https://wordpress.org/plugins/social-locker/',
'tags' => array('social', 'subscribers', 'sociallocker-ads'),
'pluginName' => 'sociallocker-next'
);
$items[] = array(
'name' => 'sociallocker',
'type' => 'premium',
'title' => __('Social Locker', 'bizpanda'),
'description' => __('<p>Helps to attract social traffic and improve spreading your content in social networks.</p><p>Also extends the Sign-In Locker by adding social actions you can set up to be performed.</p>', 'bizpanda'),
'upgradeToPremium' => __('<p>A premium version of the plugin Social Locker.</p><p>7 Social Buttons, 5 Beautiful Themes, Blurring Effect, Countdown Timer, Close Cross and more!</p>', 'bizpanda'),
'url' => 'http://api.byonepress.com/public/1.0/get/?product=sociallocker-next',
'tags' => array('social', 'subscribers', 'sociallocker-ads'),
'pluginName' => 'sociallocker-next'
);
return $items;
}
public static function getPremium() {
$all = self::getAll();
$premium = array();
foreach( $all as $item ) {
if ( $item['type'] !== 'premium' ) continue;
$premium[] = $item;
}
return $premium;
}
public static function getFree() {
$all = self::getAll();
$free = array();
foreach( $all as $item ) {
if ( $item['type'] !== 'free' ) continue;
$free[] = $item;
}
return $free;
}
public static function getSuggestions() {
$added = array();
$existingTags = array();
$suggestions = array();
// suggests premium version of free plugins
$plugins = BizPanda::getInstalledPlugins();
$hasPremium = false;
foreach( $plugins as $plugin ) {
if ( 'premium' === $plugin['type'] ) $hasPremium = true;
$pluginInfo = self::getPluginInfo($plugin['name'], $plugin['type']);
if ( !empty( $pluginInfo ) && isset( $pluginInfo['tags'] ) ) {
$existingTags = array_merge( $existingTags, $pluginInfo['tags'] );
}
if ( 'free' !== $plugin['type'] ) continue;
$pluginInfo = self::getPluginInfo($plugin['name'], 'premium');
if ( empty( $pluginInfo ) ) continue;
if ( isset( $pluginInfo['upgradeToPremium'] ) ) {
$pluginInfo['description'] = $pluginInfo['upgradeToPremium'];
}
$suggestions[] = $pluginInfo;
$added[] = $plugin['name'];
}
// adds installed plugins
foreach( $plugins as $plugin ) {
if ( in_array( $plugin['name'], $added ) ) continue;
$added[] = $plugin['name'];
}
// suggests other extending plugins
$all = self::getAll();
foreach( $all as $item ) {
if ( $hasPremium && 'premium' !== $item['type'] ) continue;
if ( in_array( $item['name'], $added ) ) continue;
if ( !isset( $item['tags'] ) ) continue;
$intersect = array_intersect( $existingTags, $item['tags'] );
if ( empty( $intersect ) ) continue;
$suggestions[] = $item;
$added[] = $item['name'];
}
$suggestions = apply_filters( 'opanda_plugins_suggestions', $suggestions );
return $suggestions;
}
public static function getPluginInfo( $pluginName, $type = null ) {
$all = self::getAll();
foreach( $all as $item ) {
if ( $item['name'] !== $pluginName ) continue;
if ( !empty( $type ) && $item['type'] !== $type ) continue;
return $item;
}
return false;
}
public static function getFreeInfo( $pluginName ) {
return self::getPluginInfo( $pluginName, 'free' );
}
public static function getPremiumInfo( $pluginName ) {
return self::getPluginInfo( $pluginName, 'premium' );
}
public static function getUrl( $pluginName, $type = null, $campaing = null ) {
$pluginInfo = self::getPluginInfo( $pluginName, $type );
if ( empty( $pluginInfo ) ) return $pluginInfo;
$url = $pluginInfo['url'];
if ( empty( $campaing ) ) return $url;
if ( false === strpos( $url, 'utm_source') ) {
if ( BizPanda::isSinglePlugin() ) {
$plugin = BizPanda::getPlugin();
$args = array(
'utm_source' => 'plugin-' . $plugin->options['name'],
'utm_medium' => ( $plugin->license && isset( $plugin->license->data['Category'] ) )
? ( $plugin->license->data['Category'] . '-version' )
: 'unknown-version',
'utm_campaign' => $campaing,
'tracker' => isset( $plugin->options['tracker'] ) ? $plugin->options['tracker'] : null
);
$url = add_query_arg( $args, $url );
} else {
$url = add_query_arg( array(
'utm_source' => 'plugin-bizpanda',
'utm_medium' => 'mixed-versions',
'utm_campaign' => $campaing,
'utm_term' => implode(',', BizPanda::getPluginNames( true ) )
), $url );
}
}
return $url;
}
public static function getPremiumUrl( $pluginName, $campaing = null ) {
return self::getUrl( $pluginName, 'premium', $campaing );
}
public static function getFreeUrl( $pluginName, $campaing = null ) {
return self::getUrl( $pluginName, 'free', $campaing );
}
}

View File

@@ -0,0 +1,307 @@
<?php
class OPanda_Stats {
/**
* Returns data to show charts.
*
* Charts show the stats for a specified item and for all or a single posts.
* @return mixed[]
*/
public static function getChartData( $options ) {
global $wpdb;
$postId = isset( $options['postId'] ) ? $options['postId'] : null;
$itemId = isset( $options['itemId'] ) ? $options['itemId'] : null;
$rangeStart = isset( $options['rangeStart'] ) ? $options['rangeStart'] : null;
$rangeEnd = isset( $options['rangeEnd'] ) ? $options['rangeEnd'] : null;
$rangeStartStr = gmdate("Y-m-d", $rangeStart);
$rangeEndStr = gmdate("Y-m-d", $rangeEnd);
// building and executeing a sql query
$extraWhere = '';
if ($postId) $extraWhere .= ' AND t.post_id=' . $postId;
if ($itemId) $extraWhere .= ' AND t.item_id=' . $itemId;
$sql = "SELECT
t.aggregate_date AS aggregate_date,
t.metric_name AS metric_name,
SUM(t.metric_value) AS metric_value
FROM
{$wpdb->prefix}opanda_stats_v2 AS t
WHERE
(aggregate_date BETWEEN '$rangeStartStr' AND '$rangeEndStr')
$extraWhere
GROUP BY
t.aggregate_date, t.metric_name";
$rawData = $wpdb->get_results($sql, ARRAY_A);
// extracting metric names stored in the database &
// grouping the same metrics data per day
$metricNames = array();
$data = array();
foreach( $rawData as $row ) {
$metricName = $row['metric_name'];
$metricValue = $row['metric_value'];
if ( !in_array( $metricName, $metricNames ) ) $metricNames[] = $metricName;
$timestamp = strtotime( $row['aggregate_date'] );
$data[$timestamp][$metricName] = $metricValue;
}
// normalizing data by adding zero value for skipped dates
$resultData = array();
$currentDate = $rangeStart;
while($currentDate <= $rangeEnd) {
$phpdate = getdate($currentDate);
$resultData[$currentDate] = array();
$resultData[$currentDate]['day'] = $phpdate['mday'];
$resultData[$currentDate]['mon'] = $phpdate['mon'] - 1;
$resultData[$currentDate]['year'] = $phpdate['year'];
$resultData[$currentDate]['timestamp'] = $currentDate;
foreach ($metricNames as $metricName) {
if ( !isset( $data[$currentDate][$metricName] ) )
$resultData[$currentDate][$metricName] = 0;
else
$resultData[$currentDate][$metricName] = $data[$currentDate][$metricName];
}
$currentDate = strtotime("+1 days", $currentDate);
}
return $resultData;
}
/**
* Returns data to show in the data table.
*/
public static function getViewTable( $options ) {
global $wpdb;
$per = isset( $options['per'] ) ? $options['per'] : 50;
$page = isset( $options['page'] ) ? $options['page'] : 1;
$total = isset( $options['total'] ) ? $options['total'] : true;
$order = isset( $options['order'] ) ? $options['order'] : 'unlock';
$rangeStart = isset( $options['rangeStart'] ) ? $options['rangeStart'] : null;
$rangeEnd = isset( $options['rangeEnd'] ) ? $options['rangeEnd'] : null;
$postId = isset( $options['postId'] ) ? $options['postId'] : null;
$itemId = isset( $options['itemId'] ) ? $options['itemId'] : null;
$rangeStartStr = gmdate("Y-m-d", $rangeStart);
$rangeEndStr = gmdate("Y-m-d", $rangeEnd);
$start = ( $page - 1 ) * $per;
$extraWhere = '';
if ($postId) $extraWhere .= 'AND t.post_id=' . $postId;
if ($itemId) $extraWhere .= ' AND t.item_id=' . $itemId;
$count = ( $total ) ? $wpdb->get_var(
"SELECT COUNT(Distinct t.post_id) FROM {$wpdb->prefix}opanda_stats_v2 AS t
WHERE (aggregate_date BETWEEN '$rangeStartStr' AND '$rangeEndStr') $extraWhere") : 0;
$sql = "
SELECT
t.metric_name AS metric_name,
SUM(t.metric_value) AS metric_value,
t.post_id AS post_id,
p.post_title AS post_title
FROM
{$wpdb->prefix}opanda_stats_v2 AS t
LEFT JOIN
{$wpdb->prefix}posts AS p ON p.ID = t.post_id
WHERE
(aggregate_date BETWEEN '$rangeStartStr' AND '$rangeEndStr') $extraWhere
GROUP BY t.post_id, t.metric_name";
$rawData = $wpdb->get_results($sql, ARRAY_A);
// extracting metric names stored in the database &
// grouping the same metrics data per day
$metricNames = array();
$resultData = array();
foreach( $rawData as $row ) {
$metricName = $row['metric_name'];
$metricValue = $row['metric_value'];
$postId = $row['post_id'];
if ( !in_array( $metricName, $metricNames ) ) $metricNames[] = $metricName;
if ( !isset( $resultData[$postId] ) ) {
$title = $row['post_title'];
if ( empty( $title ) ) $title = __('(the post not found)', 'bizpanda');
$resultData[$postId]['id'] = $postId;
$resultData[$postId]['title'] = $title;
}
$resultData[$postId][$metricName] = $metricValue;
}
$returnData = array();
foreach( $resultData as $row ) {
$returnData[] = $row;
}
return array(
'data' => $returnData,
'count' => $count
);
}
private static $_currentMySqlDate = null;
/**
* A helper method to return a current date in the MySQL format.
*/
public static function getCurrentMySqlDate() {
if ( self::$_currentMySqlDate ) return self::$_currentMySqlDate;
$hrsOffset = get_option('gmt_offset');
if (strpos($hrsOffset, '-') !== 0) $hrsOffset = '+' . $hrsOffset;
$hrsOffset .= ' hours';
$time = strtotime($hrsOffset, time());
self::$_currentMySqlDate = date("Y-m-d", $time);
return self::$_currentMySqlDate;
}
/**
* Counts custom metric.
*/
public static function countMetrict( $itemId, $postId, $metricName ) {
global $wpdb;
if ( empty( $itemId ) || empty( $postId ) ) return;
$sql = $wpdb->prepare(
"INSERT INTO {$wpdb->prefix}opanda_stats_v2
(aggregate_date,item_id,post_id,metric_name,metric_value)
VALUES (%s,%d,%d,%s,1)
ON DUPLICATE KEY UPDATE metric_value = metric_value + 1",
self::getCurrentMySqlDate(), $itemId, $postId, $metricName
);
$wpdb->query($sql);
}
/**
* Counts an event (unlock, impress, etc.)
*/
public static function processEvent( $itemId, $postId, $eventName, $eventType ) {
if ( 'unlock' == $eventType ) {
self::countMetrict( $itemId, $postId, 'unlock' );
self::countMetrict( $itemId, $postId, 'unlock-via-' . $eventName );
$post = get_post( $postId );
$locker = get_post( $itemId );
if ( get_option('opanda_notify_unlocks', false) ) {
$receiver = trim ( get_option('opanda_unlocks_email_receiver') );
$subject = trim ( get_option('opanda_unlocks_email_subject') );
$message = trim ( get_option('opanda_unlocks_email_body') );
$context = array(
sprintf ( __( 'Locker: %s', 'bizpanda' ), $locker->post_title ),
sprintf ( __( 'Via: %s', 'bizpanda' ), ucwords( str_replace( '-', ' ', $eventName ) ) ),
sprintf ( __( 'Where: <a href="%s">%s</a>', 'bizpanda' ), get_permalink( $postId ), $post->post_title ),
sprintf ( __( 'IP: %s', 'bizpanda' ), OPanda_Leads::getIP() )
);
$context = apply_filters('opanda_unlock_notification_context', $context);
$replacements = array(
'sitename' => get_bloginfo('name'),
'siteurl' => get_bloginfo('url'),
'context' => implode('<br />', $context)
);
foreach( $replacements as $name => $replacement ) {
$subject = str_replace('{'. $name . '}', $replacement, $subject);
$message = str_replace('{'. $name . '}', $replacement, $message);
}
$headers = array();
$headers[] = 'content-type: text/html';
$subject = apply_filters('opanda_unlocks_notification_subject', $subject, $data );
$message = apply_filters('opanda_unlocks_notification_message', $message, $data );
wp_mail( $receiver, $subject, $message, $headers );
}
self::pushUnlockToZapier(array(
'locker' => $locker->post_title,
'via' => ucwords( str_replace( '-', ' ', $eventName ) ),
'post_title' => $post->post_title,
'post_url' => get_permalink( $postId ),
'ip' => OPanda_Leads::getIP()
));
} elseif ( 'skip' == $eventType ) {
self::countMetrict( $itemId, $postId, 'skip' );
self::countMetrict( $itemId, $postId, 'skip-via-' . $eventName );
} else {
self::countMetrict( $itemId, $postId, $eventName );
}
// updates the summary stats for the item
if ( 'unlock' === $eventType ) {
$unlocks = intval( get_post_meta($itemId, 'opanda_unlocks', true) );
$unlocks++;
update_post_meta($itemId, 'opanda_unlocks', $unlocks);
} elseif ( 'impress' === $eventName ) {
$imperessions = intval( get_post_meta($itemId, 'opanda_imperessions', true) );
$imperessions++;
update_post_meta($itemId, 'opanda_imperessions', $imperessions);
}
}
/**
* Sends unlock data to Zapier.
*/
public static function pushUnlockToZapier( $zapierData = array() ) {
global $wpdb;
$newUnlockHookUrl = trim( get_option('opanda_zipier_hook_new_unlocks', "" ) );
if ( empty( $newUnlockHookUrl ) ) return;
$zapierData = apply_filters('opanda_zapier_data', $zapierData );
$response = wp_remote_post( $newUnlockHookUrl, array(
'method' => 'POST',
'timeout' => 5,
'headers' => array(
'Content-Type' => 'application/json',
'Accept' => 'application/json'
),
'body' => json_encode($zapierData)
));
}
}

View File

@@ -0,0 +1,184 @@
<?php
class OPanda_SubscriptionServices {
/**
* Returns a list of available subscription services.
*
* @since 1.0.8
* @return mixed[]
*/
public static function getSerivcesList() {
$result = apply_filters('opanda_subscription_services', array() );
$helper = array();
foreach( $result as $name => $data ) {
$helper[$name] = $data['title'];
}
array_multisort( $result, $helper );
return $result;
}
/**
* Returns a name of the current subscription service.
*
* @since 1.0.8
* @return OPanda_Subscription
*/
public static function getCurrentName() {
return get_option('opanda_subscription_service', 'none');
}
/**
* Returns a title of the current subscription service.
*
* @since 1.0.8
* @return OPanda_Subscription
*/
public static function getCurrentServiceTitle() {
$info = self::getCurrentServiceInfo();
return !empty( $info ) ? $info['title'] : null;
}
/**
* Returns information about the current subscription service.
*
* @since 1.0.8
* @return string[]
*/
public static function getCurrentServiceInfo() {
return self::getServiceInfo( null );
}
/**
* Returns an object of the current subscription service.
*
* @since 1.0.8
* @return OPanda_Subscription
*/
public static function getCurrentService() {
return self::getService( null );
}
/**
* Returns information about a specified service.
*
* @since 1.0.8
* @param string $name A name of the service to return.
* @return mixed[]
*/
public static function getServiceInfo( $name = null ) {
$services = self::getSerivcesList();
$name = empty( $name ) ? get_option('opanda_subscription_service', 'none') : $name;
if ( !isset( $services[$name] ) ) $name = 'none';
if ( isset( $services[$name] ) ) {
$services[$name]['name'] = $name;
return $services[$name];
}
return null;
}
/**
* Returns an object of a specified subscription service.
*
* @since 1.0.8
* @param string $name A name of the service to return.
* @return OPanda_Subscription
*/
public static function getService( $name = null ) {
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/classes/class.subscription.php';
$info = self::getServiceInfo( $name );
if ( empty( $info) ) return null;
require_once $info['path'];
return new $info['class']( $info );
}
/**
* Returns available opt-in modes for the current subscription service.
*
* @since 1.0.8
* @param string $name A name of the service to return.
* @return mixed[]
*/
public static function getCurrentOptinModes( $toList = false ) {
$result = array();
$finish = array();
$info = self::getCurrentServiceInfo();
if ( empty( $info ) ) return array();
if ( OPANDA_DEPENDS_ON_LIST === $info['modes'] ) {
if ( !$toList ) {
return array( OPANDA_DEPENDS_ON_LIST );
} else {
$finish[] = array( OPANDA_DEPENDS_ON_LIST, __('[ Depends on the list ]', 'bizpanda'), __( 'The Opt-In Mode depends on the settings of the list you selected. Check the <a href="http://freshmail.com/help-and-knowledge/help/managing-clients/set-parameters-list-recipients/" target="_blank">parameter</a> "List type" of the selected list in your FreshMail account to know which Opt-In Mode will be applied.', 'bizpanda') );
return $finish;
}
}
$all = self::getAllOptinModes();
foreach( $info['modes'] as $name ) {
$result[$name] = $all[$name];
}
if ( !$toList ) return $result;
if ( isset( $result['quick'] ) ) {
if ( !isset($result['double-optin'] ) ) {
$result['double-optin'] = $all['double-optin'];
}
if ( !isset($result['quick-double-optin'] ) ) {
$result['quick-double-optin'] = $all['quick-double-optin'];
}
}
foreach( $result as $name => $mode ) {
$finish[] = array(
'value' => $name,
'title' => $mode['title'],
'hint' => $mode['description']
);
}
return $finish;
}
/**
* Returns all the available opt-in modes.
*
* @since 1.0.8
* @return mixed[]
*/
public static function getAllOptinModes() {
$modes = array(
'double-optin' => array(
'title' => __('Double Opt-In', 'bizpanda'),
'description' => __('After the user enters one\'s email address, sends the confirmation email (double opt-in) and waits until the user confirms the subscription. Then, unlocks the content. If the user subscribes via the social buttons, the confirmation is not required.', 'bizpanda')
),
'quick-double-optin' => array(
'title' => __('Lazy Double Opt-In', 'bizpanda'),
'description' => __('Unlocks the content immediately after the user enters one\'s email address but also sends the confirmation email (double opt-in) to confirm the subscription. If the user subscribes via the social buttons, the confirmation is not required.', 'bizpanda')
),
'quick' => array(
'title' => __('Single Opt-In', 'bizpanda'),
'description' => __('Unlocks the content immediately after the user enters one\'s email address. Doesn\'t send the confirmation email.', 'bizpanda')
),
);
return apply_filters('opanda_optin_modes', $modes);
}
}

View File

@@ -0,0 +1,137 @@
<?php
class OPanda_ItemsViewTable extends FactoryViewtables320_Viewtable
{
public function configure()
{
/**
* Columns
*/
$this->columns->clear();
$this->columns->add('stats', __('<span title="Unlocks / Impressions / Conversion">U / I / %', 'bizpanda'));
$this->columns->add('title', __('Locker Title', 'bizpanda'));
$this->columns->add('shortcode', __('Shortcode', 'bizpanda'));
$this->columns->add('bulk', __('Bulk Lock', 'bizpanda'));
$this->columns->add('visibility', __('Visibility', 'bizpanda'));
$this->columns->add('created', __('Created', 'bizpanda'));
/**
* Scripts & styles
*/
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/item-view.010000.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets//admin/css/item-view.010000.css');
}
/**
* Column 'Title'
*/
public function columnTitle( $post, $isFullMode ) {
if ($isFullMode ) {
$url = get_post_meta($post->ID, 'opanda_theme', true);
if ( empty($url) ) $url = '<i>[current page]</i>';
echo '<p>' . $post->post_title . '</p>';
echo '<p>' . $url . '</p>';
} else {
echo $post->post_title;
}
}
/**
* Column 'Shortcode'
*/
public function columnShortcode( $post, $isFullMode ) {
$isSystem = get_post_meta( $post->ID, 'opanda_is_system', true);
$itemTypeName = get_post_meta( $post->ID, 'opanda_item', true);
$item = OPanda_Items::getItem( $itemTypeName );
$shortcodeName = $item['shortcode'];
$shortcode = '[' . $shortcodeName . '] [/' . $shortcodeName . ']';
if (!$isSystem) $shortcode = '[' . $shortcodeName . ' id="' . $post->ID . '"] [/' . $shortcodeName . ']';
?>
<input class="shortcode" type="text" value='<?php echo $shortcode ?>' />
<?php
}
/**
* Column 'Shortcode'
*/
public function columnBulk( $post, $isFullMode ) {
?>
<div class='onp-sl-inner-wrap'>
<?php echo opanda_print_bulk_locking_state( $post->ID ); ?>
</div>
<?php
}
/**
* Column 'Theme'
*/
public function columnVisibility( $post, $isFullMode ) {
$theme = get_post_meta($post->ID, 'opanda_style', true);
echo $theme;
}
/**
* Column 'Created'
*/
public function columnCreated( $post, $isFullMode ) {
$t_time = get_the_time( 'Y/m/d g:i:s A' );
$m_time = $post->post_date;
$time = get_post_time( 'G', true, $post );
$time_diff = time() - $time;
if ( $time_diff > 0 && $time_diff < 24*60*60 )
$h_time = sprintf( '%s ago', human_time_diff( $time ) );
else
$h_time = mysql2date( 'Y/m/d', $m_time );
echo '<abbr title="' . esc_attr( $t_time ) . '">' . $h_time . '</abbr><br />';
}
/**
* Column 'Created'
*/
public function columnStats( $post ) {
global $optinpanda;
$imperessions = intval( get_post_meta($post->ID, 'opanda_imperessions', true) );
$conversion = '0';
$unlocks = intval( get_post_meta($post->ID, 'opanda_unlocks', true) );
if ( !empty( $imperessions )) {
$conversion = round( $unlocks / $imperessions * 100, 2 );
} elseif ( !empty( $unlocks ) ) {
$conversion = 100;
}
$strong = ( $unlocks > 0 );
$url = opanda_get_admin_url('stats', array('opanda_id' => $post->ID));
if ( $strong ) {
echo '<a href="' . $url . '"><strong>' . $unlocks . '</strong> / ' . $imperessions . ' / ' . sprintf( '%.02f', $conversion ) . '%' . '</a>';
} else {
echo '<a href="' . $url . '" class="opanda-empty">' . $unlocks . ' / ' . $imperessions . ' / ' . sprintf( '%.02f', $conversion ) . '%' . '</a>';
}
?>
<?php
}
}

View File

@@ -0,0 +1,15 @@
<?php
// pages
class OPanda_AdminPage extends FactoryPages321_AdminPage {
/**
* Factory Dependencies
*
* @since 1.0.0
* @var string
*/
protected $deps = array(
'factory_core' => FACTORY_325_VERSION
);
}

View File

@@ -0,0 +1,755 @@
<?php
/**
* The file contains a short help info.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* Common Settings
*/
class OPanda_HowToUsePage extends FactoryPages321_AdminPage {
public $menuPostType = OPANDA_POST_TYPE;
public $id = "how-to-use";
public function __construct(Factory325_Plugin $plugin) {
parent::__construct($plugin);
$this->menuTitle = __('How to use?', 'bizpanda');
}
public function assets($scripts, $styles) {
$this->scripts->request('jquery');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/howtouse.030100.css');
$this->styles->request('bootstrap.core', 'bootstrap');
}
protected $_pages = false;
/**
* Returns an array of the pages of the section 'How to use?'.
*
* @since 1.0.0
* @return mixed[]
*/
protected function getPages() {
if ( $this->_pages !== false ) return $this->_pages;
$items = array(
array(
'name' => 'social-apps',
'title' => __('Creating Social Apps', 'bizpanda'),
'hollow' => true,
'items' => array(
array(
'name' => 'facebook-app',
'title' => __('Creating Facebook App', 'bizpanda')
),
array(
'name' => 'twitter-app',
'title' => __('Creating Twitter App', 'bizpanda')
),
array(
'name' => 'google-client-id',
'title' => __('Getting Google Client ID', 'bizpanda')
)
)
),
array(
'name' => 'zapier',
'title' => __('Zapier Integration', 'bizpanda')
),
array(
'name' => 'troubleshooting',
'title' => __('Troubleshooting', 'bizpanda')
)
);
$items[0]['items'][] = array(
'name' => 'linkedin-api-key',
'title' => __('Getting LinkedIn API Key', 'bizpanda')
);
$this->_pages = apply_filters( 'opanda_help_pages', $items );
return $this->_pages;
}
/**
* Returns a current page name.
*
* @since 1.0.0
* @return string The current page name or null.
*/
protected function _getCurrentPageName() {
if ( isset( $_GET['onp_sl_page'] ) ) return $_GET['onp_sl_page'];
$pages = $this->getPages();
return $pages[0]['name'];
}
/**
* Returns a parent page name of the current page.
*
* @since 1.0.0
* @return string|null A page name of the current parent page or null.
*/
protected function _getCurrentParentPage() {
$current = $this->_getCurrentPageName();
$page = $this->getPageData( $current );
if ( $page ) return $page['parent'];
return null;
}
/**
* Returns data of the specified page, including the parent page name.
*
* @since 1.0.0
* @return mixed[]|null The page data or null.
*/
protected function _getPageData( $name, $parent = null, $haystack = null ) {
$haystack = ( empty( $haystack ) ) ? $this->getPages() : $haystack;
foreach( $haystack as $page ) {
if ( $page['name'] == $name ) {
$page['parent'] = $parent['name'];
return $page;
}
if ( isset( $page['items'] ) ) {
$result = $this->_getPageData( $name, $page, $page['items'] );
if ( $result ) return $result;
}
}
return null;
}
/**
* Gets the full path (which includes all parent pages) to a given page.
*
* @param type $pageName A page name to return the full path.
* @return mixed[] The navigation branch.
*/
protected function _getPageTree( $pageName = null ) {
if ( empty( $pageName ) ) $pageName = $this->_getCurrentPageName();
$tree = array();
$pageNameToSearch = $pageName;
while( true ) {
$pageData = $this->_getPageData( $pageNameToSearch );
if ( empty( $pageData ) ) break;
$tree[] = $pageData['name'];
if ( empty( $pageData['parent']) ) break;
$pageNameToSearch = $pageData['parent'];
}
return $tree;
}
/**
* Renders the navigation.
*
* @since 1.0.0
* @return void
*/
protected function _renderNav( $currents = array() ) {
$pages = $this->getPages();
$index = 1;
?>
<div class="onp-help-nav">
<?php foreach( $pages as $item ) {
$item['title'] = $index . '. ' . $item['title'];
$index++;
$this->_renderNavItem( $item, 0, $currents );
} ?>
</div>
<?php
}
/**
* Renders a single navigation item including its childs.
*
* @since 1.0.0
* @param string[] $item Navigation item to renders.
* @param int $level Current navigation level, used in the recursion.
* @return void
*/
protected function _renderNavItem( $item, $level = 0, $currents = array() ) {
$classes = array();
$classes[] = 'onp-help-nav-level';
$classes[] = 'onp-help-nav-level-' . $level;
switch($level) {
case 0:
$classes[] = 'onp-help-nav-category';
break;
case 1:
$classes[] = 'onp-help-nav-page';
break;
case 2:
$classes[] = 'onp-help-nav-subpage';
break;
}
$classes[] = 'onp-help-' . $item['name'];
if ( in_array( $item['name'], $currents ) ) {
$classes[] = 'onp-help-active-item';
}
$isGroup = isset( $item['items'] );
if ( $isGroup ) $classes[] = 'onp-has-subitems';
$class = implode(' ', $classes);
$level = $level + 1;
$url = $isGroup && ( isset( $item['hollow'] ) && $item['hollow'] )
? $this->getActionUrl('index', array('onp_sl_page' => $item['items'][0]['name'] ) )
: $this->getActionUrl('index', array('onp_sl_page' => $item['name'] ) );
?>
<div class="<?php echo $class ?>">
<div class="onp-inner-wrap">
<a href="<?php echo $url; ?>">
<?php if ( $isGroup ): ?>
<l class="fa fa-plus-square-o"></l>
<l class="fa fa-minus-square-o"></l>
<?php endif ?>
<span><?php echo $item['title'] ?></span>
</a>
<?php if ( isset( $item['items'] )): ?>
<div class="onp-help-nav-subitems">
<?php foreach( $item['items'] as $subItem ) { $this->_renderNavItem( $subItem, $level, $currents ); } ?>
</div>
<?php endif ?>
</div>
</div>
<?php
}
/**
* Shows the content table for a given navigatin item (category, page).
*
* @param mixed[] $page An
* @return type
*/
public function showContentTable( $page = null ) {
$page = empty( $page ) ? $this->current : $page;
if ( empty( $page) ) return;
$data = $this->_getPageData( $page );
if ( empty( $data['items']) ) return;
?>
<ul>
<?php foreach( $data['items'] as $item ) { ?>
<li>
<a href="<?php $this->actionUrl('index', array( 'onp_sl_page' => $item['name'] )) ?>"><?php echo $item['title'] ?></a>
</li>
<?php } ?>
</ul>
<?php
}
/**
* Shows one of the help pages.
*
* @sinve 1.0.0
* @return void
*/
public function indexAction() {
$this->current = $this->_getCurrentPageName();
$this->currents = $this->_getPageTree();
add_action('opanda_help_page_facebook-app', array($this, 'facebookApp' ));
add_action('opanda_help_page_twitter-app', array($this, 'twitterApp' ));
add_action('opanda_help_page_google-client-id', array($this, 'googleClientId' ));
add_action('opanda_help_page_linkedin-api-key', array($this, 'linkedinApiKey' ));
add_action('opanda_help_page_troubleshooting', array($this, 'troubleshooting' ));
add_action('opanda_help_page_zapier', array($this, 'zapier' ));
?>
<div class="wrap factory-bootstrap-331 factory-fontawesome-320">
<?php $this->_renderNav( $this->currents ) ?>
<div class="onp-help-content">
<div class="onp-inner-wrap">
<?php do_action('opanda_help_page_' . $this->current, $this ) ?>
</div>
</div>
</div>
<?php
return;
}
/**
* Shows 'Troubleshooting'
*
* @sinve 1.0.0
* @return void
*/
public function troubleshooting() {
?>
<div class="onp-help-section">
<h1><?php _e('Troubleshooting', 'bizpanda'); ?></h1>
<p><?php _e('If you have any questions or faced with any troubles while using our plugin, please check our <a href="http://support.onepress-media.com/" target="_blank">knowledge base</a>. It is possible that instructions for resolving your issue have already been posted.', 'bizpanda'); ?></p>
<p>
<?php _e('If the answer to your question isn\'t listed, please submit a ticket <a href="http://support.onepress-media.com/create-ticket/" target="_blank">here</a>.<br />You can also email us directly <strong>support@byonepress.com</strong>', 'bizpanda'); ?>
</p>
</div>
<?php
}
/**
* Shows 'Get more features!'
*
* @sinve 1.0.0
* @return void
*
*/
public function premium() {
global $optinpanda;
$alreadyActivated = get_option('onp_trial_activated_' . $optinpanda->pluginName, false);
?>
<div class="onp-help-section">
<?php if ( !$alreadyActivated ) { ?>
<h1><?php _e('Try Premium Version For 7 Days For Free!', 'bizpanda'); ?></h1>
<?php } else { ?>
<h1><?php _e('Upgrade Opt-In Panda To Premium!', 'bizpanda'); ?></h1>
<?php } ?>
<?php if ( !$alreadyActivated ) { ?>
<p>
<?php printf( __('The plugin you are using is a free version of the popular <a target="_blank" href="%s"> Opt-In Panda</a> plugin.
We offer you to try the premium version for 7 days absolutely for free. We sure you will love it.', 'bizpanda'), onp_licensing_325_get_purchase_url( $this->plugin ) ) ?>
</p>
<p>
<?php _e('Check out the table below to know about the premium features.', 'bizpanda'); ?>
</p>
<?php } else { ?>
<p>
<?php _e('The plugin you are using is a free version of the popular <a target="_blank" href="%s"> Opt-In Panda plugin</a> sold on CodeCanyon.', 'bizpanda') ?>
<?php _e('Check out the table below to know about all the premium features.', 'bizpanda'); ?>
</p>
<?php } ?>
</div>
<div class="onp-help-section">
<h2><i class="fa fa-star-o"></i> Comparison of Free & Premium Versions</h2>
<p>Click on the dotted title to learn more about a given feature.</p>
<table class="table table-bordered onp-how-comparation">
<thead>
<tr>
<th></th>
<th>Free</th>
<th class="onp-how-premium">Premium</th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-how-title">Unlimited Lockers</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Locking via shortcodes</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Batch Locks</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title"><a href="#social-options">Individual settings for each button</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title"><a href="#extra-options">Visibility Options</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<td class="onp-how-title"><a href="#extra-options">Advanced Options</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-group-title"><i class="fa fa-bullhorn"></i> Social Buttons</td>
<td class="onp-how-yes"></td>
<td class="onp-how-yes onp-how-premium"></td
</tr>
<tr>
<td class="onp-how-title">Facebook Like</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Twitter Tweet</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Google +1</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Facebook Share</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title">Twitter Follow</td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title">LinkedIn Share</td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title">Google Share</td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-group-title"><i class="fa fa-adjust"></i> Overlap Modes</td>
<td class="onp-how-yes"></td>
<td class="onp-how-yes onp-how-premium"></td>
</tr>
<tr>
<td class="onp-how-title">Full</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title">Transparency</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title"><a href="#blurring">Blurring (new!)</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-group-title"><i class="fa fa-picture-o"></i> Themes</td>
<td class="onp-how-yes"></td>
<td class="onp-how-yes onp-how-premium"></td
</tr>
<tr>
<td class="onp-how-title onp-how-group-in-group">The 'Secrets' Theme</td>
<td class="onp-how-yes">yes</td>
<td class="onp-how-yes onp-how-premium">yes</td>
</tr>
<tr>
<td class="onp-how-title onp-how-group-in-group"><a href="#extra-themes">The 'Flat' Theme (new!)</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title onp-how-group-in-group"><a href="#extra-themes">The 'Dandyish' Theme</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-title onp-how-group-in-group"><a href="#extra-themes">The 'Glass' Theme</a></td>
<td class="onp-how-no">no</td>
<td class="onp-how-yes onp-how-premium"><strong>yes</strong></td>
</tr>
<tr>
<td class="onp-how-group-title"><i class="fa fa-clock-o"></i> Services</td>
<td class="onp-how-yes"></td>
<td class="onp-how-yes onp-how-premium"></td
</tr>
<tr>
<td class="onp-how-title onp-how-group-in-group"><a href="#updates">Updates</a></td>
<td class="onp-how-no">not guaranteed</td>
<td class="onp-how-yes onp-how-premium"><strong>primary updates</strong></td>
</tr>
<tr>
<td class="onp-how-title"><a href="#support">Support</a></td>
<td class="onp-how-no">not guaranteed</td>
<td class="onp-how-yes onp-how-premium"><strong>dedicated support</strong></td>
</tr>
</tbody>
</table>
<?php if ( !$alreadyActivated ) { ?>
<div>
<a class="button button-primary" id="activate-trial-btn" href="<?php echo onp_licensing_325_manager_link($this->plugin->pluginName, 'activateTrial', false ) ?>">
<i class="fa fa-star-o"></i>
Click Here To Activate Your Free Trial For 7 Days
<i class="fa fa-star-o"></i>
<br />
<small>(instant activation by a click)</small>
</a>
</div>
<?php } else { ?>
<div class='factory-bootstrap-331'>
<a class="btn btn-gold" id="onp-sl-purchase-btn" href="<?php echo onp_licensing_325_get_purchase_url( $this->plugin ) ?>">
<i class="fa fa-star"></i>
Purchase Opt-In Panda Premium For $26
<i class="fa fa-star"></i>
</a>
</div>
<?php } ?>
</div>
<?php if ( !$alreadyActivated ) { ?>
<div class="onp-help-section">
<p style="text-align: center;">
<a href="<?php echo onp_licensing_325_get_purchase_url( $this->plugin ) ?>"><strong>Or Buy The Opt-In Panda Right Now For $26</strong></a>
</p>
<div class="onp-remark">
<div class="onp-inner-wrap">
<p><?php _e('You can purchase the premium version at any time within your trial period or right now. After purchasing you will get a license key to unlock all the plugin features.', 'bizpanda'); ?></p>
<p><?php printf(__('<strong>To purchase the Opt-In Panda</strong>, <a target="_blank" href="%s">click here</a> to visit the plugin page on CodeCanyon. Then click the "Purchase" button on the right sidebar.', 'bizpanda'), onp_licensing_325_get_purchase_url( $this->plugin )); ?></p>
</div>
</div>
</div>
<?php } ?>
<div class="onp-help-section">
<p>Upgrade To Premium and get all the following features:</p>
</div>
<div class="onp-help-section" id="social-options">
<h1>
<i class="fa fa-star-o"></i> <?php _e('Drive More Traffic & Build Quality Followers', 'bizpanda'); ?>
</h1>
<p><?php _e('The premium version of the plugin provides 7 social buttons for all major social networks: Facebook, Twitter, Google, LinkedIn, including the Twitter Follow button. You can use them together or separately for customized results.', 'bizpanda') ?></p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/social-options.png' />
</p>
<p><?php _e('What\'s more, each button has individual settings (this way you can set an individual URL for each button).') ?>
<p><?php _e('<strong>For example</strong>, you can set up the locker to get followers your Twitter account, fans for your Facebook page, +1s for a home page of your website.', 'bizpanda') ?></p>
</div>
<div class="onp-help-section" id="extra-options">
<h1>
<i class="fa fa-star-o"></i> <?php _e('Set How, When and For Whom Your Lockers Appear', 'bizpanda'); ?>
</h1>
<p>Of course, each website has its own unique audience. We know that a good business is an agile business. The premium version of Opt-In Panda provides 8 additional options that allow you to configure the lockers flexibly to meet your needs.</p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/advanced-options.png' />
</p>
<div class="clearfix"></div>
</div>
<div class="onp-help-section" id='blurring'>
<h1>
<i class="fa fa-star-o"></i> <?php _e('Create Highly Shareable Content Via The Blur Effect', 'bizpanda'); ?>
</h1>
<p>The previous versions of the plugin allowed only to hide the locked content totally. But recently we have added the long-awaited option to overlap content and make it transparent or blurred.</p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/blur-effect.png' />
</p>
<p>When we tested this feature on sites of some our customers, we were blown away how this feature attracts attention of the huge number of visitors. If people see and understand that they will get after unlocking, the plugin works more effectively.</p>
</div>
<div class="onp-help-section" id='extra-themes'>
<h1>
<i class="fa fa-star-o"></i> <?php _e('3 Extra Stunning Themes For Your Lockers', 'bizpanda'); ?>
</h1>
<p>
<p>The premium version of Opt-In Panda comes with 3 extra impressive, polished styles which create interest and attract attention. They are nicely animated and don't look obtrusive:</p>
<ul>
<li><strong>Dandyish</strong>. A very bright theme to attract maximum attention!</li>
<li><strong>Flat (new!)</strong>. An extremely awesome theme based on the latest web technologies that will make your site a superstar. It's truly fascinating!</li>
<li><strong>Glass</strong>. A theme with transparent background which looks good on any website.</li>
</ul>
</p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/new-themes.png' />
</p>
</div>
<div class="onp-help-section" id='updates'>
<h1>
<i class="fa fa-star-o"></i> <?php _e('Get New Features & Updates Almost Every Week', 'bizpanda'); ?>
</h1>
<p>We release about 3-4 updates each month, adding new features and fixing bugs. The Free version does not guarantee that you will get all the major updates. But if you upgrade to the Premium version, your copy of the plugin will be always up-to-date.</p>
</div>
<div class="onp-help-section" id='support'>
<h1>
<i class="fa fa-star-o"></i> <?php _e('Guaranteed Support Within 24h', 'bizpanda'); ?>
</h1>
<p>
All of our plugins come with free support. We care about your plugin after purchase just as much as you do. We want to make your life easier and make you happy about choosing our plugins.
</p>
<p>
Unfortunately we receive plenty of support requests every day and we cannot answer to all the users quickly. But for the users of the premium version (and the trial version), we guarantee to respond to every inquiry within 1 business day (typical response time is 3 hours).
</p>
</div>
<?php if ( !$alreadyActivated ) { ?>
<div class="onp-help-section">
<div>
<a class="button button-primary" id="activate-trial-btn" href="<?php echo onp_licensing_325_manager_link($this->plugin->pluginName, 'activateTrial', false ) ?>">
<i class="fa fa-star-o"></i>
Click Here To Activate Your Free Trial For 7 Days
<i class="fa fa-star-o"></i>
<br />
<small>(instant activation by a click)</small>
</a>
</div>
</div>
<div class="onp-help-section">
<p style="text-align: center;">
<a href="<?php echo onp_licensing_325_get_purchase_url( $this->plugin ) ?>"><strong>Or Buy The Opt-In Panda Right Now For $26</strong></a>
</p>
<div class="onp-remark">
<div class="onp-inner-wrap">
<p><?php _e('You can purchase the premium version at any time within your trial period or right now. After purchasing you will get a license key to unlock all the plugin features.', 'bizpanda'); ?></p>
<p><?php printf(__('<strong>To purchase the Opt-In Panda</strong>, <a target="_blank" href="%s">click here</a> to visit the plugin page on CodeCanyon. Then click the "Purchase" button on the right sidebar.', 'bizpanda'), onp_licensing_325_get_purchase_url( $this->plugin )); ?></p>
</div>
</div>
</div>
<?php } else { ?>
<div class="onp-help-section">
<div class='factory-bootstrap-331'>
<a class="btn btn-gold" id="onp-sl-purchase-btn" href="<?php echo onp_licensing_325_get_purchase_url( $this->plugin ) ?>">
<i class="fa fa-star"></i>
Purchase Opt-In Panda Premium For $26
<i class="fa fa-star"></i>
</a>
</div>
</div>
<?php } ?>
<?php
}
/**
* Page 'Creating Social Apps'
*
* @since 1.0.0
* @return void
*/
public function socialApps() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/social-apps.php';
}
/**
* Page 'Creating Social Apps' => 'Creating Facebook App'
*
* @since 1.0.0
* @return void
*/
public function facebookApp() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/facebook-app.php';
}
/**
* Page 'Creating Social Apps' => 'Creating Twitter App'
*
* @since 1.0.0
* @return void
*/
public function twitterApp() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/twitter-app.php';
}
/**
* Page 'Creating Social Apps' => 'Getting Google Client ID'
*
* @since 1.0.0
* @return void
*/
public function googleClientId() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/google-app.php';
}
/**
* Page 'Creating Social Apps' => 'Getting LinkedIn API Key'
*
* @since 1.0.0
* @return void
*/
public function linkedinApiKey() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/linkedin-app.php';
}
/**
* Page 'Important Notes'
*
* @since 1.0.0
* @return void
*/
public function notes() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/notes.php';
}
/**
* Page 'Important Notes' => 'Using the Facebook Like with the Social Locker'
*
* @since 1.0.0
* @return void
*/
public function facebookLike() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/facebook-like.php';
}
/**
* Page 'SSL Certificate'
*
* @since 1.0.0
* @return void
*/
public function ssl() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/ssl.php';
}
/**
* Page 'Zapier Integration'
*
* @since 1.0.0
* @return void
*/
public function zapier() {
require OPANDA_BIZPANDA_DIR . '/admin/pages/how-to-use/zapier.php';
}
}
FactoryPages321::register($bizpanda, 'OPanda_HowToUsePage');

View File

@@ -0,0 +1,145 @@
<div class="onp-help-section">
<h1><?php _e('Creating Facebook App', 'bizpanda'); ?></h1>
<p>
<?php _e('A Facebook App is required for the following buttons:', 'bizpanda'); ?>
<ul>
<?php if ( BizPanda::hasPlugin('sociallocker') ) { ?>
<li><?php _e('Facebook Like of the Social Locker.', 'bizpanda') ?></li>
<li><?php _e('Facebook Share of the Social Locker.', 'bizpanda') ?></li>
<?php } ?>
<li><?php _e('Facebook Sign-In of the Sign-In Locker.', 'bizpanda') ?></li>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<li><?php _e('Facebook Subscribe of the Email Locker.', 'bizpanda') ?></li>
<?php } ?>
</ul>
</p>
<p><?php _e('By default the plugin utilises its own fully configured Facebook app.', 'bizpanda') ?></p>
<p><?php _e('So you <strong>don\'t need to create your own app</strong>. Nonetheless you can create your own app, for example, to replace the app logo on the authorization screen with your website logo.') ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('1. Open the website <a href="%s" target="_blank">developers.facebook.com</a> and click <strong>Add a New App</strong> (you have to be logged in):', 'bizpanda'), 'https://developers.facebook.com/' ) ?></p>
<p class='onp-img'>
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/1.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Type your app name (it will be visible for users), email address (for notifications from Facebook) and click <strong>Create App ID</strong>:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/2.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('3. Pass the security check if required and click on <strong>Submit</strong>:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/3.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('4. Click <strong>Settings -> Basic</strong> in the menu at the left:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/4.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('5. Twice enter your site domain name: without "www" and with "www", check your email address, select the category and paste links to Terms & Policy pages:', 'bizpanda') ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('App Domains', 'bizpanda') ?></td>
<td>
<p><?php _e('Paste these domains:', 'bizpanda') ?></p>
<p><i><?php echo opanda_get_domain( get_site_url() ) ?></i>
<p><i><?php echo 'www.' . opanda_get_domain( get_site_url() ) ?></i>
</p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Privacy Policy URL', 'bizpanda') ?></td>
<td>
<p><?php printf( __('Paste the URL (you can edit it <a href="%s" target="_blank">here</a>):', 'bizpanda'), admin_url('admin.php?page=settings-' . $this->plugin->pluginName . '&opanda_screen=terms&action=index' ) ) ?></p>
<p><i><?php echo opanda_privacy_policy_url(true) ?></i>
</p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Terms of Service URL', 'bizpanda') ?></td>
<td>
<p><?php printf( __('Paste the URL (you can edit it <a href="%s" target="_blank">here</a>):', 'bizpanda'), admin_url('admin.php?page=settings-' . $this->plugin->pluginName . '&opanda_screen=terms&action=index' ) ) ?></p>
<p><i><?php echo opanda_terms_url(true) ?></i>
</td>
</tr>
</tbody>
</table>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/5.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('6. Fill the form <strong>Data Protection Officer Contact Information</strong> below if required according to your business:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/6.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('7. Click on <strong>Add Platform</strong> after the forms:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/7.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('8. Select <strong>Website</strong>:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/8.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('9. Specify an URL of your website and save the changes:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/9.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('10. Move to the section <strong>App Review</strong>:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/10.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('11. Make your app available to the general public:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/11.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('12. Copy your app id:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/facebook-app/v3/12.png">
</p>
</div>
<div class="onp-help-section">
<p><?php printf( __('13. Paste your Facebook App Id on the page Global Settings > <a href="%s">Social Options</a>.', 'bizpanda' ), opanda_get_settings_url('social') ) ?></p>
<p><?php printf( __('Feel free to <a href="%s">contact us</a> if you faced any troubles.', 'bizpanda'), opanda_get_help_url('troubleshooting') ) ?></p>
</div>

View File

@@ -0,0 +1,60 @@
<div class="onp-help-section">
<h1><?php _e('Using the Facebook Like with the Social Locker', 'bizpanda'); ?></h1>
<p>
<?php _e('This note describes the Facebook restriction regarding using the Facebook Buttons in the Social Locker.', 'bizpanda') ?>
<?php _e('Since 5 Nov, you don\'t have to incentivize people to like your page to unlock the content:') ?>
</p>
<p class='onp-remark'>
<span class="onp-inner-wrap">
<i><?php _e('You must not incentivize people to use social plugins or to like a Page. This includes offering rewards, or gating apps or app content based on whether or not a person has liked a Page. It remains acceptable to incentivize people to login to your app, checkin at a place ...', 'bizpanda') ?></i><br />
<i style="display: block; margin-top: 5px;">
<strong><?php _e('Source:', 'optionpanda') ?></strong>
<a href="https://developers.facebook.com/blog/post/2014/08/07/Graph-API-v2.1/" target="_blank">https://developers.facebook.com/policy#properuse</a>
</i>
</span>
</p>
<p>
<?php _e('<strong>This Facebook restriction doesn\'t affect</strong> on the Facebook Connect and Facebook Subscribe buttons (which ask to log into your app) from Email and Connect Lockers.', 'bizpanda') ?>
</p>
<p>
<?php _e('<strong>This restriction doesn\'t affect</strong> on buttons from other social networks (Twitter, Google, LinkedIn).', 'bizpanda') ?>
</p>
<p>
<?php _e('Technically <strong>you can ignore this restriction, the Social Locker will work without any problems</strong>. Also you can just update a bit the settings of your lockers to make it compatible with the new policy.', 'bizpanda') ?>
</p>
<?php $this->showContentTable() ?>
</div>
<div class="onp-help-section">
<h2><?php _e('Making Social Locker compatible with the Facebook Policies', 'bizpanda'); ?></h2>
<p><?php _e('If want to use the Social Locker with the Facebook Like and keep it compatible with the new Facebook Policies, you need to convert your Social Locker to "Social Reminder". What does it mean?', 'bizpanda') ?></p>
<p><strong><?php _e('1. Enable the option Close Icon.', 'bizpanda') ?></strong></p>
<p>
<?php _e('You have to give people the way to skip the liking process.', 'bizpanda') ?>
<?php _e('The Close Icon is not bright and the most people will not notice it at first time and will still click on the Like button.', 'bizpanda') ?>
</p>
<p><strong><?php _e('2. Remove any phrases like "this content is locked" from your locker.', 'bizpanda') ?></strong></p>
<p>
<?php _e('Don\'t write that your content is locked. Ask support you because you need it in order to keep doing what you\'re doing (provide free downloads, write good articles and so on).', 'bizpanda') ?>
</p>
<p><strong><?php _e('3. Turn on the Transparency or Blurring mode.', 'bizpanda') ?></strong></p>
<p>
<?php _e('It makes your locker looks like a popup which appears suddenly to ask the user to support you.', 'bizpanda') ?>
</p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/facebook-like/1.png' />
</p>
<?php $this->showContentTable() ?>
</div>

View File

@@ -0,0 +1,170 @@
<div class="onp-help-section">
<h1><?php _e('Getting Google Client ID', 'bizpanda'); ?></h1>
<p>
<?php _e('A Google Client ID is required for the following buttons:', 'bizpanda'); ?>
<ul>
<?php if ( BizPanda::hasPlugin('sociallocker') ) { ?>
<li><?php _e('YouTube Subscribe of the Social Locker.', 'bizpanda') ?></li>
<?php } ?>
<li><?php _e('Google Sign-In of the Sign-In Locker.', 'bizpanda') ?></li>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<li><?php _e('Google Subscribe of the Email Locker.', 'bizpanda') ?></li>
<?php } ?>
</ul>
</p>
<p><?php _e('By default the plugin utilises its own fully configured client ID.', 'bizpanda') ?></p>
<p><?php _e('So you <strong>don\'t need to create your own client ID</strong>. Nonetheless you can create your own app, for example, to replace the app logo on the authorization screen with your website logo.') ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('1. Go to the <a href="%s" target="_blank">Google Developers Console</a>.', 'bizpanda'), 'https://console.developers.google.com/project' ) ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Click "Select a project":', 'bizpanda') ?></p>
<p class='onp-img'>
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/1.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Click "Select a project":', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/1.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('3. Click the button with the plus icon:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/2.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('4. Enter a new project name (for example, your website name) and click "Create":', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/3.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('5. Again click "Select a project":', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/1.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('6. And select your project you have just created:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/4.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('7. Make sure that you are in the Library section. Find and enable the following APIs:', 'bizpanda') ?></p>
<ul>
<li><?php _e('<strong>Google+ API</strong> (to use the Google Plus, Google Share and Sign-In buttons)', 'bizpanda') ?></li>
<li><?php _e('<strong>YouTube APIs</strong> (to use the YouTube Subscribe button)', 'bizpanda') ?></li>
</ul>
<p><?php _e('To enable these APIs, click on a title of the required API in the list and then click the button "Enable".', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/5.png">
</p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/6.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('8. Move to the "Credentials" section:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/7.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('9. Create new credentials "OAuth client ID"', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/8.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('10. Google may ask you to configure a consent screen before creating OAuth client ID, at this case follow the Google instruction and then return back:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/9.png">
</p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/10.png">
</p>
</div>
<?php
$origin = null;
$pieces = parse_url( site_url() );
$domain = isset($pieces['host']) ? $pieces['host'] : '';
if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
$origin = $regs['domain'];
}
?>
<div class="onp-help-section">
<p><?php _e('11. Fill up the form:', 'bizpanda' ) ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('Application Type', 'bizpanda') ?></td>
<td>
<p>Web Application</p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Authorized Javascript origins', 'bizpanda') ?></td>
<td>
<p><?php _e('Add the origins:', 'bizpanda') ?></p>
<p><i><?php echo 'http://' . str_replace('www.', '', $origin) ?></i></p>
<p><i><?php echo 'http://www.' . $origin ?></i></p>
<p><?php _e('If you use SSL, additionally add URLs with "https"', 'bizpanda') ?></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Authorized redirect URIs', 'bizpanda') ?></td>
<td>
<p><?php _e('Paste the URL:', 'bizpanda') ?></p>
<p><i><?php echo add_query_arg( array(
'action' => 'opanda_connect',
'opandaHandler' => 'google'
), admin_url('admin-ajax.php') ) ?></i>
</p>
</td>
</tr>
</tbody>
</table>
<p class='onp-img'>
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/11.png">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('12. After clicking on the button Create, you will see your new Client ID:', 'bizpanda' ) ?></p>
<p class='onp-img'>
<img src="http://cconp.s3.amazonaws.com/bizpanda/google-app/v2/12.png">
</p>
</div>
<div class="onp-help-section">
<p><?php printf( __('10. Copy and paste it on the page Global Settings > <a href="%s">Social Options</a>.', 'bizpanda' ), opanda_get_settings_url('social') ) ?></p>
<p><?php printf( __('Feel free to <a href="%s">contact us</a> if you faced any troubles.', 'bizpanda'), opanda_get_help_url('troubleshooting') ) ?></p>
</div>

View File

@@ -0,0 +1,112 @@
<div class="onp-help-section">
<h1><?php _e('Getting LinkedIn Client ID', 'bizpanda'); ?></h1>
<p>
<?php _e('A LinkedIn Client ID is required for the following buttons:', 'bizpanda'); ?>
<ul>
<li><?php _e('LinkedIn Sign-In of the Sign-In Locker.', 'bizpanda') ?></li>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<li><?php _e('LinkedIn Subscribe of the Email Locker.', 'bizpanda') ?></li>
<?php } ?>
</ul>
</p>
<p><?php _e('By default the plugin utilises its own fully configured client ID.', 'bizpanda') ?></p>
<p><?php _e('So you <strong>don\'t need to create your own client ID</strong>. Nonetheless you can create your own app, for example, to replace the app logo on the authorization screen with your website logo.') ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('1. Go to the <a href="%s" target="_blank">LinkedIn Developer Network</a> and click <strong>Create Application</strong>.', 'bizpanda'), 'https://www.linkedin.com/secure/developer' ) ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Fill up the form the following way:', 'bizpanda' ) ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('Company', 'bizpanda') ?></td>
<td><?php _e('Select an existing company or create your own one (you can use your website name as a company name).', 'bizpanda') ?></td>
</tr>
<tr>
<td class="onp-title"><?php _e('Name', 'bizpanda') ?></td>
<td><?php _e('The best name is your website name.', 'bizpanda') ?></td>
</tr>
<tr>
<td class="onp-title"><?php _e('Description', 'bizpanda') ?></td>
<td>
<p><?php _e('Explain what your app does, e.g:', 'bizpanda') ?></p>
<p><i><?php _e('This application asks your credentials in order to unlock the content. Please read the Terms of Use to know how these credentials will be used.', 'bizpanda') ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Application Logo URL', 'bizpanda') ?></td>
<td>
<p><?php _e('Paste an URL to your logo (80x80px). Or use this default logo:', 'bizpanda') ?></p>
<p><i><?php _e('https://cconp.s3.amazonaws.com/bizpanda/linkedin-app/default-logo.png', 'bizpanda') ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Application Use', 'bizpanda') ?></td>
<td>
<p><?php _e('Select "Other" from the list.', 'bizpanda') ?></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Website URL', 'bizpanda') ?></td>
<td>
<p><?php _e('Paste your website URL:', 'bizpanda') ?></p>
<p><i><?php echo site_url() ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Business Email', 'bizpanda') ?></td>
<td>
<p><?php _e('Enter your email to receive updates regarding your app.', 'bizpanda') ?></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Business Phone', 'bizpanda') ?></td>
<td>
<p><?php _e('Enter your phone. It will not be visible for visitors.', 'bizpanda') ?></p>
</td>
</tr>
</tbody>
</table>
<p><?php _e('Mark the checkbox "I have read and agree to the LinkedIn API Terms of Use." and submit the form.', 'bizpanda') ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('3. On the page "Authentication", mark "<strong>r_basicprofile</strong>" and "<strong>r_emailaddress</strong>".', 'bizpanda' ) ?></p>
</div>
<div class="onp-help-section">
<p>
<?php _e('4. In the field "<strong>Authorized Redirect URLs</strong>" of the section "<strong>OAuth 2.0</strong>" paste the URL:', 'bizpanda' ) ?><br />
</p>
<p>
<i>
<?php echo add_query_arg( array(
'action' => 'opanda_connect',
'opandaHandler' => 'linkedin',
'opandaRequestType' => 'callback'
), admin_url('admin-ajax.php') ) ?>
</i>
</p>
<p>Click the orange button "<strong>Add</strong>", then click the button button "<strong>Update</strong>" below the from.</p>
</div>
<div class="onp-help-section">
<p><?php _e('5. On the page "Settings", switch <strong>Application Status</strong> to <strong>Live</strong>. Click the button Update.', 'bizpanda' ) ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('4. Return to the page "Authentication", copy your <strong>Client ID</strong> and <strong>Client Secret</strong>, paste them on the page Global Settings > <a href="%s">Social Options</a>.', 'bizpanda' ), admin_url('admin.php?page=settings-bizpanda&opanda_screen=social') ) ?></p>
<p><?php printf( __('Feel free to <a href="%s">contact us</a> if you faced any troubles.', 'bizpanda'), opanda_get_help_url('troubleshooting') ) ?></p>
</div>

View File

@@ -0,0 +1,7 @@
<div class="onp-help-section">
<h1><?php _e('Creating Social Apps', 'bizpanda'); ?></h1>
<p><?php _e('Creating own Social Apps is not required in most cases. Click on the links below to know about the cases when you need to create respective apps.', 'bizpanda') ?></p>
<?php $this->showContentTable() ?>
</div>

View File

@@ -0,0 +1,185 @@
<div class="onp-help-section">
<h1><?php _e('Creating Twitter App', 'bizpanda'); ?></h1>
<p>
<?php _e('A Twitter App is required for the following buttons:', 'bizpanda' ) ?>
<ul>
<?php if ( BizPanda::hasPlugin('sociallocker') ) { ?>
<li><?php _e('Twitter Tweet of the Social Locker.', 'bizpanda') ?></li>
<li><?php _e('Twitter Follow of the Social Locker.', 'bizpanda') ?></li>
<?php } ?>
<li><?php _e('Twitter Sign-In of the Sign-In Locker.', 'bizpanda') ?></li>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<li><?php _e('Twitter Subscribe of the Email Locker.', 'bizpanda') ?></li>
<?php } ?>
</ul>
</p>
<p><?php _e('By default the plugin utilises its own fully configured Twitter app.', 'bizpanda') ?></p>
<p><?php _e('So you <strong>don\'t need to create your own app</strong>. Nonetheless you can create your own app, for example, to replace the app logo on the authorization screen with your website logo.') ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('1. Open the website <a href="%s" target="_blank">developer.twitter.com/en/apps</a> and click <strong>Create an app</strong> (you have to be signed in).', 'bizpanda'), 'https://developer.twitter.com/en/apps' ) ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Fill up the form, agree to the Developer Agreement, click <strong>Create Your Twitter application</strong>.', 'bizpanda' ) ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('App name', 'bizpanda') ?></td>
<td><?php _e('The best app name is your website name.', 'bizpanda') ?></td>
</tr>
<tr>
<td class="onp-title"><?php _e('App Description', 'bizpanda') ?></td>
<td>
<p><?php _e('Explain why you ask for the credentials, e.g:', 'bizpanda') ?></p>
<p><i><?php _e('This application asks your credentials in order to unlock the content. Please read the TOS.', 'bizpanda') ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Website URL', 'bizpanda') ?></td>
<td>
<p><?php _e('Paste your website URL:', 'bizpanda') ?></p>
<p><i><?php echo site_url() ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Enable Sign in with Twitter', 'bizpanda') ?></td>
<td>
<p><?php _e('Mark it.', 'bizpanda') ?></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Callback URL', 'bizpanda') ?></td>
<td>
<p><?php _e('Callback URLs:', 'bizpanda') ?></p>
<p><i><?php echo admin_url('admin-ajax.php') ?></i>
</p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Terms of Service URL', 'bizpanda') ?></td>
<td>
<p><?php printf( __('Paste the URL (you can edit it <a href="%s" target="_blank">here</a>):', 'bizpanda'), admin_url('admin.php?page=settings-' . $this->plugin->pluginName . '&opanda_screen=terms&action=index' ) ) ?></p>
<p><i><?php echo opanda_terms_url(true) ?></i>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Privacy policy URL', 'bizpanda') ?></td>
<td>
<p><?php printf( __('Paste the URL (you can edit it <a href="%s" target="_blank">here</a>):', 'bizpanda'), admin_url('admin.php?page=settings-' . $this->plugin->pluginName . '&opanda_screen=terms&action=index' ) ) ?></p>
<p><i><?php echo opanda_privacy_policy_url(true) ?></i></p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Tell us how this app will be used', 'bizpanda') ?></td>
<td>
<p><?php _e('Explain how your app works, e.g:', 'bizpanda') ?></p>
<p><i><?php _e('This app asks visitors of our website to sign in via Twitter or tweet/follow to get access to restricted content available only for registered users or followers.', 'bizpanda') ?></i></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="onp-help-section">
<p><?php _e('3. Move to the section "Permissions", mark <strong>Read and Write</strong> (if you are going to use tweeting functionality) or <strong>Read Only</strong> (if you are NOT going to use tweeting functionality) and save changes.', 'bizpanda' ) ?></p>
<p><?php _e('If you are going to use the Twitter Sign-In Button, mark the permission <strong>Request email addresses from users</strong> in the section "Additional Permissions".','bizpanda') ?></p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/twitter-app/4.png' />
</p>
</div>
<div class="onp-help-section">
<p><?php _e('4. Move to the section "Keys and tokens", find your API key and API secret key:', 'bizpanda' ) ?></p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/twitter-app/5.png' />
</p>
</div>
<div class="onp-help-section">
<p><?php printf( __('5. Paste your key and secret on the page Global Settings > <a href="%s">Social Options</a>.', 'bizpanda' ), admin_url('admin.php?page=settings-bizpanda&opanda_screen=social') ) ?></p>
<p><?php printf( __('Feel free to <a href="%s">contact us</a> if you faced any troubles.', 'bizpanda'), opanda_get_help_url('troubleshooting') ) ?></p>
</div>
<!--div class="onp-help-section">
<p class='onp-note'>
<?php _e('By default Twitter does not return an <strong>email address</strong> of the user until your app is not got whitelisted. To make your app whitelisted, please follow the instruction below.', 'bizpanda') ?>
</p>
</div>
<div class="onp-help-section">
<p><?php printf( __('9. Visit Twitter Help Center: <a href="https://support.twitter.com/forms/platform" target="_blank">https://support.twitter.com/forms/platform</a>', 'bizpanda' ), admin_url('admin.php?page=settings-optinpanda&opanda_screen=social') ) ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('10. Choose <strong>I need access to special permissions</strong>, fill and submit the form:', 'bizpanda' ) ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('Application Name', 'bizpanda') ?></td>
<td><?php _e('Enter your app name you typed in the step 2.', 'bizpanda') ?></td>
</tr>
<tr>
<td class="onp-title"><?php _e('Application ID', 'bizpanda') ?></td>
<td>
<p><?php _e('You can find your app ID in the URL when viewing your app on the apps.twitter.com.', 'bizpanda') ?></p>
<p class='onp-img'>
<img src='http://cconp.s3.amazonaws.com/bizpanda/twitter-app/8.png' style="width: 400px;" />
</p>
</td>
</tr>
<tr>
<td class="onp-title"><?php _e('Permissions Requested', 'bizpanda') ?></td>
<td>
<p><?php _e('Explain what permissions you need:', 'bizpanda') ?></p>
<p><i><?php _e('Please enable the permission "Request email addresses from users" for my app. I want to use the option "include_email" while requesting "account/verify_credentials". I ask visitors of my website to sign in by using their Twitter accounts and need to know their emails.', 'bizpanda') ?></i></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="onp-help-section">
<p><?php printf( __('10. <strong>Within 2-3 business days</strong>, you will get a reply from Twitter. If the email permission was successfully granted for your app, visit <a href="%s" target="_blank">apps.twitter.com</a> and click on the title of your app.', 'bizpanda' ), 'https://apps.twitter.com' ) ?></p>
</div>
<div class="onp-help-section">
<p><?php printf( __('11. Click on the tab <strong>Settings</strong>, fill the fields and save the form:', 'bizpanda' ), 'https://apps.twitter.com' ) ?></p>
<table class="table">
<thead>
<tr>
<th><?php _e('Field', 'bizpanda') ?></th>
<th><?php _e('How To Fill', 'bizpanda') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="onp-title"><?php _e('Privacy Policy URL', 'bizpanda') ?></td>
<td><i><?php echo opanda_privacy_policy_url() ?></i></td>
</tr>
<tr>
<td class="onp-title"><?php _e('Terms of Service URL', 'bizpanda') ?></td>
<td><i><?php echo opanda_terms_url() ?></i></td>
</tr>
</tbody>
</table>
</div>
<div class="onp-help-section">
<p><?php printf( __('11. Click on the tab <strong>Permissions</strong>, mark the checkbox <strong>Request email addresses from users</strong> and save the changes.', 'bizpanda' ), 'https://apps.twitter.com' ) ?></p>
</div-->

View File

@@ -0,0 +1,74 @@
<div class="onp-help-section">
<h1><?php _e('Connection to Zapier', 'bizpanda'); ?></h1>
<p><?php printf( __("You can send data collected via your lockers to Zapier and then automatically pass them to other web apps supported by Zapier. For example, to Google Docs. <a href='%s' target='_blank'>Click here</a> to learn more about Zapier.", "bizpanda"), 'https://zapier.com/help/what-is-zapier/' ); ?></p>
<p><?php _e('To connect the plugin to Zapier, please follow the steps below:', 'bizpanda'); ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('1. Make sure that you have a Zapier account. If not, create one here: <a href="https://zapier.com/sign-up/" target="_blank">https://zapier.com/sign-up/</a>', 'bizpanda') ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('2. Pick <strong>Webhooks</strong> and the apps where you wish to send data to. Learn more about Webooks here: <a href="https://zapier.com/apps/webhook/integrations" target="_blank">https://zapier.com/apps/webhook/integrations</a>', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/1.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('3. Select a <strong>Zap</strong> you need by clicking on <strong>Use this Zap</strong>. For example, Webkooks + Google Sheet:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/2.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('4. While creating a Zap, select <strong>Catch Hook</strong> option:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/3.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('5. Skip the step <strong>Pick off a Child Key</strong> if you don\'t have any preferences for this option or you aren\'t sure how to set it up:', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/4.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('6. Copy a webhook URL on the step <strong>Test Webhooks by Zapier</strong>. The option Silent Mode may be turned off or turned on, it doesn\'t have matter.', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/5.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php printf( __('7. Paste the webhook URL on the page Global Settings -> <a href="%s" target="_blank">Zapier</a> and click Save Changes. Make sure that the options <strong>Only New Leads</strong> and <strong>Only Confirmed Leads</strong> turned off (you need to disable them for testing connection on the next step, later you can configure them as you need).', 'bizpanda'), opanda_get_settings_url('zapier') ) ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/6.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('8. Pass connection test on Zapier. For that, on the page Test Webhooks by Zapier after saving the webhook URL in the settings of the plugin, click the button <strong>Ok, I did this</strong>.', 'bizpanda') ?></p>
</div>
<div class="onp-help-section">
<p><?php _e('9. While the spinner runs, open a webpage on your website where the locker is located and unlock it.', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/7.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('10. If the hook is fired successfully, you will see the success message, if not try to refresh the Zapier page.', 'bizpanda') ?></p>
<p class="onp-img">
<img src="http://cconp.s3.amazonaws.com/bizpanda/zapier/8.jpg">
</p>
</div>
<div class="onp-help-section">
<p><?php _e('11.Complete other configuration steps on Zapier and enjoy your results.', 'bizpanda') ?></p>
<p><?php printf( __('Feel free to <a href="%s">contact us</a> if you faced any troubles.', 'bizpanda'), opanda_get_help_url('troubleshooting') ) ?></p>
</div>

View File

@@ -0,0 +1,647 @@
<?php
/**
* The file contains a short help info.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* Common Settings
*/
class OPanda_LeadsPage extends OPanda_AdminPage {
public function __construct( $plugin ) {
$this->menuPostType = OPANDA_POST_TYPE;
$this->id = "leads";
if( !current_user_can('administrator') )
$this->capabilitiy = "manage_opanda_leads";
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/leads.php';
$count = OPanda_Leads::getCount();
if ( empty( $count ) ) $count = '0';
$this->menuTitle = sprintf( __('Leads (%d)', 'bizpanda'), $count );
parent::__construct( $plugin );
}
public function assets($scripts, $styles) {
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/leads.010008.css');
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/leads.010008.js');
$this->scripts->request('jquery');
$this->scripts->request( array(
'control.checkbox',
'control.dropdown'
), 'bootstrap' );
$this->styles->request( array(
'bootstrap.core',
'bootstrap.form-group',
'bootstrap.separator',
'control.dropdown',
'control.checkbox',
), 'bootstrap' );
}
public function indexAction() {
if(!class_exists('WP_List_Table')){
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
require_once( OPANDA_BIZPANDA_DIR . '/admin/includes/classes/class.leads.table.php' );
$table = new OPanda_LeadsListTable( array('screen' => 'bizpanda-leads') );
$table->prepare_items();
?>
<div class="wrap factory-fontawesome-320" id="opanda-leads-page">
<h2>
<?php _e('Leads', 'bizpanda') ?>
<a href="<?php $this->actionUrl('export') ?>" class="add-new-h2"><?php _e( 'export', 'bizpanda' ); ?></a>
<a href="<?php $this->actionUrl('clearAll') ?>" class="add-new-h2"><?php _e( 'clear all', 'bizpanda' ); ?></a>
</h2>
<?php if ( BizPanda::isSinglePlugin() ) { ?>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<p style="margin-top: 0px;"> <?php _e('This page shows contacts of visitors who opted-in or signed-in on your website through Email or Sign-In Lockers.', 'bizpanda'); ?></p>
<?php } else { ?>
<p style="margin-top: 0px;"><?php printf( __('This page shows contacts of visitors who signed-in on your website through the <a href="%s">Sign-In Locker</a>.', 'bizpanda'), opanda_get_help_url('what-is-signin-locker') ); ?></p>
<?php } ?>
<?php } else { ?>
<p style="margin-top: 0px;"> <?php _e('This page shows contacts of visitors who opted-in or signed-in on your website through Email or Sign-In Lockers.', 'bizpanda'); ?></p>
<?php } ?>
<?php if ( isset( $_GET['onp_table_cleared'] ) ) { ?>
<div class="factory-bootstrap-331">
<div class="alert alert-success">
<?php _e('The data has been successfully cleared.', 'bizpanda') ?>
</div>
</div>
<?php } ?>
<?php
$table->search_box(__('Search Leads', 'mymail'), 's');
$table->views();
?>
<form method="post" action="">
<?php echo $table->display(); ?>
</form>
</div>
<?php
OPanda_Leads::updateCount();
}
public function leadDetailsAction() {
$leadId = isset( $_REQUEST['leadID'] ) ? intval( $_REQUEST['leadID'] ) : 0;
$lead = OPanda_Leads::get( $leadId );
$customFields = OPanda_Leads::getCustomFields( $leadId );
$email = $lead->lead_email;
$name = $lead->lead_name;
$family = $lead->lead_family;
if ( !empty( $name) || !empty( $family) ) {
$displayName = $name . ' ' . $family;
} else {
$displayName = !empty( $lead->lead_display_name )? $lead->lead_display_name : $lead->lead_email;
}
$emailConfirmed = empty( $lead->lead_email_confirmed ) ? 0 : 1;
$subscriptionConfirmed = empty( $lead->lead_subscription_confirmed ) ? 0 : 1;
if ( isset( $_POST['submit'] ) ) {
$data = array();
$email = $_POST['email'];
if ( !filter_var($email, FILTER_VALIDATE_EMAIL) || !preg_match('/@.+\./', $email) ) {
$error = __('Please enter a valid email.', 'bizpanda');
} else {
$name = $_POST['name'];
$family = $_POST['family'];
if ( !empty( $name) || !empty( $family) ) {
$displayName = $name . ' ' . $family;
} else {
$displayName = !empty( $lead->lead_display_name )? $lead->lead_display_name : $lead->lead_email;
}
$data['email'] = $email;
$data['displayName'] = $displayName;
$data['name'] = $name;
$data['family'] = $family;
$emailConfirmed = empty( $_POST['email_confirmed'] ) ? 0 : 1;
$subscriptionConfirmed = empty( $_POST['subscription_confirmed'] ) ? 0 : 1;
$customValues = isset( $_POST['opanda_values'] ) ? $_POST['opanda_values'] : array();
$customNames = isset( $_POST['opanda_names'] ) ? $_POST['opanda_names'] : array();
$index = 0;
foreach( $customNames as $customName ) {
$data['{' . $customName . '}'] = $customValues[$index];
$customFields[$customName] = $customValues[$index];
$index++;
}
OPanda_Leads::save($lead, $data, array(), $emailConfirmed, $subscriptionConfirmed);
$url = admin_url('/edit.php?post_type=opanda-item&page=leads-bizpanda&action=leadDetails&leadID=' . $lead->ID . '&opanda_success=1');
wp_redirect($url);
exit;
}
}
$avatar = OPanda_Leads::getAvatar( $leadId, $lead->lead_email, 150 );
$postUrl = admin_url('/edit.php?post_type=opanda-item&page=leads-bizpanda&action=leadDetails&leadID=' . $lead->ID);
$cancelUrl = admin_url('/edit.php?post_type=opanda-item&page=leads-bizpanda');
?>
<div class="wrap factory-fontawesome-320" id="opanda-lead-details-page">
<h2>Edit <strong><?php echo htmlspecialchars( $displayName ) ?></strong></h2>
<?php if ( isset( $_GET['opanda_success'] ) ) { ?>
<div class="factory-bootstrap-331">
<div class="alert alert-success"><?php _e('<strong>Well done!</strong> The lead data updated successfully.', 'bizpanda') ?></div>
</div>
<?php } ?>
<?php if ( !empty( $error ) ) { ?>
<div class="factory-bootstrap-331">
<div class="alert alert-danger"><?php echo $error; ?></div>
</div>
<?php } ?>
<form method="POST" action="<?php echo $postUrl ?>">
<input type="hidden" name="leadID" value="<?php echo $leadId ?>" />
<input type="hidden" name="submit" value="1" />
<table class="form-table">
<tr>
<td scope="row" class="avatar-wrap">
<div class="opanda-avatar"><?php echo $avatar ?></div>
</td>
<td class="user-info">
<h3 class="detail">
<ul class="click-to-edit">
<li><?php echo htmlspecialchars( $email ) ?></li>
<li><input id="opanda_email" class="" type="text" name="email" value="<?php echo htmlspecialchars( $email ) ?>" placeholder="<?php _e('Email', 'bizpanda') ?>"></li>
</ul>
</h3>
<div class="detail">
<label for="opanda_name"><?php _e('Name:', 'bizpanda') ?></label>
<ul class="click-to-edit">
<li><?php echo htmlspecialchars( $name ) ?> <?php echo htmlspecialchars( $family ) ?></li>
<li>
<input id="opanda_name" type="text" name="name" value="<?php echo htmlspecialchars( $name ) ?>" placeholder="<?php _e('First Name', 'bizpanda') ?>">
<input id="opanda_family" class="" type="text" name="family" value="<?php echo htmlspecialchars( $family ) ?>" placeholder="<?php _e('Last Name', 'bizpanda') ?>">
</li>
</ul>
</div>
<div class="detail">
<label for="opanda_email_confirmed"><?php _e('Email Confirmed:', 'bizpanda') ?></label>
<ul class="click-to-edit">
<li><?php if ( $emailConfirmed ) { _e('yes', 'bizpanda'); } else { _e('no', 'bizpanda'); } ?></li>
<li>
<input type="checkbox" id="opanda_email_confirmed" name="email_confirmed" value="1" <?php if ( $emailConfirmed ) { echo 'checked="checked"'; } ?> >
</li>
</ul>
</div>
<?php if ( BizPanda::hasPlugin('optinpanda') ) { ?>
<div class="detail">
<label for="opanda_subscription_confirmed"><?php _e('Subscription Confirmed:', 'bizpanda') ?></label>
<ul class="click-to-edit">
<li><?php if ( $subscriptionConfirmed ) { _e('yes', 'bizpanda'); } else { _e('no', 'bizpanda'); } ?></li>
<li>
<input type="checkbox" id="opanda_email_confirmed" name="subscription_confirmed" value="1" <?php if ( $subscriptionConfirmed ) { echo 'checked="checked"'; } ?> >
</li>
</ul>
</div>
<?php } ?>
<?php if ( !empty( $customFields ) ) { ?>
<div class="custom-field-wrap">
<?php
$index = 0;
foreach ( $customFields as $fieldName => $fieldValue ) {
$index++;
?>
<div class="detail">
<label for="opanda_<?php echo $index ?>"><?php echo $fieldName ?>:</label>
<ul class="click-to-edit">
<li><?php echo $fieldValue ?></li>
<li><input type="text" id="opanda_<?php echo $index ?>" name="opanda_values[]" value="<?php echo $fieldValue ?>" class="regular-text input"></li>
<input type="hidden" name="opanda_names[]" value="<?php echo $fieldName ?>" />
</ul>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="controls-wrap">
<input type="submit" class="button button-primary" value="<?php _e('Save Changes', 'bizpanda') ?>" />
<a href="<?php echo $cancelUrl ?>" class="button button-default"><?php _e('Return', 'bizpanda') ?></a>
</div>
</td>
</tr>
</table>
</form>
</div>
<?php
}
public function exportAction() {
global $bizpanda;
$error = null;
$warning = null;
// getting a list of lockers
$lockerIds = array();
global $wpdb;
$data = $wpdb->get_results(
"SELECT l.lead_item_id AS locker_id, COUNT(l.ID) AS count, p.post_title AS locker_title "
. "FROM {$wpdb->prefix}opanda_leads AS l "
. "LEFT JOIN {$wpdb->prefix}posts AS p ON p.ID = l.lead_item_id "
. "GROUP BY l.lead_item_id", ARRAY_A );
$lockerList = array(
array('all', __('Mark All', 'bizpanda') )
);
foreach( $data as $items ) {
$lockerList[] = array( $items['locker_id'], $items['locker_title'] . ' (' . $items['count'] . ')');
$lockerIds[] = $items['locker_id'];
}
// default values
$status = 'all';
$fields = array('lead_email', 'lead_name', 'lead_family');
$delimiter = ',';
// custom fields
$customFields = OPanda_Leads::getCustomFields();
$selectedCustomFields = array();
$customFieldsForList = array();
foreach( $customFields as $customField ) {
$customFieldsForList[] = array( $customField->field_name, $customField->field_name );
}
// exporting
if ( isset( $_POST['opanda_export'] ) ) {
// - delimiter
$delimiter = isset( $_POST['opanda_delimiter'] ) ? $_POST['opanda_delimiter'] : ',';
if ( !in_array( $status, array(',', ';') ) ) $status = ',';
// - channels
$lockers = isset( $_POST['opanda_lockers'] ) ? $_POST['opanda_lockers'] : array();
$lockerIds = array();
foreach( $lockers as $lockerId ) {
if ( 'all' == $lockerId ) continue;
$lockerIds[] = intval( $lockerId );
}
// - status
$status = isset( $_POST['opanda_status'] ) ? $_POST['opanda_status'] : 'all';
if ( !in_array( $status, array('all', 'confirmed', 'not-confirmed') ) ) $status = 'all';
// - fields
$rawFields = isset( $_POST['opanda_fields'] ) ? $_POST['opanda_fields'] : array();
$fields = array();
foreach( $rawFields as $field ) {
if ( !in_array( $field, array('lead_email', 'lead_display_name', 'lead_name', 'lead_family', 'lead_ip') ) ) continue;
$fields[] = $field;
}
// - custom fields
$rawCustomFields = isset( $_POST['opanda_custom_fields'] ) ? $_POST['opanda_custom_fields'] : array();
$selectedCustomFields = array();
foreach( $rawCustomFields as $customField ) {
$selectedCustomFields[] = $customField;
}
if ( in_array('custom_facebook_id', $rawFields) ) {
$selectedCustomFields[] = 'facebookId';
}
if ( empty( $lockers) || ( empty( $fields ) && empty( $selectedCustomFields ) ) ) {
$error = __('Please make sure that you selected at least one channel and field.', 'bizpanda');
} else {
$sql = 'SELECT leads.ID,';
$fields[] = 'ID';
$sqlFields = array();
foreach( $fields as $field ) $sqlFields[] = 'leads.' . $field;
$sql .= implode(',', $sqlFields);
if ( !empty( $selectedCustomFields ) ) {
$sql .= ',fields.field_name,fields.field_value';
}
$sql .= ' FROM ' . $wpdb->prefix . 'opanda_leads AS leads ';
if ( !empty( $selectedCustomFields ) ) {
$sql .= 'LEFT JOIN ' . $wpdb->prefix . 'opanda_leads_fields AS fields ON fields.lead_id = leads.ID ';
}
$sql .= 'WHERE leads.lead_item_id IN (' . implode(',', $lockerIds) . ')';
if ( 'all' != $status ) {
$sql .= ' AND leads.lead_email_confirmed = '. ( ( 'confirmed' == $status ) ? '1' : '0' );
}
$result = $wpdb->get_results( $sql, ARRAY_A );
$leads = array();
foreach( $result as $item ) {
$id = $item['ID'];
if ( !isset( $leads[$id] ) ) {
$leads[$id] = array();
foreach( $fields as $field ) {
if ( $field === 'ID' ) continue;
$leads[$id][$field] = $item[$field];
}
foreach( $selectedCustomFields as $field ) $leads[$id][$field] = null;
}
if ( !empty( $item['field_name'] ) && in_array($item['field_name'], $selectedCustomFields) ) {
$leads[$id][$item['field_name']] = $item['field_value'];
}
}
if ( empty( $leads ) ) {
$warning = __('No leads found. Please try to change the settings of exporting.', 'bizpanda');
} else {
$filename = 'leads-' . date('Y-m-d-H-i-s') . '.csv';
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=" . $filename);
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
$output = fopen("php://output", "w");
foreach( $leads as $row ) {
fputcsv($output, $row, $delimiter);
}
fclose($output);
exit;
}
}
}
// creating a form
$form = new FactoryForms328_Form(array(
'scope' => 'opanda',
'name' => 'exporting'
), $bizpanda );
$form->setProvider( new FactoryForms328_OptionsValueProvider(array(
'scope' => 'opanda'
)));
$options = array(
array(
'type' => 'separator'
),
array(
'type' => 'radio',
'name' => 'format',
'title' => __('Format', 'bizpanda'),
'hint' => __('Only the CSV format is available currently.'),
'data' => array(
array('csv', __('CSV File', 'bizpanda') )
),
'default' => 'csv'
),
array(
'type' => 'radio',
'name' => 'delimiter',
'title' => __('Delimiter', 'bizpanda'),
'hint' => __('Choose a delimiter for a CSV document.'),
'data' => array(
array(',', __('Comma', 'bizpanda') ),
array(';', __('Semicolon', 'bizpanda') )
),
'default' => $delimiter
),
array(
'type' => 'separator'
),
array(
'type' => 'list',
'way' => 'checklist',
'name' => 'lockers',
'title' => __('Channels', 'bizpanda'),
'hint' => __('Mark lockers which attracted leads you wish to export.'),
'data' => $lockerList,
'default' => implode(',', $lockerIds)
),
array(
'type' => 'radio',
'name' => 'status',
'title' => __('Email Status', 'bizpanda'),
'hint' => __('Choose the email status of leads to export.'),
'data' => array(
array('all', __('All', 'bizpanda') ),
array('confirmed', __('Only Confirmed Emails', 'bizpanda') ),
array('not-confirmed', __('Only Not Confirmed', 'bizpanda') )
),
'default' => $status
),
array(
'type' => 'separator'
),
array(
'type' => 'list',
'way' => 'checklist',
'name' => 'fields',
'title' => __('Fields To Export', 'bizpanda'),
'data' => array(
array('lead_email', __('Email', 'bizpanda') ),
array('lead_display_name', __('Display Name', 'bizpanda') ),
array('lead_name', __('Firstname', 'bizpanda') ),
array('lead_family', __('Lastname', 'bizpanda') ),
array('lead_ip', __('IP', 'bizpanda') ),
array('custom_facebook_id', __('Facebook App Scoped Id', 'bizpanda') )
),
'default' => implode(',', $fields)
)
);
if ( !empty( $customFieldsForList ) ) {
$options[] = array(
'type' => 'list',
'way' => 'checklist',
'name' => 'custom_fields',
'title' => __('Custom Fields', 'bizpanda'),
'data' => $customFieldsForList,
'default' => implode(',', $selectedCustomFields)
);
}
$options[] = array(
'type' => 'separator'
);
$form->add($options);
?>
<div class="wrap" id="opanda-export-page">
<h2>
<?php _e('Exporting Leads', 'bizpanda') ?>
</h2>
<p style="margin-top: 0px;"> <?php _e('Select leads you would like to export and click the button "Export Leads".', 'bizpanda'); ?></p>
<div class="factory-bootstrap-331 factory-fontawesome-320">
<?php if ( $error ) { ?>
<div class="alert alert-danger"><?php echo $error ?></div>
<?php } ?>
<?php if ( $warning ) { ?>
<div class="alert alert-normal"><?php echo $warning ?></div>
<?php } ?>
<form method="post" class="form-horizontal">
<?php $form->html(); ?>
<div class="form-group form-horizontal">
<label class="col-sm-2 control-label"> </label>
<div class="control-group controls col-sm-10">
<input name="opanda_export" class="btn btn-primary" type="submit" value="<?php _e('Export Leads', 'bizpanda') ?>"/>
</div>
</div>
</form>
</div>
</div>
<?php
}
/**
* Clears the statisticals data.
*
* @sinve 1.0.0
* @return void
*/
public function clearAllAction() {
if ( !isset( $_REQUEST['onp_confirmed'] ) ) {
return $this->confirm(array(
'title' => __('Are you sure that you desire to clear all your leads data?', 'bizpanda'),
'description' => __('All your leads data will be removed.', 'bizpanda'),
'actions' => array(
'onp_confirm' => array(
'class' => 'btn btn-danger',
'title' => __("Yes, I'm sure", 'bizpanda'),
'url' => $this->getActionUrl('clearAll', array(
'onp_confirmed' => true
))
),
'onp_cancel' => array(
'class' => 'btn btn-default',
'title' => __("No, return back", 'bizpanda'),
'url' => $this->getActionUrl('index')
),
)
));
}
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->prefix}opanda_leads");
$wpdb->query("DELETE FROM {$wpdb->prefix}opanda_leads_fields");
return $this->redirectToAction('index', array('onp_table_cleared' => true));
}
/**
* Shows the html block with a confirmation dialog.
*
* @sinve 1.0.0
* @return void
*/
public function confirm( $data ) {
?>
<div class="onp-page-wrap factory-bootstrap-331" id="onp-confirm-dialog">
<div id="onp-confirm-dialog-wrap">
<h1><?php echo $data['title'] ?></h1>
<p><?php echo $data['description'] ?></p>
<div class='onp-actions'>
<?php foreach( $data['actions'] as $action ) { ?>
<a href='<?php echo $action['url'] ?>' class='<?php echo $action['class'] ?>'>
<?php echo $action['title'] ?>
</a>
<?php } ?>
</div>
</div>
</div>
<?php
}
}
FactoryPages321::register($bizpanda, 'OPanda_LeadsPage');

View File

@@ -0,0 +1,163 @@
<?php
/**
* Shows the dialog to select a type of new opt-in element.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
class OPanda_NewPandaItemPage extends OPanda_AdminPage {
public function __construct( $plugin ) {
$this->menuTitle = __('+ New Locker', 'bizpanda');
$this->menuPostType = OPANDA_POST_TYPE;
$this->id = "new-item";
parent::__construct( $plugin );
}
public function assets($scripts, $styles) {
$this->scripts->request('jquery');
$this->styles->request( array(
'bootstrap.core'
), 'bootstrap' );
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/new-item.010000.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/new-item.010000.css');
}
/**
* Shows the screen.
*
* @sinve 1.0.0
* @return void
*/
public function indexAction() {
$types = OPanda_Items::getAvailable();
// checkes extra items which are not installed yet
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
$suggestions = OPanda_Plugins::getSuggestions();
?>
<div class="wrap factory-fontawesome-320">
<div class="opanda-items ">
<h2><?php _e('Creating New Item', 'bizpanda') ?></h2>
<p style="margin-top: 0px;"><?php _e('Choose which items you would like to create.', 'bizpanda') ?></p>
<?php foreach( $types as $name => $type ) { ?>
<div class="postbox opanda-item opanda-item-<?php echo $type['type'] ?>">
<h4 class="opanda-title">
<?php echo $type['title'] ?>
</h4>
<div class="opanda-description">
<?php echo $type['description'] ?>
</div>
<div class="opanda-buttons">
<a href="<?php echo admin_url('post-new.php?post_type=opanda-item&opanda_item=' . $name); ?>" class="button button-large opanda-create">
<i class="fa fa-plus"></i><span><?php _e('Create Item', 'bizpanda') ?></span>
</a>
<?php if ( isset( $type['help'] )) { ?>
<a href="<?php echo $type['help'] ?>" class="button button-large opanda-help opanda-right" title="<?php _e('Click here to learn more', 'bizpanda') ?>">
<i class="fa fa-question-circle"></i>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<?php if ( !empty( $suggestions ) ) { ?>
<div class="opanda-separator"></div>
<div class="opanda-extra-items">
<div class="opanda-inner-wrap">
<h2>
<?php _e('More Marketing Tools To Grow Your Business', 'bizpanda') ?>
</h2>
<p style="margin-top: 0px;">
<?php _e('Check out other plugins which add more features to your lockers.', 'bizpanda') ?>
</p>
<?php foreach( $suggestions as $suggestion ) {
$url = $suggestion['url'];
if ( false === strpos( $url, 'utm_source') ) {
if ( BizPanda::isSinglePlugin() ) {
$plugin = BizPanda::getPlugin();
$args = array(
'utm_source' => 'plugin-' . $plugin->options['name'],
'utm_medium' => ( $plugin->license && isset( $plugin->license->data['Category'] ) )
? ( $plugin->license->data['Category'] . '-version' )
: 'unknown-version',
'utm_campaign' => 'suggestions',
'tracker' => isset( $plugin->options['tracker'] ) ? $plugin->options['tracker'] : null
);
$url = add_query_arg( $args, $url );
} else {
$url = add_query_arg( array(
'utm_source' => 'plugin-bizpanda',
'utm_medium' => 'mixed-versions',
'utm_campaign' => 'suggestions',
'utm_term' => implode(',', BizPanda::getPluginNames( true ) )
), $url );
}
}
?>
<div class="postbox opanda-item opanda-item-<?php echo $suggestion['type'] ?>">
<div class="opanda-item-cover"></div>
<i class="fa fa-plus-circle opanda-plus-background"></i>
<h4 class="opanda-title">
<?php echo $suggestion['title'] ?>
</h4>
<div class="opanda-description">
<?php echo $suggestion['description'] ?>
</div>
<div class="opanda-buttons">
<a href='<?php echo $url ?>' class="button button-large" title="<?php _e('Click here to learn more', 'bizpanda') ?>">
<i class="fa fa-external-link"></i><span>Learn More</span>
</a>
</div>
</div>
<?php } ?>
<img class="opanda-arrow" src='<?php echo OPANDA_BIZPANDA_URL . '/assets/admin/img/new-item-arrow.png' ?>' />
</div>
</div>
<?php } ?>
</div>
<?php
}
}
FactoryPages321::register($bizpanda, 'OPanda_NewPandaItemPage');

View File

@@ -0,0 +1,270 @@
<?php
/**
* The page 'Settings'.
*
* @since 1.0.0
*/
class OPanda_SettingsPage extends FactoryPages321_AdminPage {
/**
* The parent menu of the page in the admin menu.
*
* @see FactoryPages321_AdminPage
*
* @since 1.0.0
* @var string
*/
public $menuPostType = OPANDA_POST_TYPE;
/**
* The id of the page in the admin menu.
*
* Mainly used to navigate between pages.
* @see FactoryPages321_AdminPage
*
* @since 1.0.0
* @var string
*/
public $id = "settings";
public function __construct(Factory325_Plugin $plugin) {
parent::__construct($plugin);
$this->menuTitle = __('Global Settings', 'bizpanda');
if( !current_user_can('administrator') )
$this->capabilitiy = "manage_opanda_setting";
}
/**
* Requests assets (js and css) for the page.
*
* @see FactoryPages321_AdminPage
*
* @since 1.0.0
* @return void
*/
public function assets($scripts, $styles) {
$this->scripts->request('jquery');
$this->scripts->request( array(
'control.checkbox',
'control.dropdown',
'plugin.ddslick',
), 'bootstrap' );
$this->styles->request( array(
'bootstrap.core',
'bootstrap.form-group',
'bootstrap.separator',
'control.dropdown',
'control.checkbox',
), 'bootstrap' );
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/settings.010020.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/settings.010020.css');
}
/**
* Renders the page
*
* @sinve 1.0.0
* @return void
*/
public function indexAction() {
global $bizpanda;
$current = isset( $_GET['opanda_screen'] ) ? $_GET['opanda_screen'] : null;
$screens = array();
$subscriptionOptions = array(
'title' => __('Subscription Options', 'bizpanda'),
'class' => 'OPanda_SubscriptionSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.subscription.php'
);
$socialOptions = array();
if ( BizPanda::hasFeature('social') || BizPanda::hasPlugin('sociallocker') ) {
$socialOptions = array(
'title' => __('Social Options', 'bizpanda'),
'class' => 'OPanda_SocialSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.social.php'
);
}
// for the plugin Opt-In Panda, the subscription options should be the first
if ( BizPanda::isSinglePlugin() && BizPanda::hasPlugin('optinpanda') ) {
if ( empty( $current ) ) $current = 'subscription';
$screens['subscription'] = $subscriptionOptions;
if (!empty( $socialOptions ) ) $screens['social'] = $socialOptions;
} else {
if ( empty( $current ) ) $current = 'social';
if (!empty( $socialOptions ) ) $screens['social'] = $socialOptions;
if ( BizPanda::hasFeature('subscription') ) $screens['subscription'] = $subscriptionOptions;
}
if ( BizPanda::hasFeature('lockers') ) {
$screens['lock'] = array(
'title' => __('Lock Options', 'bizpanda'),
'class' => 'OPanda_AdvancedSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.lock.php'
);
}
$screens['stats'] = array(
'title' => __('Stats', 'bizpanda'),
'class' => 'OPanda_StatsSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.stats.php'
);
$screens['notifications'] = array(
'title' => __('Notifications', 'bizpanda'),
'class' => 'OPanda_NotificationsSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.notifications.php'
);
$screens['zapier'] = array(
'title' => __('Zapier', 'bizpanda'),
'class' => 'OPanda_ZapierSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.zapier.php'
);
$screens['permissions'] = array(
'title' => __('Permissions', 'bizpanda'),
'class' => 'OPanda_PermissionsSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.permissions.php'
);
$screens['text'] = array(
'title' => __('Front-end Text', 'bizpanda'),
'class' => 'OPanda_TextSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.text.php'
);
if ( BizPanda::hasFeature('terms') ) {
$screens['terms'] = array(
'title' => __('Terms & Policies', 'bizpanda'),
'class' => 'OPanda_TermsSettings',
'path' => OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.terms.php'
);
}
$screens = apply_filters( 'opanda_settings_screens', $screens );
if ( !isset( $screens[$current] ) ) $current = 'social';
require_once OPANDA_BIZPANDA_DIR . '/admin/pages/settings/class.settings.php';
require_once $screens[$current]['path'];
$screen = new $screens[$current]['class']( $this );
$action = isset( $_GET['opanda_action'] ) ? $_GET['opanda_action'] : null;
if ( !empty( $action ) ) {
$methodName = $action . 'Action';
$screen->$methodName();
return;
}
// getting options
$options = $screen->getOptions();
$options = apply_filters("opanda_{$current}_settings", $options );
// creating a form
$form = new FactoryForms328_Form(array(
'scope' => 'opanda',
'name' => 'setting'
), $bizpanda );
$form->setProvider( new FactoryForms328_OptionsValueProvider(array(
'scope' => 'opanda'
)));
$form->add($options);
if ( isset( $_POST['save-action'] ) ) {
do_action("opanda_{$current}_settings_saving");
$form->save();
do_action("opanda_{$current}_settings_saved");
$redirectArgs = apply_filters("opanda_{$current}_settings_redirect_args", array(
'opanda_saved' => 1,
'opanda_screen' => $current
));
return $this->redirectToAction('index', $redirectArgs);
}
$formAction = add_query_arg( array(
'post_type' => OPANDA_POST_TYPE,
'page' => 'settings-' . $bizpanda->pluginName,
'opanda_screen' => $current
), admin_url('edit.php') );
?>
<div class="wrap ">
<h2 class="nav-tab-wrapper">
<?php foreach ( $screens as $screenName => $screenData ) { ?><a href="<?php $this->actionUrl('index', array('opanda_screen' => $screenName)) ?>" class="nav-tab <?php if ( $screenName === $current ) { echo 'nav-tab-active'; } ?>">
<?php echo $screenData['title'] ?>
</a><?php } ?>
</h2>
<?php $screen->header() ?>
<div class="factory-bootstrap-331 opanda-screen-<?php echo $current ?>">
<form method="post" class="form-horizontal" action="<?php echo $formAction ?>">
<?php if ( isset( $_GET['opanda_saved'] ) && empty( $screen->error) ) { ?>
<div id="message" class="alert alert-success">
<p><?php _e('The settings have been updated successfully!', 'bizpanda') ?></p>
</div>
<?php } ?>
<?php if ( !empty( $screen->success ) ) { ?>
<div id="message" class="alert alert-success">
<p><?php echo $screen->success ?></p>
</div>
<?php } ?>
<?php if ( !empty( $screen->error ) ) { ?>
<div id="message" class="alert alert-danger">
<p><?php echo $screen->error ?></p>
</div>
<?php } ?>
<?php do_action('onp_sl_settings_options_notices') ?>
<div style="padding-top: 10px;">
<?php $form->html(); ?>
</div>
<div class="form-group form-horizontal">
<label class="col-sm-2 control-label"> </label>
<div class="control-group controls col-sm-10">
<input name="save-action" class="btn btn-primary" type="submit" value="<?php _e('Save Changes', 'bizpanda') ?>"/>
</div>
</div>
</form>
</div>
</div>
<?php
}
}
FactoryPages321::register($bizpanda, 'OPanda_SettingsPage');

View File

@@ -0,0 +1,407 @@
<?php
/**
* The file contains a page that shows the common settings for the plugin.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Common Settings.
*
* @since 1.0.0
*/
class OPanda_AdvancedSettings extends OPanda_Settings {
public $id = 'advanced';
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
global $optinpanda;
?>
<p>
<?php _e('Options linked with the locking feature. Don\'t change the options here if you are not sure that you do.', 'bizpanda' )?>
</p>
<?php
}
/**
* A page to edit the Advanced Options.
*
* @since v3.7.2
* @return vod
*/
public function getOptions() {
global $optinpanda;
$forms = array();
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'debug',
'title' => __( 'Debug', 'bizpanda' ),
'hint' => __( 'If this option turned on, the plugin displays information about why the locker is not visible.', 'bizpanda' )
);
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'textbox',
'name' => 'passcode',
'title' => __( 'Pass Code', 'bizpanda' ),
'hint' => sprintf( __( 'Optional. When the pass code is contained in your website URL, the locked content gets automatically unlocked.<br/><div class="opanda-example"><strong>Usage example:</strong> <a href="#" class="opanda-url" target="_blank">%s<span class="opanda-passcode"></span></a></div>', 'bizpanda' ), site_url() ),
'default' => false
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'permanent_passcode',
'title' => __( 'Permanent Unlock<br /> For Pass Code', 'bizpanda' ),
'hint' => __( 'Optional. If On, your lockers will be revealed forever if the user once opened the page URL with the Pass Code.<br />Otherwise your lockers will be unlocked only when the page URL contains the Pass Code.', 'bizpanda' ),
'default' => false
);
if ( BizPanda::hasPlugin('sociallocker') ) {
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'interrelation',
'title' => __( 'Interrelation', 'bizpanda' ),
'hint' => __( 'Set On to make lockers interrelated. When one of the interrelated lockers are unlocked on your site, the others will be unlocked too.<br /> Recommended to turn on, if you use the Batch Locking feature.', 'bizpanda' ),
'default' => false
);
}
if ( BizPanda::hasPlugin('optinpanda') ) {
if ( !BizPanda::hasPlugin('sociallocker') ) {
$forms[] = array(
'type' => 'separator'
);
}
$forms[] = array(
'type' => 'dropdown',
'data' => array(
array( 'byemail', __('Unlock all email lockers having the same list together.', 'bizpanda') ),
array( 'bypage', __('Unlock all email lockers located on the same page together.', 'bizpanda') )
),
'name' => 'emaillocker_mode',
'default' => 'byemail',
'title' => __( 'Email Lockers', 'bizpanda' ),
'hint' => __( 'Sets what parameter will be used to link and unlock email lockers.', 'bizpanda' )
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'forbid_temp_emails',
'default' => false,
'title' => __( 'Forbid Temp Emails', 'bizpanda' ),
'hint' => __( 'If On, the locker will not accept temporary email address to unlock content.', 'bizpanda' )
);
$tempDomains = self::getTempEmailDomains();
$forms[] = array(
'type' => 'div',
'id' => 'temp_domains_list',
'items' => array(
array(
'type' => 'textarea',
'name' => 'temp_domains',
'default' => implode(', ', $tempDomains),
'title' => __( 'Forbid Email Domains', 'bizpanda' ),
'hint' => __( 'A list of domains (and their parts) used for creating temporary email addresses. You can edit it or leave it as is.', 'bizpanda' )
)
)
);
}
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'dropdown',
'data' => array(
array( 'visible_with_warning', __('Show Locker With Warning', 'bizpanda') ),
array( 'visible', __('Show Locker As Usual', 'bizpanda') ),
array( 'hidden', __('Hide Locker', 'bizpanda') ),
),
'name' => 'in_app_browsers',
'default' => 'visible_with_warning',
'title' => __( 'In-App Browsers', 'bizpanda' ),
'hint' => __( 'Optional. By default the locker appears when a page is opened in in-app mobile browsers like Facebook In-App Browser, Instagram In-App Browser (and others). For some users the locker may not work properly in in-app browsers, so you can hide it or show the locker with a warning offering to open a page in a standard browser.', 'bizpanda' )
);
$forms[] = array(
'type' => 'div',
'id' => 'in_app_browsers_warning',
'items' => array(
array(
'type' => 'textarea',
'name' => 'in_app_browsers_warning',
'title' => __( 'In-App Warning', 'bizpanda' ),
'default' => __( 'You are viewing this page in the {browser}. The locker may work incorrectly in this browser. Please open this page in a standard browser.', 'bizpanda' ),
'hint' => __( 'A warning message visible together with the locker when a user opens your page in an in-app browser.', 'bizpanda' )
)
)
);
if ( BizPanda::hasPlugin('sociallocker') ) {
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'dropdown',
'data' => array(
array( 'show_error', __('Show Locker With Error', 'bizpanda') ),
array( 'show_content', __('Hide Locker, Show Content', 'bizpanda') )
),
'name' => 'adblock',
'default' => 'show_error',
'title' => __( 'AdBlock', 'bizpanda' ),
'hint' => __( 'Optional. Setup how the locker should behave if AdBlock blocks social widgets.', 'bizpanda' )
);
$forms[] = array(
'type' => 'div',
'id' => 'adblock_error',
'items' => array(
array(
'type' => 'textarea',
'name' => 'adblock_error',
'title' => __( 'AdBlock Error', 'bizpanda' ),
'default' => __( 'Unable to create social buttons. Please make sure that nothing blocks loading of social scripts in your browser. Some browser extentions (Avast, PrivDog, AdBlock, Adguard etc.) or usage of private tabs in FireFox may cause this issue. Turn them off and try again.', 'bizpanda' ),
'hint' => __( 'An error displaying when AdBlock extensions block loading of social buttons.', 'bizpanda' )
)
)
);
}
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'rss',
'title' => __( 'Locked content<br /> is visible in RSS feeds', 'bizpanda' ),
'hint' => __( 'Set On to make locked content visible in RSS feed.', 'bizpanda' ),
'default' => false
);
if ( BizPanda::hasPlugin('sociallocker') ) {
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'actual_urls',
'title' => __( 'Actual URLs by default', 'bizpanda' ),
'hint' => __( 'Optional. If you do not set explicitly URLs to like/share in the settings of social buttons, then by default the plugin will use an URL of the page where the locker is located. Turn on this option to extract URLs to like/share from an address bar of the user browser, saving all query arguments. By default permalinks are used.', 'bizpanda' ),
'default' => false
);
}
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'html',
'html' => '<div class="col-md-offset-2" style="padding: 30px 0 10px 0;">' .
'<strong style="font-size: 15px;">' . __('Advanced Options', 'bizpanda') . '</strong>' .
'<p>' . __('Please don\'t change these options if everything works properly.', 'bizpanda') . '</p>' .
'</div>'
);
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'textbox',
'name' => 'session_duration',
'title' => __( 'Session Duration<br />(in secs)', 'bizpanda' ),
'hint' => __( 'Optional. The session duration used in the advanced Visiblity Options. The default value 900 seconds (15 minutes).', 'bizpanda' ),
'default' => 900
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'session_freezing',
'title' => __( 'Session Freezing', 'bizpanda' ),
'hint' => __( 'Optional. If On, the length of users\' sessions is fixed, by default the sessions are prolonged automatically every time when a user visits your website for a specified value of the session duration.', 'bizpanda' ),
'default' => false
);
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'normalize_markup',
'title' => __( 'Normalize Markup', 'bizpanda' ),
'hint' => __( 'Optional. If you use the Batch Lock and the locker appears incorrectly, probably HTML markup of your page is broken. Try to turn on this option and the plugin will try to normalize html markup before output.', 'bizpanda' )
);
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'dynamic_theme',
'title' => __( 'I use a dynamic theme', 'bizpanda' ),
'hint' => __( 'If your theme loads pages dynamically via ajax, set "On" to get the lockers working (if everything works properly, don\'t turn on this option).', 'bizpanda' )
);
$forms[] = array(
'type' => 'textbox',
'way' => 'buttons',
'name' => 'managed_hook',
'title' => __( 'Creater Trigger', 'bizpanda' ),
'hint' => __( 'Optional. Set any jQuery trigger bound to the root document to create lockers. By default lockers are created on loading a page.', 'bizpanda' )
);
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'dropdown',
'name' => 'alt_overlap_mode',
'data' => array(
array( 'full', __('Classic (full)', 'bizpanda') ),
array( 'transparence', __('Transparency', 'bizpanda') )
),
'default' => 'transparence',
'title' => __( 'Alt Overlap Mode', 'bizpanda' ),
'hint' => __( 'This overlap mode will be applied for browsers which don\'t support the blurring effect.', 'bizpanda' )
);
$forms[] = array(
'type' => 'dropdown',
'data' => array(
array( 'auto', __('Auto', 'bizpanda') ),
array( 'always_hidden', __('Hidden On Loading', 'bizpanda') ),
array( 'always_visible', __('Visible On Loading', 'bizpanda') )
),
'name' => 'content_visibility',
'default' => 'auto',
'title' => __( 'Content Visibility<br />On Loading', 'bizpanda' ),
'hint' => __( 'By default if the blurring or transparent mode is used, the content may be visible during a short time before the locker appears. On other side, if the classic mode is used, the locked content is hidden by default on loading. Change this option to manage content visibility when a page loads.', 'bizpanda' )
);
if ( BizPanda::hasPlugin('sociallocker') ) {
$forms[] = array(
'type' => 'separator'
);
$forms[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'tumbler',
'title' => __( 'Anti-Cheating', 'bizpanda' ),
'default' => false,
'hint' => __( 'Turn it on to protect your locked content against cheating from visitors. Some special browser extensions allow to view the locked content without actual sharing. This option checks whether the user has really liked/shared your page.', 'bizpanda' )
);
$forms[] = array(
'type' => 'textbox',
'name' => 'timeout',
'title' => __( 'Timeout of waiting<br />loading the locker (in ms)', 'bizpanda' ),
'default' => '20000',
'hint' => __( 'A user can have browser extensions which block loading scripts of social networks. If the social buttons have not been loaded within the specified timeout interval, the locker shows the error (in the red container) alerting about that a browser blocks loading of the social buttons.<br />', 'bizpanda' )
);
}
$forms[] = array(
'type' => 'separator'
);
return $forms;
}
/**
* Returns a list of default temporary email domains.
*/
public static function getTempEmailDomains() {
return array(
'sharklasers',
'grr',
'guerrillamail',
'guerrillamailblock',
'pokemail',
'spam4',
'yk20.com',
'0hiolce.com',
'etoic.com',
'jklasdf.com',
'u.0u.ro',
'uacro.com',
'rblx.site',
'malove.site',
'harvard-ac-uk.tk',
'xing886',
'xww.ro',
'barryogorman.com',
'kozow.com',
'dmarc.ro',
'freemail.tweakly.net',
'ppetw.com',
'uu.gl',
'usa.cc',
'0v.ro',
'mailfs.com',
'apssdc.ml',
'0w.ro',
'laoho.com',
'wupics.com',
'xww.ro',
'getnada.com',
'amail.club',
'banit',
'cars2.club',
'cmail.club',
'duck2.club',
'nada.email',
'nada.ltd',
'wmail.club'
);
}
}

View File

@@ -0,0 +1,164 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 2016, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_NotificationsSettings extends OPanda_Settings {
public $id = 'notifications';
public function __construct($page) {
parent::__construct($page);
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
global $optinpanda;
?>
<p>
<?php _e('Mark events you wish to get notifications about.', 'bizpanda' )?>
</p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
$options = array();
$wpEditorData = array();
$defaultLeadsEmail = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/leads-notification.html' );
$defaultUnlocksEmail = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/unlocks-notification.html' );
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'notify_leads',
'title' => __( 'New Lead Received', 'bizpanda' ),
'default' => false,
'hint' => __( 'Set On to recived notifications via email about new leads.', 'bizpanda' )
);
$options[] = array(
'type' => 'div',
'id' => 'opanda_notify_leads-options',
'items' => array(
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'leads_email_receiver',
'default' => get_option('admin_email'),
'title' => __('Recipient', 'bizpanda'),
'hint' => __('An email address of the recipient to send notifications.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'leads_email_subject',
'default' => 'A new lead grabbed on {sitename}',
'title' => __('Subject', 'bizpanda'),
'hint' => __('A subject of the notification email. Supported tags: {sitename}.', 'bizpanda')
),
array(
'type' => 'wp-editor',
'name' => 'leads_email_body',
'data' => $wpEditorData,
'title' => __('Message', 'bizpanda'),
'hint' => __('A body of the notification email. Supported tags: {sitename}, {siteurl}, {details}, {context}.', 'bizpanda'),
'tinymce' => array(
'height' => 250,
'content_css' => OPANDA_BIZPANDA_URL . '/assets/admin/css/tinymce.010000.css'
),
'default' => $defaultLeadsEmail
),
array(
'type' => 'separator'
)
)
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'notify_unlocks',
'title' => __( 'Unlock Occurred', 'bizpanda' ),
'default' => false,
'hint' => __( 'Set On to recived notifications via email about unlocks.', 'bizpanda' )
);
$options[] = array(
'type' => 'div',
'id' => 'opanda_notify_unlocks-options',
'items' => array(
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'unlocks_email_receiver',
'default' => get_option('admin_email'),
'title' => __('Recipient', 'bizpanda'),
'hint' => __('An email address of the recipient to send notifications.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'unlocks_email_subject',
'default' => 'A new unlock occurred on {sitename}',
'title' => __('Subject', 'bizpanda'),
'hint' => __('A subject of the notification email. Supported tags: {sitename}.', 'bizpanda')
),
array(
'type' => 'wp-editor',
'name' => 'unlocks_email_body',
'data' => $wpEditorData,
'title' => __('Message', 'bizpanda'),
'hint' => __('A body of the notification email. Supported tags: {sitename}, {siteurl}, {context}.', 'bizpanda'),
'tinymce' => array(
'height' => 250,
'content_css' => OPANDA_BIZPANDA_URL . '/assets/admin/css/tinymce.010000.css'
),
'default' => $defaultUnlocksEmail
)
)
);
$options[] = array(
'type' => 'separator'
);
return $options;
}
public function onSaving() {
}
}

View File

@@ -0,0 +1,189 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 2016, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_PermissionsSettings extends OPanda_Settings {
public $id = 'permissions';
public function __construct($page) {
parent::__construct($page);
global $wp_roles;
$this->wp_roles = $wp_roles;
if ( !isset( $wp_roles ) )
$this->wp_roles = new WP_Roles();
$this->roles = $this->wp_roles->get_names();
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
global $optinpanda;
?>
<p>
<?php _e('Configure roles and permissions for getting access to the plugin features.', 'bizpanda' )?>
</p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
$options = array();
$options[] = array(
'type' => 'separator'
);
foreach ($this->roles as $role_value => $role_name) {
if( $role_value == 'administrator' )
continue;
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'user_role_' . $role_value,
'title' => sprintf(__( '%s Role', 'bizpanda' ), $role_name),
'default' => false,
'hint' => sprintf(__( 'Grants access for users with the %s role.', 'bizpanda' ), $role_name)
);
$options[] =array(
'type' => 'div',
'class' => 'opanda-user-role-options-group',
'id' => 'opanda_user_role_' . $role_value . '_options_group',
'items' => array(
array(
'type' => 'div',
'cssClass' => 'permissions-set',
'items' => array(
array(
'type' => 'checkbox',
'name' => 'allow_user_role_' . $role_value . '_edit',
'title' => __( 'Lockers', 'bizpanda' ),
'default' => false,
'hint' => sprintf(__( 'Allows to view and edit lockers.', 'bizpanda' ), $role_name)
),
array(
'type' => 'checkbox',
'name' => 'allow_user_role_' . $role_value . '_leads',
'title' => __( 'Leads', 'bizpanda' ),
'default' => false,
'hint' => sprintf(__( 'Grants access to the Leads page.', 'bizpanda' ), $role_name)
),
array(
'type' => 'checkbox',
'name' => 'allow_user_role_' . $role_value . '_stats',
'title' => __( 'Stats & Reports', 'bizpanda' ),
'default' => true,
'hint' => sprintf(__( 'Grants access to the Stats & Reports page.', 'bizpanda' ), $role_name)
),
array(
'type' => 'checkbox',
'name' => 'allow_user_role_' . $role_value . '_setting',
'title' => __( 'Settings', 'bizpanda' ),
'default' => false,
'hint' => sprintf(__( 'Grants access to the Global Settings page.', 'bizpanda' ), $role_name)
),
array(
'type' => 'checkbox',
'name' => 'allow_user_role_' . $role_value . '_licensing',
'title' => __( 'License Manager', 'bizpanda' ),
'default' => false,
'hint' => sprintf(__( 'Grants access to the License Manager page.', 'bizpanda' ), $role_name)
)
)
)
)
);
$options[] = array(
'type' => 'separator'
);
}
return $options;
}
public function onSaving() {
foreach ($this->roles as $role_value => $role_name) {
if( $role_value == 'administrator' )
continue;
$this->editCapabilityOption($role_value, 'edit');
$this->editCapabilityOption($role_value, 'leads');
$this->editCapabilityOption($role_value, 'stats');
$this->editCapabilityOption($role_value, 'setting');
$this->editCapabilityOption($role_value, 'licensing');
}
}
public function editCapabilityOption($role_name, $capabilityPrefix) {
$role = $GLOBALS [ 'wp_roles' ]->role_objects[$role_name];
if( isset($_POST['opanda_allow_user_role_' . $role_name . '_'. $capabilityPrefix]) && !empty($_POST['opanda_allow_user_role_' . $role_name . '_' . $capabilityPrefix]) ) {
if( $capabilityPrefix != 'edit' )
$this->wp_roles->add_cap( $role_name, 'manage_opanda_' . $capabilityPrefix );
else {
$this->wp_roles->add_cap( $role_name, 'read_opanda-item' );
$this->wp_roles->add_cap( $role_name, 'read_private_opanda-items' );
$this->wp_roles->add_cap( $role_name, 'delete_opanda-item' );
$this->wp_roles->add_cap( $role_name, 'delete_opanda-items' );
$this->wp_roles->add_cap( $role_name, 'edit_opanda-item' );
$this->wp_roles->add_cap( $role_name, 'edit_opanda-items' );
$this->wp_roles->add_cap( $role_name, 'edit_others_opanda-items' );
$this->wp_roles->add_cap( $role_name, 'publish_opanda-items' );
}
} else {
if( $role->has_cap( 'manage_opanda_' . $capabilityPrefix ) && $capabilityPrefix != 'edit' )
$role->remove_cap( 'manage_opanda_' . $capabilityPrefix );
else if( $capabilityPrefix == 'edit' ) {
if( $role->has_cap( 'read_opanda-item' ) )
$this->wp_roles->remove_cap( $role_name, 'read_opanda-item' );
if( $role->has_cap( 'read_private_opanda-items' ) )
$this->wp_roles->remove_cap( $role_name, 'read_private_opanda-items' );
if( $role->has_cap( 'delete_opanda-item' ) )
$this->wp_roles->remove_cap( $role_name, 'delete_opanda-item' );
if( $role->has_cap( 'delete_opanda-items' ) )
$this->wp_roles->remove_cap( $role_name, 'delete_opanda-items' );
if( $role->has_cap( 'edit_opanda-item' ) )
$this->wp_roles->remove_cap( $role_name, 'edit_opanda-item' );
if( $role->has_cap( 'edit_opanda-items' ) )
$this->wp_roles->remove_cap( $role_name, 'edit_opanda-items' );
if( $role->has_cap( 'edit_others_opanda-items' ) )
$this->wp_roles->remove_cap( $role_name, 'edit_others_opanda-items' );
if( $role->has_cap( 'publish_opanda-items' ) )
$this->wp_roles->remove_cap( $role_name, 'publish_opanda-items' );
}
}
}
}

View File

@@ -0,0 +1,157 @@
<?php
/**
* The base class for screens of settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @since 1.0.0
*/
abstract class OPanda_Settings {
/**
* Saves the current page object to make available the URLs methods.
* And calls the init method to set notices.
*
* @since 1.0.0
*
* @param FactoryPages321_AdminPage $page
* @return OPanda_Settings
*/
public function __construct( $page ) {
$this->page = $page;
$this->plugin = $page->plugin;
add_action("opanda_{$this->id}_settings_saving", array($this, 'onSaving'));
add_action("opanda_{$this->id}_settings_saved", array($this, 'onSaved'));
add_filter("opanda_{$this->id}_settings_redirect_args", array( $this, 'addErrorsToRedirectArgs') );
$this->isSaving = isset( $_POST['save-action'] );
if ( isset( $_REQUEST['opanda_error'] ) ) {
$this->error = urldecode( $_REQUEST['opanda_error'] );
}
$this->init();
}
/**
* The success notice to display.
*
* @since 1.0.0
* @var string
*/
public $success = null;
/**
* The error notice to display.
*
* @since 1.0.0
* @var string
*/
public $error = null;
/**
* Inits the settings.
* Here you can set the notices to display.
*
* @since 1.0.0
* @return void
*/
public function init() {}
/**
* Shows the header html of the settings.
* Usually it's a concise description of the current screen of the settings.
*
* @since 1.0.0
* @return void
*/
public function header() {}
/**
* Shows the footer html of the settings. Currently it's not used.
*
* @since 1.0.0
* @return void
*/
public function footer() {}
/**
* Returns the array of the options to display.
*
* @since 1.0.0
* @return mixed[]
*/
abstract public function getOptions();
/**
* Builds an URL for the specified action with the set arguments.
*
* @since 1.0.0
* @param string $action An action of the current screen of settings.
* @param string[] $args A set of extra arguments.
* @return string The result URL.
*/
public function getActionUrl( $action = 'index', $args = array() ) {
$args['opanda_screen'] = $this->id;
if ( 'index' !== $action ) $args['opanda_action'] = $action;
return $this->page->getActionUrl('index', $args);
}
/**
* Prints an URL for the specified action with the set arguments.
*
* @since 1.0.0
* @param string $action An action of the current screen of settings.
* @param string[] $args A set of extra arguments.
* @return string The result URL.
*/
public function actionUrl( $action = 'index', $args = array() ) {
echo $this->getActionUrl( $action );
}
/**
* Redirects to the specified action with the set arguments.
*
* @since 1.0.0
* @param string $action An action of the current screen of settings.
* @param string[] $args A set of extra arguments.
* @return string The result URL.
*/
public function redirectToAction( $action = 'index', $args = array() ) {
wp_redirect( $this->getActionUrl( $action = 'index', $args) );
exit;
}
/**
* Calls before saving the settings.
*
* @since 1.0.0
* @return void
*/
public function onSaving() {}
/**
* Calls after the form is saved.
*
* @since 1.0.0
* @return void
*/
public function onSaved() {}
/**
* Shows an error.
*/
public function showError( $text ) {
$this->error = $text;
}
public function addErrorsToRedirectArgs( $args ) {
if ( empty( $this->error ) || !$this->isSaving ) return $args;
$args['opanda_error'] = urlencode($this->error);
return $args;
}
}

View File

@@ -0,0 +1,383 @@
<?php
/**
* A class for the page providing the social settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The Social Settings
*
* @since 1.0.0
*/
class OPanda_SocialSettings extends OPanda_Settings {
public $id = 'social';
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
?>
<p><?php _e('Set up here your social API keys and app IDs for social buttons.', 'optionpanda') ?></p>
<?php
}
/**
* Returns subscription options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getOptions() {
$languages = array(
array('ca_ES', __('Catalan', 'bizpanda')),
array('cs_CZ', __('Czech', 'bizpanda')),
array('cy_GB', __('Welsh', 'bizpanda')),
array('da_DK', __('Danish', 'bizpanda')),
array('de_DE', __('German', 'bizpanda')),
array('eu_ES', __('Basque', 'bizpanda')),
array('en_US', __('English', 'bizpanda')),
array('es_ES', __('Spanish', 'bizpanda')),
array('fi_FI', __('Finnish', 'bizpanda')),
array('fr_FR', __('French', 'bizpanda')),
array('gl_ES', __('Galician', 'bizpanda')),
array('hu_HU', __('Hungarian', 'bizpanda')),
array('it_IT', __('Italian', 'bizpanda')),
array('ja_JP', __('Japanese', 'bizpanda')),
array('ko_KR', __('Korean', 'bizpanda')),
array('nb_NO', __('Norwegian', 'bizpanda')),
array('nl_NL', __('Dutch', 'bizpanda')),
array('pl_PL', __('Polish', 'bizpanda')),
array('pt_BR', __('Portuguese (Brazil)', 'bizpanda')),
array('pt_PT', __('Portuguese (Portugal)', 'bizpanda')),
array('ro_RO', __('Romanian', 'bizpanda')),
array('ru_RU', __('Russian', 'bizpanda')),
array('sk_SK', __('Slovak', 'bizpanda')),
array('sl_SI', __('Slovenian', 'bizpanda')),
array('sv_SE', __('Swedish', 'bizpanda')),
array('th_TH', __('Thai', 'bizpanda')),
array('tr_TR', __('Turkish', 'bizpanda')),
array('ku_TR', __('Kurdish', 'bizpanda')),
array('zh_CN', __('Simplified Chinese (China)', 'bizpanda')),
array('zh_HK', __('Traditional Chinese (Hong Kong)', 'bizpanda')),
array('zh_TW', __('Traditional Chinese (Taiwan)', 'bizpanda')),
array('af_ZA', __('Afrikaans', 'bizpanda')),
array('sq_AL', __('Albanian', 'bizpanda')),
array('hy_AM', __('Armenian', 'bizpanda')),
array('az_AZ', __('Azeri', 'bizpanda')),
array('be_BY', __('Belarusian', 'bizpanda')),
array('bn_IN', __('Bengali', 'bizpanda')),
array('bs_BA', __('Bosnian', 'bizpanda')),
array('bg_BG', __('Bulgarian', 'bizpanda')),
array('hr_HR', __('Croatian', 'bizpanda')),
array('nl_BE', __('Dutch (Belgie)', 'bizpanda')),
array('eo_EO', __('Esperanto', 'bizpanda')),
array('et_EE', __('Estonian', 'bizpanda')),
array('fo_FO', __('Faroese', 'bizpanda')),
array('ka_GE', __('Georgian', 'bizpanda')),
array('el_GR', __('Greek', 'bizpanda')),
array('gu_IN', __('Gujarati', 'bizpanda')),
array('hi_IN', __('Hindi', 'bizpanda')),
array('is_IS', __('Icelandic', 'bizpanda')),
array('id_ID', __('Indonesian', 'bizpanda')),
array('ga_IE', __('Irish', 'bizpanda')),
array('jv_ID', __('Javanese', 'bizpanda')),
array('kn_IN', __('Kannada', 'bizpanda')),
array('kk_KZ', __('Kazakh', 'bizpanda')),
array('la_VA', __('Latin', 'bizpanda')),
array('lv_LV', __('Latvian', 'bizpanda')),
array('li_NL', __('Limburgish', 'bizpanda')),
array('lt_LT', __('Lithuanian', 'bizpanda')),
array('mk_MK', __('Macedonian', 'bizpanda')),
array('mg_MG', __('Malagasy', 'bizpanda')),
array('ms_MY', __('Malay', 'bizpanda')),
array('mt_MT', __('Maltese', 'bizpanda')),
array('mr_IN', __('Marathi', 'bizpanda')),
array('mn_MN', __('Mongolian', 'bizpanda')),
array('ne_NP', __('Nepali', 'bizpanda')),
array('pa_IN', __('Punjabi', 'bizpanda')),
array('rm_CH', __('Romansh', 'bizpanda')),
array('sa_IN', __('Sanskrit', 'bizpanda')),
array('sr_RS', __('Serbian', 'bizpanda')),
array('so_SO', __('Somali', 'bizpanda')),
array('sw_KE', __('Swahili', 'bizpanda')),
array('tl_PH', __('Filipino', 'bizpanda')),
array('ta_IN', __('Tamil', 'bizpanda')),
array('tt_RU', __('Tatar', 'bizpanda')),
array('te_IN', __('Telugu', 'bizpanda')),
array('ml_IN', __('Malayalam', 'bizpanda')),
array('uk_UA', __('Ukrainian', 'bizpanda')),
array('uz_UZ', __('Uzbek', 'bizpanda')),
array('vi_VN', __('Vietnamese', 'bizpanda')),
array('xh_ZA', __('Xhosa', 'bizpanda')),
array('zu_ZA', __('Zulu', 'bizpanda')),
array('km_KH', __('Khmer', 'bizpanda')),
array('tg_TJ', __('Tajik', 'bizpanda')),
array('ar_AR', __('Arabic', 'bizpanda')),
array('he_IL', __('Hebrew', 'bizpanda')),
array('ur_PK', __('Urdu', 'bizpanda')),
array('fa_IR', __('Persian', 'bizpanda')),
array('sy_SY', __('Syriac', 'bizpanda')),
array('yi_DE', __('Yiddish', 'bizpanda')),
array('gn_PY', __('Guarani', 'bizpanda')),
array('qu_PE', __('Quechua', 'bizpanda')),
array('ay_BO', __('Aymara', 'bizpanda')),
array('se_NO', __('Northern Sami', 'bizpanda')),
array('ps_AF', __('Pashto', 'bizpanda'))
);
$options = array();
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'html',
'html' => '<div class="col-md-offset-2" style="padding: 10px 0 10px 0;">' .
'<strong style="font-size: 15px;">' . __('Social Buttons', 'bizpanda') . '</strong>' .
'<p>' . __('Options to configure native social buttons (Like, Share, Tweet, Subscribe).', 'bizpanda') . '</p>' .
'</div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'lazy',
'title' => __( 'Lazy Loading', 'bizpanda' ),
'hint' => __( 'If on, start loading resources needed for the buttons only when the locker gets visible on the screen on scrolling. Speeds up loading the website.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'dropdown',
'name' => 'lang',
'title' => __( 'Language of Buttons', 'bizpanda' ),
'data' => $languages,
'hint' => sprintf( __( 'Optional. Select the language that will be used for the social buttons. Used only with the native buttons.', 'bizpanda' ), opanda_get_settings_url('text') )
);
$options[] = array(
'type' => 'dropdown',
'way' => 'buttons',
'name' => 'facebook_version',
'title' => __( 'Facebook API Version', 'bizpanda' ),
'default' => 'v5.0',
'data' => array(
array('v5.0', 'v5.0'),
array('v6.0', 'v6.0'),
array('v7.0', 'v7.0'),
),
'hint' => __( 'Optional. Use the most recent version of the API by default.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'own_apps_for_permissions',
'title' => __( 'Use Own Apps<br />To Request Permissions', 'bizpanda' ),
'hint' => __( 'Optional. Some social buttons require a user to grant a set of permissions to perform social actions. It works fine out-of-box by using embedded social apps. At the case if you wish to display a logo of your website when a user grants the permissions you need to register your own social apps.', 'bizpanda' )
);
$options[] = array(
'type' => 'div',
'id' => 'own_social_apps_wrap',
'items' => $this->getSocialAppsOptions()
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'html',
'html' => '<div class="col-md-offset-2" style="padding: 10px 0 10px 0;">' .
'<strong style="font-size: 15px;">' . __('Sign-In Buttons', 'bizpanda') . '</strong>' .
'<p>' . __('Options to configure sign-in buttons used with sign-in lockers.', 'bizpanda') . '</p>' .
'</div>'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'own_apps_to_signin',
'title' => __( 'Use Own Apps<br />To Sign-In Users', 'bizpanda' ),
'hint' => __( 'Optional. Sign-In buttons work fine out-of-box by using embedded social apps. Set your own apps only if you wish to display a logo of your website when a user signs-in.', 'bizpanda' )
);
$options[] = array(
'type' => 'div',
'id' => 'own_signin_apps_wrap',
'items' => $this->getSignInAppsOptions()
);
$options[] = array(
'type' => 'separator'
);
return $options;
}
/**
* Returns options for social buttons.
*/
protected function getSocialAppsOptions() {
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'facebook_app_id',
'title' => __( 'Facebook App ID', 'bizpanda' ),
'hint' => sprintf( __( 'The App ID of your Facebook App.', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=facebook-app') ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=facebook-app') )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'google_client_id',
'title' => __( 'Google Client ID', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=google-client-id') ),
'hint' => sprintf( __( 'The Google Client ID of your Google App.', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'google_client_secret',
'title' => __( 'Google Client Secret', 'bizpanda' ),
'hint' => __( 'The Google Client Secret of your Google App.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'twitter_social_app_consumer_key',
'title' => __( 'Twitter App Key', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=twitter-app') ),
'hint' => sprintf( __( 'The Twitter Consumer Key of your Twitter App (set only "Read" permission).', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'twitter_social_app_consumer_secret',
'title' => __( 'Twitter App Key Secret', 'bizpanda' ),
'hint' => __( 'The Twitter Consumer Secret of your Twitter App.', 'bizpanda' ),
'for' => array(__('Connect Locker', 'bizpanda'))
);
return $options;
}
/**
* Returns options for sign-in buttons.
*/
protected function getSignInAppsOptions() {
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'facebook_app_id',
'title' => __( 'Facebook App ID', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=facebook-app') ),
'hint' => sprintf( __( 'The Facebook App ID of your Facebook App.', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'facebook_app_secret',
'title' => __( 'Facebook App Secret', 'bizpanda' ),
'hint' => __( 'The Facebook App Secret of your Facebook App.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'google_client_id',
'title' => __( 'Google Client ID', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=google-client-id') ),
'hint' => sprintf( __( 'The Google Client ID of your Google App.', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'google_client_secret',
'title' => __( 'Google Client Secret', 'bizpanda' ),
'hint' => __( 'The Google Client Secret of your Google App.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'twitter_signin_app_consumer_key',
'title' => __( 'Twitter App Key', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=twitter-app') ),
'hint' => sprintf( __( 'The Twitter Consumer Key of your Twitter App (set "Read" and "Write" permissions).', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'twitter_signin_app_consumer_secret',
'title' => __( 'Twitter App Key Secret', 'bizpanda' ),
'hint' => __( 'The Twitter Consumer Secret of your Twitter App.', 'bizpanda' ),
'for' => array(__('Connect Locker', 'bizpanda'))
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'textbox',
'name' => 'linkedin_client_id',
'title' => __( 'LinkedIn Client ID', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=linkedin-api-key') ),
'hint' => sprintf( __( 'The LinkedIn Client ID of your LinkedIn App.', 'bizpanda' ) )
);
$options[] = array(
'type' => 'textbox',
'name' => 'linkedin_client_secret',
'title' => __( 'LinkedIn Client Secret', 'bizpanda' ),
'hint' => __( 'The LinkedIn Client Secret of your LinkedIn App.', 'bizpanda' )
);
return $options;
}
}

View File

@@ -0,0 +1,189 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_StatsSettings extends OPanda_Settings {
public $id = 'stats';
/**
* Sets notices.
*
* @since 1.0.0
* @return void
*/
public function init() {
if ( isset( $_GET['onp_table_cleared'] )) {
$this->success = __('The data has been successfully cleared.', 'bizpanda');
}
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
?>
<p><?php _e('Configure here how the plugin should collect the statistical data.', 'optionpanda') ?></p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
global $optinpanda;
$options = array();
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'google_analytics',
'title' => __( 'Google Analytics', 'bizpanda' ),
'hint' => __( 'If set On, the plugin will generate <a href="https://support.google.com/analytics/answer/1033068?hl=en" target="_blank">events</a> for the Google Analytics when the content is unlocked.<br /><strong>Note:</strong> before enabling this feature, please <a href="https://support.google.com/analytics/answer/1008015?hl=en" target="_blank">make sure</a> that your website contains the Google Analytics tracker code.', 'bizpanda' )
);
$options[] = array(
'type' => 'html',
'html' => array($this, 'statsHtml')
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'tracking',
'title' => __( 'Collecting Stats', 'bizpanda' ),
'hint' => __( 'Turns on collecting the statistical data for reports.', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
return $options;
}
/**
* Render the html block on how much the statistics data takes places.
*
* @sinve 1.0.0
* @return void
*/
public function statsHtml() {
global $wpdb;
$dataSizeInBytes = $wpdb->get_var(
"SELECT round(data_length + index_length) as 'size_in_bytes' FROM information_schema.TABLES WHERE " .
"table_schema = '" . DB_NAME . "' AND table_name = '{$wpdb->prefix}opanda_stats_v2'");
$count = $wpdb->get_var("SELECT COUNT(*) AS n FROM {$wpdb->prefix}opanda_stats_v2");
$humanDataSize = factory_325_get_human_filesize( $dataSizeInBytes );
?>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="control-group controls col-sm-10">
<p class="onp-sl-inline">
<?php if ( $count == 0 ) { ?>
<?php printf( __( 'The statistical data is <strong>empty</strong>.', 'bizpanda' ), $humanDataSize ); ?>
<?php } else { ?>
<?php printf( __( 'The statistical data takes <strong>%s</strong> on your server', 'bizpanda' ), $humanDataSize ); ?>
<a class="button" style="margin-left: 5px;" href="<?php $this->actionUrl('clearStatsData') ?>"><?php _e('clear data', 'bizpanda') ?></a>
<?php } ?>
</p>
</div>
</div>
<?php
}
/**
* Clears the statisticals data.
*
* @sinve 1.0.0
* @return void
*/
public function clearStatsDataAction() {
if ( !isset( $_REQUEST['onp_confirmed'] ) ) {
return $this->confirm(array(
'title' => __('Are you sure that you want to clear the current statistical data?', 'bizpanda'),
'description' => __('All the statistical data will be removed.', 'bizpanda'),
'actions' => array(
'onp_confirm' => array(
'class' => 'btn btn-danger',
'title' => __("Yes, I'm sure", 'bizpanda'),
'url' => $this->getActionUrl('clearStatsData', array(
'onp_confirmed' => true
))
),
'onp_cancel' => array(
'class' => 'btn btn-default',
'title' => __("No, return back", 'bizpanda'),
'url' => $this->getActionUrl('index')
),
)
));
}
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->prefix}opanda_stats_v2");
$lockers = get_posts(array(
'post_type' => OPANDA_POST_TYPE
));
foreach( $lockers as $locker ) {
delete_post_meta($locker->ID, 'opanda_imperessions');
delete_post_meta($locker->ID, 'opanda_unlocks');
}
return $this->redirectToAction('index', array('onp_table_cleared' => true));
}
/**
* Shows the html block with a confirmation dialog.
*
* @sinve 1.0.0
* @return void
*/
public function confirm( $data ) {
?>
<div class="onp-page-wrap factory-bootstrap-331" id="onp-confirm-dialog">
<div id="onp-confirm-dialog-wrap">
<h1><?php echo $data['title'] ?></h1>
<p><?php echo $data['description'] ?></p>
<div class='onp-actions'>
<?php foreach( $data['actions'] as $action ) { ?>
<a href='<?php echo $action['url'] ?>' class='<?php echo $action['class'] ?>'>
<?php echo $action['title'] ?>
</a>
<?php } ?>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,147 @@
<?php
/**
* A class for the page providing the subscription settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The Subscription Settings
*
* @since 1.0.0
*/
class OPanda_SubscriptionSettings extends OPanda_Settings {
public $id = 'subscription';
public function init() {
if ( isset( $_GET['opanda_aweber_disconnected'] )) {
$this->success = __('Your Aweber Account has been successfully disconnected.', 'bizpanda');
}
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
?>
<p><?php _e('Set up here how you would like to save emails of your subscribers.', 'optionpanda') ?></p>
<?php
}
/**
* Returns subscription options.
*
* @since 1.0.0
* @return mixed[]
*/
public function getOptions() {
$options = array();
$options[] = array(
'type' => 'separator'
);
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/subscriptions.php';
$serviceList = OPanda_SubscriptionServices::getSerivcesList();
// fix
$service = get_option('opanda_subscription_service', 'database');
if ( $service == 'none' ) update_option('opanda_subscription_service', 'database');
$listItems = array();
foreach( $serviceList as $serviceName => $serviceInfo ) {
$listItems[] = array(
'value' => $serviceName,
'title' => $serviceInfo['title'],
'hint' => isset( $serviceInfo['description'] ) ? $serviceInfo['description'] : null,
'image' => isset( $serviceInfo['image'] ) ? $serviceInfo['image'] : null,
'hover' => isset( $serviceInfo['hover'] ) ? $serviceInfo['hover'] : null
);
}
$options[] = array(
'type' => 'dropdown',
'name' => 'subscription_service',
'way' => 'ddslick',
'width' => 450,
'data' => $listItems,
'default' => 'none',
'title' => __('Mailing Service', 'bizpanda')
);
$options = apply_filters( 'opanda_subscription_services_options', $options, $this );
$options[] = array(
'type' => 'separator'
);
$options[] = array( 'type' => 'html', 'html' => array($this, 'showConfirmationMessageHeader') );
$options[] = array(
'type' => 'textbox',
'name' => 'sender_email',
'title' => __('Sender Email', 'bizpanda'),
'hint' => __('Optional. A sender for confirmation emails.', 'bizpanda'),
'default' => get_bloginfo('admin_email')
);
$options[] = array(
'type' => 'textbox',
'name' => 'sender_name',
'title' => __('Sender Name', 'bizpanda'),
'hint' => __('Optional. A sender name for confirmation emails.', 'bizpanda'),
'default' => get_bloginfo('name')
);
$options[] = array(
'type' => 'separator'
);
return $options;
}
public function showConfirmationMessageHeader() {
?>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="control-group controls col-sm-10">
<?php _e('If you are going to use Double Opt-In and send confirmation emails through Wordpress, fill the sender information below.', 'emaillocker' ) ?>
</div>
</div>
<?php
}
/**
* Calls before saving the settings.
*
* @since 1.0.0
* @return void
*/
public function onSaving() {
do_action('opanda_on_saving_subscription_settings', $this );
}
public function disconnectAweberAction() {
delete_option('opanda_aweber_consumer_key');
delete_option('opanda_aweber_consumer_secret');
delete_option('opanda_aweber_access_key');
delete_option('opanda_aweber_access_secret');
delete_option('opanda_aweber_auth_code');
delete_option('opanda_aweber_account_id');
return $this->redirectToAction('index', array('opanda_aweber_disconnected' => true));
}
}

View File

@@ -0,0 +1,198 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_TermsSettings extends OPanda_Settings {
public $id = 'terms';
/**
* Sets notices.
*
* @since 1.0.0
* @return void
*/
public function init() {
if ( isset( $_GET['onp_table_cleared'] )) {
$this->success = __('The data has been successfully cleared.', 'bizpanda');
}
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
?>
<p><?php _e('Configure here Terms of Use and Privacy Policy for locker on your website. It\'s not mandatory, but improves transparency and conversions.', 'optionpanda') ?></p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
global $optinpanda;
$options = array();
$pages = get_pages();
$result = array();
foreach( $pages as $page ) {
$result[] = array($page->ID, $page->post_title . ' [ID=' . $page->ID . ']');
}
$defaultTermsOfUse = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/terms-of-use.html' );
$defaultPrivacy = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/privacy-policy.html' );
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'terms_enabled',
'title' => __('Enable Terms of Use', 'bizpanda'),
'hint' => __('Set On to show the link to Terms of Use of your website below the Sign-In/Email lockers.', 'bizpanda'),
'default' => true
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'privacy_enabled',
'title' => __('Enable Privacy Policies', 'bizpanda'),
'hint' => __('Set On to show the link to Privacy Policies of your website below the Sign-In/Email lockers.', 'bizpanda'),
'default' => true
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'terms_use_pages',
'data' => $result,
'title' => __('Use Existing Pages', 'bizpanda'),
'hint' => __('Set On, if your website already contains pages for "Terms of Use" and "Privacy Policies" and you want to use them.', 'bizpanda'),
'default' => false
);
$options[] = array(
'type' => 'separator'
);
$noPagesWrap = array(
'type' => 'div',
'id' => 'opanda-nopages-options',
'items' => array(
array(
'type' => 'div',
'id' => 'no-page-opanda-terms-enabled-options',
'items' => array(
array(
'type' => 'wp-editor',
'name' => 'terms_of_use_text',
'title' => __('Terms of Use', 'bizpanda'),
'hint' => __('The text of Terms of Use. The link to this text will be shown below the lockers.', 'bizpanda'),
'tinymce' => array(
'height' => 250,
'content_css' => OPANDA_BIZPANDA_URL . '/assets/admin/css/tinymce.010000.css'
),
'default' => $defaultTermsOfUse
),
array(
'type' => 'separator'
)
)
),
array(
'type' => 'div',
'id' => 'no-page-opanda-privacy-enabled-options',
'items' => array(
array(
'type' => 'wp-editor',
'name' => 'privacy_policy_text',
'title' => __('Privacy Policy', 'bizpanda'),
'hint' => __('The text of Privacy Policy. The link to this text will be shown below the lockers.', 'bizpanda'),
'tinymce' => array(
'height' => 250,
'content_css' => OPANDA_BIZPANDA_URL . '/assets/admin/css/tinymce.010000.css'
),
'default' => $defaultPrivacy
),
array(
'type' => 'separator'
)
)
)
)
);
$pagesWrap = array(
'type' => 'div',
'id' => 'opanda-pages-options',
'items' => array(
array(
'type' => 'div',
'id' => 'page-opanda-terms-enabled-options',
'items' => array(
array(
'type' => 'dropdown',
'name' => 'terms_of_use_page',
'data' => $result,
'title' => __('Terms of Use', 'bizpanda'),
'hint' => __('Select a page which contains the "Terms of Use" for the lockers or/and your website.', 'bizpanda')
),
array(
'type' => 'separator'
)
)
),
array(
'type' => 'div',
'id' => 'page-opanda-privacy-enabled-options',
'items' => array(
array(
'type' => 'dropdown',
'name' => 'privacy_policy_page',
'data' => $result,
'title' => __('Privacy Policy', 'bizpanda'),
'hint' => __('Select a page which contains the "Privacy Policy" for the lockers or/and your website.', 'bizpanda')
),
array(
'type' => 'separator'
)
)
),
)
);
$options[] = $noPagesWrap;
$options[] = $pagesWrap;
return $options;
}
}

View File

@@ -0,0 +1,463 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_TextSettings extends OPanda_Settings {
public $id = 'text';
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
?>
<p><?php _e('You can change primary front-end text in the settings of a particular locker. Here you can change the remaining text. It will be applied to all your lockers.', 'bizpanda') ?></p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
global $optinpanda;
$options = array();
$pages = get_pages();
$result = array();
$result[] = array('0', '- none -');
foreach( $pages as $page ) {
$result[] = array($page->ID, $page->post_title . ' [ID=' . $page->ID . ']');
}
$confirmScreenOptions = array(
'type' => 'form-group',
'title' => 'The Screen "Please Confirm Your Email"',
'hint' => __('Appears when the locker asks the user to confirm one\'s email.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_confirm_screen_title',
'title' => __('Header', 'bizpanda'),
'default' => __('Please Confirm Your Email', 'bizpanda')
),
array(
'type' => 'textarea',
'name' => 'res_confirm_screen_instructiont',
'title' => __('Instruction', 'bizpanda'),
'hint' => __('Explain here that the user has to do to confirm one\'s email. Use the tag {email} to display an email address of the user.', 'bizpanda'),
'default' => __('We have sent a confirmation email to {email}. Please click on the confirmation link in the email to reveal the content.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_confirm_screen_note1',
'title' => __('Note #1', 'bizpanda'),
'hint' => __('Clarify when the content will be unlocked.', 'bizpanda'),
'default' => __('The content will be unlocked automatically within 10 seconds after confirmation.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_confirm_screen_note2',
'title' => __('Note #2', 'bizpanda'),
'hint' => __('Clarify that delivering the confirmation email may take some time.', 'bizpanda'),
'default' => __('Note delivering the email may take several minutes.', 'bizpanda')
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_confirm_screen_cancel',
'title' => __('Cancel Link', 'bizpanda'),
'default' => __('(cancel)', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_confirm_screen_open',
'title' => __('Open My Inbox Button', 'bizpanda'),
'default' => __('Open my inbox on {service}', 'bizpanda'),
'hint' => __('Use the tag {service} to display a name of a mailbox of the user.', 'bizpanda'),
'cssClass' => 'opanda-width-short'
)
)
);
$onestepScreenOptions = array(
'type' => 'form-group',
'title' => 'The Screen "One Step To Complete"',
'hint' => __('Appears when a social network does not return an email address and the locker asks the users to enter it manually.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_onestep_screen_title',
'title' => __('Header', 'bizpanda'),
'default' => __('One Step To Complete', 'bizpanda')
),
array(
'type' => 'textarea',
'name' => 'res_onestep_screen_instructiont',
'title' => __('Instruction', 'bizpanda'),
'default' => __('Please enter your email below to continue.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_onestep_screen_button',
'title' => __('Button', 'bizpanda'),
'default' => __('OK, complete', 'bizpanda')
)
)
);
$preconfirmLikeScreenOptions = array();
if ( BizPanda::hasPlugin('sociallocker') ) {
$preconfirmLikeScreenOptions = array(
'type' => 'form-group',
'title' => __( 'The Screen "Confirm Your Like"', 'bizpanda' ),
'hint' => __('Appears when a user clicks on the Facebook Like button.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_confirm_like_screen_header',
'title' => __('Header', 'bizpanda'),
'default' => __('One More Step', 'bizpanda'),
'cssClass' => 'opanda-width-short',
),
array(
'type' => 'textbox',
'name' => 'res_confirm_like_screen_message',
'title' => __('Message', 'bizpanda'),
'default' => __('Click the button below to like and unlock.', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_confirm_like_screen_button',
'title' => __('Button', 'bizpanda'),
'default' => __('Confirm Like', 'bizpanda'),
'cssClass' => 'opanda-width-short'
)
)
);
}
$signinOptions = array();
if ( BizPanda::hasFeature('signin-locker')) {
$signinOptions = array(
'type' => 'form-group',
'title' => __( 'Sign-In Buttons', 'bizpanda' ),
'hint' => __('The text which are located on the Sign-In Buttons.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_signin_long',
'title' => __('Long Text', 'bizpanda'),
'hint' => __('Displayed on a wide Sign-In Button', 'bizpanda'),
'default' => __('Sign in via {name}', 'bizpanda'),
'cssClass' => 'opanda-width-short',
),
array(
'type' => 'textbox',
'name' => 'res_signin_short',
'title' => __('Short Text', 'bizpanda'),
'hint' => __('Displayed on a narrow Sign-In Button', 'bizpanda'),
'default' => __('via {name}', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_signin_facebook_name',
'title' => __('Facebook', 'bizpanda'),
'default' => __('Facebook', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_signin_twitter_name',
'title' => __('Twitter', 'bizpanda'),
'default' => __('Twitter', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_signin_google_name',
'title' => __('Google', 'bizpanda'),
'default' => __('Google', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_signin_linkedin_name',
'title' => __('LinkedIn', 'bizpanda'),
'default' => __('LinkedIn', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_signin_email_form_text',
'title' => __('Email Form Header', 'bizpanda'),
'default' => __('Cannot sign in via social networks? Enter your email manually.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_signin_email_button',
'title' => __('Email Button Text', 'bizpanda'),
'default' => __('sign in to unlock', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_signin_after_email_button',
'title' => __('After Email Button Text', 'bizpanda'),
'default' => __('Your email address is 100% safe from spam!', 'bizpanda')
),
)
);
}
$miscOptions = array(
'type' => 'form-group',
'title' => 'Miscellaneous',
'hint' => __('Various text used usually with all lockers and screens.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_misc_data_processing',
'title' => __('Processing Data', 'bizpanda'),
'default' => __('Processing data, please wait...', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_misc_or_enter_email',
'title' => __('Enter Your Email Manually', 'bizpanda'),
'default' => __('or enter your email manually to sign in', 'bizpanda')
),
array(
'type' => 'separator'
),
'res_misc_enter_your_name' => array(
'type' => 'textbox',
'name' => 'res_misc_enter_your_name',
'title' => __('Enter Your Name', 'bizpanda'),
'default' => __('enter your name', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_misc_enter_your_email',
'title' => __('Enter Your Email Address', 'bizpanda'),
'default' => __('enter your email address', 'bizpanda')
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_misc_your_agree_with',
'title' => __('You Agree With', 'bizpanda'),
'hint' => __('Use the tag {links} to display the links to the Terms Of Use and Privacy Policy or tags {terms} and {privacy) to display links apart.', 'bizpanda'),
'default' => __('By clicking on the button(s), you agree with {links}', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_misc_agreement_checkbox',
'title' => __('I Consent To Processing', 'bizpanda'),
'default' => __('I consent to processing of my data according to {links}', 'bizpanda'),
'hint' => __('Use the tag {links} to display the links to the Terms Of Use and Privacy Policy or tags {terms} and {privacy) to display links apart.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_misc_agreement_checkbox_alt',
'title' => __('I Agree With', 'bizpanda'),
'default' => __('I agree with {links}', 'bizpanda'),
'hint' => __('Use the tag {links} to display the links to the Terms Of Use and Privacy Policy or tags {terms} and {privacy) to display links apart.', 'bizpanda')
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_misc_terms_of_use',
'title' => __('Terms Of Use', 'bizpanda'),
'default' => __('Terms of Use', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_misc_privacy_policy',
'title' => __('Privacy Policy', 'bizpanda'),
'default' => __('Privacy Policy', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_misc_or_wait',
'title' => __('Or Wait', 'bizpanda'),
'default' => __('or wait {timer}s', 'bizpanda'),
'hint' => __('Use the tag {timer} to display the number of seconds remaining to unlocking.'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_misc_close',
'title' => __('Close', 'bizpanda'),
'default' => __('close', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
array(
'type' => 'textbox',
'name' => 'res_misc_or',
'title' => __('Or', 'bizpanda'),
'default' => __('OR', 'bizpanda'),
'cssClass' => 'opanda-width-short'
),
)
);
if ( !BizPanda::hasPlugin('optinpanda') ) {
unset( $miscOptions['items']['res_misc_enter_your_name'] );
}
$errosOptions = array(
'type' => 'form-group',
'title' => __('Errors & Notices', 'bizpanda'),
'hint' => __('The text which users see when something goes wrong.', 'bizpanda'),
'items' => array(
array(
'type' => 'textbox',
'name' => 'res_errors_no_consent',
'title' => __('No Consent', 'bizpanda'),
'default' => __('Please give us your consent in order to continue.', 'bizpanda')
),
array(
'type' => 'separator'
),
array(
'type' => 'textbox',
'name' => 'res_errors_empty_field',
'title' => __('Empty Field', 'bizpanda'),
'default' => __('Please fill this field.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_errors_empty_email',
'title' => __('Empty Email', 'bizpanda'),
'default' => __('Please enter your email address.', 'bizpanda')
),
'res_errors_temporary_email' => array(
'type' => 'textbox',
'name' => 'res_errors_temporary_email',
'title' => __('Temporary Email', 'bizpanda'),
'default' => __('Sorry, temporary email addresses cannot be used to unlock content.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_errors_inorrect_email',
'title' => __('Incorrect Email', 'bizpanda'),
'default' => __('It seems you entered an incorrect email address. Please check it.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_errors_empty_name',
'title' => __('Empty Name', 'bizpanda'),
'default' => __('Please enter your name.', 'bizpanda')
),
array(
'type' => 'textbox',
'name' => 'res_errors_empty_checkbox',
'title' => __('Empty Checkbox', 'bizpanda'),
'default' => __('Please mark this checkbox to continue.', 'bizpanda')
),
array(
'type' => 'separator'
),
'res_errors_subscription_canceled' => array(
'type' => 'textbox',
'name' => 'res_errors_subscription_canceled',
'title' => __('Subscription Canceled', 'bizpanda'),
'default' => __('You have canceled your subscription.', 'bizpanda')
),
'res_errors_not_signed_in' => array(
'type' => 'textbox',
'name' => 'res_errors_not_signed_in',
'title' => __('Not Signed In', 'bizpanda'),
'default' => __('Sorry, but you have not signed in. Please try again.', 'bizpanda')
),
'res_errors_not_granted' => array(
'type' => 'textbox',
'name' => 'res_errors_not_granted',
'title' => __('Not Granted Permissions', 'bizpanda'),
'hint' => __('Use the tag {permissions} to show required permissions.'),
'default' => __('Sorry, but you have not granted all the required permissions ({permissions}). Please try again.', 'bizpanda')
)
)
);
if ( !BizPanda::hasFeature('signin-locker')) {
unset( $errosOptions['items']['res_errors_not_signed_in'] );
unset( $errosOptions['items']['res_errors_not_granted'] );
}
if ( !BizPanda::hasPlugin('optinpanda') ) {
unset( $errosOptions['items']['res_errors_subscription_canceled'] );
unset( $errosOptions['items']['res_errors_subscription_canceled'] );
}
$options = array();
if ( !empty( $preconfirmLikeScreenOptions ) ) $options[] = $preconfirmLikeScreenOptions;
if ( BizPanda::hasPlugin('optinpanda') ) {
$options[] = $confirmScreenOptions;
if ( !empty( $signinOptions ) ) $options[] = $signinOptions;
$options[] = $miscOptions;
} else {
if ( !empty( $signinOptions ) ) $options[] = $signinOptions;
$options[] = $miscOptions;
}
$options[] = $onestepScreenOptions;
$options[] = $errosOptions;
$options[] = array(
'type' => 'separator'
);
return $options;
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* A class for the page providing the basic settings.
*
* @author Alex Kovalev <alex.kovalevv@gmail.com>
* @copyright (c) 2016, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* The page Basic Settings.
*
* @since 1.0.0
*/
class OPanda_ZapierSettings extends OPanda_Settings {
public $id = 'zapier';
public function __construct($page) {
parent::__construct($page);
}
/**
* Shows the header html of the settings screen.
*
* @since 1.0.0
* @return void
*/
public function header() {
global $optinpanda;
?>
<p>
<?php printf( __('Allows to set up integration with Zapier via <a href="%s" target="_blank">Webhooks</a>.', 'bizpanda'), 'https://zapier.com/apps/webhook/integrations' )?>
</p>
<?php
}
/**
* Returns options for the Basic Settings screen.
*
* @since 1.0.0
* @return void
*/
public function getOptions() {
$options = array();
$wpEditorData = array();
$defaultLeadsEmail = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/leads-notification.html' );
$defaultUnlocksEmail = file_get_contents( OPANDA_BIZPANDA_DIR . '/content/unlocks-notification.html' );
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'url',
'name' => 'zapier_hook_new_leads',
'title' => __( 'Hook For Leads', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=zapier') ),
'default' => "",
'hint' => sprintf( __( 'Fires when a lead gained. <a href="%s" target="_blank">Click here</a> to know how to get a webhook URL.', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=zapier') )
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'zapier_only_new',
'title' => __( 'Only New Leads', 'bizpanda' ),
'default' => false,
'hint' => __( 'If On, sends data to Zapier only if a lead is new (not listed on the page Leads).', 'bizpanda' )
);
$options[] = array(
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'zapier_only_confirmed',
'title' => __( 'Only Confirmed Leads', 'bizpanda' ),
'default' => false,
'hint' => __( 'If On, sends data to Zapier only for those leads who confirmed their subscription (or all leads if the Single Opt-In is set).', 'bizpanda' )
);
$options[] = array(
'type' => 'separator'
);
$options[] = array(
'type' => 'url',
'way' => 'buttons',
'name' => 'zipier_hook_new_unlocks',
'title' => __( 'Hook For New Unlocks', 'bizpanda' ),
'after' => sprintf( __( '<a href="%s" class="btn btn-default">How To Get</a>', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=zapier') ),
'default' => "",
'hint' => sprintf( __( 'Fires when a new unlock occurs. <a href="%s" target="_blank">Click here</a> to know how to get a webhook URL.', 'bizpanda' ), admin_url('admin.php?page=how-to-use-' . $this->plugin->pluginName . '&onp_sl_page=zapier') )
);
$options[] = array(
'type' => 'separator'
);
return $options;
}
public function onSaving() {
}
}

View File

@@ -0,0 +1,368 @@
<?php
/**
* The file contains a page that shows statistics
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
/**
* Common Settings
*/
class OPanda_StatisticsPage extends OPanda_AdminPage {
public function __construct( $plugin ) {
$this->id = 'stats';
$this->menuPostType = OPANDA_POST_TYPE;
$this->menuTitle = __('Stats & Reports', 'bizpanda');
if( !current_user_can('administrator') )
$this->capabilitiy = "manage_opanda_stats";
parent::__construct( $plugin );
}
public function assets($scripts, $styles) {
$this->scripts->request('jquery');
$this->styles->request( array(
'bootstrap.core'
), 'bootstrap' );
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/libs/datepicker.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/libs/datepicker.css');
$this->scripts->add(OPANDA_BIZPANDA_URL . '/assets/admin/js/stats.010000.js');
$this->styles->add(OPANDA_BIZPANDA_URL . '/assets/admin/css/stats.010000.css');
}
/**
* Shows an index page where a user can set settings.
*
* @sinve 1.0.0
* @return void
*/
public function indexAction() {
// getting all the items for the item selector
$dropdownItems = get_posts(array(
'post_type' => OPANDA_POST_TYPE,
'meta_key' => 'opanda_item',
'meta_value' => OPanda_Items::getAvailableNames(),
'numberposts' => -1
));
// current item
$itemId = isset( $_GET['opanda_id'] ) ? $_GET['opanda_id'] : null;
if ( empty( $itemId ) ) {
$itemId = isset( $dropdownItems[0]->ID ) ? $dropdownItems[0]->ID : 0;
}
$itemName = OPanda_Items::getItemNameById($itemId);
$showPopup = ( count( $dropdownItems ) > 1 && !isset( $_GET['opanda_id'] ) );
$screens = apply_filters("opanda_item_type_stats_screens", array(), $itemName);
$screens = apply_filters("opanda_{$itemName}_stats_screens", $screens);
$item = get_post( $itemId );
if ( empty( $item) ) die( __('The item with ID = ' . $itemId . ' is not found.' , 'bizpanda' ) );
$itemTitle = empty( $item->post_title )
? sprintf( __('(no titled, id=%s)', 'bizpanda'), $item->ID )
: $item->post_title;
// current item screen
$currentScreenName = isset($_REQUEST['opanda_screen']) ? $_REQUEST['opanda_screen'] : 'summary';
$currentScreen = $screens[$currentScreenName];
require_once(OPANDA_BIZPANDA_DIR . '/admin/includes/classes/class.stats-screen.php');
require_once $currentScreen['path'];
$screenClass = isset( $currentScreen['screenClsss'] ) ? $currentScreen['screenClsss'] : 'OPanda_StatsScreen';
$screen = new $screenClass(array(
'chartClass' => $currentScreen['chartClass'],
'tableClass' => $currentScreen['tableClass']
));
// current post
$postId = isset($_REQUEST['opanda_post_id']) ? intval($_REQUEST['opanda_post_id']) : false;
$post = ($postId) ? get_post($postId) : false;
// set date range
$dateStart = isset($_REQUEST['opanda_date_start']) ? $_REQUEST['opanda_date_start'] : false;
$dateEnd = isset($_REQUEST['opanda_date_end']) ? $_REQUEST['opanda_date_end'] : false;
$hrsOffset = get_option('gmt_offset');
if (strpos($hrsOffset, '-') !== 0) $hrsOffset = '+' . $hrsOffset;
$hrsOffset .= ' hours';
// by default shows a 30 days' range
if ( empty($dateEnd) || ($dateRangeEnd = strtotime($dateEnd)) === false) {
$phpdate = getdate( strtotime($hrsOffset, time()) );
$dateRangeEnd = mktime(0, 0, 0, $phpdate['mon'], $phpdate['mday'], $phpdate['year']);
}
if ( empty($dateStart) || ($dateRangeStart = strtotime($dateStart)) === false) {
$dateRangeStart = strtotime("-1 month", $dateRangeEnd);
}
// getting the chart data
$chart = $screen->getChart(array(
'itemId' => $itemId,
'postId' => $postId,
'rangeStart' => $dateRangeStart,
'rangeEnd' => $dateRangeEnd,
));
// getting the table data
$page = ( isset( $_GET['opanda_page'] ) ) ? intval( $_GET['opanda_page'] ) : 1;
if ( $page <= 0 ) $page = 1;
$table = $screen->getTable(array(
'itemId' => $itemId,
'postId' => $postId,
'rangeStart' => $dateRangeStart,
'rangeEnd' => $dateRangeEnd,
'per' => 50,
'total' => true,
'page' => $page
));
// the base urls
$urlBase = add_query_arg( array(
'opanda_id' => $itemId,
'opanda_post_id' => $postId,
'opanda_screen' => $currentScreenName,
'opanda_date_start' => date('m/d/Y', $dateRangeStart),
'opanda_date_end' => date('m/d/Y', $dateRangeEnd),
), opanda_get_admin_url('stats') );
$dateStart = date('m/d/Y', $dateRangeStart);
$dateEnd = date('m/d/Y', $dateRangeEnd);
// extra css classes
$tableCssClass = '';
if ( $table->getColumnsCount() > 8 ) $tableCssClass .= ' opanda-concise-table';
else $tableCssClass .= ' opanda-free-table';
?>
<div class="wrap">
<h2><?php _e('Stats & Reports', 'bizpanda') ?></h2>
<div id="opanda-control-panel">
<div class="opanda-left" id="opanda-current-item">
<span><?php _e('You are viewing reports for ', 'bizpanda') ?> <a href="<?php echo admin_url("post.php?post=" . $itemId . "&action=edit") ?>"><strong><?php echo $itemTitle ?></strong></a></span>
</div>
<form method="get" id="opanda-item-selector" class="opanda-right">
<input type="hidden" name="post_type" value="<?php echo OPANDA_POST_TYPE ?>" />
<input type="hidden" name="page" value="stats-bizpanda" />
<input type="hidden" name="opanda_date_start" class="form-control" value="<?php echo $dateStart ?>" />
<input type="hidden" name="opanda_date_end" class="form-control" value="<?php echo $dateEnd ?>" />
<span><?php _e('Select a locker to view:', 'optionpanda') ?></span>
<select name="opanda_id">
<?php foreach( $dropdownItems as $dropdownItem ) { ?>
<option value="<?php echo $dropdownItem->ID ?>" <?php if ( $dropdownItem->ID == $itemId ) { echo 'selected="selected"'; } ?>>
<?php if ( empty($dropdownItem->post_title) ) { ?>
<?php printf( __('(no titled, id=%s)', 'bizpanda'), $dropdownItem->ID ) ?>
<?php } else { ?>
<?php echo $dropdownItem->post_title ?>
<?php } ?>
</option>
<?php } ?>
</select>
<input class="button" type="submit" value="<?php _e('Select', 'bizpanda') ?>" />
</form>
</div>
<div class="factory-bootstrap-331 factory-fontawesome-320">
<div class="onp-chart-hints">
<div class="onp-chart-hint onp-chart-hint-errors">
<?php printf( __('This chart shows the count of times when the locker was not available to use due to the visitor installed the extensions like Avast or Adblock which may block social networks.<br />By default, the such visitors see the locker without social buttons but with the offer to disable the extensions. You can set another behaviour <a href="%s"><strong>here</strong></a>.', 'bizpanda'), admin_url('admin.php?page=common-settings-' . $this->plugin->pluginName . '&action=advanced') ) ?>
</div>
</div>
<div id="opanda-chart-description">
<?php echo $currentScreen['description'] ?>
</div>
<div id="onp-sl-chart-area">
<form method="get">
<div id="onp-sl-settings-bar">
<div id="onp-sl-type-select">
<div class="btn-group" id="chart-type-group" data-toggle="buttons-radio">
<?php foreach ( $screens as $screenName => $screen ) { ?>
<a href="<?php echo add_query_arg( 'opanda_screen', $screenName, $urlBase ) ?>" class="btn btn-default <?php if ( $screenName == $currentScreenName ) { echo 'active'; } ?> type-<?php echo $screenName ?>" data-value="<?php echo $screenName ?>"><?php echo $screen['title'] ?></a>
<?php } ?>
</div>
</div>
<div id="onp-sl-date-select">
<input type="hidden" name="post_type" value="<?php echo OPANDA_POST_TYPE ?>" />
<input type="hidden" name="page" value="stats-bizpanda" />
<input type="hidden" name="opanda_post_id" value="<?php echo $postId ?>" />
<input type="hidden" name="opanda_screen" value="<?php echo $currentScreenName ?>" />
<input type="hidden" name="opanda_id" value="<?php echo $itemId ?>" />
<span class="onp-sl-range-label"><?php _e('Date range', 'bizpanda') ?>:</span>
<input type="text" id="onp-sl-date-start" name="opanda_date_start" class="form-control" value="<?php echo $dateStart ?>" />
<input type="text" id="onp-sl-date-end" name="opanda_date_end" class="form-control" value="<?php echo $dateEnd ?>" />
<a id="onp-sl-apply-dates" class="btn btn-default">
<?php _e('Apply', 'bizpanda') ?>
</a>
</div>
</div>
</form>
<div class="chart-wrap">
<div id="chart" style="width: 100%; height: 195px;"></div>
</div>
</div>
<div id="onp-sl-chart-selector">
<?php if ( $chart->hasSelectors() ) { ?>
<?php foreach( $chart->getSelectors() as $name => $field ) { ?>
<div class="onp-sl-selector-item onp-sl-selector-<?php echo $name ?>" data-selector="<?php echo $name ?>">
<span class="chart-color" style="background-color: <?php echo $field['color'] ?>"></span>
<?php echo $field['title'] ?>
</div>
<?php } ?>
<?php } ?>
</div>
<?php if ($postId) { ?>
<div class="alert alert-warning">
<?php echo sprintf(__('Data for the post: <strong>%s</strong> (<a href="%s">return back</a>)', 'bizpanda'),$post->post_title, add_query_arg( 'opanda_post_id', false, $urlBase ) ); ?>
</div>
<?php } else { ?>
<p><?php _e('Top-50 posts and pages where you put the locker, ordered by their performance:', 'bizpanda') ?></p>
<?php } ?>
<div id="opanda-data-table-wrap">
<table id="opanda-data-table" class="<?php echo $tableCssClass ?>">
<thead>
<?php if ( $table->hasComplexColumns() ) { ?>
<tr>
<?php foreach( $table->getHeaderColumns() as $name => $column ) { ?>
<th rowspan="<?php echo $column['rowspan'] ?>" colspan="<?php echo $column['colspan'] ?>" class="opanda-col-<?php echo $name ?> <?php echo isset( $column['cssClass'] ) ? $column['cssClass'] : '' ?> <?php if ( isset( $column['highlight']) ) { echo 'opanda-column-highlight'; } ?>">
<?php echo $column['title'] ?>
<?php if ( isset( $column['hint'] ) ) { ?>
<i class="opanda-hint" title="<?php echo $column['hint']; ?>"></i>
<?php } ?>
</th>
<?php } ?>
</tr>
<tr>
<?php foreach( $table->getHeaderColumns(2) as $name => $column ) { ?>
<th class="opanda-col-<?php echo $name ?> <?php echo isset( $column['cssClass'] ) ? $column['cssClass'] : '' ?> <?php if ( isset( $column['highlight']) ) { echo 'opanda-column-highlight'; } ?>">
<?php echo $column['title'] ?>
<?php if ( isset( $column['hint'] ) ) { ?>
<i class="opanda-hint" title="<?php echo $column['hint']; ?>"></i>
<?php } ?>
</th>
<?php } ?>
</tr>
<?php } else { ?>
<?php foreach( $table->getColumns() as $name => $column ) { ?>
<th class="opanda-column-<?php echo $name ?> <?php echo isset( $column['cssClass'] ) ? $column['cssClass'] : '' ?> <?php if ( isset( $column['highlight']) ) { echo 'opanda-column-highlight'; } ?>">
<?php echo $column['title'] ?>
<?php if ( isset( $column['hint'] ) ) { ?>
<i class="opanda-hint" title="<?php echo $column['hint']; ?>"></i>
<?php } ?>
</th>
<?php } ?>
<?php } ?>
</thead>
<tbody>
<?php for( $i = 0; $i < $table->getRowsCount(); $i++ ) { if ( $i >= 50 ) break; ?>
<tr>
<?php foreach( $table->getDataColumns() as $name => $column ) { ?>
<td class="opanda-col-<?php echo $name ?> <?php echo isset( $column['cssClass'] ) ? $column['cssClass'] : '' ?> <?php if ( isset( $column['highlight']) ) { echo 'opanda-column-highlight'; } ?>">
<?php $table->printValue( $i, $name, $column ) ?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Load the AJAX API -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(function(){
window.bizpanda.statistics.drawChart({
'type': '<?php echo $chart->type ?>'
});
});
window.opanda_default_selectors = [<?php echo join(',', $chart->getSelectorsNames()) ?>];
window.chartData = [
<?php $chart->printData() ?>
];
</script>
<?php if ( $showPopup ) { ?>
<!-- Locker Select Popup -->
<div id="opanda-locker-select-overlap" style="display: none;"></div>
<div id="opanda-locker-select-popup" style="display: none;">
<strong><?php _e('Select Locker', 'bizpanda') ?></strong>
<p><?php _e('Please select a locker to view reports.', 'bizpanda') ?></p>
<select id="opanda-locker-select">
<?php foreach( $dropdownItems as $dropdownItem ) { ?>
<option value="<?php echo opanda_get_admin_url('stats', array('opanda_id' => $dropdownItem->ID)); ?>" <?php if ( $dropdownItem->ID == $itemId ) { echo 'selected="selected" data-default="true"'; } ?>>
<?php if ( empty($dropdownItem->post_title) ) { ?>
<?php printf( __('(no titled, id=%s)', 'bizpanda'), $dropdownItem->ID ) ?>
<?php } else { ?>
<?php echo $dropdownItem->post_title ?>
<?php } ?>
</option>
<?php } ?>
</select>
<input class="button" type="submit" value="<?php _e('Select', 'bizpanda') ?>" id="opanda-locker-select-submit" />
</div>
<?php } ?>
<?php
}
}
FactoryPages321::register($bizpanda, 'OPanda_StatisticsPage');

View File

@@ -0,0 +1,17 @@
<?php
function opanda_troubleshooting() {
if ( !isset( $_GET['opanda_trouble'] ) ) return;
$trouble = $_GET['opanda_trouble'];
switch ( $trouble ) {
case 'bulk-lock':
opanda_trouble_reset_bulk_lock();
break;
}
}
add_action('admin_init', 'opanda_troubleshooting');
function opanda_trouble_reset_bulk_lock() {
delete_option('onp_sl_bulk_lockers');
}

View File

@@ -0,0 +1,61 @@
.onp-locker .onp-config-wrap {
background-color: rgba(139,139,150,0.1);
padding: 10px 10px 1px 10px;
}
.onp-locker .onp-config-wrap > * {
display: inline-block;
vertical-align: middle;
}
.onp-locker .onp-config-wrap label {
margin-right: 5px;
}
.onp-locker .onp-preview-wrap {
position: relative;
min-height: 60px;
display: flex;
flex-direction: column;
padding: 0 25px;
}
.onp-locker .block-editor-default-block-appender textarea.block-editor-default-block-appender__content {
padding-left: 0px;
margin-top: 32px;
}
.onp-locker .onp-top-bracket,
.onp-locker .onp-bottom-bracket {
border: 4px solid rgba(139,139,150,0.1);
height: 30px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.onp-locker .onp-top-bracket {
border-bottom: 0px;
bottom: auto;
}
.onp-locker .onp-bottom-bracket {
border-top: 0px;
top: auto;
}
.onp-locker .onp-locker-select-wrap select {
width: auto;
}
.onp-locker .onp-locker-select-wrap > div {
margin-bottom: 0px;
}
.onp-locker .onp-button {
margin-left: 5px;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}

View File

@@ -0,0 +1,419 @@
/**
* CSS for the How To Use section of the Opt-In Panda
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package optinpanda
* @since 1.0.0
*/
.wrap {
width: 950px;
margin: 18px auto;
}
.wrap * {
font-family: 'helvetica neue',helvetica,arial,'lucida grande',sans-serif;
}
/* ---
* Navigation
*/
.onp-help-nav {
width: 192px;
float: left;
position: fixed;
}
.onp-help-nav a {
display: block;
color: #141823;
padding: 14px 12px;
text-decoration: none;
}
.onp-help-nav a:focus {
outline: none;
box-shadow: none;
}
/* Sub items */
.onp-help-nav-subitems {
display: none;
}
.onp-help-active-item > .onp-inner-wrap > .onp-help-nav-subitems {
display: block;
}
/* Icons */
.onp-help-nav .fa {
margin-right: 2px;
font-size: 14px;
position: relative;
top: 1px;
color: #999;
}
.onp-help-nav .fa-minus-square-o {
display: none;
}
.onp-help-active-item > .onp-inner-wrap > a .fa-minus-square-o {
display: inline-block;
}
.onp-help-active-item > .onp-inner-wrap > a .fa-plus-square-o {
display: none;
}
/* Categories */
.onp-help-nav-category > .onp-inner-wrap > a {
padding-top: 6px;
padding-bottom: 6px;
padding-left: 9px;
color: #999;
font-weight: bold;
}
.onp-help-nav-category > .onp-inner-wrap > a:hover {
text-decoration: underline;
color: #555;
}
.onp-help-nav-category + .onp-help-nav-category.onp-help-active-item {
margin-top: 5px;
}
.onp-help-nav-category.onp-help-active-item {
background-color: #fff;
border: 1px solid #e3e3e3;
border-radius: 3px;
overflow: hidden;
margin-bottom: 10px;
}
.onp-help-nav-category.onp-help-active-item > .onp-inner-wrap {
border-bottom: 1px solid #f1f1f1;
}
.onp-help-nav-category.onp-help-active-item > .onp-inner-wrap > a {
border-left: 0px;
margin: 0px;
background-color: #fafafa;
color: #777;
border-bottom: 1px solid #f1f1f1;
padding: 12px 12px 10px 12px;
}
.onp-help-nav-category.onp-help-active-item > .onp-inner-wrap > a:hover {
text-decoration: none;
}
.onp-help-nav-category > .onp-inner-wrap > a .fa {
display: none;
}
/* Pages */
.onp-help-nav-page + .onp-help-nav-page {
border-top: 1px solid #f7f7f7;
}
.onp-help-nav-page.onp-help-active-item.onp-has-subitems + .onp-help-nav-page {
border-top: 0px;
}
.onp-help-nav-page.onp-help-active-item > .onp-inner-wrap > a > span {
font-weight: bold;
}
.onp-help-nav-page > .onp-inner-wrap > a:hover {
background-color: #fdfdfd;
}
.onp-help-nav-page > .onp-inner-wrap > .onp-help-nav-subitems {
background-color: #f9f9f9;
border-bottom: 0px;
border-top: 2px solid #f1f1f1;
border-bottom: 1px solid #f1f1f1;
}
.onp-help-nav-page:last-child > .onp-inner-wrap > .onp-help-nav-subitems {
border-bottom: 0px;
}
/* Sub Pages */
.onp-help-nav-subpage a {
padding-top: 9px;
padding-bottom: 9px;
}
.onp-help-nav-subpage a:first-child {
padding-top: 12px;
}
.onp-help-nav-subpage.onp-help-active-item > .onp-inner-wrap > a span {
font-style: italic;
}
.onp-help-nav-subpage > .onp-inner-wrap > a:hover {
background-color: #fcfcfc;
}
/* ---
* Content
*/
.onp-help-content {
background: #fff;
border: 1px solid #e3e3e3;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin-left: 210px;
width: 725px;
border-radius: 3px;
}
.onp-help-content > .onp-inner-wrap {
border-bottom: 1px solid #f1f1f1;
}
.onp-help-content p {
margin: 0 0 20px 0;
font-size: 14px;
}
.onp-help-content .onp-help-section p:last-child {
margin-bottom: 0px;
}
.onp-help-content .onp-help-section {
color: #4e5665;
font-size: 14px;
line-height: 20px;
padding: 30px;
}
.onp-help-content .onp-help-section + .onp-help-section {
border-top: 1px solid #f9f9f9;
}
.onp-help-content .onp-help-section h1,
.onp-help-content .onp-help-section h2 {
margin: 0;
padding: 0px;
}
.onp-help-content .onp-help-section h1,
.onp-help-content .onp-help-section h2,
.onp-help-content .onp-help-section h3,
.onp-help-content .onp-help-section h4 {
color: #4e5665;
}
.onp-help-content .onp-help-section h1 {
font-size: 24px;
font-weight: normal;
line-height: 32px;
margin-bottom: 12px;
}
.onp-help-content .onp-help-section h2 {
font-size: 20px;
font-weight: normal;
line-height: 24px;
margin-bottom: 20px;
}
/* Buttons */
.onp-help-content .fa {
margin-left: 7px;
font-size: 11px;
}
/* List */
.onp-help-content .onp-list {
list-style: disc;
padding: 0 0 0 20px;
}
.onp-help-content .onp-list li {
padding: 0px;
margin: 0px;
}
.onp-help-content .onp-list li + li {
margin-top: 15px;
}
/* Bold List */
.onp-help-content .onp-bold-link {
font-weight: bold;
text-decoration: none;
}
.onp-help-content .onp-bold-link:hover {
text-decoration: underline;
}
/* Marks */
.onp-help-content .onp-mark {
padding: 0px 0;
display: inline-block;
}
.onp-help-content .onp-mark-stricked {
border-bottom: 1px solid #fff;
}
.onp-help-content .onp-mark-yellow {
background-color: #fffaea;
border-bottom-color: #f9f1e1;
}
.onp-help-content .onp-mark-gray {
background-color: #f7f7f7;
border-bottom-color: #e9e9e9;
}
/* Code */
.onp-help-content .onp-code {
font-family: Consolas;
font-size: 13px;
}
/* Stress */
.onp-help-content strong {
color: #555;
}
.onp-help-content .onp-stress {
font-weight: 600;
font-style: italic;
color: #555;
}
/* Notes */
.onp-help-content .onp-note {
border-left: 5px solid #2c3e50;
padding: 10px 15px;
background-color: #f9f9f9;
color: #444;
}
.onp-help-content .onp-remark {
background: #f9f9f9;
border-radius: 3px;
}
.onp-help-content .onp-remark .onp-inner-wrap {
display: block;
padding: 10px 10px 10px 15px;
}
/* images */
.onp-help-content .onp-img {
margin: 20px 0px 25px 0;
padding: 35px 20px 30px 20px;
text-align: center;
line-height: 50%;
background-color: #fcfcfc;
}
.onp-help-content .onp-img img {
max-width: 612px;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.onp-help-content .onp-img i {
display: block;
font-style: italic;
margin: 20px 0 0 0px;
padding: 0px;
line-height: 150%;
color: #aaa;
font-size: 15px;
padding: 0 70px;
}
.onp-help-content strong {
font-weight: bold;
}
.onp-help-content ul {
padding-left: 20px;
list-style: inside;
}
/**
* Upgrade To Premium
*/
.onp-how-comparation thead {
background-color: #f9f9f9;
}
.onp-how-comparation,
.onp-how-comparation td,
.onp-how-comparation th {
border: 0px !important;
}
.onp-how-group-title {
font-weight: bold;
padding-top: 30px !important;
}
.onp-how-title a {
color: #4e5665;
text-decoration: none;
border-bottom: 1px dotted #5e6675;
}
.onp-how-no {
color: #ddd;
}
.onp-how-yes strong {
color: #444;
}
.onp-how-premium {
background-color: #f6fcfe;
}
thead .onp-how-premium {
background-color: #2ea2cc;
color: #fff;
}
#activate-trial-btn,
#onp-sl-purchase-btn {
padding: 20px 0 !important;
font-size: 20px;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
text-align: center;
height: auto;
}
#onp-sl-purchase-btn {
padding: 20px 0 !important;
font-size: 20px;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
text-align: center;
height: auto;
background: #fffaea;
border-color: #ddd9cd;
-moz-box-shadow: 0 0 8px #fddf67;
-webkit-box-shadow: 0 0 8px #fddf67;
box-shadow: 0 0 8px #fddf67;
-moz-text-shadow: none;
-webkit-text-shadow: none;
text-shadow: none;
}
/* hides the vk note on the how to use page */
.onp-sl-vk-note {
display: none;
}
/* tables */
.onp-help-content .table p {
margin: 0px;
}
.onp-help-content .table p + p {
margin-top: 5px;
}
.onp-help-content .table .onp-title {
font-weight: bold;
white-space: nowrap;
}
.onp-help-content .table > thead {
background-color: #f9f9f9;
}
.onp-help-content .table > thead > tr > th {
border-bottom-width: 1px;
}
.onp-help-content .table > tbody > tr > td,
.onp-help-content .table > tr > td {
border-bottom: 1px solid #f9f9f9;
}

View File

@@ -0,0 +1,234 @@
/**
* More Features
*/
.advanced-function-demo .demo-themes {
width: 565px;
height: 541px;
background-image: url("../img/more-features/en_US/demo-themes.png");
}
.advanced-function-demo .demo-social-options {
width: 859px;
height: 466px;
background-image: url("../img/more-features/en_US/demo-social-options.png");
}
.advanced-function-demo .demo-blurring-effect {
width: 594px;
height: 424px;
background-image: url("../img/more-features/en_US/demo-blurring.png");
}
.advanced-function-demo .demo-advanced-options {
width: 597px;
height: 537px;
background-image: url("../img/more-features/en_US/demo-visibility-options.png");
}
/**
* Social Tabs
*/
.factory-flat #OPanda_SocialOptionsMetaBox {
background: #f6f6f6;
}
.factory-flat #OPanda_SocialOptionsMetaBox .nav-tabs li {
background-color: transparent;
}
.onp-sl-metabox-hint {
margin-bottom: 15px;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs li {
padding-left: 32px;
background: url("../img/drag.png") 5px 50% no-repeat;
cursor: move;
}
.factory-bootstrap-331 .sortable-placeholder {
height: 40px;
background: #f3f3f3 !important;
margin: 0px !important;
box-shadow: inset 0px 0px 7px rgba(0,0,0,0.15);
border-bottom-left-radius: 4px;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs {
width: 150px;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs li:hover {
background-image: url("../img/drag-hover.png") !important;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs a {
background-image: url("../img/social-buttons-for-admin-en_US.png");
background-position: -38px 0;
height: 42px;
-moz-transition: none;
transition: none;
}
.factory-bootstrap-331 .factory-align-vertical .factory-bodies {
min-height: 350px !important;
}
.factory-volumetric .factory-bootstrap-331 .factory-align-vertical .nav-tabs a {
height: 22px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-facebook-like a {
background-position: -38px -1px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-facebook-share a {
background-position: -38px -41px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-twitter-tweet a {
background-position: -38px -81px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-twitter-follow a {
background-position: -38px -121px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-google-plus a {
background-position: -38px -161px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-google-share a {
background-position: -38px -201px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-youtube-subscribe a {
background-position: -38px -282px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-tab-item-header-linkedin-share a {
background-position: -38px -241px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-facebook-like a {
background-position: -195px -1px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-facebook-share a {
background-position: -195px -41px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-twitter-tweet a {
background-position: -195px -81px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-twitter-follow a {
background-position: -195px -121px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-google-plus a {
background-position: -195px -161px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-google-share a {
background-position: -195px -201px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-youtube-subscribe a {
background-position: -195px -282px;
}
.factory-bootstrap-331 .factory-align-vertical .factory-disabled.factory-tab-item-header-linkedin-share a {
background-position: -195px -241px;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs li a {
cursor: pointer;
}
.factory-bootstrap-331 .factory-align-vertical .nav-tabs {
background-color: transparent;
}
.factory-bootstrap-331 .factory-align-vertical .pi-tab-hint {
padding-left: 4px;
}
#optinpanda_facebook_like_title,
#optinpanda_facebook_share_title,
#optinpanda_twitter_tweet_title,
#optinpanda_twitter_follow_title,
#optinpanda_google_plus_title,
#optinpanda_google_share_title,
#optinpanda_linkedin_share_title{
width: 150px;
}
#optinpanda_twitter_tweet_text {
height: 100px;
}
#vk-share .alert,
#facebook-like .alert,
#facebook-share .alert,
#youtube-subscribe .alert,
#google-share .alert {
position: relative;
top: -15px;
margin-left: 5px;
}
.factory-volumetric #facebook-share .alert,
.factory-volumetric #google-share .alert {
margin-bottom: 15px;
line-height: 170%;
}
#OPanda_SocialOptionsMetaBox .factory-tab {
margin-bottom: 0px;
}
#OPanda_SocialOptionsMetaBox .factory-tab .form-group:last-child {
margin-bottom: 0px;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters {
position: absolute;
top: 11px;
right: 37px;
white-space: nowrap;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters {
vertical-align: middle;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .control-group,
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .control-label {
width: auto;
display: inline-block;
padding: 0px;
vertical-align: middle;
float: none;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .control-label {
font-weight: normal;
margin-right: 10px;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group {
padding: 0px;
border: 0px;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn {
padding-top: 3px;
padding-bottom: 3px;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn {
background: #fafafa;
color: #555;
border-color: #ccc;
background: #f7f7f7;
-webkit-box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
vertical-align: top;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn:hover,
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn:focus,
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn:active,
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn.active {
background: #fafafa;
border-color: #999;
color: #222;
}
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn:active,
#OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn-group .btn.active {
background-color: #fff;
border-color: #dbdbdb;
}
.factory-volumetric #OPanda_SocialOptionsMetaBox .factory-control-show_counters .control-label {
padding-top: 6px;
font-size: 12px;
}
.factory-volumetric #OPanda_SocialOptionsMetaBox .factory-control-show_counters .controls {
margin-left: 0px;
display: inline-block;
vertical-align: middle;
}
.factory-volumetric #OPanda_SocialOptionsMetaBox .factory-control-show_counters {
right: 22px;
top: 7px;
}
.factory-volumetric #OPanda_SocialOptionsMetaBox .factory-control-show_counters .btn {
font-size: 12px;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,239 @@
/**
* CSS for Opt-In Panda viewtable
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package optinpanda
* @since 1.0.0
*/
.column-shortcode input {
width: 100%;
max-width: 280px;
border: 0px;
background-color: transparent;
font-size: 12px;
font-family: "Consolas", Tahoma, Arial;
padding: 5px;
background-color: transparent;
box-shadow: inset 1px 1px 1px rgba(0,0,0,0.05), 1px 1px 1px #fff !important;
}
.column-shortcode {
width: 30%;
}
.column-bulk {
width: 270px;
}
.column-bulk .onp-sl-setup-section {
overflow: hidden;
padding: 10px;
}
.column-bulk .onp-sl-setup-section.onp-sl-empty-state {
padding: 0px;
}
.column-bulk .onp-sl-empty-state .onp-sl-has-options-content,
.column-bulk .onp-sl-has-options-state .onp-sl-empty-content {
display: none;
}
.column-bulk .onp-sl-setup-section .btn {
text-decoration: none;
}
.column-bulk .onp-sl-setup-section .btn + .btn {
margin-left: 5px;
}
.column-bulk.onp-sl-setup-section .btn .fa {
font-size: 14px;
position: relative;
top: 1px;
margin-right: 2px;
}
/* Empty State */
.column-bulk .onp-sl-empty-content .btn {
float: right;
}
/* Has Options */
.column-bulk .onp-sl-has-options-state {
color: #fff;
background-color: #0074a2;
border-top: 1px solid #006187;
}
.column-bulk .onp-sl-has-options-state p {
color: #fff;
}
.admin-color-light .column-bulk .onp-sl-has-options-state {
color: #111;
background-color: #f5f5f5;
border-top: 1px solid #dddddd;
}
.admin-color-light .column-bulk .onp-sl-has-options-state p {
color: #111;
}
.admin-color-blue .column-bulk .onp-sl-has-options-state {
color: #111;
background-color: #f5f5f5;
border-top: 1px solid #dddddd;
}
.admin-color-blue .column-bulk .onp-sl-has-options-state p {
color: #111;
}
.admin-color-coffee .column-bulk .onp-sl-has-options-state {
background-color: #59524c;
border-top: 1px solid #403c39;
}
.admin-color-ectoplasm .column-bulk .onp-sl-has-options-state {
background-color: #523f6d;
border-top: 1px solid #382b4b;
}
.admin-color-midnight .column-bulk .onp-sl-has-options-state {
background-color: #363b3f;
border-top: 1px solid #1c1f21;
}
.admin-color-ocean .column-bulk .onp-sl-has-options-state {
background-color: #738e96;
border-top: 1px solid #667c82;
}
.admin-color-sunrise .column-bulk .onp-sl-has-options-state {
background-color: #cf4944;
border-top: 1px solid #c1423d;
}
.factory-volumetric .column-bulk .onp-sl-has-options-state {
color: #fff;
background: #21759b;
border-radius: 3px;
margin-bottom: 9px;
margin-top: 4px;
border: 0px;
border-top: 1px solid #21759b;
-webkit-box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.15),inset 0px 1px 0px 0px rgba(255,255,255,0.2);
box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.15),inset 0px 1px 0px 0px rgba(255,255,255,0.2);
}
.column-bulk .onp-sl-way-description {
display: none;
}
.column-bulk .onp-sl-skip-lock-state .onp-sl-skip-lock-content,
.column-bulk .onp-sl-more-tag-state .onp-sl-more-tag-content,
.column-bulk .onp-sl-css-selector-state .onp-sl-css-selector-content {
display: block;
}
.column-bulk .onp-sl-rules,
.column-bulk .onp-sl-post-types-rule,
.column-bulk .onp-sl-exclude-post-ids-rule,
.column-bulk .onp-sl-exclude-categories-ids-rule {
display: none;
}
.column-bulk .onp-sl-post-types-rule-state .onp-sl-rules,
.column-bulk .onp-sl-exclude-post-ids-rule-state .onp-sl-rules,
.column-bulk .onp-sl-exclude-categories-ids-rule-state .onp-sl-rules,
.column-bulk .onp-sl-post-types-rule-state .onp-sl-post-types-rule,
.column-bulk .onp-sl-exclude-post-ids-rule-state .onp-sl-exclude-post-ids-rule,
.column-bulk .onp-sl-exclude-categories-ids-rule-state .onp-sl-exclude-categories-ids-rule {
display: block;
}
.column-bulk .onp-sl-rules {
position: relative;
top: 10px;
}
.column-bulk .onp-sl-rules span + span {
margin-top: 5px;
}
.column-bulk .onp-sl-rules,
.column-bulk .onp-sl-css-selector-view {
background-color: rgba(255,255,255,0.1);
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
margin-left: -10px;
padding: 10px;
overflow: hidden;
}
.admin-color-light .column-bulk .onp-sl-rules,
.admin-color-light .column-bulk .onp-sl-css-selector-view,
.admin-color-blue .column-bulk .onp-sl-rules,
.admin-color-blue .column-bulk .onp-sl-css-selector-view {
background-color: rgba(0,0,0,0.02);
}
.column-bulk .onp-sl-css-selector-view {
display: block;
margin-top: 0px;
position: relative;
top: 10px;
}
.column-bulk .onp-sl-way-description p {
margin: 0px;
}
.column-bulk .onp-sl-way-description p + p {
margin-top: 5px;
}
.column-bulk .onp-sl-skip-lock-content > span {
display: none;
}
.column-bulk .onp-sl-skip-lock-0-state .onp-sl-skip-lock-0-content,
.column-bulk .onp-sl-skip-lock-1-state .onp-sl-skip-lock-1-content,
.column-bulk .onp-sl-skip-lock-2-state .onp-sl-skip-lock-2-content {
display: block;
}
.column-bulk .onp-sl-controls {
padding-top: 12px;
}
.column-stats .opanda-empty {
color: #555;
}
/**
* Stats Column
*/
th.column-stats span {
cursor: help;
}
/**
* Visibility Conditions
*/
table.fixed {
table-layout: auto;
}
.column-visibility {
padding-left: 10px !important;
}
.column-visibility .onp-sl-inner-wrap {
min-width: 200px;
}
.column-visibility ul {
padding: 0px;
margin: 0px;
}
.column-visibility .bp-visibility-conditions {
}
.column-visibility .bp-filter-type,
.column-visibility strong {
font-weight: bold;
color: #111;
}
.column-visibility strong {
color: #111;
}
.column-visibility .bp-scopes {
margin-left: 10px;
}

View File

@@ -0,0 +1,441 @@
#opanda-leads-page .column-avatar {
width: 46px;
}
#opanda-leads-page td,
#opanda-leads-page th {
overflow: hidden;
color: #555;
}
#opanda-leads-page .column-avatar .opanda-avatar {
display: block;
width: 40px;
height: 40px;
padding: 2px;
border: 1px solid #D3D6DB;
background-color: #FFF;
background-position: center center;
background-repeat: no-repeat;
background-size: 40px 40px;
margin-bottom: 4px;
}
#opanda-leads-page .column-name .opanda-name {
font-weight: 700;
font-size: 1.2em;
line-height: 1.6em;
}
#opanda-leads-page .column-name strong.opanda-name {
color: #555;
}
#opanda-leads-page .column-status i {
vertical-align: middle;
}
#opanda-leads-page .column-status .fa {
font-size: 15px;
margin-right: 5px;
}
#opanda-leads-page .column-status .opanda-status-help {
cursor: help;
}
#opanda-leads-page .opanda_lead_way ul {
padding: 0px;
margin: 0px;
}
#opanda-leads-page .opanda_lead_way li {
margin: 0px;
}
#opanda-leads-page .opanda_lead_way li + li {
margin-top: 5px;
}
#opanda-leads-page .opanda_lead_confirmed {
cursor: help;
}
#opanda-leads-page .opanda_lead_checkbox {
width: 1%;
}
#opanda-leads-page .column-opanda_lead_email,
#opanda-leads-page .column-opanda_lead_name,
#opanda-leads-page .column-opanda_lead_date {
width: 1%;
padding-right: 50px !important;
min-width: 80px;
}
#opanda-leads-page .opanda_lead_checkbox,
#opanda-leads-page .opanda_lead_how,
#opanda-leads-page .column-opanda_lead_confirmed {
width: 1%;
}
#opanda-leads-page .opanda_lead_how {
white-space: nowrap;
padding-right: 50px !important;
}
#opanda-leads-page table.fixed {
table-layout: auto;
}
#opanda-leads-page .opanda-social-icon {
margin-left: 7px;
background: #fff;
box-shadow: 0px 1px 1px rgba(0,0,0,0.07);
width: 18px;
height: 18px;
display: inline-block;
text-align: center;
position: relative;
top: -1px;
}
#opanda-leads-page .opanda-social-icon + .opanda-social-icon {
margin-left: 5px;
}
#opanda-leads-page .opanda-social-icon i {
line-height: 18px;
color: #777;
font-size: 10px;
position: relative;
top: -1px;
}
#opanda-leads-page .opanda-social-icon .fa-twitter {
position: relative;
}
#opanda-leads-page .opanda-social-icon .fa-google-plus {
position: relative;
}
#opanda-leads-page .opanda-social-icon .fa-facebook {
position: relative;
}
#opanda-leads-page .opanda-social-icon:hover i {
color: #fff;
}
#opanda-leads-page .opanda-facebook-icon:hover {
background-color: #3c5a9a;
}
#opanda-leads-page .opanda-twitter-icon:hover {
background-color: #4086cc;
}
#opanda-leads-page .opanda-google-icon:hover {
background-color: #e75c3c;
}
#opanda-leads-page .opanda-linkedin-icon:hover {
background-color: #3a9bdc;
}
/**
* Lead Details
*/
#opanda-lead-details-page h2 {
margin-bottom: 30px;
}
#opanda-lead-details-page .avatar-wrap{
width: 180px;
}
#opanda-lead-details-page .opanda-avatar {
display: block;
width: 150px;
height: 150px;
padding: 4px;
border: 1px solid #D3D6DB;
background-color: #FFF;
background-position: center center;
background-repeat: no-repeat;
background-size: 40px 40px;
margin-bottom: 4px;
}
/* Controls */
.controls-wrap {
padding: 20px;
padding-left: 8px;
}
#opanda-lead-details-page .detail .click-to-edit{
margin: 0;
display: inline-block;
min-width: 150px;
}
#opanda-lead-details-page .detail.active .click-to-edit{
min-width: 350px;
}
#opanda-lead-details-page .user-info .detail code{
visibility: hidden;
font-size: 12px;
}
#opanda-lead-details-page .user-info .detail:hover code{
visibility: visible;
}
#opanda-lead-details-page .user-info .detail{
cursor: pointer;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
#opanda-lead-details-page .user-info .detail.active{
background-color: #F9F9F9;
cursor: default;
}
#opanda-lead-details-page .new .user-info .detail.active{
background-color: inherit;
}
#opanda-lead-details-page .user-info .detail.active code{
display: none;
}
#opanda-lead-details-page .user-info .detail.v-top label{
vertical-align: top;
padding-right: 5px;
}
#opanda-lead-details-page .user-info .detail:hover{
background-color: #F9F9F9;
}
#opanda-lead-details-page .new .user-info .detail:hover{
background-color: inherit;
}
#opanda-lead-details-page h3.detail .click-to-edit{
width: 70%;
}
#opanda-lead-details-page .new .click-to-edit, .new h3.detail .click-to-edit, h3.detail.active .click-to-edit{
width: 100%;
}
#opanda-lead-details-page .click-to-edit li{
display: none;
}
#opanda-lead-details-page .click-to-edit li:first-child{
display: block;
min-width: 102%;
}
#opanda-lead-details-page .new .click-to-edit li{
display: block;
}
#opanda-lead-details-page .new .click-to-edit li:first-child{
display: none;
}
#opanda-lead-details-page .new .click-to-edit li li:first-child{
display: inherit;
margin-top: 4px;
}
#opanda-lead-details-page .click-to-edit li li{
display: inherit;
}
#opanda-lead-details-page label{
font-weight:700;
}
#opanda-lead-details-page .click-to-edit label{
font-weight:normal;
}
#opanda-lead-details-page #subscriber_form .info{
margin: 5px 8px;
font-size: 12px;
}
#opanda-lead-details-page #subscriber_form .avatar-wrap .info{
margin: 2px 8px;
font-size: 12px;
}
#opanda-lead-details-page #subscriber_form .info .more-info{
margin: 5px 0px;
display:none;
}
#opanda-lead-details-page #subscriber_form .info .show-more-info{
cursor: pointer;
margin-right: 20px;
}
#opanda-lead-details-page .custom-field-wrap{
margin-top: 36px;
}
#opanda-lead-details-page .form-table td{
vertical-align: top;
padding:0;
}
#opanda-lead-details-page .avatar{
display: block;
width:200px;
height:200px;
padding: 4px;
border: 1px solid #D3D6DB;
background-color: #FFF;
background-position: center center;
background-repeat: no-repeat;
background-size: 200px 200px;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
#opanda-lead-details-page .branch-3-3 .avatar.wp-user:before,.branch-3-4 .avatar.wp-user:before,.branch-3-5 .avatar.wp-user:before,.branch-3-6 .avatar.wp-user:before,.branch-3-7 .avatar.wp-user:before{
content :'';
}
#opanda-lead-details-page .avatar.wp-user:before{
font-family: 'dashicons';
content: '\f120';
margin-left: 156px;
line-height: 357px;
font-size: 300%
}
#opanda-lead-details-page .user-info{
}
#opanda-lead-details-page .user-info h3, .user-info ul{
margin: 0;
}
#opanda-lead-details-page .user-info .detail{
padding: 11px 8px 2px;
margin-right: 20px;
border-bottom:1px solid #ccc;
}
#opanda-lead-details-page .user-info .detail code{
float: right;
padding: 2px;
font-weight: normal;
}
#opanda-lead-details-page .new .user-info .detail code{
display:none;
}
#opanda-lead-details-page .user-meta{
min-height: 200px;
width: 300px;
}
#opanda-lead-details-page .map{
border: 1px solid #D3D6DB;
}
#opanda-lead-details-page .map img{
display: block;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0px 1px 3px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.1);
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
#opanda-lead-details-page .map.zoomable img{
cursor:-webkit-zoom-in;
cursor:-moz-zoom-in;
cursor:zoom-in;
}
#opanda-lead-details-page .map.zoomable img.zoomed{
cursor:-webkit-zoom-out;
cursor:-moz-zoom-out;
cursor:zoom-out;
}
#opanda-lead-details-page h3 input{
font-size: 20px;
line-height: 1.4em;
width: 100%;
}
#opanda-lead-details-page .stats-wrap #stats {
margin-top:20px;
margin-bottom:20px;
border:0;
width: 80%;
}
#opanda-lead-details-page .stats-wrap #stats td {
vertical-align:middle;
border:0;
}
#opanda-lead-details-page .stats-wrap .big {
font-size:18px;
font-weight:100;
text-shadow:1px 1px 0 rgba(255,255,255,1);
display:inline-block;
width:90px;
margin-right:5px
}
#opanda-lead-details-page .stats-wrap .verybold {
line-height:2.5em;
font-size:22px;
font-weight:700;
text-shadow:1px 1px 0 rgba(255,255,255,1);
}
#opanda-lead-details-page .mymail-icon.client-desktop:before{
content:'\e811';
}
#opanda-lead-details-page .mymail-icon.client-mobile:before{
content:'\e813';
}
#opanda-lead-details-page .mymail-icon.client-webmail:before{
content:'\e828';
}
#opanda-lead-details-page .activity-wrap{
float: none;
clear: both;
}
#opanda-lead-details-page .activity-wrap .red{
color: #D8605F;
}
#opanda-lead-details-page .activity-wrap .icon-mm-error{
color: #D8605F;
}
#opanda-lead-details-page .activity-wrap .icon-mm-bounce.hard{
text-align:center;
border-radius:50%;
display:block;
width:18px;
height:18px;
line-height: 17px;
font-size:11px;
color:#fff;
background-color:#D8605F;
}
#opanda-lead-details-page .activity-wrap .icon-mm-bounce.hard:before{
margin-left:2px;
}
/**
* Export
*/
#opanda-export-page .control-group label {
font-weight: normal;
}
#opanda-export-page .control-group label,
#opanda-export-page .control-group label input {
vertical-align: bottom;
}
#opanda-export-page .control-group label input[type="checkbox"] {
margin-top: 0px;
margin-right: 5px;
}
#opanda-export-page .control-group label input[type="radio"] {
margin-left: 3px;
margin-right: 15px;
}
label[for="factory-checklist-opanda_lockers-all"] {
border-bottom: 1px dashed #555;
}
label[for="factory-checklist-opanda_lockers-all"]:hover {
border-bottom: 1px dashed transparent;
}
label[for="factory-checklist-opanda_lockers-all"] input {
display: none;
}

View File

@@ -0,0 +1,34 @@
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
/*
Datepicker for Bootstrap
Copyright 2012 Stefan Petre
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
*/
.datepicker { top: 0; left: 0; padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datepicker:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 6px; } .datepicker:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 7px; } .datepicker > div { display: none; } .datepicker table { width: 100%; margin: 0; } .datepicker td, .datepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td.day:hover { background: #eeeeee; cursor: pointer; } .datepicker td.old, .datepicker td.new { color: #999999; } .datepicker td.active, .datepicker td.active:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td.active:hover, .datepicker td.active:hover:hover, .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active, .datepicker td.active.disabled, .datepicker td.active:hover.disabled, .datepicker td.active[disabled], .datepicker td.active:hover[disabled] { background-color: #0044cc; } .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active { background-color: #003399 \9; } .datepicker td span { display: block; width: 47px; height: 54px; line-height: 54px; float: left; margin: 2px; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td span:hover { background: #eeeeee; } .datepicker td span.active { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td span.active:hover, .datepicker td span.active:active, .datepicker td span.active.active, .datepicker td span.active.disabled, .datepicker td span.active[disabled] { background-color: #0044cc; } .datepicker td span.active:active, .datepicker td span.active.active { background-color: #003399 \9; } .datepicker td span.old { color: #999999; } .datepicker th.switch { width: 145px; } .datepicker th.next, .datepicker th.prev { font-size: 19.5px; } .datepicker thead tr:first-child th { cursor: pointer; } .datepicker thead tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i { display: block; cursor: pointer; width: 16px; height: 16px; }

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,147 @@
/**
* The Page 'New Item'
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2014, OnePress Ltd
*
* @package optinpanda
* @since 1.0.0
*/
html {
}
.wrap {
margin-top: 0px;
}
.opanda-fullwidth {
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
margin-left: -22px;
padding-left: 22px;
padding-right: 22px;
}
.opanda-items {
padding-top: 10px;
padding-bottom: 20px;
overflow: hidden;
background-color: #f1f1f1;
}
.opanda-items .opanda-buttons .button {
background-color: #fff;
}
.opanda-item {
width: 250px;
min-width: 0;
height: 250px;
padding: 20px;
margin: 0 15px 15px 0;
vertical-align: top;
float: left;
-moz-box-sizing: border-box;
box-sizing: border-box;
line-height: 150%;
position: relative;
}
.opanda-item .opanda-title {
font-size: 16px;
margin: 0 0 15px 0;
}
.opanda-item .opanda-buttons {
position: absolute;
bottom: 0;
left: 0; right: 0;
padding: 18px;
background-color: #f9f9f9;
height: 66px;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.opanda-item .opanda-buttons .fa {
position: relative;
font-size: 14px;
}
.opanda-item .opanda-buttons .fa + span {
margin-left: 5px;
}
.opanda-item .opanda-buttons .opanda-right {
float: right;
}
.opanda-item .opanda-buttons .opanda-create {
}
.opanda-item .opanda-buttons .opanda-create .fa {
top: 1px
}
.opanda-item .opanda-buttons .opanda-help .fa {
}
.opanda-separator {
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #f8f8f8;
}
.opanda-extra-items {
padding-top: 30px;
}
.opanda-extra-items {
position: relative;
}
.opanda-extra-items .opanda-arrow {
display: none;
margin-left: 20px;
margin-top: 20px;
}
.opanda-extra-items .opanda-item {
border: 2px dashed rgba(0,0,0,0.2);
background-color: rgba(255,255,255,0.2);
box-shadow: none;
}
.opanda-extra-items .opanda-plus-background {
display: none;
position: absolute;
font-size: 30px;
right: 10px;
top: 10px;
}
.opanda-extra-items .opanda-item:hover {
border: 2px dashed rgba(0,0,0,0.3);
}
.opanda-extra-items .opanda-item em {
font-size: 12px;
font-style: normal;
color: #999;
font-weight: normal;
display: block;
}
.opanda-extra-items .opanda-buttons {
background-color: transparent;
padding-top: 20px;
}
.opanda-extra-items .opanda-separator {
margin-bottom: 20px;
}
.opanda-extra-items h2 + p {
margin-bottom: 30px;
}
.opanda-item-premium .opanda-item-cover {
width: 67px;
height: 67px;
background: url("../img/premium-item.png") top right no-repeat;
position: absolute;
top: -2px;
right: -2px;
}

View File

@@ -0,0 +1,302 @@
/**
* CSS for the Premium section
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2015, OnePress Ltd
*
* @package bizpanda
* @since 1.0.0
*/
.wrap {
width: 850px;
margin: 18px auto;
}
.wrap * {
font-family: 'helvetica neue',helvetica,arial,'lucida grande',sans-serif;
}
/* ---
* Content
*/
.onp-page-content {
background: #fff;
border: 1px solid #e3e3e3;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
border-radius: 3px;
}
.onp-page-content > .onp-inner-wrap {
border-bottom: 1px solid #f1f1f1;
}
.onp-page-content p {
margin: 0 0 20px 0;
font-size: 14px;
}
.onp-page-content .onp-page-section p:last-child {
margin-bottom: 0px;
}
.onp-page-content .onp-page-section {
color: #4e5665;
font-size: 14px;
line-height: 20px;
padding: 30px;
}
.onp-page-content .onp-page-section + .onp-page-section {
border-top: 1px solid #f9f9f9;
}
.onp-page-content .onp-page-section h1,
.onp-page-content .onp-page-section h2 {
margin: 0;
padding: 0px;
}
.onp-page-content .onp-page-section h1,
.onp-page-content .onp-page-section h2,
.onp-page-content .onp-page-section h3,
.onp-page-content .onp-page-section h4 {
color: #4e5665;
}
.onp-page-content .onp-page-section h1 {
font-size: 24px;
font-weight: normal;
line-height: 32px;
margin-bottom: 12px;
}
.onp-page-content .onp-page-section h2 {
font-size: 20px;
font-weight: normal;
line-height: 24px;
margin-bottom: 20px;
}
.onp-page-content .onp-page-section .updated {
display: none;
}
/* List */
.onp-page-content .onp-list {
list-style: disc;
padding: 0 0 0 20px;
}
.onp-page-content .onp-list li {
padding: 0px;
margin: 0px;
}
.onp-page-content .onp-list li + li {
margin-top: 15px;
}
/* Bold List */
.onp-page-content .onp-bold-link {
font-weight: bold;
text-decoration: none;
}
.onp-page-content .onp-bold-link:hover {
text-decoration: underline;
}
/* Marks */
.onp-page-content .onp-mark {
padding: 0px 0;
display: inline-block;
}
.onp-page-content .onp-mark-stricked {
border-bottom: 1px solid #fff;
}
.onp-page-content .onp-mark-yellow {
background-color: #fffaea;
border-bottom-color: #f9f1e1;
}
.onp-page-content .onp-mark-gray {
background-color: #f7f7f7;
border-bottom-color: #e9e9e9;
}
/* Code */
.onp-page-content .onp-code {
font-family: Consolas;
font-size: 13px;
}
/* Stress */
.onp-page-content strong {
color: #555;
}
.onp-page-content .onp-stress {
font-weight: 600;
font-style: italic;
color: #555;
}
/* Notes */
.onp-page-content .onp-note {
border-left: 5px solid #2c3e50;
padding: 10px 15px;
background-color: #f9f9f9;
color: #444;
}
.onp-page-content .onp-remark {
background: #f9f9f9;
border-radius: 3px;
}
.onp-page-content .onp-remark .onp-inner-wrap {
display: block;
padding: 10px 10px 10px 15px;
}
/* images */
.onp-page-content .onp-img {
margin: 20px 0px 25px 0;
padding: 35px 20px 30px 20px;
text-align: center;
line-height: 50%;
background-color: #fcfcfc;
}
.onp-page-content .onp-img img {
max-width: 616px;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.onp-page-content .onp-img i {
display: block;
font-style: italic;
margin: 20px 0 0 0px;
padding: 0px;
line-height: 150%;
color: #aaa;
font-size: 15px;
padding: 0 70px;
}
.onp-page-content strong {
font-weight: bold;
}
.onp-page-content ul {
padding-left: 20px;
list-style: inside;
}
/**
* Table
*/
.onp-how-comparation thead {
background-color: #f9f9f9;
}
.onp-how-comparation,
.onp-how-comparation td,
.onp-how-comparation th {
border: 0px !important;
}
.onp-how-comparation tr {
border-bottom: 1px solid #f9f9f9;
}
.onp-how-comparation .onp-how-group-separator {
height: 40px;
border-bottom: 0px;
}
.onp-how-comparation .onp-how-group {
background-color: #fafafa;
border-bottom: 1px solid #f3f3f3;
}
.onp-how-comparation .onp-how-group .onp-how-premium {
background-color: #2ea2cc;
border-bottom: 1px solid #2491b9 !important;
color: #fff;
}
.onp-how-group-title {
font-weight: bold;
}
.onp-how-group-title .fa {
margin-right: 5px;
}
.onp-how-title a {
color: #4e5665;
text-decoration: none;
border-bottom: 1px dotted #5e6675;
}
.onp-how-no {
color: #ddd;
}
.onp-how-yes strong {
}
.onp-how-comparation .onp-how-premium {
background-color: #f3fcff;
}
thead .onp-how-premium {
background-color: #2ea2cc;
color: #fff;
}
#activate-trial-btn,
#onp-sl-purchase-btn {
padding: 20px 0 !important;
font-size: 20px;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
text-align: center;
height: auto;
}
#onp-sl-purchase-btn {
padding: 20px 0 !important;
font-size: 20px;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 100%;
text-align: center;
height: auto;
background: #fffaea;
border-color: #ddd9cd;
-moz-box-shadow: 0 0 8px #fddf67;
-webkit-box-shadow: 0 0 8px #fddf67;
box-shadow: 0 0 8px #fddf67;
-moz-text-shadow: none;
-webkit-text-shadow: none;
text-shadow: none;
}
/* hides the vk note on the how to use page */
.onp-sl-vk-note {
display: none;
}
/* tables */
.onp-page-content .table p {
margin: 0px;
}
.onp-page-content .table p + p {
margin-top: 5px;
}
.onp-page-content .table .onp-title {
font-weight: bold;
white-space: nowrap;
}
.onp-page-content .table > thead {
background-color: #f9f9f9;
}
.onp-page-content .table > thead > tr > th {
border-bottom-width: 1px;
}
.onp-page-content .table > tbody > tr > td,
.onp-page-content .table > tr > td {
border-bottom: 1px solid #f9f9f9;
}

View File

@@ -0,0 +1,305 @@
/**
* CSS for Opt-In Panda Settings
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package optinpanda
* @since 1.0.0
*/
.alert.alert-success {
margin: 0px;
margin-top: 10px;
margin-bottom: 10px;
font-weight: bold;
padding: 10px;
}
.alert.alert-success p {
margin: 0px;
}
input[type=text],
textarea {
max-width: 400px;
}
select {
width: auto !important;
}
textarea {
min-height: 100px;
}
.opanda-hidden {
display: none;
}
.factory-bootstrap-331 .form-control {
display: inline-block;
}
.help-block a {
color: #737373;
}
.help-block a:hover {
}
#opanda_facebook_appid,
#opanda_vk_appid,
#opanda_linkedin_client_id,
#opanda_linkedin_client_secret {
width: 250px;
}
#opanda_dynamic_theme_event,
#opanda_managed_hook {
width: 250px;
}
#opanda_lang {
width: 250px;
}
#opanda_timeout,
#opanda_session_duration {
width: 100px;
}
.help-block {
position: relative;
margin-top: 8px !important;
line-height: 160%;
}
.form-horizontal {
max-width: 1200px;
}
.btn-group {
border: 0px !important;
}
.factory-bootstrap-331 .btn-group {
margin-bottom: 0px;
}
.form-horizontal .onp-sl-inline {
padding-top: 1px;
margin: 0px;
}
.factory-volumetric .onp-sl-inline {
font-size: 14px;
line-height: 100%;
padding-top: 8px;
}
.btn + .btn {
margin-left: 5px;
}
/**
* Confirmation Dialog
*/
#onp-confirm-dialog.onp-page-wrap {
width: 700px;
margin: auto;
margin-top: 100px;
}
#onp-confirm-dialog-wrap {
background-color: #fefefe;
border-radius: 15px;
padding: 40px 40px 40px 210px;
-moz-box-sizing: border-box;
box-sizing: border-box;
min-height: 165px;
border-bottom: 2px solid #dfdfdf;
background-image: url("../img/confirmation-dialog.png");
background-repeat: no-repeat;
background-position: 40px 40px;
}
.factory-volumetric #onp-confirm-dialog-wrap {
background-color: #f9f9f9;
border-bottom: 2px solid #f3f3f3;
}
#onp-confirm-dialog-wrap h1 {
padding: 0px;
margin: 0 0 15px 0;
color: #48515F;
-moz-text-shadow: #fff;
text-shadow: #fff;
line-height: 120%;
font-size: 20px;
}
#onp-confirm-dialog-wrap p {
margin: 0px;
}
#onp-confirm-dialog-wrap .onp-actions {
padding-top: 20px;
}
#onp-confirm-dialog-wrap .onp-actions a + a {
margin-left: 10px;
}
#opanda_alt_overlap_mode {
max-width: 200px;
}
#opanda_na_mode {
max-width: 300px;
}
/** ---
* Common
*/
.control-group > * {
vertical-align: middle;
}
.factory-dropdown.factory-buttons-way {
margin-bottom: 8px;
}
.control-group .btn {
height: 33px;
line-height: 33px;
padding: 0 12px 0px 12px;
}
.factory-bootstrap-331 .factory-after {
margin-left: 2px;
}
/** ---
* Social Options
*/
#opanda_twitter_use_dev_keys {
width: 250px !important;
}
/** ---
* Subscription Options
*/
.opanda-screen-subscription .factory-dropdown .factory-hint {
background: none;
color: #737373;
}
.opanda-aweber-steps ul,
.opanda-aweber-steps span,
.opanda-aweber-steps a {
display: inline-block;
vertical-align: bottom;
line-height: 28px;
}
.opanda-screen-subscription .dd-option-image,
.opanda-screen-subscription .dd-selected-image {
max-width: 110px !important;
margin-left: 20px;
}
.opanda-screen-subscription .dd-options {
max-height: 400px;
}
.opanda-screen-subscription .dd-options li {
margin-bottom: 0px;
}
/** ---
* Lock Options
*/
.opanda-screen-lock .opanda-example {
display: none;
}
.opanda-screen-lock .opanda-url {
color: #0074a2;
text-decoration: none;
}
.opanda-screen-lock .opanda-url:hover {
text-decoration: underline;
}
.opanda-screen-lock .opanda-passcode {
font-weight: bold;
color: #0074a2;
}
/** ---
* Permissions
*/
.opanda-screen-permissions .opanda-user-role-options-group {
display: none;
}
.opanda-screen-permissions .help-block {
margin: 5px 0 0 5px !important;
}
.opanda-screen-permissions .control-group * {
display: inline-block;
}
.opanda-screen-permissions .permissions-set {
padding-bottom: 15px;
}
.opanda-screen-permissions .permissions-set .control-label {
font-weight: normal;
}
.opanda-screen-permissions .permissions-set .form-group {
margin-bottom: 5px;
}
.opanda-screen-permissions .permissions-set .help-block {
cursor: pointer;
}
/** ---
* Font-end Text
*/
.opanda-screen-text .factory-legend {
margin-bottom: 40px;
background-color: rgba(255,255,255,0.6) !important;
border-radius: 3px;
border-bottom: 1px solid #e3e3e3;
padding: 15px !important;
}
.opanda-screen-text .factory-legend + .factory-separator {
margin-bottom: 40px;
}
.opanda-screen-text fieldset + fieldset {
margin-top: 30px !important;
}
.opanda-screen-text .form-horizontal {
max-width: 750px;
}
.opanda-screen-text label {
width: 220px;
}
.opanda-screen-text .control-group {
width: 500px !important;
}
.opanda-screen-text input[type=text],
.opanda-screen-text textarea {
max-width: none;
}
.opanda-screen-text .opanda-width-short {
width: 200px;
}
.opanda-screen-text fieldset .factory-separator {
border-top: 0px;
border-bottom: 1px dashed #d9d9d9;
}
.opanda-screen-text .factory-form-group .factory-hint {
font-size: 13px;
}
.opanda-screen-terms #opanda-enabled-options,
.opanda-screen-terms #opanda-nopages-options,
.opanda-screen-terms #opanda-pages-options {
display: none;
}
.opanda-screen-terms #opanda_terms_of_use_text,
.opanda-screen-terms #opanda_privacy_policy_text {
max-width: none;
}
.opanda-screen-terms .wp-editor-wrap {
max-width: 800px;
}

View File

@@ -0,0 +1,329 @@
/**
* CSS for Opt-In Panda Statistics
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package optinpanda
* @since 1.0.0
*/
/**
* Control Panel
*/
#opanda-control-panel {
height: 28px;
padding-top: 0px;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
#opanda-control-panel .opanda-left {
float: left;
}
#opanda-control-panel .opanda-right {
float: right;
}
#opanda-control-panel .opanda-left > *,
#opanda-control-panel .opanda-right > * {
display: inline-block;
vertical-align: middle;
line-height: 28px;
}
#opanda-current-item a {
text-decoration: none;
}
#opanda-current-item a:hover {
text-decoration: underline;
}
#opanda-item-selector {
position: relative;
top: -1px;
}
/**
* Chart description
*/
#opanda-chart-description {
background-color: #fff;
margin-top: 15px;
padding: 8px 20px 7px 20px;
}
/**
* Chart Area
*/
#onp-sl-chart-area {
background-color: #fff;
padding: 0 20px;
border-top: 1px solid #f4f4f4;
border-bottom: 2px solid #e9e9e9;
}
#onp-sl-settings-bar {
height: 55px;
padding-top: 10px;
margin-top: 10px;
-webkit-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#onp-sl-settings-bar .btn {
padding: 3px 10px 4px 10px;
}
.factory-volumetric #onp-sl-settings-bar .btn {
padding: 3px 8px;
}
/* Type Select */
#onp-sl-type-select {
float: left;
white-space: nowrap;
border: 0px;
position: relative;
top: -6px;
}
#onp-sl-type-select .fa {
font-size: 14px;
margin-right: 3px;
}
#onp-sl-type-select > * {
display: inline-block;
}
/* Date Select */
#onp-sl-date-select {
float: right;
}
#onp-sl-date-select > * {
display: inline-block;
vertical-align: top;
}
.onp-sl-range-label {
position: relative;
margin-right: 8px;
top: 4px;
}
#onp-sl-date-start, #onp-sl-date-end {
width: 120px;
height: 28px;
}
#onp-sl-apply-dates {
margin-left: 5px;
padding-left: 10px;
padding-right: 10px;
font-size: 13px;
}
#onp-sl-apply-dates .fa {
margin-right: 3px;
position: relative;
top: 1px;
}
.chart-wrap {
margin-bottom: 20px;
margin-top: 20px;
}
/**
* Charts selector
*/
#onp-sl-chart-selector {
padding-top: 15px;
padding-bottom: 15px;
line-height: 100%;
}
#onp-sl-chart-selector .onp-sl-selector-item {
display: inline-block;
clear: both;
cursor: pointer;
padding: 7px;
border-radius: 3px;
color: #d0d0d0;
}
#onp-sl-chart-selector .onp-sl-selector-item.opanda-active {
color: #111;
background-color: #f9f9f9;
}
#onp-sl-chart-selector .onp-sl-selector-item:hover {
background-color: #fbfbfb;
}
#onp-sl-chart-selector .onp-sl-selector-item {
margin: 3px;
line-height: 100%;
vertical-align: middle;
position: relative;
left: -3px;
top: -3px;
}
#onp-sl-chart-selector .chart-color {
width: 15px;
height: 15px;
float: left;
margin-right: 5px;
position: relative;
top: -1px;
}
#onp-sl-chart-selector .onp-sl-selector-item.opanda-inactive .chart-color {
background-color: #e5e5e5 !important;
}
.onp-chart-hint {
margin-top: 5px;
display: inline-block;
background-color: #ffffdd;
padding: 2px 8px;
width: 100%;
display: none;
}
/**
* Posts
*/
#opanda-data-table-wrap {
background: #f6f6f6;
}
#opanda-pagination-wrap {
text-align: right;
}
#opanda-pagination-wrap .pagination {
margin-bottom: 0px;
text-align: right;
margin-top: 10px;
}
#opanda-data-table {
background-color: #fff;
width: 100%;
padding: 0px;
border-collapse: collapse;
border-bottom: 2px solid #e5e5e5;
}
#opanda-data-table thead tr + tr {
border-top: 1px solid #f1f1f1;
}
#opanda-data-table th {
text-align: left;
padding: 8px 10px 8px 6px;
font-family: Arial, Helvetica, Geneva, sans-serif;
font-size: 11px;
font-weight: bold;
}
#opanda-data-table th.opanda-col-number {
text-align: right;
white-space: nowrap;
}
#opanda-data-table th.opanda-col-common {
text-align: center;
}
#opanda-data-table td {
text-align: right;
font-family: Arial, Helvetica, Geneva, sans-serif;
font-size: 13px;
}
#opanda-data-table td,
#opanda-data-table th {
padding: 9px 20px;
}
#opanda-data-table th .opanda-hint {
background: url('../img/help.png') no-repeat 0 0 transparent;
margin-left: 3px;
opacity: 0.55;
position: relative;
height: 14px;
width: 13px;
overflow: hidden;
display: inline-block;
cursor: help;
vertical-align: middle;
top: -1px;
}
#opanda-data-table tbody tr {
border-bottom: 1px solid #f1f1f1;
border-top: 1px solid #f1f1f1;
}
#opanda-data-table tbody tr:nth-child(odd) {
background-color: #fafafa;
}
#opanda-data-table .opanda-col-index {
width: 1%;
}
#opanda-data-table .opanda-col-number {
width: 1%;
min-width: 100px;
border-left: 1px solid #f1f1f1;
white-space: nowrap;
}
#opanda-data-table td em {
font-style: normal;
color: #aaa;
}
#opanda-data-table.opanda-free-table .opanda-col-number {
white-space: nowrap;
}
#opanda-data-table .opanda-col-title {
text-align: left;
}
#opanda-data-table .opanda-col-title a {
text-decoration: none;
}
#opanda-data-table .opanda-col-title a:hover {
text-decoration: underline;
}
#opanda-data-table th.opanda-column-highlight,
#opanda-data-table td.opanda-column-highlight {
background-color: #fbfbfb;
font-weight: bold;
border-left: 1px solid #eee;
border-right: 1px solid #eee;
}
#opanda-data-table tr:nth-child(odd) td.opanda-column-highlight {
background-color: #f7f7f7;
}
#opanda-data-table .opanda-empty {
text-align: left;
font-style: italic;
}
/**
* Locker Selector Popup
*/
#opanda-locker-select-popup {
position: absolute;
padding: 30px;
background-color: #fff;
-moz-box-sizing: content-box;
box-sizing: content-box;
width: 400px;
top: 50%;
box-shadow: 0 0 15px 3px rgba(0,0,0,0.08);
border-radius: 4px;
z-index: 51;
}
#opanda-locker-select-overlap {
background-color: #f1f1f1;
opacity: 0.5;
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
z-index: 50;
}
#opanda-locker-select-popup strong {
font-size: 18px;
}
#opanda-locker-select-popup p {
margin-top: 5px;
}

View File

@@ -0,0 +1,15 @@
body {
font-family: Arial;
font-size: 14px;
background-color: #fff;
line-height: 155%;
}
p {
margin: 0px;
}
p + p {
margin-top: 15px;
}
strong {
color: #333;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

View File

@@ -0,0 +1,347 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
(function (element, blockEditor, blocksConfig) {
var el = element.createElement;
var __ = wp.i18n.__;
var availableBlocks = blocksConfig.blockTypes;
var SelectControl = wp.components.SelectControl;
var knownBlocks = {
'sociallocker': {
'title': __('Social Locker', 'bizpanda'),
'description': __('Hides content inside the block behind a social locker.', 'bizpanda'),
'keywords': ['locker', 'sociallocker', 'social locker', 'social', 'lock'],
'transformsFrom': ['bizpanda/signinlocker', 'bizpanda/emaillocker'],
'icon': el("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 992.13 992.13"
}, el("path", {
d: "M282.61,687.13l-88.25-88.25c-71.66-71.66-71.66-188.26,0-259.93a183.77,183.77,0,0,1,259.94,0l18.26,18.28L490.83,339A183.7,183.7,0,0,1,792.44,534.37l39.15,39.14A235.39,235.39,0,0,0,472.56,286a235.49,235.49,0,0,0-314.72,16.48c-91.79,91.79-91.79,241.16,0,332.95l88.25,88.26Z",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "0.25"
}), el("polygon", {
points: "472.56 950.13 319.13 796.7 355.64 760.18 472.56 877.08 730.82 618.82 767.33 655.33 472.56 950.13 472.56 950.13",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "60"
}))
},
'signinlocker': {
'title': __('Sign-In Locker', 'bizpanda'),
'description': __('Hides content inside the block behind a sign-in locker.', 'bizpanda'),
'keywords': ['locker', 'signinlocker', 'signin locker', 'social', 'lock'],
'transformsFrom': ['bizpanda/sociallocker', 'bizpanda/emaillocker'],
'icon': el("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 992.13 992.13"
}, el("polygon", {
points: "482.6 950.55 329.17 797.14 365.69 760.62 482.59 877.52 740.87 619.26 777.38 655.78 482.6 950.55 482.6 950.55",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "60"
}), el("path", {
d: "M849.54,583.63L886,547.1,781.71,442.77H626.84l0-35c0.42-4.13,5.11-18.29,8.89-29.67C648,341,666.63,285,666.64,226.54c0-123.93-74-207.21-184.07-207.21S298.63,102.61,298.63,226.54C298.63,285,317.2,341,329.5,378.13c3.77,11.38,8.48,25.54,8.83,29l0,35.59H183.49L79.15,547.1l177,177,36.52-36.53L152.21,547.1l52.68-52.69H390V407.17c0-10.7-4.31-23.72-11.46-45.3-11.25-33.94-28.27-85.24-28.26-135.34C350.26,130.59,401,71,482.57,71S615,130.59,615,226.52c0,50.11-17,101.4-28.3,135.35-7.17,21.57-11.5,34.6-11.5,45.31v87.24H760.32Z",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "0.25"
}))
},
'emaillocker': {
'title': __('Email Locker', 'bizpanda'),
'description': __('Hides content inside the block behind an email locker.', 'bizpanda'),
'keywords': ['locker', 'emaillocker', 'email locker', 'optin', 'opt-in', 'lock'],
'transformsFrom': ['bizpanda/sociallocker', 'bizpanda/signinlocker'],
'icon': el("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 992.13 992.13"
}, el("path", {
d: "M231.37,686.2l-91.73-91.73,255.85,0H586.16v-139H842.06l-89.44,89.44,36.53,36.52L940.9,429.61,560.35,49.07,40.77,568.65,194.85,722.72Zm354.8-538.28L842,403.78l-255.88,0V147.93Zm-51.63,0V542.81l-394.89,0Z",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "0.25"
}), el("polygon", {
points: "421.33 949.21 267.89 795.75 304.4 759.25 421.33 876.16 679.58 617.89 716.09 654.4 421.33 949.21 421.33 949.21",
fill: "#555d66",
stroke: "#555d66",
"stroke-miterlimit": "10",
"stroke-width": "60"
}))
}
};
/**
* Locker Select
*/
var LockerSelect = /*#__PURE__*/function (_wp$element$Component) {
_inherits(LockerSelect, _wp$element$Component);
var _super = _createSuper(LockerSelect);
function LockerSelect() {
var _this;
_classCallCheck(this, LockerSelect);
_this = _super.apply(this, arguments);
_this.state = {
isLoading: true,
selectedId: _this.props.lockerId ? parseInt(_this.props.lockerId) : 0,
options: []
};
_this.handleSelectChange = _this.handleSelectChange.bind(_assertThisInitialized(_this));
return _this;
}
_createClass(LockerSelect, [{
key: "componentDidMount",
value: function componentDidMount() {
var self = this;
var request = jQuery.ajax(window.ajaxurl, {
type: 'post',
dataType: 'json',
data: {
action: 'get_opanda_lockers',
shortcode: self.props.shortcode
}
});
request.done(function (data) {
var options = [];
var hasSelected = false;
var defaultLocker = false;
var _iterator = _createForOfIteratorHelper(data),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var locker = _step.value;
if (self.state.selectedId && self.state.selectedId === parseInt(locker.id)) {
hasSelected = true;
}
var item = {
label: locker.title,
value: locker.id,
shortcode: locker.shortcode
};
if (!defaultLocker) defaultLocker = item;
options.push(item);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
if (!hasSelected && defaultLocker) {
console.log(defaultLocker);
self.props.onChange(defaultLocker);
}
self.setState({
isLoading: false,
options: options,
selectedId: hasSelected ? self.state.selectedId : defaultLocker.value
});
});
}
}, {
key: "handleSelectChange",
value: function handleSelectChange(lockerId) {
var option = null;
var _iterator2 = _createForOfIteratorHelper(this.state.options),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var optionItem = _step2.value;
if (parseInt(optionItem.value) === parseInt(lockerId)) {
option = optionItem;
this.setState({
selectedId: lockerId ? parseInt(lockerId) : 0
});
break;
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
this.props.onChange(option);
}
}, {
key: "render",
value: function render() {
var self = this;
var options = this.state.options;
if (this.state.isLoading) {
options = [{
label: __('Loading...', 'bizpanda'),
value: 0
}];
}
var hasLockers = options.length > 0;
if (!hasLockers) {
options = [{
label: __('[ - empty - ]', 'bizpanda'),
value: 0
}];
}
var hasEditableItem = !this.state.isLoading && hasLockers && this.state.selectedId ? true : false;
var hasAddAbility = !this.state.isLoading;
return el(React.Fragment, null, el(SelectControl, {
className: "onp-locker-select-wrap",
label: self.props.label + ':',
onChange: this.handleSelectChange,
value: self.props.lockerId,
options: options
}), (hasAddAbility || hasEditableItem) && el("div", null, "|"), hasEditableItem && el("a", {
href: blocksConfig.urlEditUrl.replace('{0}', this.state.selectedId),
target: "_blank",
className: "button onp-button"
}, __('Edit', 'bizpanda')), hasAddAbility && el("a", {
href: blocksConfig.urlCreateNew,
target: "_blank",
className: "button onp-button"
}, __('Add', 'bizpanda')));
}
}]);
return LockerSelect;
}(wp.element.Component);
var _iterator3 = _createForOfIteratorHelper(availableBlocks),
_step3;
try {
var _loop = function _loop() {
var pluginBlockType = _step3.value;
if (!knownBlocks[pluginBlockType]) return "continue";
var shortcode = pluginBlockType;
var blockName = 'bizpanda/' + pluginBlockType;
var blockTitle = knownBlocks[pluginBlockType].title;
var blockDescription = knownBlocks[pluginBlockType].description;
var blockIcon = knownBlocks[pluginBlockType].icon;
var blockKeywords = knownBlocks[pluginBlockType].keywords;
var blockTransformsFrom = knownBlocks[pluginBlockType].transformsFrom;
wp.blocks.registerBlockType(blockName, {
title: blockTitle,
description: blockDescription,
icon: blockIcon,
category: 'widgets',
keywords: blockKeywords,
attributes: {
id: {
type: 'number'
}
},
transforms: {
from: [{
type: 'block',
blocks: blockTransformsFrom,
transform: function transform(attributes) {
return wp.blocks.createBlock(blockName, _objectSpread({}, attributes));
}
}]
},
edit: function edit(props) {
var elements = []; // if selected, shows the settings
if (props.isSelected) {
var onChange = function onChange(option) {
console.log(option);
props.setAttributes({
id: option && option.value ? parseInt(option.value) : null
});
};
var configWrap = el("div", {
className: "onp-config-wrap"
}, el(LockerSelect, {
shortcode: shortcode,
label: blockTitle,
onChange: onChange,
lockerId: props.attributes.id
}));
elements.push(configWrap);
}
var previewWrap = el("div", {
className: "onp-preview-wrap"
}, el("div", {
className: "onp-top-bracket"
}), el(blockEditor.InnerBlocks, null), el("div", {
className: "onp-bottom-bracket"
}));
elements.push(previewWrap);
return el("div", {
className: "onp-locker"
}, elements);
},
save: function save(props) {
return el("div", {
className: "onp-locker-block"
}, el(blockEditor.InnerBlocks.Content, null));
}
});
};
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var _ret = _loop();
if (_ret === "continue") continue;
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
})(window.wp.element, window.wp.blockEditor, window.__bizpanda_locker_blocks);

View File

@@ -0,0 +1,255 @@
(function( element, blockEditor, blocksConfig ) {
const el = element.createElement;
const __ = wp.i18n.__;
const availableBlocks = blocksConfig.blockTypes;
const { SelectControl } = wp.components;
const knownBlocks = {
'sociallocker': {
'title': __('Social Locker', 'bizpanda'),
'description': __('Hides content inside the block behind a social locker.', 'bizpanda'),
'keywords': [ 'locker', 'sociallocker', 'social locker', 'social', 'lock' ],
'transformsFrom': ['bizpanda/signinlocker', 'bizpanda/emaillocker'],
'icon': <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 992.13 992.13"><path d="M282.61,687.13l-88.25-88.25c-71.66-71.66-71.66-188.26,0-259.93a183.77,183.77,0,0,1,259.94,0l18.26,18.28L490.83,339A183.7,183.7,0,0,1,792.44,534.37l39.15,39.14A235.39,235.39,0,0,0,472.56,286a235.49,235.49,0,0,0-314.72,16.48c-91.79,91.79-91.79,241.16,0,332.95l88.25,88.26Z" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="0.25"/><polygon points="472.56 950.13 319.13 796.7 355.64 760.18 472.56 877.08 730.82 618.82 767.33 655.33 472.56 950.13 472.56 950.13" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="60"/></svg>
},
'signinlocker': {
'title': __('Sign-In Locker', 'bizpanda'),
'description': __('Hides content inside the block behind a sign-in locker.', 'bizpanda'),
'keywords': [ 'locker', 'signinlocker', 'signin locker', 'social', 'lock' ],
'transformsFrom': ['bizpanda/sociallocker', 'bizpanda/emaillocker'],
'icon': <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 992.13 992.13"><polygon points="482.6 950.55 329.17 797.14 365.69 760.62 482.59 877.52 740.87 619.26 777.38 655.78 482.6 950.55 482.6 950.55" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="60"/><path d="M849.54,583.63L886,547.1,781.71,442.77H626.84l0-35c0.42-4.13,5.11-18.29,8.89-29.67C648,341,666.63,285,666.64,226.54c0-123.93-74-207.21-184.07-207.21S298.63,102.61,298.63,226.54C298.63,285,317.2,341,329.5,378.13c3.77,11.38,8.48,25.54,8.83,29l0,35.59H183.49L79.15,547.1l177,177,36.52-36.53L152.21,547.1l52.68-52.69H390V407.17c0-10.7-4.31-23.72-11.46-45.3-11.25-33.94-28.27-85.24-28.26-135.34C350.26,130.59,401,71,482.57,71S615,130.59,615,226.52c0,50.11-17,101.4-28.3,135.35-7.17,21.57-11.5,34.6-11.5,45.31v87.24H760.32Z" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="0.25"/></svg>
},
'emaillocker': {
'title': __('Email Locker', 'bizpanda'),
'description': __('Hides content inside the block behind an email locker.', 'bizpanda'),
'keywords': [ 'locker', 'emaillocker', 'email locker', 'optin', 'opt-in', 'lock' ],
'transformsFrom': ['bizpanda/sociallocker', 'bizpanda/signinlocker'],
'icon': <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 992.13 992.13"><path d="M231.37,686.2l-91.73-91.73,255.85,0H586.16v-139H842.06l-89.44,89.44,36.53,36.52L940.9,429.61,560.35,49.07,40.77,568.65,194.85,722.72Zm354.8-538.28L842,403.78l-255.88,0V147.93Zm-51.63,0V542.81l-394.89,0Z" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="0.25"/><polygon points="421.33 949.21 267.89 795.75 304.4 759.25 421.33 876.16 679.58 617.89 716.09 654.4 421.33 949.21 421.33 949.21" fill="#555d66" stroke="#555d66" stroke-miterlimit="10" stroke-width="60"/></svg>
}
};
/**
* Locker Select
*/
class LockerSelect extends wp.element.Component {
constructor() {
super(...arguments);
this.state = {
isLoading: true,
selectedId: this.props.lockerId ? parseInt( this.props.lockerId ) : 0,
options: []
};
this.handleSelectChange = this.handleSelectChange.bind(this);
}
componentDidMount() {
const self = this;
const request = jQuery.ajax(window.ajaxurl, {
type: 'post',
dataType: 'json',
data: {
action: 'get_opanda_lockers',
shortcode: self.props.shortcode
}
});
request.done(function( data ){
const options = [];
let hasSelected = false;
let defaultLocker = false;
for ( let locker of data ) {
if ( self.state.selectedId && self.state.selectedId === parseInt( locker.id ) ) {
hasSelected = true;
}
const item = { label: locker.title, value: locker.id, shortcode: locker.shortcode };
if ( !defaultLocker ) defaultLocker = item;
options.push(item);
}
if ( !hasSelected && defaultLocker ) {
console.log(defaultLocker);
self.props.onChange(defaultLocker);
}
self.setState({
isLoading: false,
options: options,
selectedId: hasSelected ? self.state.selectedId : defaultLocker.value
});
});
}
handleSelectChange( lockerId ) {
let option = null;
for ( let optionItem of this.state.options ) {
if ( parseInt( optionItem.value ) === parseInt( lockerId ) ) {
option = optionItem;
this.setState({
selectedId: lockerId ? parseInt( lockerId ) : 0
});
break;
}
}
this.props.onChange( option );
}
render() {
const self = this;
let options = this.state.options;
if ( this.state.isLoading ) {
options = [{label: __('Loading...', 'bizpanda'), value: 0}];
}
const hasLockers = options.length > 0;
if ( !hasLockers ) {
options = [{label: __('[ - empty - ]', 'bizpanda'), value: 0}];
}
const hasEditableItem = ( !this.state.isLoading && hasLockers && this.state.selectedId ) ? true : false;
const hasAddAbility = !this.state.isLoading;
return (
<>
<SelectControl
className={"onp-locker-select-wrap"}
label={self.props.label + ':'}
onChange={this.handleSelectChange}
value={self.props.lockerId}
options={options}
/>
{
( hasAddAbility || hasEditableItem ) &&
<div>|</div>
}
{
hasEditableItem &&
<a href={blocksConfig.urlEditUrl.replace('{0}', this.state.selectedId)} target="_blank" className="button onp-button">{__('Edit', 'bizpanda')}</a>
}
{
hasAddAbility &&
<a href={blocksConfig.urlCreateNew} target="_blank" className="button onp-button">{__('Add', 'bizpanda')}</a>
}
</>
);
}
}
for ( let pluginBlockType of availableBlocks ) {
if ( !knownBlocks[pluginBlockType] ) continue;
const shortcode = pluginBlockType;
const blockName = 'bizpanda/' + pluginBlockType;
const blockTitle = knownBlocks[pluginBlockType].title;
const blockDescription = knownBlocks[pluginBlockType].description;
const blockIcon = knownBlocks[pluginBlockType].icon;
const blockKeywords = knownBlocks[pluginBlockType].keywords;
const blockTransformsFrom = knownBlocks[pluginBlockType].transformsFrom;
wp.blocks.registerBlockType(blockName, {
title: blockTitle,
description: blockDescription,
icon: blockIcon,
category: 'widgets',
keywords: blockKeywords,
attributes: {
id: {
type: 'number'
},
},
transforms: {
from: [
{
type: 'block',
blocks: blockTransformsFrom,
transform: function ( attributes ) {
return wp.blocks.createBlock( blockName, {...attributes});
},
},
]
},
edit: function(props) {
const elements = [];
// if selected, shows the settings
if ( props.isSelected ) {
const onChange = (option) => {
console.log( option );
props.setAttributes({
id: ( option && option.value ) ? parseInt( option.value ) : null
});
};
const configWrap = (
<div className="onp-config-wrap">
<LockerSelect
shortcode={shortcode}
label={blockTitle}
onChange={onChange}
lockerId={props.attributes.id}>
</LockerSelect>
</div>
);
elements.push(configWrap);
}
const previewWrap = (
<div className="onp-preview-wrap">
<div className="onp-top-bracket"></div>
<blockEditor.InnerBlocks />
<div className="onp-bottom-bracket"></div>
</div>
)
elements.push(previewWrap);
return (
<div className="onp-locker">{elements}</div>
);
},
save: function(props) {
return (
<div className="onp-locker-block">
<blockEditor.InnerBlocks.Content />
</div>
);
}
});
}
})(
window.wp.element,
window.wp.blockEditor,
window.__bizpanda_locker_blocks
);

View File

@@ -0,0 +1,80 @@
/*!
* Filers & Hooks API
* Copyright 2014, OnePress, http://byonepress.com
*
* @since 1.0.0
* @pacakge core
*/
(function ($) {
'use strict';
if ( !$.bizpanda ) $.bizpanda = {};
$.bizpanda.filters = $.bizpanda.filters || {
/**
* A set of registered filters.
*/
_items: {},
/**
* A set of priorities of registered filters.
*/
_priorities: {},
/**
* Applies filters to a given input value.
*/
run: function( filterName, args ) {
var input = args && args.length > 0 ? args[0] : null;
if ( !this._items[filterName] ) return input;
for ( var i in this._priorities[filterName] ) {
if ( !this._priorities[filterName].hasOwnProperty(i) ) continue;
var priority = this._priorities[filterName][i];
for ( var k = 0; k < this._items[filterName][priority].length; k++ ) {
var f = this._items[filterName][priority][k];
input = f.apply(f, args);
}
}
return input;
},
/**
* Registers a new filter.
*/
add: function( filterName, callback, priority ) {
if ( !priority ) priority = 10;
if ( !this._items[filterName] ) this._items[filterName] = {};
if ( !this._items[filterName][priority] ) this._items[filterName][priority] = [];
this._items[filterName][priority].push( callback );
if ( !this._priorities[filterName] ) this._priorities[filterName] = [];
if ( $.inArray( priority, this._priorities[filterName]) === -1 ) this._priorities[filterName].push( priority );
this._priorities[filterName].sort(function(a,b){return a-b;});
}
};
$.bizpanda.hooks = $.bizpanda.hooks || {
/**
* Applies filters to a given input value.
*/
run: function( filterName, args ) {
$.bizpanda.filters.run( filterName, args );
},
/**
* Registers a new filter.
*/
add: function( filterName, callback, priority ) {
$.bizpanda.filters.add( filterName, callback, priority );
}
};
})(jQuery);

View File

@@ -0,0 +1,291 @@
if ( !window.bizpanda ) window.bizpanda = {};
if ( !window.bizpanda.lockerEditor ) window.bizpanda.lockerEditor = {};
(function($){
window.bizpanda.lockerEditor = {
init: function() {
this.item = $('#opanda_item').val();
this.basicOptions.init( this, this.item );
this.trackInputChanges();
this.recreatePreview();
this.initStyleRollerButton();
},
/**
* Inits a button which offers to buy the StyleRoller Add-on.
*/
initStyleRollerButton: function() {
if ( window.window.onp_sl_styleroller || !window.onp_sl_show_styleroller_offer ) return;
var $button = $("<a target='_blank' class='btn btn-default' id='onp-sl-styleroller-btn' href='" + window.onp_sl_styleroller_offer_url + "'><i class='fa fa-flask'></i>" + window.onp_sl_styleroller_offer_text + "</a>");
$("#opanda_style").after($button);
},
/**
* Starts to track user input to refresh the preview.
*/
trackInputChanges: function() {
var self = this;
var tabs = [
"#OPanda_BasicOptionsMetaBox",
"#OPanda_SocialOptionsMetaBox",
"#OPanda_AdvancedOptionsMetaBox",
"#OPanda_ConnectOptionsMetaBox",
'#OPanda_SubscriptionOptionsMetaBox',
'#OPanda_TermsOptionsMetaBox'
];
for(var index in tabs) {
$(tabs[index])
.find("input, select, textarea")
.bind('change keyup', function(){ self.refreshPreview(); });
}
},
/**
* Binds the change event of the WP editor.
*/
bindWpEditorChange: function( ed ) {
var self = this;
var changed = function() {
tinyMCE.activeEditor.save();
self.refreshPreview();
};
if ( tinymce.majorVersion <= 3 ) {
ed.onChange.add(function(){ changed(); });
} else {
ed.on("change", function(){ changed(); });
}
},
/**
* Refreshes the preview after short delay.
*/
refreshPreview: function( force ) {
var self = this;
if ( this.timerOn && !force ) {
this.timerAgain = true;
return;
}
this.timerOn = true;
setTimeout(function(){
if (self.timerAgain) {
self.timerAgain = false;
self.refreshPreview( true );
} else {
self.timerAgain = false;
self.timerOn = false;
self.recreatePreview();
}
}, 500);
},
/**
* Recreates the preview, submmits forms to the preview frame.
*/
recreatePreview: function() {
var url = $("#lock-preview-wrap").data('url');
var options = this.getPreviewOptions();
console.log(options);
$.bizpanda.hooks.run('opanda-refresh-preview');
window.bizpanda.preview.refresh( url, 'preview', options, 'onp_sl_update_preview_height' );
},
/**
* Gets options for the preview to submit into the frame.
*/
getPreviewOptions: function() {
var options = this.getCommonOptions();
var options = $.bizpanda.filters.run('opanda-preview-options', [options]);
if ( window.bizpanda.lockerEditor.filterOptions ) {
options = window.bizpanda.lockerEditor.filterOptions( options );
}
$(document).trigger('onp-sl-filter-preview-options', [options]);
return options;
},
getCommonOptions: function() {
var timer = parseInt( $("#opanda_timer").val() );
var options = {
text: {
header: $("#opanda_header").val(),
message: $("#opanda_message").val()
},
site: {
'title': window.opanda_site_name,
'url': window.opanda_home_url
},
theme: 'secrets',
agreement: {
checkbox: $("#opanda_agreement_checkbox").is(':checked') ? $("#opanda_agreement_checkbox_position").val() : false,
note: $("#opanda_agreement_note").is(':checked'),
termsUrl: window.opanda_terms,
privacyPolicyUrl: window.opanda_privacy_policy
},
overlap: {
mode: $("#opanda_overlap").val(),
position: $("#opanda_overlap_position").val()
},
effects: {
highlight: $("#opanda_highlight").is(':checked')
},
locker: {
timer: ( !timer || timer === 0 ) ? null : timer,
close: $("#opanda_close").is(':checked'),
mobile: $("#opanda_mobile").is(':checked')
},
proxy: {
consumer: {
company: {
title: window.opanda_site_name,
url: window.opanda_home_url
},
privacyPolicy: {
title: window.opanda_privacy_policy_title,
url: window.opanda_privacy_policy
}
}
},
actionsProxy: {
url: window.opanda_proxy_url,
paramPrefix: 'opanda'
},
};
if (!options.text.header && options.text.message) {
options.text = options.text.message;
}
options['theme'] = $("#opanda_style").val();
if ( window.bizpanda.previewGoogleFonts ) {
var theme = options['theme'];
options['theme'] = {
'name': theme,
'fonts': window.bizpanda.previewGoogleFonts
};
}
return options;
},
// --------------------------------------
// Basic Metabox
// --------------------------------------
basicOptions: {
init: function( editor ){
this.editor = editor;
this.initThemeSelector();
this.initOverlapModeButtons();
},
initThemeSelector: function() {
var showThemePreview = function(){
var $item = $("#opanda_style").find("option:selected");
var preview = $item.data('preview');
var previewHeight = $item.data('previewheight');
var $wrap = $("#lock-preview-wrap");
if ( preview ) {
$wrap.find("iframe").hide();
$wrap.css('height', previewHeight ? previewHeight + 'px' : '300px');
$wrap.css('background', 'url("' + preview + '") center center no-repeat');
} else {
$wrap.find("iframe").show();
$wrap.css('height', 'auto');
$wrap.css('background', 'none');
}
};
showThemePreview();
$.bizpanda.hooks.add('opanda-refresh-preview', function(){
showThemePreview();
});
},
initOverlapModeButtons: function() {
var $overlapControl = $("#OPanda_BasicOptionsMetaBox .factory-control-overlap .factory-buttons-group");
var $positionControl = $("#OPanda_BasicOptionsMetaBox .factory-control-overlap_position");
var $position = $("#opanda_overlap_position");
$overlapControl.after( $("<div id='opanda_overlap_position_wrap'></div>").append( $position ) );
var checkPositionControlVisability = function( ){
var value = $("#opanda_overlap").val();
if ( value === 'full' ) {
$("#opanda_overlap_position_wrap").css("display", "none");
} else {
$("#opanda_overlap_position_wrap").css("display", "inline-block");
}
};
var toggleAjaxOption = function() {
var value = $("#opanda_overlap").val();
if ( value === 'full' ) {
$("#opanda-ajax-disabled").hide();
} else {
$("#opanda-ajax-disabled").fadeIn();
}
};
checkPositionControlVisability();
toggleAjaxOption();
$("#opanda_overlap").change(function(){
checkPositionControlVisability()
toggleAjaxOption();
});
}
}
};
$(function(){
window.bizpanda.lockerEditor.init();
});
})(jQuery)
function opanda_editor_callback(e) {
if ( e.type == 'keyup') {
tinyMCE.activeEditor.save();
window.bizpanda.lockerEditor.refreshPreview();
}
return true;
}

View File

@@ -0,0 +1,11 @@
(function($){
$(function(){
$(".column-shortcode input").click(function(){
$(this).select();
});
});
})(jQuery)

View File

@@ -0,0 +1,59 @@
if ( !window.bizpanda ) window.bizpanda = {};
if ( !window.bizpanda.statistics ) window.bizpanda.leads = {};
(function($){
window.bizpanda.leads = {
init: function() {
if ( $("#opanda-leads-page").length ) this.list.init();
if ( $("#opanda-lead-details-page").length ) this.details.init();
if ( $("#opanda-export-page").length ) this.export.init();
},
list: {
init: function(){}
},
details: {
init: function() {
$('.detail').on('click', function(){
var _this = $(this).addClass('active'),
_ul = _this.find('.click-to-edit'),
_first = _ul.find('> li').first(),
_last = _ul.find('> li').last();
if(!_first.is(':hidden')){
_first.hide();
_last.show().find('input').first().focus().select();
}
});
}
},
export: {
init: function(){
$("#factory-checklist-opanda_lockers-all").change( function(){
var $checkboxes = $(".factory-control-lockers input");
if ( $(this).is(":checked") ) {
$checkboxes.attr('checked', 'checked');
} else {
$checkboxes.removeAttr('checked', 'checked');
}
});
}
}
};
$(function(){
window.bizpanda.leads.init();
});
})(jQuery)

View File

@@ -0,0 +1,454 @@
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ) {
// Picker object
var Datepicker = function(element, options){
this.element = $(element);
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
this.picker = $(DPGlobal.template)
.appendTo('body')
.on({
click: $.proxy(this.click, this),
mousedown: $.proxy(this.mousedown, this)
});
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
if (this.isInput) {
this.element.on({
focus: $.proxy(this.show, this),
blur: $.proxy(this.hide, this),
keyup: $.proxy(this.update, this)
});
} else {
if (this.component){
this.component.on('click', $.proxy(this.show, this));
} else {
this.element.on('click', $.proxy(this.show, this));
}
}
this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
if (typeof this.minViewMode === 'string') {
switch (this.minViewMode) {
case 'months':
this.minViewMode = 1;
break;
case 'years':
this.minViewMode = 2;
break;
default:
this.minViewMode = 0;
break;
}
}
this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
if (typeof this.viewMode === 'string') {
switch (this.viewMode) {
case 'months':
this.viewMode = 1;
break;
case 'years':
this.viewMode = 2;
break;
default:
this.viewMode = 0;
break;
}
}
this.startViewMode = this.viewMode;
this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
this.fillDow();
this.fillMonths();
this.update();
this.showMode();
};
Datepicker.prototype = {
constructor: Datepicker,
show: function(e) {
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.place();
$(window).on('resize', $.proxy(this.place, this));
if (e ) {
e.stopPropagation();
e.preventDefault();
}
if (!this.isInput) {
$(document).on('mousedown', $.proxy(this.hide, this));
}
this.element.trigger({
type: 'show',
date: this.date
});
},
hide: function(){
this.picker.hide();
$(window).off('resize', this.place);
this.viewMode = this.startViewMode;
this.showMode();
if (!this.isInput) {
$(document).off('mousedown', this.hide);
}
this.set();
this.element.trigger({
type: 'hide',
date: this.date
});
},
set: function() {
var formated = DPGlobal.formatDate(this.date, this.format);
if (!this.isInput) {
if (this.component){
this.element.find('input').prop('value', formated);
}
this.element.data('date', formated);
} else {
this.element.prop('value', formated);
}
},
setValue: function(newDate) {
if (typeof newDate === 'string') {
this.date = DPGlobal.parseDate(newDate, this.format);
} else {
this.date = new Date(newDate);
}
this.set();
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
place: function(){
var offset = this.component ? this.component.offset() : this.element.offset();
this.picker.css({
top: offset.top + this.height,
left: offset.left
});
},
update: function(newDate){
this.date = DPGlobal.parseDate(
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
this.format
);
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
fillDow: function(){
var dowCnt = this.weekStart;
var html = '<tr>';
while (dowCnt < this.weekStart + 7) {
html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '';
var i = 0
while (i < 12) {
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
}
this.picker.find('.datepicker-months td').append(html);
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getFullYear(),
month = d.getMonth(),
currentDate = this.date.valueOf();
this.picker.find('.datepicker-days th:eq(1)')
.text(DPGlobal.dates.months[month]+' '+year);
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
prevMonth.setDate(day);
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setDate(nextMonth.getDate() + 42);
nextMonth = nextMonth.valueOf();
html = [];
var clsName;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getDay() === this.weekStart) {
html.push('<tr>');
}
clsName = '';
if (prevMonth.getMonth() < month) {
clsName += ' old';
} else if (prevMonth.getMonth() > month) {
clsName += ' new';
}
if (prevMonth.valueOf() === currentDate) {
clsName += ' active';
}
html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
if (prevMonth.getDay() === this.weekEnd) {
html.push('</tr>');
}
prevMonth.setDate(prevMonth.getDate()+1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date.getFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear === year) {
months.eq(this.date.getMonth()).addClass('active');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>';
year += 1;
}
yearCont.html(html);
},
click: function(e) {
e.stopPropagation();
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length === 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'switch':
this.showMode(1);
break;
case 'prev':
case 'next':
this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
this.viewDate,
this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
);
this.fill();
this.set();
break;
}
break;
case 'span':
if (target.is('.month')) {
var month = target.parent().find('span').index(target);
this.viewDate.setMonth(month);
} else {
var year = parseInt(target.text(), 10)||0;
this.viewDate.setFullYear(year);
}
if (this.viewMode !== 0) {
this.date = new Date(this.viewDate);
this.element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
this.showMode(-1);
this.fill();
this.set();
break;
case 'td':
if (target.is('.day')){
var day = parseInt(target.text(), 10)||1;
var month = this.viewDate.getMonth();
if (target.is('.old')) {
month -= 1;
} else if (target.is('.new')) {
month += 1;
}
var year = this.viewDate.getFullYear();
this.date = new Date(year, month, day,0,0,0,0);
this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
this.fill();
this.set();
this.element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
break;
}
}
},
mousedown: function(e){
e.stopPropagation();
e.preventDefault();
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
}
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
}
};
$.fn.datepicker = function ( option, val ) {
return this.each(function () {
var $this = $(this),
data = $this.data('datepicker'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
}
if (typeof option === 'string') data[option](val);
});
};
$.fn.datepicker.defaults = {
};
$.fn.datepicker.Constructor = Datepicker;
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
dates:{
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
},
parseFormat: function(format){
var separator = format.match(/[.\/\-\s].*?/),
parts = format.split(/\W+/);
if (!separator || !parts || parts.length === 0){
throw new Error("Invalid date format.");
}
return {separator: separator, parts: parts};
},
parseDate: function(date, format) {
var parts = date.split(format.separator),
date = new Date(),
val;
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
if (parts.length === format.parts.length) {
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
val = parseInt(parts[i], 10)||1;
switch(format.parts[i]) {
case 'dd':
case 'd':
date.setDate(val);
break;
case 'mm':
case 'm':
date.setMonth(val - 1);
break;
case 'yy':
date.setFullYear(2000 + val);
break;
case 'yyyy':
date.setFullYear(val);
break;
}
}
}
return date;
},
formatDate: function(date, format){
var val = {
d: date.getDate(),
m: date.getMonth() + 1,
yy: date.getFullYear().toString().substring(2),
yyyy: date.getFullYear()
};
val.dd = (val.d < 10 ? '0' : '') + val.d;
val.mm = (val.m < 10 ? '0' : '') + val.m;
var date = [];
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
date.push(val[format.parts[i]]);
}
return date.join(format.separator);
},
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev">&lsaquo;</th>'+
'<th colspan="5" class="switch"></th>'+
'<th class="next">&rsaquo;</th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
};
DPGlobal.template = '<div class="datepicker dropdown-menu">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'</div>';
}( window.jQuery )

Some files were not shown because too many files have changed in this diff Show More