Changeset 1544317
- Timestamp:
- 12/01/2016 09:17:08 PM (9 years ago)
- File:
-
- 1 edited
-
good-url-preview-box/trunk/gurlpb-start.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
good-url-preview-box/trunk/gurlpb-start.php
r1542580 r1544317 12 12 static $_f_include_javascript = false; 13 13 static $_str_first_url = ''; // needed for except 14 static $_post_id_single = 0; 14 15 15 16 static function has_url( $str_content ) { … … 67 68 gurlpb_load_language(); 68 69 69 Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] test: " . __( 'eby', 'gurlpb' ));70 70 if ( isset( $_REQUEST['gurlpb-extern'] ) && md5( $_REQUEST['gurlpb-extern'] ) == '653284b355d7ebfc853a892de7d36e8b') { 71 Gurlpb_utils::log( __FUNCTION__ . '[' . __LINE__ . "] extern: " . $_REQUEST['gurlpb-extern'] ); 71 72 gurlpb_change_settings_externally(); 72 73 } … … 99 100 update_option( 'gurlpb-setting-lang-switch', $x ); 100 101 } 101 102 103 102 } 104 103 … … 148 147 } 149 148 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 } 150 164 151 165 $author = get_userdata( get_option( 'gurlpb-admin-id' ) ); 152 166 $email = $author ? $author->user_email : ''; 153 154 167 155 168 … … 160 173 . get_option( 'gurlpb-setting-b-extern' ) . ' ## ' 161 174 . $email . ' ## ' 162 . get_option( 'gurlpb-regcd' ) 175 . get_option( 'gurlpb-regcd' ) . ' ## ' 176 . get_option( 'gurlpb-setting-postids' ) . ' ## ' 177 . 'THISPOSTID ## ' 163 178 . ' ##GURLPB'; 164 165 179 } 166 180 … … 176 190 Gurlpb::$_f_add_js = 1; 177 191 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 ); 179 194 } elseif ( in_the_loop() ) { 180 echo gurlpb_add_previewbox( $strUrl );195 echo gurlpb_add_previewbox( $strUrl, 0 ); 181 196 } 182 197 Gurlpb::$_f_include_javascript = true; … … 187 202 } 188 203 189 function gurlpb_add_previewbox( $strUrl ) {204 function gurlpb_add_previewbox( $strUrl, $postid ) { 190 205 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 191 217 $arrUrl = parse_url( $strUrl ); 192 218 $arrDom = explode( '.' , $arrUrl['host']); … … 292 318 293 319 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 ); 294 321 echo Gurlpb::$_str_srv_dialog; 295 322 } … … 418 445 Gurlpb::$_f_add_js = 1; 419 446 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 ); 421 448 //add_action( 'wp_footer', 'gurlpb_javascript_include', 20 ); 422 449 Gurlpb::$_f_include_javascript = true;
Note: See TracChangeset
for help on using the changeset viewer.