• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP yourls_apply_filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中yourls_apply_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP yourls_apply_filter函数的具体用法?PHP yourls_apply_filter怎么用?PHP yourls_apply_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: churl_reachability

function churl_reachability($churl_reachable, $url, $keyword = '')
{
    global $ydb;
    preg_match('!^[a-zA-Z0-9\\+\\.-]+:(//)?!', $url, $matches);
    $protocol = isset($matches[0]) ? $matches[0] : '';
    $different_protocols = array('http://', 'https://');
    if ($protocol == '') {
        $protocol = 'http://';
        $url = 'http://' . $url;
    }
    $check_url = in_array($protocol, $different_protocols);
    // Return to normal routine if non-http(s) protocol is valid
    if ($check_url == false) {
        return false;
    }
    // Check if the long URL is reachable
    $resURL = curl_init();
    curl_setopt($resURL, CURLOPT_URL, $url);
    curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
    curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
    curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
    curl_exec($resURL);
    $intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
    curl_close($resURL);
    // Return error if the entered URL is unreachable
    if ($intReturnCode == '' || $intReturnCode == 404) {
        $return['status'] = 'fail';
        $return['code'] = 'error:url';
        $return['message'] = 'The entered URL is unreachable.  Check the URL or try again later.';
        $return['statusCode'] = 200;
        // regardless of result, this is still a valid request
        return yourls_apply_filter('add_new_link_fail_unreachable', $return, $url, $keyword, $title);
    }
    return false;
}
开发者ID:fstltna,项目名称:yourls-check-url,代码行数:35,代码来源:plugin.php


示例2: yourls_kses_init

/**
 * Init KSES globals if not already defined (by a plugin)
 *
 * @since 1.6
 *
 */
function yourls_kses_init()
{
    global $yourls_allowedentitynames, $yourls_allowedprotocols;
    if (!$yourls_allowedentitynames) {
        $yourls_allowedentitynames = yourls_apply_filter('kses_allowed_entities', yourls_kses_allowed_entities());
    }
    if (!$yourls_allowedprotocols) {
        $yourls_allowedprotocols = yourls_apply_filter('kses_allowed_protocols', yourls_kses_allowed_protocols());
    }
    /** See NOTE ABOUT GLOBALS **
    	
    	if( ! $yourls_allowedtags_all ) {
    		$yourls_allowedtags_all = yourls_kses_allowed_tags_all();
    		$yourls_allowedtags_all = array_map( '_yourls_add_global_attributes', $yourls_allowedtags_all );
    		$yourls_allowedtags_all = yourls_apply_filter( 'kses_allowed_tags_all', $yourls_allowedtags_all );
    	} else {
    		// User defined: let's sanitize
    		$yourls_allowedtags_all = yourls_kses_array_lc( $yourls_allowedtags_all );
    	}
    	
    	if( ! $yourls_allowedtags ) {
    		$yourls_allowedtags = yourls_kses_allowed_tags();
    		$yourls_allowedtags = array_map( '_yourls_add_global_attributes', $yourls_allowedtags );
    		$yourls_allowedtags = yourls_apply_filter( 'kses_allowed_tags', $yourls_allowedtags );
    	} else {
    		// User defined: let's sanitize
    		$yourls_allowedtags = yourls_kses_array_lc( $yourls_allowedtags );
    	}
    
    	/**/
}
开发者ID:acidpop,项目名称:YOURLS,代码行数:37,代码来源:functions-kses.php


示例3: yourls_get_duplicate_keywords

/**
 * Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords.
 *
 */
function yourls_get_duplicate_keywords($longurl)
{
    yourls_deprecated_function(__FUNCTION__, '1.7', 'yourls_get_longurl_keywords');
    if (!yourls_allow_duplicate_longurls()) {
        return NULL;
    }
    return yourls_apply_filter('get_duplicate_keywords', yourls_get_longurl_keywords($longurl), $longurl);
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:12,代码来源:functions-deprecated.php


示例4: fix_long_url

function fix_long_url($url, $unsafe_url)
{
    $search = array('%2520', '%2521', '%2522', '%2523', '%2524', '%2525', '%2526', '%2527', '%2528', '%2529', '%252A', '%252B', '%252C', '%252D', '%252E', '%252F', '%253A', '%253D', '%253F', '%255C', '%255F');
    $replace = array('%20', '%21', '%22', '%23', '%24', '%25', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%2D', '%2E', '%2F', '%3A', '%3D', '%3F', '%5C', '%5F');
    $url = str_ireplace($search, $replace, $url);
    // Remove any trailing spaces from the long URL
    while (substr($url, -strlen('%20')) == '%20') {
        $url = preg_replace('/%20$/', '', $url);
    }
    return yourls_apply_filter('after_fix_long_url', $url, $unsafe_url);
}
开发者ID:adigitalife,项目名称:yourls-fix-long-url,代码行数:11,代码来源:plugin.php


示例5: allow_aliases

function allow_aliases()
{
    yourls_do_action('pre_get_request');
    // Ignore protocol & www. prefix
    $root = str_replace(array('https://', 'http://', 'https://www.', 'http://www.'), '', YOURLS_SITE);
    // Use the configured domain instead of $_SERVER['HTTP_HOST']
    $root_host = parse_url(YOURLS_SITE);
    // Case insensitive comparison of the YOURLS root to match both http://Sho.rt/blah and http://sho.rt/blah
    $request = preg_replace("!{$root}/!i", '', $root_host['host'] . $_SERVER['REQUEST_URI'], 1);
    // Unless request looks like a full URL (ie request is a simple keyword) strip query string
    if (!preg_match("@^[a-zA-Z]+://.+@", $request)) {
        $request = current(explode('?', $request));
    }
    return yourls_apply_filter('get_request', $request);
}
开发者ID:NorthstarOfficial,项目名称:yourls-allow-aliases,代码行数:15,代码来源:plugin.php


示例6: insensitive_get_keyword_infos

function insensitive_get_keyword_infos($keyword, $use_cache = true)
{
    global $ydb;
    $keyword = yourls_sanitize_string($keyword);
    yourls_do_action('pre_get_keyword', $keyword, $use_cache);
    if (isset($ydb->infos[$keyword]) && $use_cache == true) {
        return yourls_apply_filter('get_keyword_infos', $ydb->infos[$keyword], $keyword);
    }
    yourls_do_action('get_keyword_not_cached', $keyword);
    $table = YOURLS_DB_TABLE_URL;
    $infos = $ydb->get_row("SELECT * FROM `{$table}` WHERE LOWER(`keyword`) = LOWER('{$keyword}')");
    if ($infos) {
        $infos = (array) $infos;
        $ydb->infos[$keyword] = $infos;
    } else {
        $ydb->infos[$keyword] = false;
    }
    return yourls_apply_filter('get_keyword_infos', $ydb->infos[$keyword], $keyword);
}
开发者ID:tehMorag,项目名称:yourls-case-insensitive,代码行数:19,代码来源:plugin.php


示例7: ozh_yourls_antispam_is_blacklisted

function ozh_yourls_antispam_is_blacklisted($url)
{
    $parsed = parse_url($url);
    if (!isset($parsed['host'])) {
        return yourls_apply_filter('ozh_yourls_antispam_malformed', 'malformed');
    }
    // Remove www. from domain (but not from www.com)
    $parsed['host'] = preg_replace('/^www\\.(.+\\.)/i', '$1', $parsed['host']);
    // Major blacklists. There's a filter if you want to manipulate this.
    $blacklists = yourls_apply_filter('ozh_yourls_antispam_list', array('dbl.spamhaus.org', 'multi.surbl.org', 'black.uribl.com'));
    // Check against each blacklist, exit if blacklisted
    foreach ($blacklists as $blacklist) {
        $domain = $parsed['host'] . '.' . $blacklist . '.';
        $record = @dns_get_record($domain);
        if ($record && count($record) > 0) {
            return yourls_apply_filter('ozh_yourls_antispam_blacklisted', true);
        }
    }
    // All clear, probably not spam
    return yourls_apply_filter('ozh_yourls_antispam_clean', false);
}
开发者ID:kst87,项目名称:antispam,代码行数:21,代码来源:plugin.php


示例8: yourls_content_type_header

/**
 * Send a filerable content type header
 *
 * @since 1.7
 * @param string $type content type ('text/html', 'application/json', ...)
 * @return bool whether header was sent
 */
function yourls_content_type_header($type)
{
    yourls_do_action('content_type_header', $type);
    if (!headers_sent()) {
        $charset = yourls_apply_filter('content_type_header_charset', 'utf-8');
        header("Content-Type: {$type}; charset={$charset}");
        return true;
    }
    return false;
}
开发者ID:yourls,项目名称:yourls,代码行数:17,代码来源:functions-html.php


示例9: yourls_encodeURI

/**
* PHP emulation of JS's encodeURI
*
* @link https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURI
* @param $url
* @return string
*/
function yourls_encodeURI($url)
{
    // Decode URL all the way
    $result = yourls_rawurldecode_while_encoded($url);
    // Encode once
    $result = strtr(rawurlencode($result), array('%3B' => ';', '%2C' => ',', '%2F' => '/', '%3F' => '?', '%3A' => ':', '%40' => '@', '%26' => '&', '%3D' => '=', '%2B' => '+', '%24' => '$', '%21' => '!', '%2A' => '*', '%27' => '\'', '%28' => '(', '%29' => ')', '%23' => '#'));
    // @TODO:
    // Known limit: this will most likely break IDN URLs such as http://www.académie-française.fr/
    // To fully support IDN URLs, advocate use of a plugin.
    return yourls_apply_filter('encodeURI', $result, $url);
}
开发者ID:chadcumm,项目名称:YOURLS,代码行数:18,代码来源:functions-formatting.php


示例10: yourls_http_user_agent

function yourls_http_user_agent()
{
    return yourls_apply_filter('http_user_agent', 'YOURLS v' . YOURLS_VERSION . ' +http://yourls.org/ (running on ' . YOURLS_SITE . ')');
}
开发者ID:TheProjecter,项目名称:yourls-ext,代码行数:4,代码来源:functions-http.php


示例11: yourls_api_expand

/**
 * Expand short url to long url
 *
 */
function yourls_api_expand($shorturl)
{
    $keyword = str_replace(YOURLS_SITE . '/', '', $shorturl);
    // accept either 'http://ozh.in/abc' or 'abc'
    $keyword = yourls_sanitize_string($keyword);
    $longurl = yourls_get_keyword_longurl($keyword);
    if ($longurl) {
        $return = array('keyword' => $keyword, 'shorturl' => YOURLS_SITE . "/{$keyword}", 'longurl' => $longurl, 'simple' => $longurl, 'message' => 'success', 'statusCode' => 200);
    } else {
        $return = array('keyword' => $keyword, 'simple' => 'not found', 'message' => 'Error: short URL not found', 'errorCode' => 404);
    }
    return yourls_apply_filter('api_expand', $return, $shorturl);
}
开发者ID:steenhulthin,项目名称:hult.in,代码行数:17,代码来源:functions-api.php


示例12: isset

    $url = $_REQUEST['url'];
    $keyword = isset($_REQUEST['keyword']) ? $_REQUEST['keyword'] : '';
    $title = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
    $text = isset($_REQUEST['text']) ? $_REQUEST['text'] : '';
    // Create short URL, receive array $return with various information
    $return = yourls_add_new_link($url, $keyword, $title);
    $shorturl = isset($return['shorturl']) ? $return['shorturl'] : '';
    $message = isset($return['message']) ? $return['message'] : '';
    $title = isset($return['title']) ? $return['title'] : '';
    $status = isset($return['status']) ? $return['status'] : '';
    // Stop here if bookmarklet with a JSON callback function ("instant" bookmarklets)
    if (isset($_GET['jsonp']) && $_GET['jsonp'] == 'yourls') {
        $short = $return['shorturl'] ? $return['shorturl'] : '';
        $message = "Short URL (Ctrl+C to copy)";
        header('Content-type: application/json');
        echo yourls_apply_filter('bookmarklet_jsonp', "yourls_callback({'short_url':'{$short}','message':'{$message}'});");
        die;
    }
}
// Part to be executed if FORM has been submitted
if (isset($_REQUEST['url']) && $_REQUEST['url'] != 'http://') {
    // Display result message of short link creation
    if (isset($message)) {
        echo "<h2><center>{$message}</h2></center>";
    }
    if ($status == 'success') {
        echo "<h3><center>Short: {$shorturl}</h3></center>";
        // Include the Copy box and the Quick Share box
        // yourls_share_box( $url, $shorturl, $title, $text );
        // Initialize clipboard -- requires js/share.js and js/jquery.zclip.min.js to be properly loaded in the <head>
        // echo "<script>init_clipboard();</script>\n";
开发者ID:serversquared,项目名称:SSShortConfig,代码行数:31,代码来源:index.php


示例13: muAdminUrl

function muAdminUrl($page = '')
{
    $admin = YOURLS_SITE . '/user/plugins/multi-user/' . $page;
    return yourls_apply_filter('admin_url', $admin, $page);
}
开发者ID:Efreak,项目名称:YOURLS,代码行数:5,代码来源:mufunctions.php


示例14: yourls_html_menu

/**
 * Display the admin menu
 *
 */
function yourls_html_menu()
{
    // Build menu links
    if (defined('YOURLS_USER')) {
        $logout_link = yourls_apply_filter('logout_link', sprintf(yourls__('Hello <strong>%s</strong>'), YOURLS_USER) . ' (<a href="?action=logout" title="' . yourls_esc_attr__('Logout') . '">' . yourls__('Logout') . '</a>)');
    } else {
        $logout_link = yourls_apply_filter('logout_link', '');
    }
    $help_link = yourls_apply_filter('help_link', '<a href="' . yourls_site_url(false) . '/readme.html">' . yourls__('Help') . '</a>');
    $admin_links = array();
    $admin_sublinks = array();
    $admin_links['admin'] = array('url' => yourls_admin_url('index.php'), 'title' => yourls__('Go to the admin interface'), 'anchor' => yourls__('Admin interface'));
    if (yourls_is_admin()) {
        $admin_links['tools'] = array('url' => yourls_admin_url('tools.php'), 'anchor' => yourls__('Tools'));
        $admin_links['plugins'] = array('url' => yourls_admin_url('plugins.php'), 'anchor' => yourls__('Manage Plugins'));
        $admin_sublinks['plugins'] = yourls_list_plugin_admin_pages();
    }
    $admin_links = yourls_apply_filter('admin_links', $admin_links);
    $admin_sublinks = yourls_apply_filter('admin_sublinks', $admin_sublinks);
    // Now output menu
    echo '<ul id="admin_menu">' . "\n";
    if (yourls_is_private() && !empty($logout_link)) {
        echo '<li id="admin_menu_logout_link">' . $logout_link . '</li>';
    }
    foreach ((array) $admin_links as $link => $ar) {
        if (isset($ar['url'])) {
            $anchor = isset($ar['anchor']) ? $ar['anchor'] : $link;
            $title = isset($ar['title']) ? 'title="' . $ar['title'] . '"' : '';
            printf('<li id="admin_menu_%s_link" class="admin_menu_toplevel"><a href="%s" %s>%s</a>', $link, $ar['url'], $title, $anchor);
        }
        // Output submenu if any. TODO: clean up, too many code duplicated here
        if (isset($admin_sublinks[$link])) {
            echo "<ul>\n";
            foreach ($admin_sublinks[$link] as $link => $ar) {
                if (isset($ar['url'])) {
                    $anchor = isset($ar['anchor']) ? $ar['anchor'] : $link;
                    $title = isset($ar['title']) ? 'title="' . $ar['title'] . '"' : '';
                    printf('<li id="admin_menu_%s_link" class="admin_menu_sublevel admin_menu_sublevel_%s"><a href="%s" %s>%s</a>', $link, $link, $ar['url'], $title, $anchor);
                }
            }
            echo "</ul>\n";
        }
    }
    if (isset($help_link)) {
        echo '<li id="admin_menu_help_link">' . $help_link . '</li>';
    }
    yourls_do_action('admin_menu');
    echo "</ul>\n";
    yourls_do_action('admin_notices');
    yourls_do_action('admin_notice');
    // because I never remember if it's 'notices' or 'notice'
    /*
    To display a notice:
    $message = "<div>OMG, dude, I mean!</div>" );
    yourls_add_action( 'admin_notices', create_function( '', "echo '$message';" ) );
    */
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:61,代码来源:functions-html.php


示例15: yourls_deprecated_function

/**
 * Marks a function as deprecated and informs when it has been used. Stolen from WP.
 *
 * There is a hook deprecated_function that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if YOURLS_DEBUG is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 1.6
 * @uses yourls_do_action() Calls 'deprecated_function' and passes the function name, what to use instead,
 *   and the version the function was deprecated in.
 * @uses yourls_apply_filter() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do
 *   trigger or false to not trigger error.
 *
 * @param string $function The function that was called
 * @param string $version The version of WordPress that deprecated the function
 * @param string $replacement Optional. The function that should have been called
 */
function yourls_deprecated_function($function, $version, $replacement = null)
{
    yourls_do_action('deprecated_function', $function, $replacement, $version);
    // Allow plugin to filter the output error trigger
    if (YOURLS_DEBUG && yourls_apply_filter('deprecated_function_trigger_error', true)) {
        if (!is_null($replacement)) {
            trigger_error(sprintf(yourls__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
        } else {
            trigger_error(sprintf(yourls__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
        }
    }
}
开发者ID:Steadroy,项目名称:YOURLS,代码行数:33,代码来源:functions.php


示例16: yourls_load_custom_textdomain

/**
 * Loads a custom translation file (for a plugin, a theme, a public interface...) if locale is defined
 *
 * The .mo file should be named based on the domain with a dash, and then the locale exactly,
 * eg 'myplugin-pt_BR.mo'
 *
 * @since 1.6
 *
 * @param string $domain Unique identifier (the "domain") for retrieving translated strings
 * @param string $path Full path to directory containing MO files.
 * @return mixed Returns nothing if locale undefined, otherwise return bool: true on success, false on failure
 */
function yourls_load_custom_textdomain($domain, $path)
{
    $locale = yourls_apply_filter('load_custom_textdomain', yourls_get_locale(), $domain);
    if (!empty($locale)) {
        $mofile = rtrim($path, '/') . '/' . $domain . '-' . $locale . '.mo';
        return yourls_load_textdomain($domain, $mofile);
    }
}
开发者ID:liruqi,项目名称:YOURLS,代码行数:20,代码来源:functions-l10n.php


示例17: yourls_store_cookie

/**
 * Store new cookie. No $user will delete the cookie.
 *
 */
function yourls_store_cookie($user = null)
{
    if (!$user) {
        $pass = null;
        $time = time() - 3600;
    } else {
        global $yourls_user_passwords;
        if (isset($yourls_user_passwords[$user])) {
            $pass = $yourls_user_passwords[$user];
        } else {
            die('Stealing cookies?');
            // This should never happen
        }
        $time = time() + YOURLS_COOKIE_LIFE;
    }
    $domain = yourls_apply_filter('setcookie_domain', parse_url(YOURLS_SITE, 1));
    $secure = yourls_apply_filter('setcookie_secure', yourls_is_ssl());
    $httponly = yourls_apply_filter('setcookie_httponly', true);
    // Some browsers refuse to store localhost cookie
    if ($domain == 'localhost') {
        $domain = '';
    }
    if (!headers_sent($filename, $linenum)) {
        // Set httponly if the php version is >= 5.2.0
        if (version_compare(phpversion(), '5.2.0', 'ge')) {
            setcookie(yourls_cookie_name(), yourls_salt($user), $time, '/', $domain, $secure, $httponly);
        } else {
            setcookie(yourls_cookie_name(), yourls_salt($user), $time, '/', $domain, $secure);
        }
    } else {
        // For some reason cookies were not stored: action to be able to debug that
        yourls_do_action('setcookie_failed', $user);
        yourls_debug_log("Could not store cookie: headers already sent in {$filename} on line {$linenum}");
    }
}
开发者ID:Steadroy,项目名称:YOURLS,代码行数:39,代码来源:functions-auth.php


示例18: yourls_esc_url

/**
 * Checks and cleans a URL before printing it. Stolen from WP.
 *
 * A number of characters are removed from the URL. If the URL is for displaying
 * (the default behaviour) ampersands are also replaced.
 *
 * @since 1.6
 *
 * @param string $url The URL to be cleaned.
 * @param string $context 'display' or something else. Use yourls_sanitize_url() for database or redirection usage.
 * @param array $protocols Optional. Array of allowed protocols, defaults to global $yourls_allowedprotocols
 * @return string The cleaned $url
 */
function yourls_esc_url($url, $context = 'display', $protocols = array())
{
    // make sure there's only one 'http://' at the beginning (prevents pasting a URL right after the default 'http://')
    $url = str_replace(array('http://http://', 'http://https://'), array('http://', 'https://'), $url);
    if ('' == $url) {
        return $url;
    }
    // make sure there's a protocol, add http:// if not
    if (!yourls_get_protocol($url)) {
        $url = 'http://' . $url;
    }
    // force scheme and domain to lowercase - see issue 591
    preg_match('!^([a-zA-Z]+://([^/]+))(.*)$!', $url, $matches);
    if (isset($matches[1]) && isset($matches[3])) {
        $url = strtolower($matches[1]) . $matches[3];
    }
    $original_url = $url;
    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\\|*\'()\\x80-\\xff]|i', '', $url);
    // Previous regexp in YOURLS was '|[^a-z0-9-~+_.?\[\]\^#=!&;,/:%@$\|*`\'<>"()\\x80-\\xff\{\}]|i'
    // TODO: check if that was it too destructive
    $strip = array('%0d', '%0a', '%0D', '%0A');
    $url = yourls_deep_replace($strip, $url);
    $url = str_replace(';//', '://', $url);
    // Replace ampersands and single quotes only when displaying.
    if ('display' == $context) {
        $url = yourls_kses_normalize_entities($url);
        $url = str_replace('&amp;', '&#038;', $url);
        $url = str_replace("'", '&#039;', $url);
    }
    if (!is_array($protocols) or !$protocols) {
        global $yourls_allowedprotocols;
        $protocols = yourls_apply_filter('esc_url_protocols', $yourls_allowedprotocols);
        // Note: $yourls_allowedprotocols is also globally filterable in functions-kses.php/yourls_kses_init()
    }
    if (!yourls_is_allowed_protocol($url, $protocols)) {
        return '';
    }
    // I didn't use KSES function kses_bad_protocol() because it doesn't work the way I liked (returns //blah from illegal://blah)
    $url = substr($url, 0, 1999);
    return yourls_apply_filter('esc_url', $url, $original_url, $context);
}
开发者ID:GasmoN,项目名称:yourls,代码行数:54,代码来源:functions-formatting.php


示例19: authmgr_user_has_role

function authmgr_user_has_role($username, $rolename)
{
    return yourls_apply_filter(AUTHMGR_HASROLE, false, $username, $rolename);
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:4,代码来源:plugin.php


示例20: yourls_stats_line

/**
 * Echoes an image tag of Google Charts line graph from array of values (eg 'number of clicks').
 * 
 * $legend1_list & legend2_list are values used for the 2 x-axis labels. $id is an HTML/JS id
 *
 */
function yourls_stats_line($values, $id = null)
{
    yourls_do_action('pre_stats_line');
    // if $id is null then assign a random string
    if ($id === null) {
        $id = uniqid('yourls_stats_line_');
    }
    // If we have only 1 day of data, prepend a fake day with 0 hits for a prettier graph
    if (count($values) == 1) {
        array_unshift($values, 0);
    }
    // Keep only a subset of values to keep graph smooth
    $values = yourls_array_granularity($values, 30);
    $data = array_merge(array('Time' => 'Hits'), $values);
    $data = yourls_google_array_to_data_table($data);
    $options = array("legend" => "none", "pointSize" => "3", "theme" => "maximized", "curveType" => "function", "width" => 430, "height" => 220, "hAxis" => "{minTextSpacing: 80, maxTextLines: 1, maxAlternation: 1}", "vAxis" => "{minValue: -0.5, format: '#'}", "colors" => "['#2a85b3']");
    $options = yourls_apply_filter('stats_line_options', $options);
    $lineChart = yourls_google_viz_code('LineChart', $data, $options, $id);
    echo yourls_apply_filter('stats_line', $lineChart, $values, $options, $id);
}
开发者ID:chadcumm,项目名称:YOURLS,代码行数:26,代码来源:functions-infos.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP yourls_die函数代码示例发布时间:2022-05-23
下一篇:
PHP yourls_admin_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap