---
title: "移植了两个wordpress的插件"
author: "atomoptics"
date: "2006-02-25T16:16:49Z"
tags: []
slug: "wordpress"
draft: false
lastmod: "2006-02-25T16:16:49Z"
id: 163071
url: "https://atomoptics.iteye.com/blog/163071"
---

Coolcode.cn上有两个很不错的wordpress插件，CoolPlayer和CoolCode。其中coolcode可以只使用php就可以给很多常见的编程语言加亮，coolplayer更是能在几乎所有的浏览器(支持flash)，windows，linux上播放多媒体文件。虽然drupal上也有提供以上两个功能的模块，但是语法加亮要perl模块，播放多媒体文件更是要求浏览器装插件，很是不便。于是花了些时间把这两个插件一起移植到drupal上了。

闲言少叙，看看成果。CoolPlayer的信息栏对齐还有点问题,除非不使用换行器。Click on "1 2 3" to switch different media
1 2 3 4 Loading...
Coofilter的coolcode暂时还不支持download功能，所以把linenum默认给off了
Download Code: ppmBar.h#ifndef PPMBAR_H
#define PPMBAR_H
#include &quot;ppm.h&quot;
struct seNode{int se;int lab;};&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; //lab=0 噪声,1边缘 2拐点
using&nbsp;namespace std;
class ppmBar{
public:
&nbsp; &nbsp; &nbsp; &nbsp; ppmBar(ppm *ppmImg);
&nbsp; &nbsp; &nbsp; &nbsp; ~ppmBar();
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;init(float p);
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;findStart(int tBGw,int tBmin,int tWmax);
&nbsp; &nbsp; &nbsp; &nbsp; void&nbsp;displayStartEnd(int l);
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;classify();
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;findClassP(seNode* n,int x,int m); //m=-1 向前找，1 向后 ，x起始点
int findClassLabP(seNode* n,int x,int m,int lab); //m=-1
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;calculateLineK();
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;readBarCode(BYTE* line,int num,int Wmin);
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;getEAN(char *jg);
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;check();
bool tryReadBarCode(int Wmin);
bool tryPReadBarCode(int w);
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp;getEan13_1(int *oodd);
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;odd(int w1,int w2,int w3,int w4);
//&nbsp; &nbsp; &nbsp; void rotate(double d); //用 endx，y&nbsp; kEnd参考
//-----------------------------------------------&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; ppm* img;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;lineNum;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;start1,start2,start3;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;end1,end2,end3;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;startEndNum;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;yuzi;&nbsp; &nbsp; &nbsp;&nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp;N;
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;ean13;
&nbsp; &nbsp; &nbsp; &nbsp; struct&nbsp;seNode *startx,*starty,*endx,*endy;
&nbsp; &nbsp; &nbsp; &nbsp; double&nbsp;kStart,kEnd;
private:
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;isBW(BYTE* line ,int numMax,int bwMin);
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;findDiff(BYTE* line);
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;isBeginEnd(BYTE* line ,int numMax,int bwMin,int* lab);
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;countBW(BYTE* line);
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp;getNum(int w1,int w2,int w3,int w4);
&nbsp; &nbsp; &nbsp; };
&nbsp;
#endif&nbsp;/* PPMBAR_H */

目前只在drupal4.7上测试过。