This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## Utility API | |
#set ($outputUtil = $sitevisionUtils.outputUtil) | |
#set ($portletContextUtil = $sitevisionUtils.portletContextUtil) | |
#set ($resourceLocatorUtil = $sitevisionUtils.resourceLocatorUtil) | |
#set ($scriptUtil = $sitevisionUtils.scriptUtil) | |
#set ($docTypeUtil = $sitevisionUtils.docTypeUtil) | |
## | |
## Portlet properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get query parameters as literal object. | |
var queryObject = (function (queryParams, k, v) { | |
return queryParams.reduce(function (params, p) { | |
if ((p = p.split('=')).length) { | |
k = p[0]; | |
v = p[0]; | |
params[k] = (typeof params[k] !== 'undefined') ? (Array.isArray(params[k]) ? params[k] : [params[k]]).concat(v) : v; | |
} | |
return params; | |
}, {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set( $propertyUtil = $sitevisionUtils.propertyUtil ) | |
#set( $currentPage = $sitevisionUtils.portletContextUtil.currentPage ) | |
#set( $metadataValue = $propertyUtil.getString($currentPage, 'META', '') ) | |
#if( "$!metadataValue" != "" ) | |
+metadata.META:"$metadataValue" | |
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [MODULE NAME] | |
* | |
* Limepark AB, 2016 | |
*/ | |
(function (window, document, $) { | |
// ... | |
// Document Ready |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#################################################### | |
# Script to download a dummy/placeholder image. | |
#################################################### | |
if [ -z "$1" ]; then | |
echo "Missing argument with the pixel dimensions (try 'dummy 250x200')" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#################################################### | |
# Script to get the SiteVision version of a URL. | |
# This depends on the linked assets having the | |
# version number in their URLs. | |
#################################################### | |
if [ -z "$1" ]; then | |
echo "Missing argument (URL)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WP Filter which adds acf field value to body classes for all pages but home. | |
* | |
* @see https://codex.wordpress.org/Plugin_API/Filter_Reference/body_class | |
*/ | |
function THEME_NAME_body_class( $classes ) { | |
if ( function_exists( 'get_field' ) && ! is_home() ) { | |
$classes[] = get_field( 'page_background' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select all posts which are duplicates of a language. | |
# The language parameter is to only select by the new language (not the original duplication language). | |
SET @lang_code = 'da'; | |
SELECT pm.*, p.post_title, p.post_type, icl.language_code | |
FROM wp_postmeta pm | |
INNER JOIN wp_icl_translations icl ON icl.element_id = pm.post_id | |
INNER JOIN wp_posts p ON p.`ID` = pm.post_id | |
WHERE meta_key='_icl_lang_duplicate_of' AND icl.language_code = @lang_code; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cleanup Xliffs | |
* | |
* This file can be called through the php cli and clean up xliff files. | |
* | |
* The script takes directories and/or xliff files and removes XML nodes which | |
* matches the XPath query. | |
* | |
* @author Hampus Nordin <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you get an error about illegal mixes of collation you might need to force the collation. | |
# SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'; | |
SET @old_url = 'http://www.oldurl.com'; | |
SET @new_url = 'http://www.newurl.com'; | |
UPDATE wp_options SET option_value = replace(option_value, @old_url, @new_url) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, @old_url, @new_url); | |
UPDATE wp_posts SET post_content = replace(post_content, @old_url, @new_url); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value, @old_url, @new_url); |
NewerOlder