source: trunk/www.guidonia.net/wp/wp-content/plugins/minimax/minimax.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 2.1 KB
Line 
1<?php
2
3/*
4Plugin Name: minimax
5Version: 0.2.5
6Plugin URI: http://www.sebaxtian.com/acerca-de/minimax
7Description: Minimax is a minimal ajax library.
8Author: Juan Sebastián Echeverry
9Author URI: http://www.sebaxtian.com/
10*/
11
12/* Copyright 2008-2009 Juan Sebastián Echeverry (email : sebaxtian@gawab.com)
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27*/
28
29add_action('admin_head', 'minimax_header');
30add_action('wp_head', 'minimax_header');
31
32
33/**
34 * Function to add scripts into headers
35 *
36 * @access public
37 */
38
39function minimax_header() {
40 $dir_name = '/wp-content/plugins/minimax';
41 $url=get_bloginfo('wpurl');
42 $script= $url . $dir_name . "/scripts/minimax.js";
43 echo "\n<script type='text/javascript' src='$script'></script>";
44}
45
46
47/**
48 * Function to determine if minimax has been activated.
49 *
50 * @access public
51 */
52
53function minimax() {
54 return true;
55}
56
57
58/**
59* Function to determine minimax version.
60*
61* @access public
62*/
63
64function minimax_version() {
65 return 0.2;
66}
67
68
69/**
70* A kind of readfile function to determine if use Curl or fopen.
71*
72* @access public
73* @param string filename URI of the File to open
74* @return The content of the file
75*/
76function mnmx_readfile($filename)
77{
78 $data=false;
79 if(function_exists(curl_init)) {
80 $ch = curl_init($filename);
81 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
82 curl_setopt($ch, CURLOPT_HEADER, 0);
83 $data=curl_exec($ch);
84 curl_close($ch);
85 } else {
86 if($fop = @fopen($filename, 'r')) {
87 $data = null;
88 while(!feof($fop))
89 $data .= fread($fop, 1024);
90 fclose($fop);
91 }
92 }
93 return $data;
94}
95
96?>
Note: See TracBrowser for help on using the repository browser.