Example #1
0
 /**
  * (non-PHPdoc)
  * @see \mithra62\BackupPro\Platforms\PlatformInterface::getIaCronCommands()
  */
 public function getIaCronCommands(array $settings)
 {
     $config = \Craft\craft()->config;
     $trigger = $config->get('actionTrigger');
     $url = UrlHelper::getSiteUrl() . $trigger . '/backupPro/cron/integrity?backup_pro=' . $settings['cron_query_key'];
     return array('verify_backup_stability' => array('url' => $url, 'cmd' => 'curl "' . $url, 'type' => 'curl'), 'console_verify_backup_stability' => array('url' => '', 'cmd' => 'php craft/app/etc/console/yiic.php backup integrity', 'type' => 'console'));
 }
 public function disconnect($handle, $namespace = null)
 {
     Craft::log(__METHOD__, LogLevel::Info, true);
     $params = array('provider' => $handle);
     if ($namespace) {
         $params['namespace'] = $namespace;
     }
     $url = UrlHelper::getSiteUrl(craft()->config->get('actionTrigger') . '/oauth/disconnect', $params);
     Craft::log(__METHOD__ . " : Deauthenticate : " . $url, LogLevel::Info, true);
     return $url;
 }
 /**
  * Get an Event tracking URL
  * @param  string $url the URL to track
  * @param  string $eventCategory the event category
  * @param  string $eventAction the event action
  * @param  string $eventLabel the event label
  * @param  string $eventValue the event value
  * @return string the tracking URL
  */
 public function eventTrackingUrl($url, $eventCategory = "", $eventAction = "", $eventLabel = "", $eventValue = 0)
 {
     $urlParams = array('url' => $url, 'eventCategory' => $eventCategory, 'eventAction' => $eventAction, 'eventLabel' => $eventLabel, 'eventValue' => $eventValue);
     $fileName = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_BASENAME);
     $trackingUrl = UrlHelper::getSiteUrl('instantanalytics/eventTrack/' . $fileName, $urlParams);
     InstantAnalyticsPlugin::log("Created eventTrackingUrl for " . $trackingUrl, LogLevel::Info, false);
     return $trackingUrl;
 }
Example #4
0
 public function getLocalizedUrls()
 {
     $localizedUrls = array();
     $requestUri = craft()->request->getRequestUri();
     if (craft()->isLocalized()) {
         $element = craft()->urlManager->getMatchedElement();
         if ($element) {
             $unsortedLocalizedUrls = array();
             $_rows = craft()->db->createCommand()->select('locale')->addSelect('uri')->from('elements_i18n')->where(array('elementId' => $element->id, 'enabled' => 1))->queryAll();
             foreach ($_rows as $row) {
                 $path = $row['uri'] == '__home__' ? '' : $row['uri'];
                 $unsortedLocalizedUrls[$row['locale']] = UrlHelper::getSiteUrl($path, null, null, $row['locale']);
             }
             $locales = craft()->i18n->getSiteLocales();
             foreach ($locales as $locale) {
                 $localeId = $locale->getId();
                 if (isset($unsortedLocalizedUrls[$localeId])) {
                     $localizedUrls[$localeId] = $unsortedLocalizedUrls[$localeId];
                 }
             }
         } else {
             $locales = craft()->i18n->getSiteLocales();
             foreach ($locales as $locale) {
                 $localeId = $locale->getId();
                 $localizedUrls[$localeId] = UrlHelper::getSiteUrl($requestUri, null, null, $localeId);
             }
         }
     }
     return $localizedUrls;
 }
 /**
  * @param Market_TransactionModel $transaction
  * @param CreditCard              $card
  *
  * @return array
  */
 private function buildPaymentRequest(Market_TransactionModel $transaction, CreditCard $card = null)
 {
     $request = ['amount' => $transaction->amount, 'currency' => craft()->market_settings->getOption('defaultCurrency'), 'transactionId' => $transaction->id, 'clientIp' => craft()->request->getIpAddress(), 'returnUrl' => UrlHelper::getActionUrl('market/cartPayment/complete', ['id' => $transaction->id, 'hash' => $transaction->hash]), 'cancelUrl' => UrlHelper::getSiteUrl($transaction->order->cancelUrl)];
     if ($card) {
         $request['card'] = $card;
     }
     return $request;
 }
 public function block_foot($context, array $blocks = array())
 {
     // line 37
     echo "\t<noscript>\n\t\t<div class=\"message-container no-access\">\n\t\t\t<div class=\"pane notice\">\n\t\t\t\t<p>";
     // line 40
     echo twig_escape_filter($this->env, \Craft\Craft::t("JavaScript must be enabled to access the Craft control panel."), "html", null, true);
     echo "</p>\n\t\t\t</div>\n\t\t</div>\n\t</noscript>\n\n\t<script type=\"text/javascript\">\n\t\twindow.Craft = {\n\t\t\tsiteUid:              \"";
     // line 47
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "app"), "getSiteUid", array(), "method"), "js"), "html", null, true);
     echo "\",\n\t\t\tbaseUrl:              \"";
     // line 48
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, \Craft\UrlHelper::getUrl(), "js"), "html", null, true);
     echo "\",\n\t\t\tbaseCpUrl:            \"";
     // line 49
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, \Craft\UrlHelper::getCpUrl(), "js"), "html", null, true);
     echo "\",\n\t\t\tbaseSiteUrl:          \"";
     // line 50
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, \Craft\UrlHelper::getSiteUrl(), "js"), "html", null, true);
     echo "\",\n\t\t\tactionUrl:            \"";
     // line 51
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, \Craft\UrlHelper::getActionUrl(), "js"), "html", null, true);
     echo "\",\n\t\t\tresourceUrl:          \"";
     // line 52
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, \Craft\UrlHelper::getResourceUrl(), "js"), "html", null, true);
     echo "\",\n\t\t\tscriptName:           \"";
     // line 53
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "request"), "getScriptName", array(), "method"), "js"), "html", null, true);
     echo "\",\n\t\t\tomitScriptNameInUrls: ";
     // line 54
     echo $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "config"), "omitScriptNameInUrls", array(), "method") ? "true" : "false";
     echo ",\n\t\t\tusePathInfo:          ";
     // line 55
     echo $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "config"), "usePathInfo", array(), "method") ? "true" : "false";
     echo ",\n\t\t\tresourceTrigger:      \"";
     // line 56
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "config"), "getResourceTrigger", array(), "method"), "js"), "html", null, true);
     echo "\",\n\t\t\tactionTrigger:        \"";
     // line 57
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "config"), "actionTrigger"), "js"), "html", null, true);
     echo "\",\n\t\t\tpath:                 \"";
     // line 58
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "request"), "getPath", array(), "method"), "js"), "html", null, true);
     echo "\",\n\t\t\tlocale:               \"";
     // line 59
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "craft"), "locale"), "js"), "html", null, true);
     echo "\",\n\t\t\torientation:          \"";
     // line 60
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getContext($context, "orientation"), "js"), "html", null, true);
     echo "\",\n\t\t\tleft:                 \"";
     // line 61
     echo $this->getContext($context, "orientation") == "ltr" ? "left" : "right";
     echo "\",\n\t\t\tright:                \"";
     // line 62
     echo $this->getContext($context, "orientation") == "ltr" ? "right" : "left";
     echo "\",\n\t\t\tPersonal:             ";
     // line 63
     echo twig_escape_filter($this->env, $this->getContext($context, "CraftPersonal"), "html", null, true);
     echo ",\n\t\t\tClient:               ";
     // line 64
     echo twig_escape_filter($this->env, $this->getContext($context, "CraftClient"), "html", null, true);
     echo ",\n\t\t\tPro:                  ";
     // line 65
     echo twig_escape_filter($this->env, $this->getContext($context, "CraftPro"), "html", null, true);
     echo ",\n\t\t\tedition:              ";
     // line 66
     echo twig_escape_filter($this->env, $this->getContext($context, "CraftEdition"), "html", null, true);
     echo ",\n\t\t\tisLocalized:          ";
     // line 67
     echo $this->getAttribute($this->getContext($context, "craft"), "isLocalized", array(), "method") ? "true" : "false";
     echo ",\n\t\t\ttranslations:         ";
     // line 68
     echo \Craft\craft()->templates->getTranslations();
     echo ",\n\t\t\tmaxUploadSize:        ";
     // line 69
     echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "app"), "getMaxUploadSize", array(), "method"), "html", null, true);
     echo ",\n\t\t\tslugWordSeparator:    \"";
     // line 70
     echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "config"), "slugWordSeparator"), "js"), "html", null, true);
     echo "\"\n\t\t};\n\n\t\twindow.Craft.fileKinds = {};\n\t\t";
     // line 74
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable($this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "app"), "getFileKinds", array(), "method"));
     foreach ($context['_seq'] as $context["kind"] => $context["info"]) {
         // line 75
         echo "\t\t\twindow.Craft.fileKinds.";
         echo twig_escape_filter($this->env, $this->getContext($context, "kind"), "html", null, true);
         echo " = [];\n\t\t\t";
         // line 76
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getAttribute($this->getContext($context, "info"), "extensions"));
         foreach ($context['_seq'] as $context["_key"] => $context["extension"]) {
             // line 77
             echo "\t\t\t\twindow.Craft.fileKinds.";
             echo twig_escape_filter($this->env, $this->getContext($context, "kind"), "html", null, true);
             echo ".push(\"";
             echo twig_escape_filter($this->env, $this->getContext($context, "extension"), "html", null, true);
             echo "\");\n\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['extension'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 79
         echo "\t\t";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['kind'], $context['info'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 80
     echo "\t</script>\n";
 }
 private function _initProviderSource($token = null, $scope = null, $callbackUrl = null)
 {
     $providerHandle = $this->getHandle();
     // get provider record
     if (!$callbackUrl) {
         $callbackUrl = UrlHelper::getSiteUrl(\Craft\craft()->config->get('actionTrigger') . '/oauth/public/connect', array('provider' => $providerHandle));
     }
     // provider options
     $opts = array('id' => 'x', 'secret' => 'x', 'redirect_url' => 'x');
     if ($this->_providerSource) {
         if (!empty($this->_providerSource->client_id)) {
             $opts = array('id' => $this->_providerSource->client_id, 'secret' => $this->_providerSource->client_secret, 'redirect_url' => $callbackUrl);
             $this->isConfigured = true;
         }
     }
     if ($scope) {
         if (is_array($scope) && !empty($scope)) {
             $opts['scope'] = $scope;
         }
     }
     $class = "\\OAuth\\Provider\\{$this->getClass()}";
     $this->_providerSource = new $class($opts);
     if ($token) {
         $this->_providerSource->setToken($token);
         $this->tokenRefresh();
     }
 }