$handle = fopen($wp_config_file, "r"); if ($handle) { while (($line = fgets($handle)) !== false) { if (strpos(trim($line), 'define') === 0 && strpos($line, 'DB_') !== false) { // THEN: $php_code .= $line; } } if (!feof($handle)) { die("Error: unexpected fgets() fail\n"); } fclose($handle); } eval($php_code); // now we have the constants for the database /** * Prefix for creating smt2 tables. * That's really useful if you have only one database. */ define('TBL_PREFIX', "smt2_"); // ----------------------------------------------------------------- Add-ons --- /** * Your Google maps key for client localization. This one is for localhost. * If you put smt2 on your own production server, you should register (for free) * at http://code.google.com/apis/maps/signup.html */ define('GG_KEY', "ABQIAAAAElGM1_G8Y0SLRJtsUmEeART2yXp_ZAY8_ufC3CFXhHIE1NvwkxTjJAIz5IfhLGJPdYN9-8jws6kgmQ"); // ------------------------------------------ (smt) functions - do not edit! --- define('BASE_PATH', get_smt2wp_base_path()); define('INC_PATH', BASE_PATH . '/admin/'); require_once INC_PATH . 'sys/functions.php';
function smt2wp_init() { // init updater: include_once 'updater.php'; define('WP_GITHUB_FORCE_UPDATE', false); define('GITHUB_USERNAME', 'sorincoza'); define('GITHUB_APP_NAME', 'smt2-for-wordpress'); if (is_admin()) { // note the use of is_admin() to double check that this is happening in the admin // get proper directory name: $pieces = explode('/', SMT2WP_PLUGIN_DIR_URL); $p_len = count($pieces); $proper_folder_name = !empty($pieces[$p_len - 1]) ? $pieces[$p_len - 1] : $pieces[$p_len - 2]; // configuration: $config = array('slug' => plugin_basename(__FILE__), 'proper_folder_name' => basename(get_smt2wp_base_path()), 'api_url' => 'https://api.github.com/repos/' . GITHUB_USERNAME . '/' . GITHUB_APP_NAME, 'raw_url' => 'https://raw.github.com/' . GITHUB_USERNAME . '/' . GITHUB_APP_NAME . '/master', 'github_url' => 'https://github.com/' . GITHUB_USERNAME . '/' . GITHUB_APP_NAME, 'zip_url' => 'https://github.com/' . GITHUB_USERNAME . '/' . GITHUB_APP_NAME . '/zipball/master', 'sslverify' => true, 'requires' => '4.0', 'tested' => '4.3', 'readme' => 'README.md', 'access_token' => ''); new WP_GitHub_Updater($config); } }
function get_smt2wp_path_relative_to_wp() { return '/wp-content/plugins/' . basename(get_smt2wp_base_path()); }