当前位置: 首页>>代码示例>>PHP>>正文


PHP GADWP_Tools::colourVariator方法代码示例

本文整理汇总了PHP中GADWP_Tools::colourVariator方法的典型用法代码示例。如果您正苦于以下问题:PHP GADWP_Tools::colourVariator方法的具体用法?PHP GADWP_Tools::colourVariator怎么用?PHP GADWP_Tools::colourVariator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GADWP_Tools的用法示例。


在下文中一共展示了GADWP_Tools::colourVariator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_content

        public function add_content($content)
        {
            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'])) {
                return $content;
            }
            if ($this->gadwp->config->options['ga_dash_frontend_stats'] && $this->gadwp->config->options['ga_dash_frontend_keywords']) {
                $npcounter = 1;
            } else {
                $npcounter = 0;
            }
            if ((is_page() || is_single()) && !is_preview()) {
                $page_url = $_SERVER["REQUEST_URI"];
                //Encode URL
                $page_url = rawurlencode($page_url);
                $content .= '<script type="text/javascript">
                  
                  gadash_firstclick = true;
                    
                  function checknpcounter(max) {
                    	try {
                    		if (npcounter == max) {
                    			NProgress.done();
                    		} else {
                    			npcounter++;
                    			NProgress.set((1/(max+1))*npcounter);
                    		}
                    	} catch(e) {}		
                    }

                    npcounter = 0;
                    
					jQuery(document).ready(function(){
					 	jQuery("#gadwp-title").click(function(){
							  	if (gadash_firstclick){
                                        
                                	try {
                                    	NProgress.configure({ parent: "#gadwp-progressbar" });
                                        NProgress.configure({ showSpinner: false });
                                        NProgress.start();
                                	} catch(e) {
                                		jQuery("#gadwp-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red","font-size":"13px"});
                                		jQuery("#gadwp-progressbar").html("' . __("A JavaScript Error is blocking plugin resources!", 'ga-dash') . '");
                                	} 
                                		    
									if(typeof ga_dash_drawpagesessions == "function"){
										jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontend_pagereports",gadash_pageurl: "' . $page_url . '",query: "pageviews",gadash_security_pagereports: "' . wp_create_nonce('gadash_get_frontend_pagereports') . '"}, function(response){
										  if (!jQuery.isNumeric(response)){  
                                            if (jQuery.isArray(response)){
                                            	gadash_pagesessions = response;
                                       		    google.setOnLoadCallback(ga_dash_drawpagesessions(gadash_pagesessions));
                                             } else {
                                             	checknpcounter(0);
                                     			jQuery("#gadwp-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red","font-size":"13px"});
                                     			jQuery("#gadwp-progressbar").html("' . __("Invalid response, more details in JavaScript Console (F12).", 'ga-dash') . '");
                                     			console.log("\\n********************* GADWP Log ********************* \\n\\n"+response);
                                     		} 										  
										  }else{
									        jQuery("#gadwp-sessions").css({"background-color":"#F7F7F7","height":"auto","padding-top":"30px","padding-bottom":"30px","color":"#000","text-align":"center"});  
									        jQuery("#gadwp-sessions").html("' . __("This report is unavailable", 'ga-dash') . ' ("+response+")");
									        checknpcounter(' . $npcounter . ');    
                                          }	
										});
									}
									if(typeof ga_dash_drawpagesearches == "function"){
										jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontend_pagereports",gadash_pageurl: "' . $page_url . '",query: "searches",gadash_security_pagereports: "' . wp_create_nonce('gadash_get_frontend_pagereports') . '"}, function(response){
                                            if (!jQuery.isNumeric(response)){										  
                                              if (jQuery.isArray(response)){
                                                  gadash_pagesearches = response;
                                           		  google.setOnLoadCallback(ga_dash_drawpagesearches(gadash_pagesearches));
                                               } else {
                                                  checknpcounter(0);
                                         		  jQuery("#gadwp-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red","font-size":"13px"});
                                         		  jQuery("#gadwp-progressbar").html("' . __("Invalid response, more details in JavaScript Console (F12).", 'ga-dash') . '");
                                         		  console.log("\\n********************* GADWP Log ********************* \\n\\n"+response);
                                       		   }										    
											}else{
										        jQuery("#gadwp-searches").css({"background-color":"#F7F7F7","height":"auto","padding-top":"30px","padding-bottom":"30px","color":"#000","text-align":"center"});
										        jQuery("#gadwp-searches").html("' . __("This report is unavailable", 'ga-dash') . ' ("+response+")");
										        checknpcounter(' . $npcounter . ');
                                            }	
										});
									}
    							gadash_firstclick = false;
							}
						});
					});';
                if ($this->gadwp->config->options['ga_dash_frontend_stats']) {
                    $title = __("Views vs UniqueViews", 'ga-dash');
                    if (isset($this->gadwp->config->options['ga_dash_style'])) {
                        $css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator($this->gadwp->config->options['ga_dash_style'], -20) . "'],";
                        $color = $this->gadwp->config->options['ga_dash_style'];
                    } else {
                        $css = "";
                        $color = "#3366CC";
                    }
                    $content .= '
			google.load("visualization", "1", {packages:["corechart"]});
			function ga_dash_drawpagesessions(gadash_pagesessions) {
	
			var data = google.visualization.arrayToDataTable(gadash_pagesessions);
//.........这里部分代码省略.........
开发者ID:healthcommcore,项目名称:osnap,代码行数:101,代码来源:item-reports.php

示例2: dashboard_widget


//.........这里部分代码省略.........
                    break;
                case '14daysAgo':
                    $from = '14daysAgo';
                    $to = 'yesterday';
                    $haxis = 3;
                    break;
                case '90daysAgo':
                    $from = '90daysAgo';
                    $to = 'yesterday';
                    $haxis = 16;
                    break;
                case '365daysAgo':
                    $from = '365daysAgo';
                    $to = 'yesterday';
                    $haxis = 5;
                    break;
                case '1095daysAgo':
                    $from = '1095daysAgo';
                    $to = 'yesterday';
                    $haxis = 5;
                    break;
                default:
                    $from = '30daysAgo';
                    $to = 'yesterday';
                    $haxis = 5;
                    break;
            }
            if ($query == 'visitBounceRate') {
                $formater = "var formatter = new google.visualization.NumberFormat({\r\n\t\t\t\t  suffix: '%',\r\n\t\t\t\t  fractionDigits: 2\r\n\t\t\t\t});\r\n\r\n\t\t\t\tformatter.format(data, 1);\t";
            } else {
                $formater = '';
            }
            if (isset($this->gadwp->config->options['ga_dash_style'])) {
                $light_color = GADWP_Tools::colourVariator($this->gadwp->config->options['ga_dash_style'], 40);
                $dark_color = GADWP_Tools::colourVariator($this->gadwp->config->options['ga_dash_style'], -20);
                $css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator($this->gadwp->config->options['ga_dash_style'], -20) . "'],";
                $color = $this->gadwp->config->options['ga_dash_style'];
            } else {
                $css = "";
                $color = "#3366CC";
            }
            if ($period == 'realtime') {
                wp_register_style('jquery-ui-tooltip-html', GADWP_URL . 'realtime/jquery/jquery.ui.tooltip.html.css');
                wp_enqueue_style('jquery-ui-tooltip-html');
                if (!wp_script_is('jquery')) {
                    wp_enqueue_script('jquery');
                }
                if (!wp_script_is('jquery-ui-tooltip')) {
                    wp_enqueue_script("jquery-ui-tooltip");
                }
                if (!wp_script_is('jquery-ui-core')) {
                    wp_enqueue_script("jquery-ui-core");
                }
                if (!wp_script_is('jquery-ui-position')) {
                    wp_enqueue_script("jquery-ui-position");
                }
                if (!wp_script_is('jquery-ui-position')) {
                    wp_enqueue_script("jquery-ui-position");
                }
                wp_register_script("jquery-ui-tooltip-html", GADWP_URL . 'realtime/jquery/jquery.ui.tooltip.html.js');
                wp_enqueue_script("jquery-ui-tooltip-html");
            }
            if ($period == 'realtime') {
                ?>
<div class="realtime">
    <div class="gadash-rt-box">
开发者ID:linniepinski,项目名称:perssistant,代码行数:67,代码来源:widgets.php

示例3: widget

    public function widget($args, $instance)
    {
        $widget_title = apply_filters('widget_title', $instance['title']);
        $title = __("Sessions", 'google-analytics-dashboard-for-wp');
        echo "\n<!-- BEGIN GADWP v" . GADWP_CURRENT_VERSION . " Widget - https://deconf.com/google-analytics-dashboard-wordpress/ -->\n";
        echo $args['before_widget'];
        if (!empty($widget_title)) {
            echo $args['before_title'] . $widget_title . $args['after_title'];
        }
        if (isset($this->gadwp->config->options['ga_dash_style'])) {
            $css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator($this->gadwp->config->options['ga_dash_style'], -20) . "'],";
            $color = $this->gadwp->config->options['ga_dash_style'];
        } else {
            $css = "";
            $color = "#3366CC";
        }
        ob_start();
        if ($instance['anonim']) {
            $formater = "var formatter = new google.visualization.NumberFormat({\r\n\t\t\t\t\t  suffix: '%',\r\n\t\t\t\t\t  fractionDigits: 2\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tformatter.format(data, 1);\t";
        } else {
            $formater = '';
        }
        $periodtext = "";
        switch ($instance['period']) {
            case '7daysAgo':
                $periodtext = sprintf(__('Last %d Days', 'google-analytics-dashboard-for-wp'), 7);
                break;
            case '14daysAgo':
                $periodtext = sprintf(__('Last %d Days', 'google-analytics-dashboard-for-wp'), 14);
                break;
            case '30daysAgo':
                $periodtext = sprintf(__('Last %d Days', 'google-analytics-dashboard-for-wp'), 30);
                break;
            default:
                $periodtext = "";
                break;
        }
        switch ($instance['display']) {
            case '1':
                echo '<div id="gadwp-widget"><div id="gadwp-widgetchart"></div><div id="gadwp-widgettotals"></div></div>';
                break;
            case '2':
                echo '<div id="gadwp-widget"><div id="gadwp-widgetchart"></div></div>';
                break;
            case '3':
                echo '<div id="gadwp-widget"><div id="gadwp-widgettotals"></div></div>';
                break;
        }
        echo '<script type="text/javascript">

				jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontendwidget_data",gadash_number: "' . $this->number . '",gadash_optionname: "' . $this->option_name . '"}, function(response){
				    if (!jQuery.isNumeric(response) && jQuery.isArray(response)){
				        if (jQuery("#gadwp-widgetchart")[0]){
				           gadash_widgetsessions=response[0];
						   google.setOnLoadCallback(ga_dash_drawfwidgetsessions(gadash_widgetsessions));
				        }
				        if (jQuery("#gadwp-widgettotals")[0]){
						   ga_dash_drawtotalsstats(response[1]);
				        }
					}else{
				        jQuery("#gadwp-widgetchart").css({"background-color":"#F7F7F7","height":"auto","padding-top":"50px","padding-bottom":"50px","color":"#000","text-align":"center"});
				        jQuery("#gadwp-widgetchart").html("' . __("This report is unavailable", 'google-analytics-dashboard-for-wp') . ' ("+response+")");
                    }
				});';
        echo 'google.load("visualization", "1", {packages:["corechart"], "language" : "' . get_bloginfo('language') . '"});
					function ga_dash_drawfwidgetsessions(response) {
    					var data = google.visualization.arrayToDataTable(response);
    					var options = {
    					  legend: {position: "none"},
    					  pointSize: 3,' . $css . '
    					  title: "' . $title . '",
    					  titlePosition: "in",
    					  chartArea: {width: "95%",height:"75%"},
    					  hAxis: { textPosition: "none"},
    					  vAxis: { textPosition: "none", minValue: 0, gridlines: {color: "transparent"}, baselineColor: "transparent"}
    				 	}
    					var chart = new google.visualization.AreaChart(document.getElementById("gadwp-widgetchart"));
    					' . $formater . '
    					chart.draw(data, options);
				   }
    			   function ga_dash_drawtotalsstats(response) {
    					if (response == null){
    					    response = 0;
                        }
                        jQuery("#gadwp-widgettotals").html("<div class=\\"gadwp-left\\">' . __("Period:", 'google-analytics-dashboard-for-wp') . '</div> <div class=\\"gadwp-right\\">' . $periodtext . '</div><div class=\\"gadwp-left\\">' . __("Sessions:", 'google-analytics-dashboard-for-wp') . '</div> <div class=\\"gadwp-right\\">"+response+"</div>");
                   }';
        echo '</script>';
        if ($instance['give_credits'] == 1) {
            echo '<div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;">' . __('generated by', 'google-analytics-dashboard-for-wp') . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=front_widget&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a>&nbsp;</div>';
        }
        $widget_content = ob_get_contents();
        ob_end_clean();
        echo apply_filters('widget_html_content', $widget_content);
        echo $args['after_widget'];
        echo "\n<!-- END GADWP Widget -->\n";
    }
开发者ID:linniepinski,项目名称:perssistant,代码行数:96,代码来源:widgets.php


注:本文中的GADWP_Tools::colourVariator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。