1 | <?php |
---|
2 | /** |
---|
3 | * @author Nicolas Frandeboeuf <nicofrand@gmail.com> |
---|
4 | * @version 1.0.1 |
---|
5 | * @package feed2img |
---|
6 | */ |
---|
7 | |
---|
8 | if (!defined("DC_CONTEXT_ADMIN")) |
---|
9 | return; |
---|
10 | |
---|
11 | // We read the plugin version |
---|
12 | $m_version = $core->plugins->moduleInfo("feed2img", "version"); |
---|
13 | |
---|
14 | // We read the plugin version from the version database table |
---|
15 | $i_version = $core->getVersion("feed2img"); |
---|
16 | |
---|
17 | /** |
---|
18 | * If the db version is greater or equals the module version, then the plugin |
---|
19 | * is already installed and up to date. |
---|
20 | */ |
---|
21 | if (version_compare($i_version,$m_version, ">=")) |
---|
22 | return; |
---|
23 | |
---|
24 | // Load translations of alert messages |
---|
25 | $_lang = $core->auth->getInfo("user_lang"); |
---|
26 | $_lang = preg_match("/^[a-z]{2}(-[a-z]{2})?$/", $_lang) ? $_lang : "en"; |
---|
27 | l10n::set(dirname(__FILE__)."/locales/".$_lang."/admin"); |
---|
28 | |
---|
29 | if (version_compare(DC_VERSION, "2.3.1", "<")) |
---|
30 | throw new Exception('Feed2img requires Dotclear 2.3.1 or greater'); |
---|
31 | |
---|
32 | // Create the workspace |
---|
33 | $core->auth->user_prefs->addWorkSpace('feed2img'); |
---|
34 | |
---|
35 | // Register the plugin preferences in the workspace |
---|
36 | $core->auth->user_prefs->feed2img->put("show_blog_title", true, "boolean", __("Print the blog's title")); |
---|
37 | $core->auth->user_prefs->feed2img->put("number_of_posts", '3', "integer", __("Number of Posts")); |
---|
38 | $core->auth->user_prefs->feed2img->put("max_chars_by_line", "80", "integer", __("Maximum number of chars by line")); |
---|
39 | $core->auth->user_prefs->feed2img->put("title_font_size", "13", "float", __("Title's font size")); |
---|
40 | $core->auth->user_prefs->feed2img->put("title_x", "9", "integer", __("Title position in pixels from left")); |
---|
41 | $core->auth->user_prefs->feed2img->put("title_y", "21", "integer", __("Title position in pixels from top")); |
---|
42 | $core->auth->user_prefs->feed2img->put("title_color", '#1a2d52', 'string', __("Title color")); |
---|
43 | $core->auth->user_prefs->feed2img->put("text_font_size", "10", "float", __("Text font size")); |
---|
44 | $core->auth->user_prefs->feed2img->put("text_color", '#43403e', "string", __("Text color")); |
---|
45 | $core->auth->user_prefs->feed2img->put("text_x", "43", "integer", __("Text position in pixels from left")); |
---|
46 | $core->auth->user_prefs->feed2img->put("text_y", "44", "integer", __("Text position in pixels from top")); |
---|
47 | $core->auth->user_prefs->feed2img->put("line_height", "23", "float", __("Line height")); |
---|
48 | $core->auth->user_prefs->feed2img->put("image_source", "", "string", __("Source image name in public directory. Let it empty to use the default image")); |
---|
49 | $core->auth->user_prefs->feed2img->put("image_output", "feed2img_output.png", "string", __("Output image name in public directory")); |
---|
50 | $core->auth->user_prefs->feed2img->put("font", "", "string", __("Font name (only .ttf) in public directory. Let it empty to use the default font")); |
---|
51 | |
---|
52 | $public_dir = path::real(path::fullFromRoot($core->blog->settings->public_path, DC_ROOT), false); |
---|
53 | |
---|
54 | if (!is_file($public_dir."/feed2img_output.png")) |
---|
55 | { |
---|
56 | require_once(dirname(__FILE__)."/inc/class.feed2img.php"); |
---|
57 | $entriesSelection = new EntriesSelection(); |
---|
58 | $entriesSelection->install(); |
---|
59 | } |
---|
60 | |
---|
61 | $core->setVersion("feed2img", $m_version); |
---|
62 | ?> |
---|