Plugin Directory

Changeset 1637822


Ignore:
Timestamp:
04/14/2017 05:16:30 PM (9 years ago)
Author:
simasta
Message:

Version 1.0.6

Location:
wpsid-shortcode/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • wpsid-shortcode/trunk/ci-bootstrap.php

    r1633985 r1637822  
    11<?php
    22defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    3 $application_folder = OPENSID_APPPATH.'/donjo-app';
    4 $system_path = OPENSID_APPPATH.'/donjo-sys/';
     3$application_folder = OPENSID_APPPATH . '/donjo-app';
     4$system_path = OPENSID_APPPATH . '/donjo-sys/';
    55 
    66if( !defined('BASEPATH') )
     
    2121include_once OPENSID_APPPATH . '/donjo-sys/database/DB.php';
    2222 
    23 function &opensid_ci_load_database($params = '', $active_record_override = false){
    24     $database =& DB($params, $active_record_override);
     23function &opensid_ci_load_database($active_record_override = true){
     24    $database =& DB(OPENSID_CONNECT, $active_record_override);
    2525    return $database;
    2626}
  • wpsid-shortcode/trunk/classes/class-ci-model.php

    r1633860 r1637822  
    77       
    88    public function __construct(){
    9         $this->db =& opensid_ci_load_database('mysqli://' . DB_USER . ':' . DB_PASSWORD . '@' . DB_HOST . '/' . DB_NAME, true);
     9        $this->db =& opensid_ci_load_database();
    1010       
    1111        $this->load = new OPENSID___FAKE_LOAD;
  • wpsid-shortcode/trunk/classes/class-model.php

    r1633860 r1637822  
    66    public function __construct() {
    77       
    8         $this->db =& opensid_ci_load_database('mysqli://' . DB_USER . ':' . DB_PASSWORD . '@' . DB_HOST . '/' . DB_NAME, true);
     8        $this->db =& opensid_ci_load_database();
    99    }
    1010} // class OpenSID_Model
  • wpsid-shortcode/trunk/classes/class-opensid.php

    r1633860 r1637822  
    66    public static $controller;
    77    public static function run() {
    8         do_action( 'opensid_run' );
    9         if ( ( 'wp-login.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ) // Login screen
    10             || ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST )
    11             || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
    12             return;
     8       
     9        if(OPENSID_READY){
     10           
     11           
     12            do_action( 'opensid_run' );
     13           
     14            self::$model_opensid = self::load_model( 'opensid' );
    1315        }
    14         include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
    15         if ( version_compare( str_replace( '-src', '', $wp_version ), '4.3', '<' ) ) {
    16             if ( current_user_can( 'update_plugins' ) ) {
    17                 add_action( 'admin_notices', array( 'OpenSID', 'show_minimum_requirements_error_notice' ) );
    18             }
    19             return;
    20         }
    21         self::$model_opensid = self::load_model( 'opensid' );
     16       
    2217        if ( is_admin() ) {
    2318            $controller = 'admin';
     
    2520                $controller .= '_ajax';
    2621            }
     22            self::$controller = self::load_controller( $controller );
    2723        } else {
    28             $controller = 'frontend';
    29             Disable: self::$controller = self::load_controller( $controller );
     24            if(OPENSID_READY){
     25                $controller = 'frontend';
     26                self::$controller = self::load_controller( $controller );
     27            }
    3028        }
    3129    }
     
    4341        return $the_class;
    4442    }
    45    
    46    
    4743    public static function load_shortcode( $shortcode, array $data = array() ) {
    4844        self::load_file( 'class-shortcode.php', 'classes' );
  • wpsid-shortcode/trunk/classes/class-shortcode.php

    r1633860 r1637822  
    77   
    88    public function __construct() {
    9         $this->db =& opensid_ci_load_database('mysqli://' . DB_USER . ':' . DB_PASSWORD . '@' . DB_HOST . '/' . DB_NAME, true);
     9        $this->db =& opensid_ci_load_database();
    1010   
    1111       
  • wpsid-shortcode/trunk/init.php

    r1636430 r1637822  
    11<?php
    22defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    3 define( 'OPENSID_ABSPATH', plugin_dir_path( __FILE__ ) );
    4 define( 'OPENSID_DIR_URL', plugin_dir_url( __FILE__ ) );
    5 define( 'OPENSID__FILE__', __FILE__ );
    6 define( 'OPENSID_BASENAME', plugin_basename( OPENSID__FILE__ ) );
    73load_plugin_textdomain( 'wpsid-shortcode', false, basename( dirname( __FILE__ ) ) . '/locale' );
    8 if( is_dir( ABSPATH . 'opensid/donjo-sys') ) {
    9     define( 'OPENSID_APPPATH', ABSPATH . 'opensid' );
    10     define( 'OPENSID_HOMEURL', esc_url(site_url()) . '/opensid' );
    11 } else echo(printf(
    12         __( '<b>ERROR</b>: Can\'t find opensid!.<br>This plugin require  to opensid installed in <b>`%sopensid/`</b>. <br>Please read <b>`%sreadme.txt`</b> file for installation detail.', 'wpsid-shortcode'),
    13         ABSPATH,
    14         OPENSID_ABSPATH
    15     ));
    16 if( defined('OPENSID_APPPATH') ) {
     4register_activation_hook( OPENSID__FILE__, 'opensid_init' );
     5 
     6function opensid_init() {
     7    $options = get_option( OPENSID_OPTION_KEY );
     8   
     9    if ( !isset($options['db_name']) ) $options['db_name'] =  DB_NAME;
     10    if ( !isset($options['db_user']) ) $options['db_user'] =  DB_USER;
     11    if ( !isset($options['db_host']) ) $options['db_host'] =  DB_HOST;
     12    if ( !isset($options['sid_path']) ) $options['sid_path'] =  esc_attr( ABSPATH . 'opensid' );
     13    if ( !isset($options['sid_home']) ) $options['sid_home'] =  esc_url( site_url() . '/opensid' );
     14   
     15    if ( !isset($options['db_pass']) ) $options['db_pass'] =  DB_PASSWORD;
     16   
     17    update_option( OPENSID_OPTION_KEY, $options );
     18}
     19function opensid_set_option($key, $value) {
     20    $options = get_option( OPENSID_OPTION_KEY );
     21   
     22    $options[$key] = $value;
     23   
     24    update_option( OPENSID_OPTION_KEY, $options );
     25   
     26}
     27function opensid_get_option($key) {
     28    $options = get_option( OPENSID_OPTION_KEY );
     29   
     30    if( !isset($options[$key]) )
     31        return;
     32   
     33    return $options[$key];
     34}
     35defined('OPENSID_DB_NAME') or
     36    define( 'OPENSID_DB_NAME', opensid_get_option('db_name') );
     37   
     38defined('OPENSID_DB_USER') or
     39    define( 'OPENSID_DB_USER', opensid_get_option('db_user') );
     40   
     41defined('OPENSID_DB_PASS') or
     42    define( 'OPENSID_DB_PASS', opensid_get_option('db_pass') );
     43   
     44defined('OPENSID_DB_HOST') or
     45    define( 'OPENSID_DB_HOST', opensid_get_option('db_host') );
     46defined('OPENSID_APPPATH') or
     47    define( 'OPENSID_APPPATH', opensid_get_option('sid_path') );
     48   
     49defined('OPENSID_HOMEURL') or
     50    define( 'OPENSID_HOMEURL', opensid_get_option('sid_home') );
     51define( 'OPENSID_CONNECT', 'mysqli://' . OPENSID_DB_USER . ':' . OPENSID_DB_PASS . '@' . OPENSID_DB_HOST . '/' . OPENSID_DB_NAME);
     52 
     53if( is_dir( opensid_get_option('sid_path') . '/donjo-sys') ) {
     54   
    1755    require_once OPENSID_ABSPATH . 'ci-bootstrap.php';
    18     require_once OPENSID_ABSPATH . 'classes/class-opensid.php';
    19     add_action( 'init', array( 'OpenSID', 'run' ) );
    20 }
     56   
     57    $connection = opensid_ci_load_database();
     58   
     59    if( $connection->initialize() )
     60        define( 'OPENSID_READY', true );
     61    else define( 'OPENSID_READY', false );
     62   
     63    unset($connection);
     64   
     65} else define( 'OPENSID_READY', false );
     66require_once OPENSID_ABSPATH . 'classes/class-opensid.php';
     67add_action( 'init', array( 'OpenSID', 'run' ) );
  • wpsid-shortcode/trunk/opensid.php

    r1636430 r1637822  
    99 * Author: Simasta
    1010 * Author URI: http://simasta.siini.com
    11  * Version: 1.0.5
     11 * Version: 1.0.6
    1212 * Text Domain: wpsid-shortcode
    1313 * Domain Path: /locale/
     
    1818
    1919/**
    20  *  Copyright (C) 2017 Simasta (email: simasta@siini.com)
     20 *  Copyright (C) 2017 Simasta (email: masta@siini.com)
    2121 *
    2222 *  This program is free software; you can redistribute it and/or
     
    3838defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    3939
     40 
     41// Define certain plugin variables as constants.
     42define( 'OPENSID_ABSPATH', plugin_dir_path( __FILE__ ) );
     43define( 'OPENSID_DIR_URL', plugin_dir_url( __FILE__ ) );
     44define( 'OPENSID__FILE__', __FILE__ );
     45define( 'OPENSID_BASENAME', plugin_basename( OPENSID__FILE__ ) );
     46define( 'OPENSID_OPTION_KEY', 'wpsid_config' );
     47
    4048require_once 'init.php';
  • wpsid-shortcode/trunk/readme.txt

    r1633999 r1637822  
    55Requires at least: 4.3
    66Tested up to: 4.7.3
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv2 or later
    99
     
    1414WPSID Shortcode integrate OpenSID and SID to Wrodpress with shortcodes. You can display statistics data from OpenSID and SID into wordpress. Visit [**demo site**](http://wpsid-shortcode.plugin.demo.siini.com/) for detail.
    1515
    16 If you find this useful, [**please consider donating**](http://www.siini.com/wordpress/plugins/wpsid-shortcode/) whatever sum you choose, **even just 10 cents**. It's been downloaded thousands of times: just a few cents from every user would help me develop the plugin and improve support.
     16If you find this useful, [**please consider donating**](http://www.siini.com/wordpress/plugins/wpsid-shortcode/) whatever sum you choose, **even just 10 cents**.
    1717
    1818== Installation ==
     
    1131132. How to usage shortcode
    1141143. Example directory structure
     1154. Admin page
    115116
    116117
    117118== Changelog ==
     119
     120= 1.0.6 =
     121*Release Date - 2017/04/14*
     122* Added admin page
     123* Support custom path & database
     124
     125= 1.0.5.1 =
     126*Release Date - 2017/04/13*
     127* Added localization
    118128
    119129= 1.0.5 =
Note: See TracChangeset for help on using the changeset viewer.