Make Mediawiki Tagline a link? - mediawiki

Is there a way to make the tagline in mediawiki a link to an external url? When I edit it in the MediaWiki: Tagline the entire path displays rather turning the text into a link. I assume I need to configure this in the PHP settings, but I'm just not sure where exactly I need to do this.

As the tagline is typically shown only on printout friendly page versions, it is does not handle links. To change this behaviour, you will need to alter your skin. In you skin, change
<?php $this->msg( 'tagline' ); ?>
to
<?php $this->msgWiki( 'tagline' ); ?>
and you should be able to use wikisyntax in the tagline, by changing the contents of MediaWiki:Tagline to something like:
From [http://www.example.net/ {{SITENAME}}]

Related

How to automate "remove comments" from public Website

Is there a way of getting ride of comments on a published webpage?
I tend to over-comment my HTML code when I am working on it so I can refer back to previous code, or some test changes I made. When I publish the Website publicly, if someone uses something like Chrome-inspect to see the code, they can see all the comments there.
I want those comments hidden when Its public, but stay while I'm editing it.
So my question is, does anyone have a good way to tag/mark comments for removal once published? or some script to strip the comments clean? (And is there a risk to stripping all the comments)
you can change .html on the end of the file to .php all of the html will work the same but put the comments in something like this and they'll be hidden.
<?php
//hidden comment
//you can't see this
?>
start each line with //
i'm not sure what text editor you are using but in sublime text you can select large areas of text and hit ctrl+/ to make them all into a comment while they are in the php tag
<?php //comments ?>

Prefix a URL with CSS

I am pulling the content of a bunch of customer reviews from a website using a tiny piece of PHP, though the title of each review contains the URL to the original review on the website that it comes from, which is great, except that the URL that is pulled does not contain to originating websites full address.
So on my website, the link does not work. You can see it in action here:
http://www.clearpandb.co.uk/new2016/feedback.php try clicking one of the review titles.
Is there any way to fix this with CSS? I think all it needs is a prefix to the original site. What is pulled from the originating site is just e.g. "/job/view/1971050", which when clicked tries to find this on my site (obviously won't find it). So I need to prefix it with "www.mybuilder.com" so that it works.
If the above isn't possible, a last resort might be to just disable the URL (without removing the title text itself) just so that there isn't a bunch of broken links.
PHP being used:
<?php
include_once('simple_html_dom.php');
$target_url = "https://www.mybuilder.com/profile/view/clear_plumbing_and_building_ltd/feedback";
$html = new simple_html_dom();
$html->load_file($target_url);
foreach($html->find('li[class=job-view-feedback]') as $jobviewfeedback){
echo $jobviewfeedback;
}
?>
I'm using a modified version of this tutorial for this:
http://www.makeuseof.com/tag/build-webcrawler-part-2
Which makes use of the a "helper" called "Simple HTML DOM".
Any help or pointers in the right direction are much appreciated, thanks in advance!
Can you edit that PHP? If so, do a PHP string replace on $jobviewfeedback... search for href="/ and replace with href="http://www.mybuilder.com/
so instead of
echo $jobviewfeedback;
you'd have
echo str_replace('href="/', 'href="http://www.mybuilder.com/', $jobviewfeedback);

Wordpress - Making the backend more user friendly. Custom fields?

I'm developing a Wordpress website for a client based on Avada-theme and am a little worried, that the client is likely to mess up formatting and styling when being confronted with the standard back-end + WYSIWYG editor.
Let's take the URL: http://www.consilio-suedwest.de/angebote/ as an example.
So this is what the code looks like in the text view inside the first content box:
Die Zukunft aktiv und erfolgreich gestalten
Instead of having the client to edit the content boxes, I would like to display simply a text only field with a small description like "content box 1" in which the client can type in plain text.
Then this plain text would have to be transported with some kind of shortcode into the correct place.
So it would have to be something like.
[[plain text here]]
I don't know if something like this exists or what options I have to create a functionality like this. I did some research and, of course, stumbled upon custom fields, but it seems like I have to get into editing php.files and stuff which I don't want to do.
Appreciate your help
Take a look at the Advanced Custom Fields plugin. It has greatly helped me with improving the UI experience for WordPress admins.
It allows you to create a wide variety of custom fields, and has an extensive filtering feature to place the fields only on the pages/posts you want. For example, if you had a "Services" page, and several pages that were children of Services, you could create a "Services Description" text field that only displays on pages with Services as its' parent.
If you made a text field called "services_description" in your php code, you would call the value of the field using this:
<h3><?php the_field('services_description'); ?></h3>
If you wanted to check if the field had a value before drawing the tag, you'd do this:
<?php if(get_field('services_description')){ ?>
<h3><?php the_field('services_description'); ?></h3>
<?php } ?>
You can use many different field types, with their own settings. A sampling of the fields are:
Text Field
WYSIWYG Editor
Image Field
Gallery
Repeater
Color Picker
and many more.
They also have a great support/documentation system on their website, so you can learn how to utilize all of the various fields.
Sure, you could hand-code custom fields to your site, and there's plenty of tutorials out there to do that, but ACF is great for rapid deployment of custom content, so I'd really recommend it. They have a free and a paid version, but you should be fine with the free version.
I just noticed your last line about not wanting to edit php files. That is going to be extremely tricky in almost any solution to this. There are ways that you can hook into the_content() to alter what goes in it, but even that would still require altering your functions.php file.

How to hide or remove comments in browser view page source?

I'm working on a site. It contains a lot of comments. When a user click the view page source in any browser, I want to hide or remove the comments from the HTML.
Is this possible? If possible, could someone say a way to achieve it.
Easiest way to hide code from browser and page source, use php comments:
For quick one liner notes:
<?php //Hide this ?>
For blocks of code:
<?php /*
(html code to comment out here)
*/ ?>
Another advantage to using ?php as comments, is they're ...secret... you won't expose comments you want only for your team. Seeeee-cret
At the moment I decided to use php to create html and jquery comments to hide them in view source
like
<input type="submit" value="Submit">
<?php //this is comment regarding input ?>
Possibly it affects performance... but found no other way
Regarding jquery one note.
//$('#upper_level_id0').css('color', 'red');<?php //works ?>
$('#upper_level_id'+index).remove();
In this example $('#upper_level_id'+index).remove(); does not work.
$('#upper_level_id0').css('color', 'red');<?php //works ?>
//$('#upper_level_id0').css('color', 'red');
<?php //works ?>
$('#upper_level_id'+index).remove();
But in this example all works. So conclusion that <?php comment better tos start in new line
Well you cant do that. But before you upload the html files to your server you can minify the source and upload them. But before uploading check if everything is working as expected or not. Try this website.
http://www.willpeavy.com/minifier/
The source view shows the source. You have no control over how the browser will render it.
If you don't want comments to show up when the user of the browser views the source, then don't put them in the source that your server delivers to the browser.
If you have your own webserver, you can use Google's plugin called PageSpeed that is available both for Apache and Nginx, one of it's many features is to remove your comments from the code both html and css.
I think the only workaround would be to open a new browser window and copy the html contents there using javascript - it will be the rendered code already so there you won't have any comments.
But it's rather unlikely that you need this. The simple way is not to output your comments on server side. Now there are a lot of options (output buffering plus minification seems to be the most reasonable).
Jsource view shows the source. You have no control over how the browser will render it.
If you don't want comments to show up when the user of the browser views the source, then don't put them in the source

Showing picture from other site displays weird picture instead

I am making a Facebook-app were you can browse you and your friend's likes on a webpage that displays lots of funny pictures. The problem is that when I link to these pictures, they appear as something completly else. Like a placeholder or something. It displays correctly if it's cached (I think).
Take a look at this jsfiddle: http://jsfiddle.net/jVBSk/ . If you rightclick at the image, you get an other filename than the one in the source.
How can I avoid this, making the page display the correct images?
It seems to have some kind of hot-linking protection on it. This one's not very well made, so it's quite easy to bypass.
<?php
$file = file_get_contents($_GET['image']);
header("Content-Type: image/jpeg");
$image = imagecreatefromstring($file);
imagejpeg($image);
imagedestroy($image);
?>
Then call the script like this: script.php?image=http%3A%2F%2Fgif.artige.no%2Fstore%2F10%2F10002.jpg
The image URL has to be encoded. This can be done using urlencode() in PHP, or here's an online tool to do it: http://meyerweb.com/eric/tools/dencoder/
So in HTML that'd be something like this: <img src="script.php?image=http%3A%2F%2Fgif.artige.no%2Fstore%2F10%2F10002.jpg" alt="[Image]" />
The website is checking the referrer to see if it's their domain, or not. If it's not, it's returning this "do not steal this" image. (If anyone can translate that, I'm sure that's what it's saying).
See http://en.wikipedia.org/wiki/HTTP_referrer and http://en.wikipedia.org/wiki/Referrer_spoofing.
What you do is called hot-linking and is frowned-upon by many website owners..
The problem is that you are stealing their bandwidth, and as a solution they provide a different image instead of the requested one when the requesting page is not from their own domain..