diff --git a/admin/qtx_admin.php b/admin/qtx_admin.php index cdb5e78..65dde0e 100644 --- a/admin/qtx_admin.php +++ b/admin/qtx_admin.php @@ -125,6 +125,8 @@ function qtranxf_admin_load() if(!empty($page_configs['']['filters'])){ qtranxf_add_filters($page_configs['']['filters']); } + $bnm = qtranxf_plugin_basename(); + add_filter( 'plugin_action_links_'.$bnm, 'qtranxf_links', 10, 4); qtranxf_add_admin_filters(); } qtranxf_admin_load(); @@ -694,19 +696,11 @@ function qtranxf_add_language_menu( $wp_admin_bar ){ } } -function qtranxf_links($links, $file){ // copied from Sociable Plugin - //Static so we don't call plugin_basename on every plugin row. - static $this_plugin; - if (!$this_plugin){ - $this_plugin = plugin_basename(QTRANSLATE_FILE); - } - if ($file == $this_plugin){ - $settings_link = '' . __('Settings', 'qtranslate') . ''; - array_unshift( $links, $settings_link ); // before other links - } +function qtranxf_links($links, $file, $plugin_data, $context){ + $settings_link = '' . __('Settings', 'qtranslate') . ''; + array_unshift( $links, $settings_link ); // before other links return $links; } -add_filter('plugin_action_links', 'qtranxf_links', 10, 2); //should be moved to qtx_configuration.php from qtx_admin.php ? function qtranxf_admin_notices_config() { @@ -784,7 +778,6 @@ function qtranxf_add_admin_filters() add_filter('home_url', 'qtranxf_admin_home_url', 5, 4); } } -//qtranxf_add_admin_filters(); add_action('admin_head-nav-menus.php', 'qtranxf_add_nav_menu_metabox'); add_action('admin_menu', 'qtranxf_admin_menu', 999); diff --git a/inc/qtx_dbg.php b/inc/qtx_dbg.php index 3f61355..18daeaa 100644 --- a/inc/qtx_dbg.php +++ b/inc/qtx_dbg.php @@ -18,8 +18,8 @@ function qtranxf_dbg_log($msg,$var='novar',$bt=false,$exit=false){ } if(!empty($h)) $msg = $h.': '.$msg; if( $var !== 'novar' ){ - //$msg .= var_export($var,true); - $msg .= print_r($var,true); + $msg .= var_export($var,true); + //$msg .= print_r($var,true); } if($bt){ //$msg .= PHP_EOL.'backtrace:'.PHP_EOL.var_export(debug_backtrace(),true); diff --git a/qtranslate_utils.php b/qtranslate_utils.php index fb3d924..20a9130 100644 --- a/qtranslate_utils.php +++ b/qtranslate_utils.php @@ -56,8 +56,7 @@ function qtranxf_translate_wp($s) { return __($s); } function qtranxf_plugin_basename(){ static $s; if(!$s){ - $b = plugin_basename(QTRANSLATE_FILE); - $s = basename(dirname($b)).'/'.basename($b);//Windows trick when folder is linked + $s = plugin_basename(wp_normalize_path(QTRANSLATE_FILE)); } return $s; } @@ -68,8 +67,8 @@ function qtranxf_plugin_basename(){ function qtranxf_plugin_dirname(){ static $s; if(!$s){ - $b = plugin_basename(QTRANSLATE_FILE); - $s = basename(dirname($b));//Windows trick when folder is linked + $b = qtranxf_plugin_basename(); + $s = dirname($b); } return $s; }