public function getDummy() { $color = str_replace('#', '', $this->getApplication()->getBlock('tabbar')->getImageColor()); $option = new Application_Model_Option(); $option->find('newswall', 'code'); $dummy = new self(); $dummy->addData($option->getData())->setTabbarName('Sample')->setIsDummy(1)->setIsActive(1)->setIconUrl(Core_Model_Url::create("template/block/colorize", array('id' => $dummy->getIconId(), 'color' => $color)))->setId(0); return $dummy; }
protected function _redirect($url, array $options = array()) { $url = Core_Model_Url::create($url, $options); parent::_redirect($url, $options); }
public function getUrl($url = '', array $params = array(), $locale = null) { return Core_Model_Url::create($url, $params, $locale); }
protected function _generateApk() { $output = array(); $alias = $this->getDevice()->getAlias(); $store_password = $this->getDevice()->getStorePass(); $key_password = $this->getDevice()->getKeyPass(); $src = "var/tmp/applications/android/{$this->_folder_name}/Siberian"; // Generates the keystore $keystore_base_path = Core_Model_Directory::getBasePathTo('var/apps/android/keystore/' . $this->getApplication()->getId() . '.pks'); if (!file_exists($keystore_base_path)) { $organization = preg_replace('/[,\\s]+/', " ", System_Model_Config::getValueFor("company_name")); if (!$organization) { $organization = "Default"; } exec('keytool -genkey -noprompt -alias ' . $alias . ' -dname "CN=' . $organization . ', O=' . $organization . '" -keystore ' . $keystore_base_path . ' -storepass ' . $store_password . ' -keypass ' . $key_password . ' -validity 36135 2>&1', $output); } // Adds the URL called at the end of the gradlew $gradlew_path = Core_Model_Directory::getBasePathTo("{$src}/app/gradlew"); $gradlew_content = file_get_contents($gradlew_path); $url = Core_Model_Url::create("application/device/apkisgenerated", array("app_name" => $this->_folder_name)); $gradlew_content .= 'wget "' . $url . '"'; file_put_contents($gradlew_path, $gradlew_content); // Sets the Android SDK path $data = 'sdk.dir=' . Core_Model_Directory::getBasePathTo("var/apps/android/sdk"); file_put_contents("{$src}/local.properties", $data); // Updates the build.gradle $content = file_get_contents("{$src}/app/build.gradle.save"); $arraySearch = array('my_storePassword', 'my_keyAlias', 'my_keyPassword', 'my_packageName', 'my_keystore_path'); $arrayReplace = array($store_password, $alias, $key_password, $this->_package_name, $keystore_base_path); $content = str_replace($arraySearch, $arrayReplace, $content); file_put_contents("{$src}/app/build.gradle", $content); // Changes the current directory chdir(Core_Model_Directory::getBasePathTo("{$src}/app")); // Creates a environment variable putenv('GRADLE_USER_HOME=' . Core_Model_Directory::getBasePathTo("var/tmp/applications/android/gradle")); // Executes gradlew exec('bash gradlew build 2>&1', $output); if (in_array('BUILD SUCCESSFUL', $output)) { return Core_Model_Directory::getBasePathTo("{$src}/app/build/outputs/apk/app-release.apk"); } else { Zend_Registry::get("logger")->sendException(print_r($output, true), "apk_generation_", false); return false; } }
public function getUrl($uri = null, $params = array(), $forceKey = false, $locale = null) { $request = Zend_Controller_Front::getInstance()->getRequest(); $useKey = (bool) $request->useApplicationKey(); if (!$this->getDomain()) { $forceKey = true; } if ($forceKey) { $request->useApplicationKey(true); $url = Core_Model_Url::create($uri, $params, $locale); $request->useApplicationKey($useKey); } else { $url = Core_Model_Url::createCustom('http://' . $this->getDomain(), $uri, $params, $locale); } return $url; }
public function getUrl($url = '', array $params = array(), $locale = null, $forceKey = false) { $request = Zend_Controller_Front::getInstance()->getRequest(); if (!$this->getDomain()) { $forceKey = true; } if ($forceKey) { $use_key = $request->useApplicationKey(); $request->useApplicationKey(true); $url = Core_Model_Url::create($url, $params, $locale); $request->useApplicationKey($use_key); } else { $url = Core_Model_Url::createCustom('http://' . $this->getDomain(), $url, $params, $locale); } if (substr($url, strlen($url) - 1, 1) != "/") { $url .= "/"; } return $url; }