WordPress awtomatikong i-save ang mga malayuan larawan (i-update ang 2.5)

Pebrero 12, 2008

Suporta para sa version 2.5 at wordpress2.3.3 download Address: http://www.01on.com/auto-save-image.rar
Orihinal na link: Wordpress sumulat awtomatikong mag-log-save malayuan larawan ng plug-in

Ang network ay mas patok老鬼kaugalian. Ako ay may batayan sa kanyang sagot na sa pinakabagong bersyon ay gumawa ng ilang mga pagbabago.

Auto-save malayuan larawan binago tulad ng sumusunod:

1, sa linya wp-admin/edit-form-advanced.php 167

HTML code:


<span id="autosave"> </ span>


HTML code sa likod ng mga dagdagan:


I-save ang pic: <input type="checkbox" name="savepic" value="checked" />


2, baguhin wp-admin/post.php, ang No. 7 linya ng code na PHP:


wp_reset_vars (array ( 'action', 'safe_mode', 'withcomments',' post ',

'Content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url',

excerpt ',' showcomments', 'commentstart', 'commentend', 'commentorder'));


Nagbago

PHP Code:


wp_reset_vars (array ( 'action', 'safe_mode', 'withcomments',' post ',' nilalaman ',

edited_post_title ',' comment_error ',' profile ',' trackback_url ',' excerpt ',' showcomments',

'Commentstart', 'commentend', 'commentorder', 'savepic'));



3, sa simula ng wp-admin/includes/post.php nadagdagan PHP code:


function bukas ($ file, $ type = ") (
global $ fromurl, $ referer;
$ Cachename = $ file;
kung ($ uri) (
$ File = $ fromurl .'/'.$ uri .'/'.$ file;
) Sino pa ang paririto (
$ File = $ fromurl. $ File;
)
kung ($ bukas = file ($ file)) (
$ Count = count ($ bukas);
para sa ($ i = 0; $ i <$ count; $ i + +) (
$ Theget .= $ bukas [$ i];
)
) Sino pa ang paririto (
mamatay ( 'kahilingan labis na obertaym, paki-refresh');
)
return $ theget;
)

function cut ($ file, mula sa $, $ dulo) (

$ Message = sumabog ($ mula, $ file);
$ Message = sumabog ($ dulo, $ mensahe [1]);
return $ mensahe [0];
)
function dhtmlspecialchars ($ string) (
kung (is_array ($ string)) (
foreach ($ string na $ key => $ Val) (
$ String [$ key] = dhtmlspecialchars ($ Val);
)
) Iba Pa (
$ String = str_replace ('&', '&', $ string);
$ String = str_replace ('"', ' "', $ string);
$ String = str_replace ('<', '<', $ string);
$ String = str_replace ('>', '>', $ string);
$ String = preg_replace ('/&(# d ;)/', '& 1', $ string);
)
return $ string;
)
function random ($ haba) (
$ Hash = ";
$ Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$ Max = strlen ($ chars) - 1;
mt_srand ((double) microtime () * 1000000);
para sa ($ i = 0; $ i <$ haba; $ i + +) (
$ Hash .= $ chars [mt_rand (0, $ max)];
)
return $ hash;
)

function mkdirs ($ dir)
(
kung (! is_dir ($ dir))
(
mkdirs (dirname ($ dir));
mkdir ($ dir);
)
bumalik;
)


Muli sa code na PHP:


$ _POST [ 'Post_content'] = $ _POST [ 'nilalaman'];


Sa likod ng idagdag ang sumusunod na code:
Tandaan na ang code sa itaas ay may dalawang mga lugar, ang unang pagbabago at ang huli ay idinagdag. Kung ikaw ay nagdadagdag ng mga tampok na idinagdag sa huling taasan, kung ang pagbabago ay dapat taasan, ito rin ay idinagdag sa harap ng mga ito . PHP code:


kung ($ _POST [ 'savepic']==" checked ") (
/ / Simulan upang i-save ang pic;
$ Img_array = array ();
$ Content1 = stripslashes ($ _POST [ 'post_content']);
kung (get_magic_quotes_gpc ()) $ content1 = stripslashes ($ content1);
/ / Echo $ content1; / / artikulong nilalaman嘿嘿magsimula sa pakikitungo sa mga
preg_match_all ( "/ (src | SRC tungo) =" (http:// (.+).( gif | jpg | jpeg | bmp | png)) / isU ", $ content1, $ img_array); / / ay, ay sinimulan upang tumugma sa Idagdag ang lahat ng mga imahe at data
$ Img_array = array_unique (dhtmlspecialchars ($ img_array [2]));

print_r ($ img_array);
set_time_limit (0);

foreach ($ img_array bilang $ key => $ halaga) (
$ Get_file = file_get_contents ($ halaga); / / sa simula ng pag-access sa larawan ang oh
$ Filetime = oras ();
$ Filepath = "../wp-content/uploads/pic2 /". Petsa ( "Y", $ filetime )."/". petsa ( "m", $ filetime )."/";// larawan na-save direktoryo ng landas
! Is_dir ($ filepath)? Mkdirs ($ filepath): null;
$ Filename = petsa ( "YmdHis", $ filetime). Random (1 ).'.'. substr ($ halaga, -3,3);
$ Fp = @ fopen ($ filepath. $ Filename, "w");
@ Fwrite ($ fp, $ get_file);
fclose ($ fp); / / natapos, Kazakhstan
$ Content1 = preg_replace ("/". addcslashes ($ halaga ,"/")."/ isU "," / wp-content/uploads/pic2 / ". Petsa (" Y ", $ filetime )."/". petsa ( "m", $ filetime )."/".$ filename, $ content1); / / ang paraan para palitan ang ilan sa mga larawan sa loob ng mga artikulo ng mga address

)

$ _POST [ 'Post_content'] = AddSlashes ($ content1); / /老鬼mas lumang mga bersyon ay hindi nagkaroon ng ganitong proseso upang makatakas pagkakamali

/ / End-save ng pic;
)


Tapos na. Ngayon, ikaw wrote, ang submit button sa tabi ng isa pang opsyon upang piliin ang "i-save ang pic", ang isa pang punto ng "publish", maaari mong i-save ang isang malayuan larawan. Suma-up, ito ay kinakailangan upang baguhin ang mga dokumento: wp-admin/edit-form-advanced.php
wp-admin/post.php
wp-admin/includes/post.php

Tandaan: Upang buksan ang isang PHP.INI ang output_buffering at allow_url_fopen

Mula: http://www.rongdede.com/archives/16.html

WordPress

  1. Sa 0:13 sa Pebrero 19, 2008 | # 1

    I-click ang mga paborito ~

  2. Sa 9:09 noong Hunyo 21, 2008 | # 2

    Ang bagay na ito ay hindi na ito nai-post ng isang mapanirang object! !

  3. Sa 9:40 noong Hunyo 21, 2008 | # 3
  1. Walang Trackbacks at pingbacks.