foreach (glob('tm-contents/*.txt') as $filename) {
$fileId = preg_replace('~\D~','',$filename); // удаляем все кроме цифр
$data = json_decode(file_get_contents('tm-contents/'.$filename));
foreach ($data as $key=>$arr) {
// секретные действия с $data
}
file_put_contents ('rs/alx'.$fileId.'.txt', json_encode($data));
}
while (true) {
// тут твой код делает свои грязные делишки
sleep(1);
}
function myxor($text, $key){
for($i=0;$i<strlen($text);)
{
for($j=0;$j<strlen($key);$j++, $i++)
{
$outText .= $text{$i} ^ $key{$j};
}
}
return $outText;
}
$text="Hello World!";
$key="hesoyam1234";
echo $cipher=myxor($text, $key); //зашифровали
echo myxor($cipher, $key); //расшифровали
<?php
if(isset($k1->Цена)) {
$vag="VAG";
echo 'K1 PRICE = '.$price.'<br>';
if ($k1->Запчасть->Бренд == $vag) {
echo 'VAG <br>';
$price = $k1->Цена * $koef;
} else {
echo 'NOT VAG <br>';
if ($k1->Цена <= "150") {
$price = $k1->Цена * $koef2 * 1.2;
echo 'PRICE KOEF = koef2 * 1.2 <br>';
} else {
$price = $k1->Цена * $koef2;
echo 'PRICE KOEF = koef2<br>';
}
echo 'PRICE = '.$price.'<br>';
$dataRes_final[$k][] = [
'brand' => $k1->Запчасть->Бренд,
'code' => $k1->Запчасть->Код,
'title' => $k1->Запчасть->Наименование,
'price'=>$price
];
}
}
public function register_scripts() {
$script_path = WP_TILES_ASSETS_URL . 'js/';
$in_footer = apply_filters( 'wp_tiles_js_in_footer', true );
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
wp_register_script( 'tilesjs', $script_path . 'tiles.js', array( "jquery" ), "2013-05-18", $in_footer );
wp_register_script( 'jquery-dotdotdot', $script_path . 'jquery.dotdotdot.js', array( "jquery" ), "1.6.14", $in_footer );
wp_register_script( 'wp-tiles', $script_path . 'wp-tiles.js', array( "jquery", "tilesjs", "jquery-dotdotdot" ), WP_TILES_VERSION, $in_footer );
} else {
wp_register_script( 'wp-tiles', $script_path . 'wp-tiles.min.js', array( "jquery" ), WP_TILES_VERSION, $in_footer );
}
}
public function register_styles() {
$stylesheet = WP_TILES_ASSETS_URL . 'css/wp-tiles.css';
// In admin we want vanilla WP Tiles styles
if ( !is_admin() ) {
/**
* Get the WP Tiles stylesheet
*
* @since 1.0
* @param string Stylesheet location or false to disable separate css
*/
$stylesheet = apply_filters( 'wp_tiles_stylesheet', $stylesheet );
if ( false === $stylesheet )
return;
}
wp_register_style( 'wp-tiles', $stylesheet, false, WP_TILES_VERSION );
/**
* Always enqueue stylesheet or defer loading until an instance of
* WP Tiles has been detected
*
* @since 1.0
* @param bool Always enqueue
*/
if ( !is_admin() && apply_filters( 'wp_tiles_always_enqueue_stylesheet', false ) ) {
$this->enqueue_styles();
}
}
public function enqueue_scripts() {
wp_enqueue_script( 'wp-tiles' );
$this->add_action( 'wp_footer', 'add_data', 1 );
}
public function enqueue_styles() {
wp_enqueue_style( 'wp-tiles' );
do_action( 'wp_tiles_enqueue_styles' );
}
$wpTiles = new WPTiles/WPTiles;
$wpTiles->register_scripts();
$wpTiles->register_styles();
$wpTiles->enqueue_scripts);
$wpTiles->enqueue_styles();
$script_path = путь-к-папке-с-скриптом
...
wp_register_script( 'tilesjs', $script_path . 'tiles.js', array( "jquery" ), "2013-05-18", $in_footer );
...
UPDATE tbl SET
`date` = CONCAT('20',SUBSTRING(`date`,7,2),'-',SUBSTRING(`date`,3,2),'-',SUBSTRING(`date`,0,2))
WHERE date LIKE '__.__.__'
;
SELECT
CONCAT('20',SUBSTRING(`date`,7,2),'-',SUBSTRING(`date`,3,2),'-',SUBSTRING(`date`,0,2)) as date
FROM tbl
WHERE date LIKE '__.__.__'
;
$res = mysql_query(...)
if ($res === FALSE) {
die( mysql_error() );
}
Для запросов SELECT, SHOW, DESCRIBE, EXPLAIN и других запросов, возвращающих результат из нескольких рядов, mysql_query() возвращает дескриптор результата запроса (resource), или FALSE в случае ошибки.
Для других типов SQL-запросов, INSERT, UPDATE, DELETE, DROP и других, mysql_query() возвращает TRUE в случае успеха и FALSE в случае ошибки.
Полученный дескриптор результата нужно передать в функцию mysql_fetch_assoc() или любую другую функцию, работающую с результатами запросов.
Используйте mysql_num_rows() для выяснения количества рядов в результате SELECT-запроса или mysql_affected_rows() для выяснения количества обработанных рядов запросами DELETE, INSERT, REPLACE и UPDATE.
mysql_query() также завершится с ошибкой и вернет FALSE, если у пользователя нет доступа к какой-либо из таблиц, фигурирующих в запросе.
<?php
$args = array(
'taxonomy' => array('post_tag','category'),
'hide_empty' => false, // не скрывать пустые
'number' => 0, // показывать все (по-умолчанию 45)
);
wp_tag_cloud($args);
?>
foreach($cities as $k=>$current_city){
echo ($k?',':'')."'$current_city[0]'";
}
$cities = [
['1', 'Moscow'],
['2', 'Kazan'],
];
echo "var cities_id = ['".implode("','", array_column($cities, 0))."'];";
echo '<br>';
echo "var cities_name = ['".implode("','", array_column($cities, 1))."'];";
public filter(){
foreach($_GET as $key=>$val) { ... }
}
$get = $_GET;
$context = 'url=1&tag=2';
parse_str($context, $_GET);
$this->filter();
$_GET = $get;