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


PHP yourls_add_filter函数代码示例

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


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

示例1: lc_full_bootstrap_init

/**
 * Init Bootstrap Theme
 */
function lc_full_bootstrap_init()
{
    yourls_add_filter('template_content', 'lc_full_bootstrap_template');
    lc_full_bootstrap_add_css();
    yourls_add_filter('admin_menu_start', 'lc_full_bootstrap_menu_start');
    yourls_add_filter('admin_menu_end', 'lc_full_bootstrap_menu_end');
    yourls_add_filter('logout_link', 'lc_full_bootstrap_logout_link');
}
开发者ID:master3395,项目名称:yourls-full-bootstrap,代码行数:11,代码来源:theme.php

示例2: dgw_dont_track_admins_init

function dgw_dont_track_admins_init()
{
    /* If user is logged in to yourls... */
    if (yourls_is_valid_user() === true) {
        /* ...then filter the tracking routines */
        # first the click tracker
        yourls_add_filter('shunt_update_clicks', 'dgw_dont_track_admins');
        # then the detailed logger
        yourls_add_filter('shunt_log_redirect', 'dgw_dont_track_admins');
    }
}
开发者ID:SErr0r,项目名称:yourls-dont-track-admins,代码行数:11,代码来源:plugin.php

示例3: dlb_is_crawler

Version: 1.0
Author: Suguru Hirahara
Author URI: http://www.philosophyguides.org
**/
function dlb_is_crawler()
{
    //set to 1 to be more agressive in filtering
    //adds 'curl', wget', 'ruby' and 'bot'
    $dont_log_aggressive = 0;
    // Get current User-Agent
    $current = strtolower($_SERVER['HTTP_USER_AGENT']);
    $crawlers = array('200please.com/bot', '360spider', '80legs.com/webcrawler', 'a6-indexer', 'aboundex', 'aboutusbot', 'addsearchbot', 'addthis.com', 'adressendeutschland.de', 'adsbot-google', 'ahrefsbot', 'aihitbot', 'alexa site audit', 'amznkassocbot', 'analyticsseo.com', 'applebot', 'antbot', 'arabot', 'archive.org_bot', 'archive.orgbot', 'askpeterbot', 'backlinkcrawler', 'baidu.com/search/spider.html', 'baiduspider', 'begunadvertising', 'bingbot', 'bingpreview', 'bitlybot', 'bixocrawler', 'blekkobot', 'blexbot', 'brainbrubot', 'browsershots', 'bubing', 'butterfly', 'bufferbot', 'careerbot', 'catchbot', 'ccbot', 'cert figleafbot', 'changedetection.com/bot.html', 'chilkat', 'claritybot', 'classbot', 'cliqzbot', 'cms crawler', 'coccoc', 'compspybot', 'crawler4j', 'crowsnest', 'crystalsemanticsbot', 'dataminr.com', 'daumoa', 'digg', 'easouspider', 'exabot', 'exb language crawler', 'ezooms', 'facebookexternalhit', 'facebookplatform', 'fairshare', 'feedfetcher', 'feedly.com/fetcher.html', 'feedlybot', 'fetch', 'flipboardproxy', 'fyberspider', 'genieo', 'gigabot', 'google page speed insights', 'googlebot', 'grapeshot', 'hatena-useragent', 'hubspot connect', 'hubspot links crawler', 'hosttracker.com', 'ia_archiver', 'icc-crawler', 'ichiro', 'immediatenet.com', 'iltrovatore-setaccio', 'infohelfer', 'instapaper', 'ixebot', 'jabse.com crawler', 'james bot', 'jikespider', 'jyxobot', 'linkdex', 'linkfluence', 'loadimpactpageanalyzer', 'longurl', 'luminate.com', 'lycosa', 'magpie-crawler', 'mail.ru_bot', 'meanpathbot', 'mediapartners-google', 'metageneratorcrawler', 'metajobbot', 'metauri', 'mj12bot', 'mojeekbot', 'msai.in', 'msnbot-media', 'musobot', 'najdi.si', 'nalezenczbot', 'nekstbot', 'netcraftsurveyagent', 'netestate ne crawler', 'netseer crawler', 'nuhk', 'obot', 'omgilibot', 'openwebspider', 'panscient.com', 'parsijoo', 'plukkie', 'proximic', 'psbot', 'qirina hurdler', 'qualidator.com', 'queryseekerspider', 'readability', 'rogerbot', 'sbsearch', 'scrapy', 'search.kumkie.com', 'searchbot', 'searchmetricsbot', 'semrushbot', 'seocheckbot', 'seoengworldbot', 'seokicks-robot', 'seznambot', 'shareaholic.com/bot', 'shopwiki.com/wiki/help:bot', 'showyoubot', 'sistrix', 'sitechecker', 'siteexplorer', 'speedy spider', 'socialbm_bot', 'sogou web spider', 'sogou', 'sosospider', 'spbot', 'special_archiver', 'spiderling', 'spinn3r', 'spreadtrum', 'ssl-crawler', 'steeler', 'suma spider', 'surveybot', 'suggybot', 'svenska-webbsido', 'teoma', 'thumbshots', 'tineye.com', 'trendiction.com', 'trendiction.de/bot', 'turnitinbot', 'tweetedtimes', 'tweetmeme', 'twitterbot', 'uaslinkchecker', 'umbot', 'undrip bot', 'unisterbot', 'unwindfetchor', 'urlappendbot', 'vedma', 'vkshare', 'voilabot', 'wbsearchbot', 'wch web spider', 'webcookies', 'webcrawler at wise-guys dot nl', 'webthumbnail', 'wesee:search', 'woko', 'woobot', 'woriobot', 'wotbox', 'y!j-bri', 'y!j-bro', 'y!j-brw', 'y!j-bsc', 'yacybot', 'yahoo! slurp', 'yahooysmcm', 'yandexbot', 'yats', 'yeti', 'yioopbot', 'yodaobot', 'youdaobot', 'zb-1', 'zeerch.com/bot.php', 'zing-bottabot', 'zumbot', 'ning/1.0', 'yahoo:linkexpander:slingstone', 'google-http-java-client/1.17.0-rc (gzip)', 'js-kit url resolver', 'htmlparser', 'paperlibot', 'xenu link sleuth');
    if ($dont_log_aggressive == 1) {
        $crawlers[] = 'bot';
        $crawlers[] = 'ruby';
        $crawlers[] = 'curl';
        $crawlers[] = 'wget';
    }
    // Check if the UA string contains any strings listed above
    $is_crawler = str_replace($crawlers, '', $current) != $current;
    return $is_crawler;
}
// Hook stuff in
yourls_add_filter('shunt_update_clicks', 'dlb_skip_if_crawler');
yourls_add_filter('shunt_log_redirect', 'dlb_skip_if_crawler');
// Skip if crawler
function dlb_skip_if_crawler()
{
    return dlb_is_crawler();
    // if anything but false is returned, functions using the two shunt_* filters will be short-circuited
}
开发者ID:BitpopCoin,项目名称:dont-log-crawlers,代码行数:31,代码来源:plugin.php

示例4: yourls_add_filter

<?php

/*
Plugin Name: Allow aliases
Plugin URI: http://mysite.com/yourls-sample-plugin/
Description: This plugin allows YOURLS to work with alias hostnames for the server
Version: 1.0
Author: Aylwin
Author URI: http://adigitalife.net/
*/
// Hook our custom function into the 'shunt_get_request' filter
yourls_add_filter('shunt_get_request', 'allow_aliases');
// Our custom function that will be triggered when the event occurs
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,代码行数:28,代码来源:plugin.php

示例5: yourls_add_filter

 * There should be a good collision avoidance algorithm by just incrementing
 * $osz_random_keyword['length'] by one when a collision takes place.
 */
global $ozh_random_keyword;
/*
* CONFIG: EDIT THIS
*/
/* Length of random keyword */
$ozh_random_keyword['length'] = 4;
# was 5
/*
 * yourls_rnd_string $types:
 * '0' = yourls_get_shorturl_charset(), derzeit Base62 = Lower+Uppercase
 * '1' = only lowercase, no vowels, no confusion with 0/o, 1/l
 * etc.
 * I think we stick to '1' which gives friendly random keys.
 */
$ozh_random_keyword['type'] = '1';
// Generate a random keyword
yourls_add_filter('random_keyword', 'ozh_random_keyword');
function ozh_random_keyword()
{
    global $ozh_random_keyword;
    return yourls_rnd_string($ozh_random_keyword['length'], $ozh_random_keyword['type']);
}
// Don't increment sequential keyword tracker
yourls_add_filter('get_next_decimal', 'ozh_random_keyword_next_decimal');
function ozh_random_keyword_next_decimal($next)
{
    return $next - 1;
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:31,代码来源:plugin.php

示例6: yourls_add_filter

<?php

/*
Plugin Name: Custom Protocols
Plugin URI: http://yourls.org/
Description: Add custom protocol <code>blah://</code> for trusted users, blacklist all but <code>http</code> and <code>https</code> for others
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
*/
// Hook into 'kses_allowed_protocols' to modify array. See functions-kses.php/yourls_kses_init()
yourls_add_filter('kses_allowed_protocols', 'customproto_allowed_protocols');
// Whitelist or blacklist protocols depending on user context
function customproto_allowed_protocols($protocols)
{
    if (yourls_is_valid_user() && yourls_is_admin()) {
        // if user is logged in, or valid cookie exists on the computer, and we're in admin area:
        // add custom protocol 'blah://' to authorized protocols
        $protocols[] = 'blah://';
    } else {
        // if no known user: remove all protocols except http & https
        $protocols = array('http://', 'https://');
    }
    return $protocols;
}
开发者ID:Efreak,项目名称:YOURLS,代码行数:25,代码来源:plugin.php

示例7: URLs

<?php

/*
Plugin Name: Allow Hyphens in Short URLs
Plugin URI: http://yourls.org/
Description: Allow hyphens in short URLs (like <tt>http://sho.rt/hello-world</tt>)
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
*/
yourls_add_filter('get_shorturl_charset', 'ozh_hyphen_in_charset');
function ozh_hyphen_in_charset($in)
{
    return $in . '-';
}
开发者ID:469306621,项目名称:Languages,代码行数:15,代码来源:plugin.php

示例8: authmgr_user_has_role

}
/******************** ROLE TEST AND ENUMERATION ***********************/
/*
 * Determine whether a specific user has a role.
 */
function authmgr_user_has_role($username, $rolename)
{
    return yourls_apply_filter(AUTHMGR_HASROLE, false, $username, $rolename);
}
// ******************* FILTERS THAT GRANT ROLE MEMBERSHIP *********************
// By filtering AUTHMGR_HASROLE, you can connect internal roles to something else.
// Any filter handlers should execute as quickly as possible.
/*
 * What role memberships are defined for the user in user/config.php?
 */
yourls_add_filter(AUTHMGR_HASROLE, 'authmgr_user_has_role_in_config');
function authmgr_user_has_role_in_config($original, $username, $rolename)
{
    global $authmgr_role_assignment;
    // if no role assignments are created, grant everything
    // so the site still works even if stuff is configured wrong
    if (empty($authmgr_role_assignment)) {
        return true;
    }
    // do this the case-insensitive way
    // the entire array was made lowercase in environment check
    $username = strtolower($username);
    $rolename = strtolower($rolename);
    // if the role doesn't exist, give up now.
    if (!in_array($rolename, array_keys($authmgr_role_assignment))) {
        return false;
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:31,代码来源:plugin.php

示例9: yourls_add_filter

<?php

/*
Plugin Name: Random number url
Plugin URI: http://savikin.me/
Description: Assign random numberss to shorturls
Version: 1.0
Author: Sava
Author URI: http://savikin.me/
*/
yourls_add_filter('random_keyword', 'random_number');
function random_number()
{
    return rand(1, 9999);
}
yourls_add_filter('get_next_decimal', 'random_next_decimal');
function random_next_decimal($next)
{
    return $next - 1;
}
开发者ID:andrejsavikin,项目名称:Random-number-url-YOURLS,代码行数:20,代码来源:plugin.php

示例10: yourls_add_filter

<?php

/*
Plugin Name: Fix Long URL
Plugin URI: https://github.com/adigitalife/yourls-fix-long-url/
Description: This plugin fixes links with %20 and other similar encodings in them
Version: 2.0
Author: Aylwin
Author URI: http://adigitalife.net/
*/
// Hook our custom function into the 'sanitize_url' filter
yourls_add_filter('sanitize_url', 'fix_long_url');
// Replace '%2520' with '%20' in the 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,代码行数:24,代码来源:plugin.php

示例11: URLs

<?php

/*
Plugin Name: Allow _$! in Short URLs
Plugin URI: http://yourls.org/
Description: Allow _#! in short URLs (like <tt>http://sho.rt/#!hello_world</tt>)
Version: 1.0
Author: Jesse
Author URI: http://blog.caiwangqin.com/
*/
yourls_add_filter('get_shorturl_charset', 'underscore_in_charset');
function underscore_in_charset($in)
{
    return $in . '_';
}
yourls_add_filter('get_shorturl_charset', 'symbol1_in_charset');
function symbol1_in_charset($in)
{
    return $in . '$';
}
yourls_add_filter('get_shorturl_charset', 'symbol2_in_charset');
function symbol2_in_charset($in)
{
    return $in . '!';
}
开发者ID:TheProjecter,项目名称:yourls-ext,代码行数:25,代码来源:plugin.php

示例12: yourls_update_option

    $solvemediaHKey = $_POST['spb_recaptcha_solvemediaHKey'];
    if (yourls_get_option('spb_recaptcha_pub_key') !== false) {
        yourls_update_option('spb_recaptcha_pub_key', $pubkey);
    } else {
        yourls_add_option('spb_recaptcha_pub_key', $pubkey);
    }
    if (yourls_get_option('spb_recaptcha_priv_key') !== false) {
        yourls_update_option('spb_recaptcha_priv_key', $privkey);
    } else {
        yourls_add_option('spb_recaptcha_priv_key', $privkey);
    }
    if (yourls_get_option('spb_recaptcha_solvemediaCKey') !== false) {
        yourls_update_option('spb_recaptcha_solvemediaCKey', $solvemediaCKey);
    } else {
        yourls_add_option('spb_recaptcha_solvemediaCKey', $solvemediaCKey);
    }
    if (yourls_get_option('spb_recaptcha_solvemediaVKey') !== false) {
        yourls_update_option('spb_recaptcha_solvemediaVKey', $solvemediaVKey);
    } else {
        yourls_add_option('spb_recaptcha_solvemediaVKey', $solvemediaVKey);
    }
    if (yourls_get_option('spb_recaptcha_solvemediaHKey') !== false) {
        yourls_update_option('spb_recaptcha_solvemediaHKey', $solvemediaHKey);
    } else {
        yourls_add_option('spb_recaptcha_solvemediaHKey', $solvemediaHKey);
    }
    echo "Saved";
}
yourls_add_action('plugins_loaded', 'spb_recaptcha_plugin_init');
yourls_add_filter('shunt_add_new_link', 'spb_recaptcha_check_Captcha');
开发者ID:spbriggs,项目名称:recaptcha-plugin,代码行数:30,代码来源:plugin.php

示例13: addFilter

 /**
  * Add filter function
  *
  * @param $name
  */
 protected function addFilter($name)
 {
     //         $hook, $function_name, $priority = 10, $accepted_args = NULL, $type = 'filter'
     //        yourls_add_filter(substr($name, 7), [$this, $name], 10, NULL, 'filter');
     yourls_add_filter(substr($name, 7), [$this, $name]);
 }
开发者ID:laemmi,项目名称:laemmi-yourls-default-tools,代码行数:11,代码来源:AbstractDefault.php

示例14: yourls_add_filter

<?php

/*
Plugin Name: Anti spam
Plugin URI: http://yourls.org/
Description: Absolute anti-spam plugin. Checks URL against major black lists and removes all crap. Might OR MIGHT NOT work for you. Read the readme.
Version: 1.0.3
Author: Ozh
Author URI: http://ozh.org/
*/
// Check for spam when someone adds a new link
yourls_add_filter('shunt_add_new_link', 'ozh_yourls_antispam_check_add');
function ozh_yourls_antispam_check_add($false, $url)
{
    // Sanitize URL and make sure there's a protocol
    $url = yourls_sanitize_url($url);
    // only check for 'http(s)'
    if (!in_array(yourls_get_protocol($url), array('http://', 'https://'))) {
        return false;
    }
    if (ozh_yourls_antispam_is_blacklisted($url) != false) {
        return array('status' => 'fail', 'code' => 'error:spam', 'message' => 'This domain is blacklisted', 'errorCode' => '403');
    }
    // All clear, not interrupting the normal flow of events
    return false;
}
// Has the remote link become compromised lately? Check on redirection
yourls_add_action('redirect_shorturl', 'ozh_yourls_antispam_check_redirect');
function ozh_yourls_antispam_check_redirect($url, $keyword = false)
{
    if (is_array($url) && $keyword == false) {
开发者ID:kst87,项目名称:antispam,代码行数:31,代码来源:plugin.php

示例15: Daley

<?php

/*
Plugin Name: API Action - Delete
Plugin URI: http://www.claytondaley.com/
Description: Adds a "delete" action to the API. This action requires authentication even if the site is public. This action accepts either a shorturl or keyword passed using the "shorturl" parameter.
Version: 1.0
Author: Clayton Daley (derived from API-Action by Ozh)
Author URI: http://www.claytondaley.com/
*/
// Define custom action "delete"
yourls_add_filter('api_action_delete', 'clayton_api_action_delete');
// Actually delete
function clayton_api_action_delete()
{
    // We don't want unauthenticated users deleting links
    // If YOURLS is in public mode, force authentication anyway
    if (!yourls_is_private()) {
        yourls_do_action('require_auth');
        require_once YOURLS_INC . '/auth.php';
    }
    // Need 'shorturl' parameter
    if (!isset($_REQUEST['shorturl'])) {
        return array('statusCode' => 400, 'simple' => "Need a 'shorturl' parameter", 'message' => 'error: missing param');
    }
    $shorturl = $_REQUEST['shorturl'];
    // Check if valid shorturl
    if (!yourls_is_shorturl($shorturl)) {
        return array('statusCode' => 404, 'simple ' => 'Error: short URL not found', 'message' => 'error: not found');
    }
    // Is $shorturl a URL (http://sho.rt/abc) or a keyword (abc) ?
开发者ID:Gawel1,项目名称:yourls-api-delete,代码行数:31,代码来源:plugin.php


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