Pastes (Displaying 1 through 9 of 9)
-
(View)
Planet WP-Fr by Amaury posted on
Aug 26, 2008 at 11:28PM
Tags: WordPress Francophone1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
<?php /* Plugin Name: Planet Fr Plugin URI: http://www.wordpress-fr.net/planet/ Description: Cette extension permet de remplacer le bloc "Autres actualités de WordPress" du tableau de bord par l'actualité francophone du Planet. Version: 1.0 Author: Amaury Balmer Author URI: http://wp-box.fr --- Copyright 2008 Amaury BALMER (balmer.amaury@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ if (is_admin ()) { function planet_fr_link($link = '') { return 'http://www.wordpress-fr.net/planet/'; } add_filter ( 'dashboard_secondary_link', 'planet_fr_link' ); function planet_fr_feed($feed = '') { return 'http://www.wordpress-fr.net/planet/?type=rss10'; } add_filter ( 'dashboard_secondary_feed', 'planet_fr_feed' ); function planet_fr_title($name = '') { return 'Autres actualités francophones de WordPress'; } add_filter ( 'dashboard_secondary_title', 'planet_fr_title' ); } function delete_planet_us() { $widget_options = get_option ( 'dashboard_widget_options' ); if (isset ( $widget_options ['dashboard_secondary'] )) { unset ( $widget_options ['dashboard_secondary'] ); update_option ( 'dashboard_widget_options', $widget_options ); } } register_activation_hook ( __FILE__, 'delete_planet_us' ); ?>
-
(View)
test by test posted on
Aug 10, 2008 at 08:10PM
-
(View)
Test Paste by Me posted on
Jul 14, 2008 at 02:27AM
-
(View)
Test by Nick posted on
Jun 25, 2008 at 12:53AM
-
(View)
execit by fbrubacher posted on
May 27, 2008 at 04:01PM
Tags: zip1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
protected static int ExecIt(String app, String args) { ToLog(" Executing: " + app + " " + args); string CurrentPath = Environment.GetEnvironmentVariable("PATH"); int iResultCode = -1; try { Process process1 = new Process(); process1.StartInfo.FileName = app; process1.StartInfo.Arguments = args; process1.StartInfo.UseShellExecute = false; process1.StartInfo.EnvironmentVariables.Remove("HOME"); process1.StartInfo.EnvironmentVariables.Remove("USERNAME"); process1.StartInfo.EnvironmentVariables.Remove("PATH"); process1.StartInfo.EnvironmentVariables.Add("HOME", RsyncPath); process1.StartInfo.EnvironmentVariables.Add("USERNAME", "mpibackup"); process1.StartInfo.EnvironmentVariables.Add("PATH", RsyncPath + ";" + CurrentPath); process1.Start(); process1.WaitForExit(ExecItTimeOut); if (!process1.HasExited) { process1.CloseMainWindow(); System.Threading.Thread.Sleep(RsyncSleepMilliseconds); process1.Kill(); ToLog(" Killed:" + app + ". Returning -1 as exit code."); } else { iResultCode = process1.ExitCode; ToLog(" ExecIt Completed with a completion code of " + iResultCode); } } catch (Exception e) { ToLog("ERROR: ExecIt: " + e.ToString()); } return iResultCode; }
-
(View)
zip backs by fbrubacher posted on
May 27, 2008 at 03:56PM
Tags: zip1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
private void ZipBaks() { try { // Make sure directories exist if (!Directory.Exists(BakPath)) Directory.CreateDirectory(BakPath); if (!Directory.Exists(BakZipPath)) Directory.CreateDirectory(BakZipPath); // Clean up old zip files string[] bakfiles = Directory.GetFiles(BakPath, "*" + BakExtension); string[] bakzipfiles = Directory.GetFiles(BakZipPath, "*" + ZipExtension); foreach (string bakzipfile in bakzipfiles) { string bakzipfilename = bakzipfile.Substring(bakzipfile.LastIndexOf(@"\") + 1); string bakfilename = bakzipfilename.Substring(0, bakzipfilename.LastIndexOf('.')); if (!File.Exists(BakPath + @"\" + bakfilename)) { ToLog("Deleting Zip File: " + bakzipfile); File.Delete(bakzipfile); } } // Create new zip files as necssary foreach (string bakfile in bakfiles) { string ZipFile = BakZipPath + @"\" + bakfile.Substring(bakfile.LastIndexOf(@"\") + 1) + ZipExtension; if (!File.Exists(ZipFile)) { ToLog("Creating Zip File: " + ZipFile); using (ZipOutputStream s = new ZipOutputStream(File.Create(ZipFile))) { s.SetLevel(9); // 0 - store only to 9 - means best compression byte[] buffer = new byte[4096]; // Using GetFileName makes the result compatible with XP // as the resulting path is not absolute. ZipEntry entry = new ZipEntry(Path.GetFileName(bakfile)); // Setup the entry data as required. // Crc and size are handled by the library for seakable streams // so no need to do them here. // Could also use the last write time or similar for the file. entry.DateTime = DateTime.Now; s.PutNextEntry(entry); using (FileStream fs = File.OpenRead(bakfile)) { // Using a fixed size buffer here makes no noticeable difference for output // but keeps a lid on memory usage. int sourceBytes; do { sourceBytes = fs.Read(buffer, 0, buffer.Length); s.Write(buffer, 0, sourceBytes); } while (sourceBytes > 0); } // Finish/Close arent needed strictly as the using statement does this automatically // Finish is important to ensure trailing information for a Zip file is appended. Without this // the created file would be invalid. s.Finish(); // Close is important to wrap things up and unlock the file. s.Close(); } } } }
-
(View)
cal.xml by s0undt3ch posted on
Mar 26, 2008 at 10:15PM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
jQuery(document).ready( function() { jQuery("#field-component").change( function() { switch (this.value) { case "Trac": jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(false); break; case "Trac Google Analytics": jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(false); break; case "TextPress": jQuery("#field-textpress_version").enable(true); jQuery("#field-trac_version").enable(false); break; case "TextPress Extended Latest Comments Widget": jQuery("#field-textpress_version").enable(true); jQuery("#field-trac_version").enable(false); break; default: jQuery("#field-trac_version").enable(false); jQuery("#field-textpress_version").enable(false); }; }); jQuery("#field-component").change(); jQuery("#field-component").submit( function() { jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(true); }); });
-
(View)
Thunderbird Re-Sync Log by s0undt3ch posted on
Mar 26, 2008 at 11:41AM
Tags: funambol1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
jQuery(document).ready( function() { jQuery("#field-component").change( function() { switch (this.value) { case "Trac": jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(false); break; case "Trac Google Analytics": jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(false); break; case "TextPress": jQuery("#field-textpress_version").enable(true); jQuery("#field-trac_version").enable(false); break; case "TextPress Extended Latest Comments Widget": jQuery("#field-textpress_version").enable(true); jQuery("#field-trac_version").enable(false); break; default: jQuery("#field-trac_version").enable(false); jQuery("#field-textpress_version").enable(false); }; }); jQuery("#field-component").change(); jQuery("#field-component").submit( function() { jQuery("#field-trac_version").enable(true); jQuery("#field-textpress_version").enable(true); }); });
-
(View)
Trac CustomFieldAdminPlugin - Component Dependable by s0undt3ch posted on
Mar 08, 2008 at 12:40PM
Tags: trac1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
# -*- coding: utf-8 -*- """ Injects the needed javascript to make custom fields depend on selected component. License: BSD (c) 2008 ::: UfSoft.org - Pedro Algarvio(ufs@ufsoft.org) """ from trac.core import * from trac.web.api import ITemplateStreamFilter from genshi.filters.transform import Transformer from genshi.builder import tag from api import CustomFields class ComponentDependableCustomTickets(Component): implements(ITemplateStreamFilter) def filter_stream(self, req, method, filename, stream, data): if not (req.path_info.startswith('/newticket') or \ req.path_info.startswith('/ticket')): return stream cfapi = CustomFields(self.env) fields = {} for f in cfapi.get_custom_fields(self.env): components_field = '%s.components' % f['name'] self.env.log.debug("Gathering components from field %s", components_field) components = self.config.get('ticket-custom', components_field, '').split('|') self.env.log.debug("Gathered %r", components) fields["field-%s" % f['name']] = components js = """\ jQuery(document).ready( function() { jQuery("#field-component").change( function() { switch (this.value) { """ for f in fields.keys(): for c in fields[f]: js +=' case "%s":\n' % c js +=' jQuery("#%s").enable(true);\n' % f for k in fields.keys(): if k != f: js += ' jQuery("#%s").enable(false);\n' % k js += ' break;\n' js += ' default:\n' for f in fields.keys(): js += ' jQuery("#%s").enable(false);\n' % f js += ' };\n' js += ' });\n' js += ' jQuery("#field-component").change();\n' js += ' jQuery("#field-component").submit( function() {\n' for f in fields.keys(): js += ' jQuery("#%s").enable(true);\n' % f js += ' });\n' js += '});\n' return stream | Transformer('body').\ append(tag.script(js, type="text/javascript"))