本文整理汇总了PHP中GADWP_Tools::get_selected_profile方法的典型用法代码示例。如果您正苦于以下问题:PHP GADWP_Tools::get_selected_profile方法的具体用法?PHP GADWP_Tools::get_selected_profile怎么用?PHP GADWP_Tools::get_selected_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GADWP_Tools
的用法示例。
在下文中一共展示了GADWP_Tools::get_selected_profile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_item_reports
/**
* Ajax handler for Item Reports
*
* @return json|int
*/
public function ajax_item_reports()
{
if (!isset($_REQUEST['gadwp_security_backend_item_reports']) || !wp_verify_nonce($_REQUEST['gadwp_security_backend_item_reports'], 'gadwp_backend_item_reports')) {
wp_die(-30);
}
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$query = $_REQUEST['query'];
if (isset($_REQUEST['filter'])) {
$filter_id = $_REQUEST['filter'];
} else {
$filter_id = false;
}
if (ob_get_length()) {
ob_clean();
}
if (!GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) || 0 == $this->gadwp->config->options['backend_item_reports']) {
wp_die(-31);
}
if ($this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] && $from && $to) {
if (null === $this->gadwp->gapi_controller) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die(-24);
}
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
$profile_info = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $projectId);
if (isset($profile_info[4])) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time('timestamp') - time();
}
if ($filter_id) {
$uri_parts = explode('/', get_permalink($filter_id), 4);
if (isset($uri_parts[3])) {
$uri = '/' . $uri_parts[3];
} else {
wp_die(-25);
}
// allow URL correction before sending an API request
$filter = apply_filters('gadwp_backenditem_uri', $uri);
$lastchar = substr($filter, -1);
if (isset($profile_info[6]) && $profile_info[6] && $lastchar == '/') {
$filter = $filter . $profile_info[6];
}
// Encode URL
$filter = rawurlencode(rawurldecode($filter));
}
$queries = explode(',', $query);
$results = array();
foreach ($queries as $value) {
$results[] = $this->gadwp->gapi_controller->get($projectId, $value, $from, $to, $filter);
}
wp_send_json($results);
}
示例2: esc_html
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
$profile = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $this->gadwp->config->options['ga_dash_tableid_jail']);
?>
<script type="text/javascript">
var _gaq = _gaq || [];
<?php
if ($this->gadwp->config->options['ga_enhanced_links']) {
?>
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
<?php
}
?>
_gaq.push(['_setAccount', '<?php
echo esc_html($profile[2]);
?>
']);
_gaq.push(['_trackPageview']<?php
if ($this->gadwp->config->options['ga_dash_anonim']) {
?>
示例3: get_plugin_options
private function get_plugin_options()
{
/*
* Get plugin options
*/
global $blog_id;
if (!get_option('gadash_options')) {
GADWP_Install::install();
}
$this->options = (array) json_decode(get_option('gadash_options'));
// Maintain Compatibility
$this->maintain_compatibility();
// Handle Network Mode
if (is_multisite()) {
$get_network_options = get_site_option('gadash_network_options');
$network_options = (array) json_decode($get_network_options);
if (isset($network_options['ga_dash_network']) && $network_options['ga_dash_network']) {
$network_options = (array) json_decode($get_network_options);
if (!is_network_admin() && !empty($network_options['ga_dash_profile_list']) && isset($network_options['ga_dash_tableid_network']->{$blog_id})) {
$network_options['ga_dash_profile_list'] = array(0 => GADWP_Tools::get_selected_profile($network_options['ga_dash_profile_list'], $network_options['ga_dash_tableid_network']->{$blog_id}));
$network_options['ga_dash_tableid_jail'] = $network_options['ga_dash_profile_list'][0][1];
}
$this->options = array_merge($this->options, $network_options);
}
}
}
示例4: general_settings_network
//.........这里部分代码省略.........
}
}
} else {
$message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>";
}
}
if (isset($_POST['Clear'])) {
if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
GADWP_Tools::clear_cache();
$message = "<div class='updated'><p>" . __("Cleared Cache.", 'google-analytics-dashboard-for-wp') . "</p></div>";
} else {
$message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>";
}
}
if (isset($_POST['Reset'])) {
if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
$gadwp->gapi_controller->reset_token(true);
GADWP_Tools::clear_cache();
$message = "<div class='updated'><p>" . __("Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp') . "</p></div>";
$options = self::update_options('Reset');
} else {
$message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>";
}
}
if (isset($_POST['options']['ga_dash_hidden']) && !isset($_POST['Clear']) && !isset($_POST['Reset']) && !isset($_POST['Refresh'])) {
$message = "<div class='updated'><p>" . __("Settings saved.", 'google-analytics-dashboard-for-wp') . "</p></div>";
if (!(isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
$message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>";
}
}
if (isset($_POST['Hide'])) {
if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
$message = "<div class='updated'><p>" . __("All other domains/properties were removed.", 'google-analytics-dashboard-for-wp') . "</p></div>";
$lock_profile = GADWP_Tools::get_selected_profile($gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail']);
$gadwp->config->options['ga_dash_profile_list'] = array($lock_profile);
$options = self::update_options('network');
} else {
$message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>";
}
}
?>
<div class="wrap">
<?php
echo "<h2>" . __("Google Analytics Settings", 'google-analytics-dashboard-for-wp') . "</h2>";
?>
<hr>
</div>
<div id="poststuff" class="gadwp">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div class="settings-wrapper">
<div class="inside">
<?php
if ($gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache('last_error')) {
$message = sprintf('<div class="error"><p>%s</p></div>', sprintf(__('Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_errors_debugging', false), __('Errors & Debug', 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_settings', false), __('authorize the plugin', 'google-analytics-dashboard-for-wp'))));
}
if (isset($_POST['Authorize'])) {
GADWP_Tools::clear_cache();
$gadwp->gapi_controller->token_request();
echo "<div class='updated'><p>" . __("Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp') . "</p></div>";
} else {
if (isset($message)) {
echo $message;
}
?>
<form name="ga_dash_form" method="post" action="<?php
示例5: ajax_frontend_widget
/**
* Ajax handler for getting analytics data for frontend Widget
*
* @return string|int
*/
public function ajax_frontend_widget()
{
if (!isset($_POST['gadwp_number']) || !isset($_POST['gadwp_optionname']) || !is_active_widget(false, false, 'gadwp-frontwidget-report')) {
wp_die(-30);
}
$widget_index = $_POST['gadwp_number'];
$option_name = $_POST['gadwp_optionname'];
$options = get_option($option_name);
if (isset($options[$widget_index])) {
$instance = $options[$widget_index];
} else {
wp_die(-32);
}
switch ($instance['period']) {
// make sure we have a valid request
case '7daysAgo':
$period = '7daysAgo';
break;
case '14daysAgo':
$period = '14daysAgo';
break;
default:
$period = '30daysAgo';
break;
}
if (ob_get_length()) {
ob_clean();
}
if ($this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail']) {
if (null === $this->gadwp->gapi_controller) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die(-24);
}
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
$profile_info = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $projectId);
if (isset($profile_info[4])) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time('timestamp') - time();
}
wp_send_json($this->gadwp->gapi_controller->frontend_widget_stats($projectId, $period, (int) $instance['anonim']));
}
示例6: ajax_widget_reports
/**
* Ajax handler for Admin Widget
*
* @return json|int
*/
public function ajax_widget_reports()
{
if (!isset($_REQUEST['gadash_security_widget_reports']) || !wp_verify_nonce($_REQUEST['gadash_security_widget_reports'], 'gadash_get_widgetreports')) {
wp_die(-30);
}
$projectId = $_REQUEST['projectId'];
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$query = $_REQUEST['query'];
if (ob_get_length()) {
ob_clean();
}
if (!GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) || 0 == $this->gadwp->config->options['dashboard_widget']) {
wp_die(-31);
}
if ($this->gadwp->config->options['ga_dash_token'] && $projectId && $from && $to) {
if (null === $this->gadwp->gapi_controller) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die(-24);
}
$profile_info = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $projectId);
if (isset($profile_info[4])) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time('timestamp') - time();
}
$queries = explode(',', $query);
$results = array();
foreach ($queries as $value) {
$results[] = $this->gadwp->gapi_controller->get($projectId, $value, $from, $to);
}
wp_send_json($results);
}