Blog

2 months ago 0
Posted in: Programování
add_filter( 'wpseo_metabox_prio', 'jw_filter_yoast_seo_metabox' );
function jw_filter_yoast_seo_metabox() {
	return 'low';
}
2 months, 1 week ago 0
Posted in: Programování
php -d memory_limit=2048M /usr/local/bin/composer require ....
2 months, 2 weeks ago 0
Posted in: Programování
# based on http://www.commandlinefu.com/commands/view/2916/backup-all-mysql-databases-to-individual-files
# but modified for the MAMP path and to include default root/root as username and password

for I in $(/Applications/MAMP/Library/bin/mysql -u root -proot -e 'show databases' -s --skip-column-names); do /Applications/MAMP/Library/bin/mysqldump -u root -proot $I | gzip > "$I.sql.gz"; done

Source: https://gist.github.com/salcode/9142815

4 months, 1 week ago 0
Posted in: WordPress

 

// $loc obsahuje správné locale (cs_CZ, ...) - záleží na pojmenování lokalizačních souborů
$filename = realpath(dirname(__FILE__) . '/../..') . '/languages/plugins/woocommerce-' . $loc . '.mo';
unload_textdomain('woocommerce' );
load_plugin_textdomain('woocommerce', false, $filename);
2 years, 8 months ago 0
Posted in: Programování
$page_id = !empty($params['page_id']) ? $params['page_id'] : null;
 $assign = !empty($params['assign']) ? $params['assign'] : null;
 
 if (!empty($page_id)) {
  $contentOps = cmsms()->getContentOperations();
  $templateOps = cmsms()->getTemplateOperations();
 if (!empty($contentOps) && !empty($templateOps)) {
   $content = $contentOps->LoadContentFromId($page_id);
      if (!empty($content)) {
    $templateID = $content->templateId();
    if (!empty($templateID)) {
     $template = $templateOps->LoadTemplateByID($templateID);
     if (!empty($template)) {
      if (!empty($assign)) $smarty->assign($assign, $template->name);
      else return $template->name;
     }
    } 
   }
  }
 }
 
 return false;
2 years, 8 months ago 0
Posted in: Programování
function current_url() {
   $pageURL = 'http';
   if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
   $pageURL .= "://";
   if ($_SERVER["SERVER_PORT"] != "80") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
   } else {
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
   }
   return $pageURL;
}

function create_url($other_qs_parsed = array()) {
  $url = current_url();
  $url_parsed = parse_url($url);
  $new_qs_parsed = array();
  
  parse_str($url_parsed['query'], $new_qs_parsed);

  $final_query_string_array = array_merge($new_qs_parsed, $other_qs_parsed);
  $final_query_string = http_build_query($final_query_string_array);

  $new_url = $url_parsed['scheme'] 
           . '://'
           . $url_parsed['host'] 
           . $url_parsed['path'] 
           . '?'      
           . $final_query_string;
  return $new_url;
}
3 years, 8 months ago 0
Posted in: Internet

It is not comfortable to select all drops one by one in the web interface of My CloudApp (cl.ly). If you need to, paste in address bar following snippet and press enter. All drops get selected and you can use the Delete selected button.

javascript:jQuery(".select input").trigger("click");
3 years, 8 months ago 0

For PhoneGap build it is enough to have self-signed keystore certificate. You can easily deploy just www folder and sign the Android application to Google Play deploy.

Having installed JSDK, in bin folder there is a keytool app. Just run the app with following parameters and the generated keystore key can be used to sign the Android application.

keytool -genkey -v -keystore yourapplication.keystore -alias yourapplication -keyalg RSA -keysize 2048 -validity 10000
4 years, 2 months ago 0
Posted in: Programování

In case you are suffering with the category page breadcrumbs, which look like nonsence, showing totally unrelated categories, solution may be quite simple (eventhough unacceptable). There may be wrong categories in table ps_category, which have parent category id linking to non existing category. In the moment you delete all rows with not-existing parent-ids, the breadcrumbs will be fixed.

This happen in the case you created some categories and deleted them, but the deletion mechanism in Prestashop is buggy.

4 years, 5 months ago 0

WordPress allows you to use custom text editors with the function wp_editor. There is one very annoying issue, which is cause in combination with qTranslate plugin. It means, while you are using qTranslate and in the same time for example in admin you have custom wp_editor ‘s, you are not able to insert any files (uploads neither images) in the wp_editor.

There is fix available. Editing file

[YOUR_SITE_ROOT]/wp-content/plugins/qtranslate/qtranslate_javascript.php

and make the block on line 238 look following:

$q_config['js']['qtrans_wpActiveEditorOverload'] = "
	jQuery('.wp-editor-wrap').unbind('mousedown');
	jQuery('.wp-editor-wrap').mousedown(function(e){
		/*wpActiveEditor = 'qtrans_textarea_'+this.id.slice(3, -5);*/
		 var sliced = this.id.slice(3, -5);
            if (sliced == 'content'){
 	            wpActiveEditor = 'qtrans_textarea_content';
            } else {
                wpActiveEditor = sliced;
            }
});
";