Comments (2)
I've also tried this here (plugin.php - line 15)
// Part to be executed if FORM has been submitted
if ( isset( $_REQUEST['url'] ) && $_REQUEST['url'] != 'http://' ) {
// Check if "https://" is missing in the URL
if (!preg_match("~^(?:f|ht)tps?://~i", $_REQUEST['url'])) {
$_REQUEST['url'] = "https://" . $_REQUEST['url'];
}
if (enableRecaptcha) {
// Use reCAPTCHA
$token = $_POST['token'];
$action = $_POST['action'];
// call curl to POST request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('secret' => recaptchaV3SecretKey, 'response' => $token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$arrResponse = json_decode($response, true);
// verify the response
if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.5) {
// reCAPTCHA succeeded
shorten();
} else {
// reCAPTCHA failed
$message = "reCAPTCHA failed";
}
} else {
// Don't use reCAPTCHA
shorten();
}
}
from sleeky.
This also didn't work (plugin.php - line 46)
function shorten() {
// Get parameters -- they will all be sanitized in yourls_add_new_link()
$url = $_REQUEST['url'];
$keyword = isset( $_REQUEST['keyword'] ) ? $_REQUEST['keyword'] : '' ;
$title = isset( $_REQUEST['title'] ) ? $_REQUEST['title'] : '' ;
$text = isset( $_REQUEST['text'] ) ? $_REQUEST['text'] : '' ;
// Prepend "https://" if not already provided in the URL
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "https://" . $url;
}
// Create short URL, receive array $return with various information
$return = yourls_add_new_link( $url, $keyword, $title );
// Make visible to UI
global $shorturl, $message, $status, $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();
}
}
from sleeky.
Related Issues (20)
- `domain.com` not redirecting to frontend HOT 1
- Small top bar / small fonts
- Frontend revisited. Sorry HOT 2
- API not functioning correctly when backend plugin enabled with PrivateBin
- Not showing shortened URL HOT 1
- It isn't working HOT 2
- ... HOT 4
- How can I prevent non-admins from adding links? HOT 1
- Admin version checker has invalid url
- Front-end pages need to be adapted to the urlads plugin
- Frontend display not working
- Copy Button not working
- Always HTTP Status Code 200 HOT 2
- Cant short HOT 1
- Broke Login HOT 4
- Is this theme maintained? HOT 3
- View QR Codes with public interface
- Frontend page isn't displayed correctly HOT 4
- Customize link is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sleeky.