function yp_getting_ver_from_changelog() { $version = 0; $pluginVersion = YP_PLUGIN_VERSION; // Changelog URL $url = "http://www.waspthemes.com/yellow-pencil/inc/changelog.txt"; // If page found. if (yp_get_http_response_code($url) == 200) { // Getting Changelog $changelog = wp_remote_get($url, array('sslverify' => false)); if (is_array($changelog)) { $changelog = $changelog['body']; } // If have data. if (!empty($changelog)) { // Get First line. $last_update = substr($changelog, 0, 32); // Part of first line. $array = explode('(', $last_update); // Only version. $version = yp_version($array['0']); if ($version > $pluginVersion) { // Add to datebase, because have a new update. if (get_option('yp_update_status') !== false) { update_option('yp_update_status', 'true'); update_option('yp_last_check_version', $pluginVersion); update_option('yp_available_version', $version); } else { add_option('yp_update_status', 'true'); add_option('yp_last_check_version', $pluginVersion); add_option('yp_available_version', $version); } return true; } else { // Update database, because not have a new update. if (get_option('yp_update_status') !== false) { update_option('yp_update_status', 'false'); } else { add_option('yp_update_status', 'false'); } return false; } } // If has data. } // IF URL working. }
$v = preg_replace('/[^0-9]/s', '', $v); if (strlen($v) == 2) { return $v . "0"; } elseif (strlen($v) == 1) { return $v . "00"; } else { return $v; } } // Need include plugin.php file if (!function_exists("get_plugin_data")) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } // Plugin version $yp_plugin_data = get_plugin_data(__FILE__); define("YP_PLUGIN_VERSION", yp_version($yp_plugin_data['Version'])); // include update api. require_once WT_PLUGIN_DIR . '/library/php/update-api.php'; } /* ---------------------------------------------------- */ /* Getting font familys by CSS OUTPUT */ /* ---------------------------------------------------- */ function yp_get_font_families() { $css = yp_get_css(true); $protocol = is_ssl() ? 'https' : 'http'; preg_match_all('/font-family:(.*?);/', $css, $r); foreach ($r['1'] as &$k) { $k = yp_font_name($k); } foreach (array_unique($r['1']) as $family) {