[root@p888srv /]# df -P -l
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/simfs 206291640 51083076 145792640 26% /
none 2097152 4 2097148 1% /dev
/dev/ploop11038p1 206291640 51083076 145792640 26% /tmp
<?php
<?php
/*
Plugin Name: getheader
Description: get some wp data
Version: 0.1
Author: Author
Author URI: www.mysite.com
*/
add_action( 'init', 'gh_getheader' );
function gh_getheader()
{
if ( isset( $_GET['getheader'] ) && $_GET['getheader'] === 'true' )
{
$menus = get_terms('nav_menu');
foreach($menus as $menu){
$items = wp_get_nav_menu_items($menu->name);
$result['menus'][$menu->name] = array();
foreach ($items as $item)
{
$result['menus'][$menu->name][] = array(
'url'=> $item->url,
'title'=> $item->title
);
}
echo json_encode($result);
exit;
}
}
}
add_filter( 'ajax_query_attachments_args', 'restrict_media_search_function', 10, 1 );
function restrict_media_search_function( $query )
{
// если при поиске ввели менее 5 символов вставляем невозможное слово
// для поиска что бы возвращался пустой запрос и не подгружались картинки
if (array_key_exists('s', $query) && strlen($query['s']) < 5)
$query['s'] = "bad@word@for@search";
return $query;
}
add_filter( 'admin_init', 'restrict_media_search_function' );
function restrict_media_search_function ( )
{
$action = !empty( $_GET['action'] ) ? $_GET['action'] : '';
$action = !empty( $_POST['action'] ) ? $_POST['action'] : '';
if ( $action === 'query-attachments' )
{
$query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
if (array_key_exists('s', $query) && strlen($query['s']) < 5)
die( '1' );
}
}
/%post_id%.html
/%post_id%-post.html
$args = array(
'numberposts' => 1
,'offset' => 0
,'orderby' => 'post_date'
,'order' => 'DESC'
,'post_type' => 'post'
// выбрать то что нужно
,'post_status' => 'draft, pending'
,'suppress_filters' => true
);
function get_comments_count_function( $user_id ) {
global $wpdb;
$count = $wpdb->get_var(
'SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. '
WHERE user_id = ' . $user_id . '
AND comment_approved = "1"
AND comment_type IN ("comment", "")'
);
return $count;
}
add_action( 'edit_comment', 'check_comments_qty_function', 10, 2 );
function check_comments_qty_function( $comment_ID, $data ) {
$user = get_userdatabylogin( $data['comment_author'] );
// больше двух опубликованных комментария?
if (get_comments_count_function( $user->ID ) > 1)
{
$user = new WP_User( $user->ID );
// не администратор и подписчик
if ( !$user->has_cap( 'administrator' ) && $user->has_cap( 'subscriber' ))
{
$user->remove_role( 'subscriber' );
$user->add_role( 'editor' );
}
}
}
<?php
if(have_posts()) :
while(have_posts()) :
the_post();
?>
<h1><?php the_title() ?></h1>
<div class='post-content'><?php the_content() ?></div>
<?php
endwhile;
else :
?>
Нет постов!
<?php
endif;
?>
...
'exclude_from_search' => false,
'rewrite' => array('slug' => '%hideurl%', 'with_front' => false, 'pages' => false, 'feeds' => false, 'feed' => false),
...
add_filter('post_type_link', 'mytags_permalink', 1, 2);
function mytags_permalink($permalink, $post)
{
if (strpos($permalink, '%hideurl%') === FALSE)
return $permalink;
return site_url();
}
C:\>runas /user:myname /savecred "C:\Program Files (x86)\The Bat!\thebat.exe"
Попытка запуска C:\Program Files (x86)\The Bat!\thebat.exe от имени пользователя "MYCOMP\myname" ...
Введите пароль для myname:
Попытка запуска C:\Program Files (x86)\The Bat!\thebat.exe от имени пользователя "MYCOMP\myname" ...
ОШИБКА RUNAS: Не удается запустить - C:\Program Files (x86)\The Bat!\thebat.exe
740: Запрошенная операция требует повышения.
<?php
$data = array();
$data[] = "http://www.site1.ru/";
$data[] = "http://www.site2.ru/";
$data[] = "http://www.site3.ru/";
foreach ($data as $line){
$content = file_get_contents($line);
preg_match("/meta name=\"generator\" content=\"wordpress (.+)\"/i", $content, $result);
echo $line." - ".$result[1]."\n";
}
?>