function __construct()
 {
     // install default options
     register_activation_hook(__FILE__, array(&$this, 'install'));
     // update options (exists since wp 3.1)
     if (function_exists('register_update_hook')) {
         register_update_hook(__FILE__, array(&$this, 'install'));
     }
     // uninstall features
     //register_deactivation_hook(__FILE__, array(&$this, 'uninstall'));
     //load language
     if (function_exists('load_plugin_textdomain')) {
         load_plugin_textdomain($this->_get_plugin_name(), false, dirname(plugin_basename(__FILE__)) . '/langs/');
     }
     // set video targets
     $this->videotargets();
     // set version
     $this->version = $this->get_version();
     // more setup links
     add_filter('plugin_row_meta', array(&$this, 'register_plugin_links'), 10, 2);
     // nagscreen at plugins page
     add_action('after_plugin_row', array(&$this, 'plugin_version_nag'));
     // add wp-filter
     add_filter('the_content', array(&$this, 'change_content'), 150);
     // add wp-action
     // use wp_enqueue_scripts from WP2.8 and above
     add_action('wp_enqueue_scripts', array(&$this, 'enqueueJS'));
     add_action('wp_enqueue_scripts', array(&$this, 'enqueueCSS'));
     add_action('wp_head', array(&$this, 'add_header'));
     // add settings menu
     add_action('admin_init', array(&$this, 'AdminHeader'));
     add_action('admin_menu', array(&$this, 'AdminMenu'));
     //add wp-shortcodes
     if ($this->get_option('load_gallery') && LVPISWP28 == true) {
         add_filter('attachment_link', array(&$this, 'direct_image_urls_for_galleries'), 10, 2);
     }
     // add MCE Editor Button
     if ($this->get_option('show_video')) {
         add_action('init', array(&$this, 'mceinit'));
         add_action('admin_print_scripts', array(&$this, 'mce_header'));
     }
 }
Example #2
0
         $result["status"] = 1;
         $result["message"] = "Your vote has been registered for this " . $element_name . ".";
         $result["post_id"] = $post_id;
         $result["comment_id"] = $comment_id;
         $result["direction"] = $vote_value;
         $result["vote_totals"] = $wpdb->get_row($wpdb->prepare("\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT vote_count_up as up, vote_count_down as down\n\t\t\t\tFROM " . $wpdb->base_prefix . "up_down_" . $element_name . "_vote_totals\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE " . $element_name . "_id = %d", $element_id));
         die(json_encode($result));
     }
 }
 //class:UpDownPostCommentVotes
 //Create instance of plugin
 $up_down_plugin = new UpDownPostCommentVotes();
 //Handle plugin activation and update
 register_activation_hook(__FILE__, array(&$up_down_plugin, 'setup_plugin'));
 if (function_exists("register_update_hook")) {
     register_update_hook(__FILE__, array(&$up_down_plugin, 'setup_plugin'));
 } else {
     add_action('init', array(&$up_down_plugin, 'setup_plugin'), 1);
 }
 //********************************************************************
 //Custom template tags
 function up_down_post_votes($post_id, $allow_votes = true)
 {
     global $up_down_plugin;
     if (!$post_id) {
         return false;
     }
     $vote_counts = $up_down_plugin->get_post_votes_total($post_id);
     $existing_vote = $up_down_plugin->get_post_user_vote($up_down_plugin->get_user_id(), $post_id);
     echo '<div class="updown-vote-box updown-post" id="updown-post-' . $post_id . '" post-id="' . $post_id . '">';
     $up_down_plugin->render_vote_badge($vote_counts["up"], $vote_counts["down"], $allow_votes, $existing_vote);
Example #3
0
      $filename = CART66_PATH . "/log.txt";
      if(file_exists($filename) && is_writable($filename)) {
        file_put_contents($filename, "\n\n\n================= Loading Cart66 Main File [" . date('m/d/Y g:i:s a') . "] " .
          $_SERVER['REMOTE_ADDR'] . " " . $_SERVER['REQUEST_URI'] . " =================\n\n", FILE_APPEND);
      }
      */
    $cart66 = new Cart66();
    load_plugin_textdomain('cart66', false, '/' . basename(dirname(__FILE__)) . '/languages/');
    // Register activation hook to install Cart66 database tables and system code
    register_activation_hook(CART66_PATH . '/cart66.php', array($cart66, 'install'));
    if (CART66_PRO) {
        register_activation_hook(CART66_PATH . '/cart66.php', array($cart66, 'scheduledEvents'));
    }
    // Check for WordPress 3.1 auto-upgrades
    if (function_exists('register_update_hook')) {
        register_update_hook(CART66_PATH . '/cart66.php', array($cart66, 'install'));
    }
    add_action('init', array($cart66, 'init'));
    add_action('widgets_init', array($cart66, 'registerCartWidget'));
    // Add settings link to plugin page
    add_filter('plugin_action_links', 'cart66SettingsLink', 10, 2);
    cart66_check_mail_plugins();
}
function cart66_check_mail_plugins()
{
    $wp_mail = true;
    $start = WP_PLUGIN_DIR;
    $plugin_files = array('wpmandrill.php', 'wp-ses.php');
    if ($dir_start = @scandir($start)) {
        foreach ($dir_start as $key => $dir) {
            if (!is_dir($start . '/' . $dir) || $dir == '.' || $dir == '..') {
Example #4
0
 /**
  * Constructor
  */
 function init()
 {
     // variables
     global $wpdb, $path, $cpd_dir_name;
     define('CPD_METABOX', 'cpd_metaboxes');
     // multisite table names
     foreach (array('cpd_counter', 'cpd_counter_useronline', 'cpd_notes') as $t) {
         $wpdb->tables[] = $t;
         $wpdb->{$t} = $wpdb->get_blog_prefix() . $t;
     }
     // use local time, not UTC
     get_option('gmt_offset');
     $this->options = get_option('count_per_day');
     // manual debug mode
     if (!empty($_GET['debug']) && WP_DEBUG) {
         $this->options['debug'] = 1;
     }
     $this->dir = plugins_url('/' . $cpd_dir_name);
     $this->queries[0] = 0;
     // update online counter
     add_action('wp', array(&$this, 'deleteOnlineCounter'));
     // settings link on plugin page
     add_filter('plugin_action_links', array(&$this, 'pluginActions'), 10, 2);
     // auto counter
     if ($this->options['autocount']) {
         add_action('wp', array(&$this, 'count'));
     }
     // javascript to count cached posts
     if ($this->options['ajax']) {
         add_action('wp_enqueue_scripts', array(&$this, 'addJquery'));
         add_action('wp_footer', array(&$this, 'addAjaxScript'));
     }
     if (is_admin()) {
         // admin menu
         add_action('admin_menu', array(&$this, 'menu'));
         // widget on dashboard page
         add_action('wp_dashboard_setup', array(&$this, 'dashboardWidgetSetup'));
         // CpD dashboard page
         add_filter('screen_layout_columns', array(&$this, 'screenLayoutColumns'), 10, 2);
         // CpD dashboard
         add_action('admin_menu', array(&$this, 'setAdminMenu'));
         // counter column posts lists
         add_action('admin_head', array(&$this, 'addPostTypesColumns'));
         // adds javascript
         add_action('admin_head', array(&$this, 'addJS'));
         // check version
         add_action('admin_head', array(&$this, 'checkInstalledVersion'));
     }
     // locale support
     // 	if (defined('WPLANG') && function_exists('load_plugin_textdomain'))
     load_plugin_textdomain('cpd', false, $cpd_dir_name . '/locale');
     // adds stylesheet
     if (is_admin()) {
         add_action('admin_head', array(&$this, 'addCss'));
     }
     if (empty($this->options['no_front_css'])) {
         add_action('wp_head', array(&$this, 'addCss'));
     }
     // widget setup
     add_action('widgets_init', array(&$this, 'register_widgets'));
     // activation hook
     register_activation_hook(ABSPATH . PLUGINDIR . '/count-per-day/counter.php', array(&$this, 'checkVersion'));
     // update hook
     if (function_exists('register_update_hook')) {
         register_update_hook(ABSPATH . PLUGINDIR . '/count-per-day/counter.php', array(&$this, 'checkVersion'));
     }
     // uninstall hook
     register_uninstall_hook($path . 'counter.php', 'count_per_day_uninstall');
     // query times debug
     if ($this->options['debug']) {
         add_action('wp_footer', array(&$this, 'showQueries'));
         add_action('admin_footer', array(&$this, 'showQueries'));
     }
     // add shortcode support
     $this->addShortcodes();
     // thickbox in backend only
     if (strpos($_SERVER['SCRIPT_NAME'], '/wp-admin/') !== false) {
         add_action('admin_enqueue_scripts', array(&$this, 'addThickbox'));
     }
     // Session
     if (strpos($_SERVER['SCRIPT_NAME'], '/wp-admin/') !== false) {
         add_action('init', array(&$this, 'startSession'), 1);
     }
     $this->aton = 'INET_ATON';
     $this->ntoa = 'INET_NTOA';
 }
Example #5
0
        define('IS_ADMIN', is_admin());
    }
    $windows = false;
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        $windows = true;
    }
    define('WPWINDOWS', $windows);
    load_plugin_textdomain('wp-editor', false, '/' . basename(dirname(__FILE__)) . '/languages/');
    // Load the main WP Editor class
    require_once WPEDITOR_PATH . 'classes/WPEditor.php';
    $wpedit = new WPEditor();
    // Register activation hook to install WP Editor database tables and system code
    register_activation_hook(__FILE__, array($wpedit, 'install'));
    // Check for WordPress 3.1 auto-upgrades
    if (function_exists('register_update_hook')) {
        register_update_hook(__FILE__, array($wpedit, 'install'));
    }
    // Initialize the main WP Editor Class
    add_action('init', array($wpedit, 'init'));
    // Add settings link to plugin page
    add_filter('plugin_action_links', 'wpEditorSettingsLink', 10, 2);
}
function wpEditorSettingsLink($links, $file)
{
    $thisFile = plugin_basename(WPEDITOR_PATH) . '/' . basename(__FILE__);
    if ($file == $thisFile) {
        $settings = '<a href="' . admin_url('admin.php?page=wpeditor_admin') . '" title="' . __('Open the settings page for this plugin', 'wp-editor') . '">' . __('Settings', 'wp-editor') . '</a>';
        array_unshift($links, $settings);
    }
    return $links;
}