本文整理汇总了PHP中yourls_add_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP yourls_add_filter函数的具体用法?PHP yourls_add_filter怎么用?PHP yourls_add_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yourls_add_filter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: yourls_add_filter
<?php
/*
Plugin Name: Check URL
Plugin URI: http://code.google.com/p/yourls-check-url/
Description: This plugin checks the reachability of an entered URL before creating the short link for it. An error is then returned if the entered URL is unreachable.
Version: 1.5
Author: Aylwin
Author URI: http://adigitalife.net/
*/
// Hook our custom function into the 'shunt_add_new_link' filter
yourls_add_filter('shunt_add_new_link', 'churl_reachability', 1);
// Add a new link in the DB, either with custom keyword, or find one
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);
开发者ID:fstltna,项目名称:yourls-check-url,代码行数:31,代码来源:plugin.php
示例17: yourls_add_filter
/*
Plugin Name: Case insensitive YOURLS
Plugin URI: http://code.google.com/p/yourls-case-insensitive/
Description: Makes YOURLS case insensitive
Version: 1.0
Author: Aylwin
Author URI: http://adigitalife.net/
*/
// No direct call
if (!defined('YOURLS_ABSPATH')) {
die;
}
// Hook our custom function into the 'add_new_link' filter
yourls_add_filter('shunt_keyword_is_taken', 'insensitive_keyword_is_taken');
yourls_add_filter('shunt_get_keyword_info', 'insensitive_get_keyword_info');
// If the keyword exists, display the long URL in the error message
function insensitive_keyword_is_taken($return, $keyword)
{
global $ydb;
$keyword = yourls_sanitize_keyword($keyword);
$taken = false;
$table = YOURLS_DB_TABLE_URL;
$already_exists = $ydb->get_var("SELECT COUNT(`keyword`) FROM `{$table}` WHERE LOWER(`keyword`) = LOWER('{$keyword}');");
if ($already_exists) {
$taken = true;
}
return yourls_apply_filter('keyword_is_taken', $taken, $keyword);
}
function insensitive_get_keyword_info($return, $keyword, $field, $notfound)
{
开发者ID:tehMorag,项目名称:yourls-case-insensitive,代码行数:30,代码来源:plugin.php
示例18: yourls_add_filter
<?php
/*
Plugin Name: Update Shortened URL
Plugin URI: https://github.com/timcrockford/yourls-api-edit-url
Description: Define a custom API action 'update' and 'geturl'
Version: 0.2.2
Author: Tim Crockford
Author URI: http://codearoundcorners.com/
*/
yourls_add_filter('api_action_update', 'api_edit_url_update');
yourls_add_filter('api_action_geturl', 'api_edit_url_get');
function api_edit_url_update()
{
if (!isset($_REQUEST['shorturl'])) {
return array('statusCode' => 400, 'status' => 'fail', 'simple' => "Need a 'shorturl' parameter", 'message' => 'error: missing param');
}
if (!isset($_REQUEST['url'])) {
return array('statusCode' => 400, 'status' => 'fail', 'simple' => "Need a 'url' parameter", 'message' => 'error: missing param');
}
$shorturl = $_REQUEST['shorturl'];
$url = $_REQUEST['url'];
if (yourls_get_protocol($shorturl)) {
$keyword = yourls_get_relative_url($shorturl);
} else {
$keyword = $shorturl;
}
if (!yourls_is_shorturl($keyword)) {
return array('statusCode' => 404, 'status' => 'fail', 'simple ' => "Error: keyword {$keyword} not found", 'message' => 'error: not found');
}
$title = '';
开发者ID:smehtaAA,项目名称:yourls-api-edit-url,代码行数:31,代码来源:plugin.php
示例19: audiomark_api_get_metadata
* @return array $return return information + metadata if request was successfully otherwise just the already created error message
*/
function audiomark_api_get_metadata($return)
{
global $ydb;
if ($return['message'] == 'success') {
$keyword = $return['keyword'];
$table = YOURLS_AUDIOMARK_TABLE_URL;
$metadata = $ydb->get_row("SELECT * FROM `{$table}` WHERE `keyword` = '{$keyword}';");
// add metadata to return message
$return['station_name'] = $metadata->station_name;
$return['station_uri'] = $metadata->station_uri;
$return['item_title'] = $metadata->item_title;
$return['item_subtitle'] = $metadata->item_subtitle;
$return['item_abstract'] = $metadata->item_abstract;
}
return $return;
}
// add filter
yourls_add_filter('random_keyword', 'audiomark_create_keyword');
/*
* Use our own keyword generator instead of the existing one.
*
* @param string $keyword
* @return string $return created keyword
*/
function audiomark_create_keyword($keyword)
{
// Use URL instead the handed over keyword (unfortuately yourls does not hand it over)
return create_short_url(yourls_sanitize_url($_REQUEST['url']));
}
开发者ID:ulfst,项目名称:radiomark-yourls-plugin,代码行数:31,代码来源:plugin.php
示例20: yourls_add_filter
<?php
/*
Plugin Name: YunoHost Auth plugin
Plugin URI: http://yourls.org/
Description: Authentification plugin for YunoHost
Version: 0.1
Author: ju
Author URI: http://github.com/julienmalik
*/
// No direct call
if (!defined('YOURLS_ABSPATH')) {
die;
}
yourls_add_filter('shunt_is_valid_user', 'yunohost_auth_is_valid_user');
function yunohost_auth_is_valid_user($value)
{
return $_SERVER['PHP_AUTH_USER'] == YOURLS_YUNOHOST_AUTH_ADMIN;
}
/* And that's it. Activate the plugin and notice how the page title changes */
开发者ID:stevenroose,项目名称:yourls_ynh,代码行数:20,代码来源:plugin.php
注:本文中的yourls_add_filter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论