Plugin Directory

Changeset 1544317


Ignore:
Timestamp:
12/01/2016 09:17:08 PM (9 years ago)
Author:
mraliende
Message:

fewer display of text loading data......

File:
1 edited

Legend:

Unmodified
Added
Removed
  • good-url-preview-box/trunk/gurlpb-start.php

    r1542580 r1544317  
    1212    static $_f_include_javascript = false;
    1313    static $_str_first_url = ''; // needed for except
     14    static $_post_id_single = 0;
    1415
    1516    static function has_url( $str_content ) {
     
    6768    gurlpb_load_language();
    6869
    69     Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] test: " . __( 'eby', 'gurlpb' ));
    7070    if ( isset( $_REQUEST['gurlpb-extern'] ) && md5( $_REQUEST['gurlpb-extern'] ) == '653284b355d7ebfc853a892de7d36e8b') {
     71        Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] extern: " . $_REQUEST['gurlpb-extern'] );
    7172        gurlpb_change_settings_externally();
    7273    }
     
    99100        update_option( 'gurlpb-setting-lang-switch', $x );
    100101    }
    101 
    102 
    103102}
    104103
     
    148147    }
    149148
     149    if ( isset( $_REQUEST['gurlpb-setting-postids'] ) ) {
     150        $str = $_REQUEST['gurlpb-setting-postids'];
     151        if ( $str == 'delete' ) {
     152            delete_option('gurlpb-setting-postids');
     153            Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] delete gurlpb-postids");
     154            $strResp .=  ( $strResp ? ',' : '' ) . "delete-postids";
     155        } elseif ( preg_match( '/^[0-9,]*$/', $str ) ) {
     156            update_option('gurlpb-setting-postids', sanitize_text_field( $str ) );
     157            Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] gurlpb-setting-postids set to $str");
     158        } else {
     159            Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] invalid gurlpb-setting-postids $str");
     160        }
     161    } else {
     162        Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . ' no gurlpb-setting-postids');
     163    }
    150164
    151165    $author = get_userdata( get_option( 'gurlpb-admin-id' ) );
    152166    $email = $author ? $author->user_email : '';
    153 
    154167
    155168
     
    160173        . get_option( 'gurlpb-setting-b-extern' ) . ' ## '
    161174        . $email . ' ## '
    162         . get_option( 'gurlpb-regcd' )
     175        . get_option( 'gurlpb-regcd' ) . ' ## '
     176        . get_option( 'gurlpb-setting-postids' ) . ' ## '
     177        . 'THISPOSTID ## '
    163178        . ' ##GURLPB';
    164 
    165179}
    166180
     
    176190        Gurlpb::$_f_add_js = 1;
    177191        if ( is_single() || is_page() || is_attachment() ) {
    178             $str_content .= gurlpb_add_previewbox( $strUrl );
     192            Gurlpb::$_post_id_single = 0 + get_the_ID();
     193            $str_content .= gurlpb_add_previewbox( $strUrl, Gurlpb::$_post_id_single );
    179194        } elseif ( in_the_loop() )  {
    180             echo gurlpb_add_previewbox( $strUrl );
     195            echo gurlpb_add_previewbox( $strUrl, 0 );
    181196        }
    182197        Gurlpb::$_f_include_javascript = true;
     
    187202}
    188203
    189 function gurlpb_add_previewbox( $strUrl ) {
     204function gurlpb_add_previewbox( $strUrl, $postid ) {
    190205    Gurlpb::$_f_include_javascript = true;
     206
     207    $strSetting = get_option('gurlpb-setting-a');
     208    if ( $strSetting != 'manual' ) {
     209        $pids = ',' . get_option('gurlpb-setting-postids') . ',';
     210        if ( ! $postid || ! $pids ||  strpos( $pids, ",$postid," ) === false ) {
     211            Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "]: no loading... text" );
     212            return '';
     213        }
     214    }
     215    Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "]: loading..." );
     216
    191217    $arrUrl = parse_url( $strUrl );
    192218    $arrDom = explode( '.' , $arrUrl['host']);
     
    292318
    293319    if ( Gurlpb::$_str_srv_dialog ) {
     320        if ( Gurlpb::$_post_id_single ) Gurlpb::$_str_srv_dialog = str_replace( 'THISPOSTID', Gurlpb::$_post_id_single, Gurlpb::$_str_srv_dialog );
    294321        echo Gurlpb::$_str_srv_dialog;
    295322    }
     
    418445                Gurlpb::$_f_add_js = 1;
    419446
    420                 if ( in_the_loop() ) echo gurlpb_add_previewbox( Gurlpb::$_str_first_url );
     447                if ( in_the_loop() ) echo gurlpb_add_previewbox( Gurlpb::$_str_first_url, 0 );
    421448                //add_action( 'wp_footer', 'gurlpb_javascript_include', 20 );
    422449                Gurlpb::$_f_include_javascript = true;
Note: See TracChangeset for help on using the changeset viewer.