ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Programmingจะ config adsense deluxe ยังไงครับ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: จะ config adsense deluxe ยังไงครับ  (อ่าน 1976 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
windandsea
Newbie
*

พลังน้ำใจ: 0
ออฟไลน์ ออฟไลน์

กระทู้: 35



ดูรายละเอียด
« เมื่อ: 05 พฤษภาคม 2007, 13:07:18 »

ผมลงแล้วตาม http://www.basicstep.net/wordp...sense-deluxe-wordpress-plugin/ พอจะอัพเดตตัวแอดเซนต์โค๊ดใน adsense deluxe แล้วมันขึ้น Cannot load adsense-deluxe.php.
ไป chmod ใหม่ก็ยังเหมือนเดิม
บันทึกการเข้า
windandsea
Newbie
*

พลังน้ำใจ: 0
ออฟไลน์ ออฟไลน์

กระทู้: 35



ดูรายละเอียด
« ตอบ #1 เมื่อ: 05 พฤษภาคม 2007, 13:15:47 »

ตรงข้อ 14 - 16
โค๊ด:
14. หาบรรทัดนี้ (ประมาณบรรทัดที่ 98)
$plugins = apply_filters(’mce_plugins’, array(’wordpress’, ‘autosave’, ‘wphelp’));



เพิ่มคำว่า ‘adsense_deluxe’ ลงไป แบบนี้

$plugins = apply_filters(’mce_plugins’, array(’wordpress’, ‘autosave’, ‘wphelp’, ‘adsense_deluxe’));



15. เลื่อนลงมาที่ บรรทัดราวๆ 129 หาบรรทัดนี้
$mce_buttons_2 = apply_filters(’mce_buttons_2′, array());



เติมคำว่า ‘adsense_deluxe’ ลงไปใน array แบบนี้ (ให้เพิ่มบรรทัดนี้จะได้ขึ้นบรรทัดใหม่ใน editor จะได้ไม่สับสน)
$mce_buttons_2 = apply_filters(’mce_buttons_2′, array(’adsense_deluxe’));



16. Save แล้วก็ upload file นี้ทับไปที่เดิม
ผมหา code ไม่เจอล่ะครับ ต้องไปแก้ตรงไหนครับ
โค๊ด:
<?php
/**
 * $RCSfile&#58; tiny_mce_gzip.php,v $
 * $Revision&#58; $
 * $Date&#58; $
 *
 * @version 1.08
 * @author Moxiecode
 * @copyright Copyright  2005-2006, Moxiecode Systems AB, All rights reserved.
 *
 * This file compresses the TinyMCE JavaScript using GZip and
 * enables the browser to do two requests instead of one for each .js file.
 * Notice&#58; This script defaults the button_tile_map option to true for extra performance.
 */

@require_once&#40;'../../../wp-config.php'&#41;;

// gzip_compression&#40;&#41;;

function wp_tinymce_lang&#40;$path&#41; &#123;
global $language;

$text '';

// Look for xx_YY.js, xx_yy.js, xx.js
$file realpath&#40;sprintf&#40;$path, $language&#41;&#41;;
if &#40; file_exists&#40;$file&#41; &#41;
$text file_get_contents&#40;$file&#41;;
$file realpath&#40;sprintf&#40;$path, strtolower&#40;$language&#41;&#41;&#41;;
if &#40; file_exists&#40;$file&#41; &#41;
$text file_get_contents&#40;$file&#41;;
$file realpath&#40;sprintf&#40;$path, substr&#40;$language, 0, 2&#41;&#41;&#41;;
if &#40; file_exists&#40;$file&#41; &#41;
$text file_get_contents&#40;$file&#41;;


// Fall back on en.js
$file realpath&#40;sprintf&#40;$path, 'en'&#41;&#41;;
if &#40; empty&#40;$text&#41; && file_exists&#40;$file&#41; &#41;
$text file_get_contents&#40;$file&#41;;

// Send lang file through gettext
if &#40; function_exists&#40;'__'&#41; && strtolower&#40;substr&#40;$language, 0, 2&#41;&#41; != 'en' &#41; &#123;
$search1 "/^tinyMCELang\\[&#40;['\"&#93;&#41;&#40;.*&#41;\\1\&#93;&#40; ?= ?&#41;&#40;['\"&#93;&#41;&#40;.*&#41;\\4/Uem";
$replace1 "'tinyMCELang[\\1\\2\\1&#93;\\3'.stripslashes&#40;'\\4'&#41;.__&#40;'\\5'&#41;.stripslashes&#40;'\\4'&#41;";

$search2 "/\\s&#58;\\s&#40;['\"&#93;&#41;&#40;.*&#41;\\1&#40;,|\\s*&#125;&#41;/Uem";
$replace2 "' &#58; '.stripslashes&#40;'\\1'&#41;.__&#40;'\\2'&#41;.stripslashes&#40;'\\1'&#41;.'\\3'";

$search = array&#40;$search1, $search2&#41;;
$replace = array&#40;$replace1, $replace2&#41;;

$text preg_replace&#40;$search, $replace, $text&#41;;

return $text;
&#125;

return $text;
&
#125;

function wp_compact_tinymce_js&#40;$text&#41; &#123;
// This function was custom-made for TinyMCE 2.0, not expected to work with any other JS.

// Strip comments
$text preg_replace&#40;"!&#40;^|\s+&#41;//.*$!m", '', $text&#41;;
$text preg_replace&#40;"!/\*.*?\*/!s", '', $text&#41;;

// Strip leading tabs, carriage returns and unnecessary line breaks.
$text preg_replace&#40;"!^\t+!m", '', $text&#41;;
$text str_replace&#40;"\r", '', $text&#41;;
$text preg_replace&#40;"!&#40;^|&#123;|&#125;|;|&#58;|\&#41;&#41;\n!m", '\\1', $text&#41;;

return "$text\n";
&
#125;


// General options
$suffix ""; // Set to "_src" to use source version
$expiresOffset 3600 24 10; // 10 days util client cache expires
$diskCache false; // If you enable this option gzip files will be cached on disk.
$cacheDir realpath&#40;"."&#41;; // Absolute directory path to where cached gz files will be stored
$debug false; // Enable this option if you need debuging info

// Headers
header&#40;"Content-Type&#58; text/javascript; charset=" . get_bloginfo&#40;'charset'&#41;&#41;;
// header&#40;"Cache-Control&#58; must-revalidate"&#41;;
header&#40;"Vary&#58; Accept-Encoding"&#41;; // Handle proxies
header&#40;"Expires&#58; " . gmdate&#40;"D, d M Y H&#58;i&#58;s", time&#40;&#41; + $expiresOffset&#41; . " GMT"&#41;;

// Get data to load
$theme = isset&#40;$_GET['theme'&#93;&#41; ? TinyMCE_cleanInput&#40;$_GET['theme'&#93;&#41; &#58; "";
$language = isset&#40;$_GET['language'&#93;&#41; ? TinyMCE_cleanInput&#40;$_GET['language'&#93;&#41; &#58; "";
$plugins = isset&#40;$_GET['plugins'&#93;&#41; ? TinyMCE_cleanInput&#40;$_GET['plugins'&#93;&#41; &#58; "";
$lang = isset&#40;$_GET['lang'&#93;&#41; ? TinyMCE_cleanInput&#40;$_GET['lang'&#93;&#41; &#58; "en";
$index = isset&#40;$_GET['index'&#93;&#41; ? TinyMCE_cleanInput&#40;$_GET['index'&#93;&#41; &#58; -1;
$cacheKey md5&#40;$theme . $language . $plugins . $lang . $index . $debug&#41;;
$cacheFile $cacheDir == "" "" &#58; $cacheDir . "/" . "tinymce_" .  $cacheKey . ".gz";
$cacheData "";

// Patch older versions of PHP < 4.3.0
if &#40;!function_exists&#40;'file_get_contents'&#41;&#41; &#123;
function file_get_contents&#40;$filename&#41; &#123;
$fd fopen&#40;$filename, 'rb'&#41;;
$content fread&#40;$fd, filesize&#40;$filename&#41;&#41;;
fclose&#40;$fd&#41;;
return $content;
&#125;
&#125;

// Security check function, can only contain a-z 0-9 , _ - and whitespace.
function TinyMCE_cleanInput&#40;$str&#41; &#123;
return preg_replace&#40;"/[^0-9a-z\-_,&#93;+/i", "", $str&#41;; // Remove anything but 0-9,a-z,-_
&#125;

function TinyMCE_echo&#40;$str&#41; &#123;
global $cacheData$diskCache;

if &#40;$diskCache&#41;
$cacheData .= $str;
else
echo $str;
&
#125;

// Only gzip the contents if clients and server support it
$encodings = array&#40;&#41;;

if &#40;isset&#40;$_SERVER['HTTP_ACCEPT_ENCODING'&#93;&#41;&#41;
$encodings explode&#40;',', strtolower&#40;preg_replace&#40;"/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'&#93;&#41;&#41;&#41;;

// Check for gzip header or northon internet securities
if &#40;&#40;in_array&#40;'gzip', $encodings&#41; || in_array&#40;'x-gzip', $encodings&#41; || isset&#40;$_SERVER['---------------'&#93;&#41;&#41; && function_exists&#40;'ob_gzhandler'&#41; && !ini_get&#40;'zlib.output_compression'&#41;&#41; &#123;
$enc in_array&#40;'x-gzip', $encodings&#41; ? "x-gzip" &#58; "gzip";

// Use cached file if it exists but not in debug mode
if &#40;file_exists&#40;$cacheFile&#41; && !$debug&#41; &#123;
header&#40;"Content-Encoding&#58; " . $enc&#41;;
echo file_get_contents&#40;$cacheFile&#41;;
die;
&#125;

if &#40;!$diskCache&#41;
ob_start&#40;"ob_gzhandler"&#41;;
&#125; else
$diskCache false;

if &
#40;$index > -1&#41; &#123;
// Write main script and patch some things
if &#40;$index == 0&#41; &#123;
TinyMCE_echo&#40;wp_compact_tinymce_js&#40;file_get_contents&#40;realpath&#40;"tiny_mce" . $suffix . ".js"&#41;&#41;&#41;&#41;; // WP
TinyMCE_echo&#40;'TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'&#41;;
TinyMCE_echo&#40;'TinyMCE.prototype.loadScript = function&#40;&#41; &#123;&#125;;var realTinyMCE = tinyMCE;'&#41;;
&#125; else
TinyMCE_echo&#40;'tinyMCE = realTinyMCE;'&#41;;

// Do init based on index
TinyMCE_echo&#40;"tinyMCE.init&#40;tinyMCECompressed.configs[" . $index . "&#93;&#41;;"&#41;;

// Load external plugins
if &#40;$index == 0&#41;
TinyMCE_echo&#40;"tinyMCECompressed.loadPlugins&#40;&#41;;"&#41;;

// Load theme, language pack and theme language packs
if &#40;$theme&#41; &#123;
TinyMCE_echo&#40;wp_compact_tinymce_js&#40;file_get_contents&#40;realpath&#40;"themes/" . $theme . "/editor_template" . $suffix . ".js"&#41;&#41;&#41;&#41;; // WP
TinyMCE_echo&#40;wp_tinymce_lang&#40;"themes/" . $theme . "/langs/%s.js"&#41;&#41;; // WP
&#125;

/* WP if &#40;$language&#41; WP */
TinyMCE_echo&#40;wp_tinymce_lang&#40;"langs/%s.js"&#41;&#41;; // WP

// Load all plugins and their language packs
$plugins explode&#40;",", $plugins&#41;;
foreach &#40;$plugins as $plugin&#41; &#123;
$pluginFile realpath&#40;"plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"&#41;;
/* WP $languageFile = realpath&#40;"plugins/" . $plugin . "/langs/" . $lang . ".js"&#41;; WP */

if &#40;$pluginFile&#41;
TinyMCE_echo&#40;file_get_contents&#40;$pluginFile&#41;&#41;;

/* WP if &#40;$languageFile&#41; WP */
TinyMCE_echo&#40;wp_tinymce_lang&#40;"plugins/" . $plugin . "/langs/%s.js"&#41;&#41;; // WP
&#125;

// Reset tinyMCE compressor engine
TinyMCE_echo&#40;"tinyMCE = tinyMCECompressed;"&#41;;

// Write to cache
if &#40;$diskCache&#41; &#123;
// Calculate compression ratio and debug target output path
if &#40;$debug&#41; &#123;
$ratio round&#40;100 - strlen&#40;gzencode&#40;$cacheData, 9, FORCE_GZIP&#41;&#41; / strlen&#40;$cacheData&#41; * 100.0&#41;;
TinyMCE_echo&#40;"alert&#40;'TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file&#58; " . $cacheFile . "'&#41;;"&#41;;
&#125;

$cacheData gzencode&#40;$cacheData, 9, FORCE_GZIP&#41;;

// Write to file if possible
$fp = @fopen&#40;$cacheFile, "wb"&#41;;
if &#40;$fp&#41; &#123;
fwrite&#40;$fp, $cacheData&#41;;
fclose&#40;$fp&#41;;
&#125;

// Output
header&#40;"Content-Encoding&#58; " . $enc&#41;;
echo $cacheData;
&#125;

die;
&
#125;
?>


function TinyMCECompressed() {
this.configs = new Array();
this.loadedFiles = new Array();
this.externalPlugins = new Array();
this.loadAdded = false;
this.isLoaded = false;
}

TinyMCECompressed.prototype.init = function(settings) {
var elements = document.getElementsByTagName('script');
var scriptURL = "";

for (var i=0; i<elements.length; i++) {
if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
scriptURL = elements[i].src;
break;
}
}

settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
this.configs[this.configs.length] = settings;
this.settings = settings;

scriptURL += (scriptURL.indexOf('?') == -1) ? '?' : '&';
scriptURL += "theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');

if (!this.loadAdded) {
tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
this.loadAdded = true;
}
}

TinyMCECompressed.prototype.onLoad = function() {
if (tinyMCE.isLoaded)
return true;

tinyMCE = realTinyMCE;
TinyMCE_Engine.prototype.onLoad();
tinyMCE._addUnloadEvents();

tinyMCE.isLoaded = true;
}

TinyMCECompressed.prototype.addEvent = function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
}

TinyMCECompressed.prototype.getOnce = function(str) {
var ar = str.replace(/\s+/g, '').split(',');

for (var i=0; i<ar.length; i++) {
if (ar[i] == '' || ar[i].charAt(0) == '-') {
ar[i] = null;
continue;
}

// Skip load
for (var x=0; x<this.loadedFiles.length; x++) {
if (this.loadedFiles[x] == ar[i])
ar[i] = null;
}

this.loadedFiles[this.loadedFiles.length] = ar[i];
}

// Glue
str = "";
for (var i=0; i<ar.length; i++) {
if (ar[i] == null)
continue;

str += ar[i];

if (i != ar.length-1)
str += ",";
}

return str;
};

TinyMCECompressed.prototype.loadPlugins = function() {
var i, ar;

TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
tinyMCE = realTinyMCE;

ar = tinyMCECompressed.externalPlugins;
for (i=0; i<ar.length; i++)
tinyMCE.loadPlugin(ar[i].name, ar[i].url);

TinyMCE.prototype.loadScript = function() {};
};

TinyMCECompressed.prototype.loadPlugin = function(n, u) {
this.externalPlugins[this.externalPlugins.length] = {name : n, url : u};
};

TinyMCECompressed.prototype.importPluginLanguagePack = function(n, v) {
tinyMCE = realTinyMCE;
TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
tinyMCE.importPluginLanguagePack(n, v);
};

TinyMCECompressed.prototype.addPlugin = function(n, p) {
tinyMCE = realTinyMCE;
tinyMCE.addPlugin(n, p);
};

var tinyMCE = new TinyMCECompressed();
var tinyMCECompressed = tinyMCE;
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
พิมพ์