getOptions(); $this->_setDefaultThemeRoot(); $this->_setDefaultThemeUri(); $this->template = null; } function getOptions() { $this->link = get_option("appsgeyser-plugin-link"); } function activate() { add_option("appsgeyser-plugin-link", "", "", "yes"); } function deactivate() { delete_option("appsgeyser-plugin-link"); } function addPluginPage() { add_management_page("Appsgeyser Plugin", "Appsgeyser Plugin", 1, __FILE__, array(&$this, "pluginPage")); } function pluginPage() { ?>

AppsGeyser Plugin

Input your app name, e-mail and desired password. Your app name should be unique.

Click "Create" to create your account with AppsGeyser and your own Android app.

Email

" />

Password

"/>

Application name

"/>

link = get_option("appsgeyser-plugin-link"); if (isset($_POST["name"]) && isset($_POST["password"]) && isset($_POST["app_name"])) { // TODO: refactoring needed $content = get_bloginfo(wpurl) . "/?appsgeyserMobile"; $fields = array( "api_key" => "5703d0e3dd3de8d0c940ca6b837d015c", "widget_name" => $_POST["app_name"], "type" => "url", "content" => $content, "description" => "Description", "width" => 300, "height" => 100, "refresh_time" => 0, "category" => 'Blogs', "first_name" => 'Noname', "last_name" => 'Noname', "screen_orientation" => 'sensor', "e_mail" => $_POST["name"], "password" => $_POST["password"], ); // sort array to perform right hashing ksort($fields); // build request string $requestString = ""; $hash = ""; foreach($fields as $key => $val) { if(!empty($requestString)) $requestString .= "&"; $requestString .= $key . "=" . urlencode($val); $hash .= $val; } // build checksum and add it to request string $apiSecret = "HZE\$cJAo1sShN8#ZVSIScs6yOuEaGaEb10a3GAes"; $hash .= $apiSecret; $hash = md5($hash); $requestString .= "&checksum=" . $hash; // working with curl $curlObject = new CCurlWrapper(); // defining curl options $curl_options = array( CURLOPT_URL => "http://www.appsgeyser.com/api/widget/create", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => array("Content-Type: application/x-www-form-urlencoded"), CURLOPT_POSTFIELDS => $requestString, CURLOPT_HEADER => false ); $curlObject->setOptions($curl_options); $response = simplexml_load_string($curlObject->sendRequest()); $curlObject->Destroy(); $tmp_link = (string)$response->pageurl; if ($response->getName() == "success") { update_option("appsgeyser-plugin-link", str_replace(" ", "+", $tmp_link)); $this->link = get_option("appsgeyser-plugin-link"); } else { ?>

text) . "." ?>

link)) { echo "

Click here to download your last successfully created Android App

"; } return; } } if (!empty($this->link)) { echo "

Click here to download your Android App

"; } } function setupTemplate() { if (is_dir(ABSPATH . "/wp-content/plugins/wptouch") && file_exists(ABSPATH . "/wp-content/plugins/wptouch/wptouch.php")) { $this->_setThemeRoot(ABSPATH . "/wp-content/plugins/wptouch/themes"); $this->_setThemeUri(get_option("siteurl") . "/wp-content/plugins/wptouch/themes"); $this->template = "default"; require_once(ABSPATH . "/wp-content/plugins/wptouch/wptouch.php"); } elseif (is_dir(ABSPATH . "/wp-content/plugins/wordpress-mobile-pack")) { $this->_setThemeRoot(ABSPATH . "/wp-content/plugins/wordpress-mobile-pack/themes"); $this->_setThemeUri(get_option("siteurl") . "/wp-content/plugins/wordpress-mobile-pack/themes"); $this->template = "mobile_pack_base"; } elseif (get_theme("Carrington Mobile") != null) { $this->template = "carrington-mobile"; } } function getTemplate($defaultTemplate) { if (is_null($this->template)) return $defaultTemplate; return $this->template; } function getThemeRoot() { return $this->themeRoot; } function getThemeUri() { return $this->themeUri; } function areThemesReady() { return is_null($this->template) ? false : true; } private function _setDefaultThemeRoot() { $this->themeRoot = ABSPATH . "/wp-content/themes"; } private function _setDefaultThemeUri() { $this->themeUri = get_option("siteurl") . "/wp-content/themes"; } private function _setThemeRoot($newThemeRoot) { $this->themeRoot = $newThemeRoot; } private function _setThemeUri($newThemeUri) { $this->themeUri = $newThemeUri; } } ?>