本文整理汇总了PHP中GADWP函数的典型用法代码示例。如果您正苦于以下问题:PHP GADWP函数的具体用法?PHP GADWP怎么用?PHP GADWP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GADWP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && 1 == $this->gadwp->config->options['dashboard_widget']) {
add_action('wp_dashboard_setup', array($this, 'add_widget'));
}
}
示例2: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) || GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_front'])) {
add_action('wp_ajax_gadwp_set_error', array($this, 'ajax_set_error'));
}
}
示例3: __construct
public function __construct()
{
$this->gadwp = GADWP();
add_filter('the_content', array($this, 'add_content'));
// Frontend Styles
add_action('wp_enqueue_scripts', array($this, 'load_styles_scripts'));
}
示例4: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && (1 == $this->gadwp->config->options['backend_item_reports'] || 1 == $this->gadwp->config->options['dashboard_widget'])) {
// Items action
add_action('wp_ajax_gadwp_backend_item_reports', array($this, 'ajax_item_reports'));
}
}
示例5: __construct
public function __construct()
{
$this->gadwp = GADWP();
include_once GADWP_DIR . 'tools/autoload.php';
$config = new Google_Config();
$config->setCacheClass('Google_Cache_Null');
if (function_exists('curl_version')) {
$curlversion = curl_version();
if (isset($curlversion['version']) && version_compare(PHP_VERSION, '5.3.0') >= 0 && version_compare($curlversion['version'], '7.10.8') >= 0 && defined('GADWP_IP_VERSION') && GADWP_IP_VERSION) {
$config->setClassConfig('Google_IO_Curl', array('options' => array(CURLOPT_IPRESOLVE => GADWP_IP_VERSION)));
// Force CURL_IPRESOLVE_V4 or CURL_IPRESOLVE_V6
}
}
$this->client = new Google_Client($config);
$this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
$this->client->setAccessType('offline');
$this->client->setApplicationName('Google Analytics Dashboard');
$this->client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
$this->set_error_timeout();
$this->managequota = 'u' . get_current_user_id() . 's' . get_current_blog_id();
$this->access = array_map(array($this, 'map'), $this->access);
if ($this->gadwp->config->options['ga_dash_userapi']) {
$this->client->setClientId($this->gadwp->config->options['ga_dash_clientid']);
$this->client->setClientSecret($this->gadwp->config->options['ga_dash_clientsecret']);
$this->client->setDeveloperKey($this->gadwp->config->options['ga_dash_apikey']);
} else {
$this->client->setClientId($this->access[0]);
$this->client->setClientSecret($this->access[1]);
}
$this->service = new Google_Service_Analytics($this->client);
if ($this->gadwp->config->options['ga_dash_token']) {
$token = $this->gadwp->config->options['ga_dash_token'];
if ($token) {
try {
$this->client->setAccessToken($token);
$gadwp->config->options['ga_dash_token'] = $this->client->getAccessToken();
} catch (Google_IO_Exception $e) {
GADWP_Tools::set_cache('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
} catch (Google_Service_Exception $e) {
GADWP_Tools::set_cache('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $this->error_timeout);
GADWP_Tools::set_cache('ga_dash_gapi_errors', array($e->getCode(), (array) $e->getErrors()), $this->error_timeout);
$this->reset_token();
} catch (Exception $e) {
GADWP_Tools::set_cache('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
$this->reset_token();
}
if (is_multisite() && $this->gadwp->config->options['ga_dash_network']) {
$this->gadwp->config->set_plugin_options(true);
} else {
$this->gadwp->config->set_plugin_options();
}
}
}
}
示例6: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_front']) && $this->gadwp->config->options['frontend_item_reports']) {
// Item Reports action
add_action('wp_ajax_gadwp_frontend_item_reports', array($this, 'ajax_item_reports'));
}
// Frontend Widget actions
add_action('wp_ajax_ajax_frontwidget_report', array($this, 'ajax_frontend_widget'));
add_action('wp_ajax_nopriv_ajax_frontwidget_report', array($this, 'ajax_frontend_widget'));
}
示例7: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_front']) && ($this->gadwp->config->options['ga_dash_frontend_stats'] || $this->gadwp->config->options['ga_dash_frontend_keywords'])) {
// Frontend Reports/Page action
add_action('wp_ajax_gadash_get_frontend_pagereports', array($this, 'ajax_afterpost_reports'));
}
// Frontend Widget actions
add_action('wp_ajax_gadash_get_frontendwidget_data', array($this, 'ajax_frontend_widget'));
add_action('wp_ajax_nopriv_gadash_get_frontendwidget_data', array($this, 'ajax_frontend_widget'));
}
示例8: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && (1 == $this->gadwp->config->options['backend_item_reports'] || 1 == $this->gadwp->config->options['dashboard_widget'])) {
// Items action
add_action('wp_ajax_gadwp_backend_item_reports', array($this, 'ajax_item_reports'));
}
if (current_user_can('manage_options')) {
// Admin Widget action
add_action('wp_ajax_gadwp_dismiss_notices', array($this, 'ajax_dismiss_notices'));
}
}
示例9: __construct
public function __construct()
{
$this->gadwp = GADWP();
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && 1 == $this->gadwp->config->options['backend_item_reports']) {
// Add custom column in Posts List
add_filter('manage_posts_columns', array($this, 'add_columns'));
// Populate custom column in Posts List
add_action('manage_posts_custom_column', array($this, 'add_icons'), 10, 2);
// Add custom column in Pages List
add_filter('manage_pages_columns', array($this, 'add_columns'));
// Populate custom column in Pages List
add_action('manage_pages_custom_column', array($this, 'add_icons'), 10, 2);
}
}
示例10: __construct
public function __construct()
{
$this->gadwp = GADWP();
// Styles & Scripts
add_action('admin_enqueue_scripts', array($this, 'load_styles_scripts'));
// Site Menu
add_action('admin_menu', array($this, 'site_menu'));
// Network Menu
add_action('network_admin_menu', array($this, 'network_menu'));
// Settings link
add_filter("plugin_action_links_" . plugin_basename(GADWP_DIR . 'gadwp.php'), array($this, 'settings_link'));
// Error bubble
add_action('admin_print_scripts', array($this, 'draw_error_bubble'), 10000);
}
示例11: __construct
public function __construct()
{
$this->gadwp = GADWP();
// Styles & Scripts
add_action('admin_enqueue_scripts', array($this, 'load_styles_scripts'));
// Site Menu
add_action('admin_menu', array($this, 'site_menu'));
// Network Menu
add_action('network_admin_menu', array($this, 'network_menu'));
// Settings link
add_filter("plugin_action_links_" . plugin_basename(GADWP_DIR . 'gadwp.php'), array($this, 'settings_link'));
// Updated admin notice
add_action('admin_notices', array($this, 'admin_notice'));
}
示例12: __construct
public function __construct()
{
$this->gadwp = GADWP();
include_once GADWP_DIR . 'tools/autoload.php';
$config = new Google_Config();
$config->setCacheClass('Google_Cache_Null');
if (function_exists('curl_version')) {
$curlversion = curl_version();
if (isset($curlversion['version']) && version_compare(PHP_VERSION, '5.3.0') >= 0 && version_compare($curlversion['version'], '7.10.8') >= 0 && defined('GADWP_IP_VERSION') && GADWP_IP_VERSION) {
$config->setClassConfig('Google_IO_Curl', array('options' => array(CURLOPT_IPRESOLVE => GADWP_IP_VERSION)));
// Force
// CURL_IPRESOLVE_V4
// or
// CURL_IPRESOLVE_V6
}
}
$this->client = new Google_Client($config);
$this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
$this->client->setAccessType('offline');
$this->client->setApplicationName('Google Analytics Dashboard');
$this->client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
$this->set_error_timeout();
$this->managequota = 'u' . get_current_user_id() . 's' . get_current_blog_id();
if ($this->gadwp->config->options['ga_dash_userapi']) {
$this->client->setClientId($this->gadwp->config->options['ga_dash_clientid']);
$this->client->setClientSecret($this->gadwp->config->options['ga_dash_clientsecret']);
$this->client->setDeveloperKey($this->gadwp->config->options['ga_dash_apikey']);
} else {
$this->client->setClientId($this->gadwp->config->access[0]);
$this->client->setClientSecret($this->gadwp->config->access[1]);
$this->client->setDeveloperKey($this->gadwp->config->access[2]);
}
$this->service = new Google_Service_Analytics($this->client);
if ($this->gadwp->config->options['ga_dash_token']) {
$token = $this->gadwp->config->options['ga_dash_token'];
$token = $this->refresh_token();
if ($token) {
$this->client->setAccessToken($token);
}
}
}
示例13: __construct
public function __construct()
{
$this->gadwp = GADWP();
add_action('admin_bar_menu', array($this, 'custom_adminbar_node'), 999);
}
示例14: __construct
public function __construct()
{
$this->gadwp = GADWP();
// Styles & Scripts
add_action('wp_enqueue_scripts', array($this, 'load_styles_scripts'));
}
示例15: output_sidebar
public static function output_sidebar()
{
global $wp_version;
$gadwp = GADWP();
?>
</div>
</div>
</div>
<div id="postbox-container-1" class="postbox-container">
<div class="meta-box-sortables">
<div class="postbox">
<h3>
<span><?php
_e("Setup Tutorial & Demo", 'google-analytics-dashboard-for-wp');
?>
</span>
</h3>
<div class="inside">
<a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp" target="_blank"><img src="<?php
echo plugins_url('images/google-analytics-dashboard.png', __FILE__);
?>
" width="100%" alt="" /></a>
</div>
</div>
<div class="postbox">
<h3>
<span><?php
_e("Follow & Review", 'google-analytics-dashboard-for-wp');
?>
</span>
</h3>
<div class="inside">
<div class="gadash-desc">
<div style="margin-left:-10px;">
<div class="g-page" data-width="273" data-href="//plus.google.com/+Deconfcom" data-layout="landscape" data-showtagline="false" data-showcoverphoto="false" data-rel="publisher"></div>
</div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<br />
<div class="gadash-desc">
<a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @deconfcom</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<br />
<div class="gadash-title">
<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php
echo plugins_url('images/star.png', __FILE__);
?>
" /></a>
</div>
<div class="gadash-desc">
<?php
printf(__('Your feedback and review are both important, %s!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'google-analytics-dashboard-for-wp')));
?>
</div>
</div>
</div>
<div class="postbox">
<h3>
<span><?php
_e("Further Reading", 'google-analytics-dashboard-for-wp');
?>
</span>
</h3>
<div class="inside">
<div class="gadash-title">
<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img src="<?php
echo plugins_url('images/clicky.png', __FILE__);
?>
" /></a>
</div>
<div class="gadash-desc">
<?php
printf(__('%s service with users tracking at IP level.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">%s</a>', __('Web Analytics', 'google-analytics-dashboard-for-wp')));
?>
</div>
<br />
<div class="gadash-title">
<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img src="<?php
echo plugins_url('images/ssl.png', __FILE__);
?>
" /></a>
</div>
<div class="gadash-desc">
<?php
printf(__('%s by moving your website to HTTPS/SSL.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">%s</a>', __('Improve search rankings', 'google-analytics-dashboard-for-wp')));
?>
</div>
<br />
<div class="gadash-title">
<a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img src="<?php
echo plugins_url('images/wp.png', __FILE__);
?>
//.........这里部分代码省略.........