Пример #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 getHelpDocument()
 {
     $oldPath = craft()->path->getTemplatesPath();
     $newPath = craft()->path->getPluginsPath() . 'usermanual/templates/';
     $template = '_body.html';
     $settings = craft()->plugins->getPlugin('usermanual')->getSettings();
     $segments = craft()->request->segments;
     $segment = end($segments);
     $sectionId = $settings->section;
     $criteria = craft()->elements->getCriteria(ElementType::Entry);
     $criteria->sectionId = $sectionId;
     $criteria->slug = $segment;
     if (!$criteria->total()) {
         $criteria->slug = null;
     }
     $entry = $criteria->first();
     // If the app has not been set up at all or there are no entires, redirect to the settings page
     if (!$sectionId || !$entry) {
         craft()->request->redirect(UrlHelper::getCpUrl('settings/plugins/usermanual/'));
     } else {
         if ($settings->templateOverride) {
             $newPath = craft()->path->getSiteTemplatesPath();
             $template = $settings->templateOverride;
         }
         craft()->path->setTemplatesPath($newPath);
         $output = craft()->templates->render($template, ['entry' => $entry]);
         craft()->path->setTemplatesPath($oldPath);
         return $output;
     }
 }
Пример #3
0
 public function generateLink($options = array())
 {
     if ($this->_validateOptions($options)) {
         $encodedOptions = $this->encodeUrlParam($options);
         return UrlHelper::getActionUrl('vCard', array('vcard' => $encodedOptions));
     }
 }
 public function InfiniteScrollFilter($paginate, $containerSelector = null, $itemSelector = null, $loadingMessage = null, $loadingImage = null, $finishedMessage = null)
 {
     if (!$containerSelector || !$itemSelector) {
         return null;
     }
     $content = '';
     if ($paginate->getNextUrl()) {
         $content .= '<div class="pagination"><a href="' . $paginate->getNextUrl() . '">Next Page</a></div>';
     }
     $content .= craft()->templates->includeJsResource('infinitescroll/js/jquery.infinitescroll.min.js');
     $script = 'var totalNumOfPages = ' . $paginate->totalPages . ';';
     $script .= 'var containerSelector = "' . $containerSelector . '";';
     $script .= 'var itemSelector = "' . $itemSelector . '";';
     $loadingImage = $loadingImage ? $loadingImage : UrlHelper::getResourceUrl('infinitescroll/img/ajax-loader.gif');
     $script .= 'var loadingImage = "' . $loadingImage . '";';
     if ($loadingMessage) {
         $script .= 'var loadingMessage = "' . $loadingMessage . '";';
     }
     if ($finishedMessage) {
         $script .= 'var finishedMessage = "' . $finishedMessage . '";';
     }
     $content .= craft()->templates->includeJs($script);
     $content .= craft()->templates->includeJsResource('infinitescroll/js/infinitescroll.js');
     return $content;
 }
 public function pluginUpdatePluginsUrl($plugins)
 {
     Craft::log(__METHOD__, LogLevel::Info, true);
     if (is_array($plugins)) {
         $plugins = implode(",", $plugins);
     }
     return UrlHelper::getActionUrl('oauth/plugin/updatePlugins', array('plugins' => $plugins));
 }
Пример #6
0
 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;
 }
 public function block_sidebar($context, array $blocks = array())
 {
     // line 17
     echo "\t";
     if (twig_length_filter($this->env, $this->getContext($context, "newEntrySections"))) {
         // line 18
         echo "\t\t<div class=\"buttons\">\n\t\t\t";
         // line 19
         if (twig_length_filter($this->env, $this->getContext($context, "newEntrySections")) > 1) {
             // line 20
             echo "\t\t\t\t<div class=\"btn submit menubtn add icon\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t("New Entry"), "html", null, true);
             echo "</div>\n\t\t\t\t<div class=\"menu\">\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t";
             // line 23
             $context['_parent'] = (array) $context;
             $context['_seq'] = twig_ensure_traversable($this->getContext($context, "newEntrySections"));
             foreach ($context['_seq'] as $context["_key"] => $context["section"]) {
                 // line 24
                 echo "\t\t\t\t\t\t\t<li><a href=\"";
                 echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("entries/" . $this->getAttribute($this->getContext($context, "section"), "handle") . "/new"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, \Craft\Craft::t($this->getAttribute($this->getContext($context, "section"), "name")), "html", null, true);
                 echo "</a></li>\n\t\t\t\t\t\t";
             }
             $_parent = $context['_parent'];
             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['section'], $context['_parent'], $context['loop']);
             $context = array_intersect_key($context, $_parent) + $_parent;
             // line 26
             echo "\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t";
         } else {
             // line 29
             echo "\t\t\t\t<a class=\"btn submit add icon\" href=\"";
             echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("entries/" . $this->getAttribute($this->getAttribute($this->getContext($context, "newEntrySections"), 0, array(), "array"), "handle") . "/new"), "html", null, true);
             echo "\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t("New Entry"), "html", null, true);
             echo "</a>\n\t\t\t";
         }
         // line 31
         echo "\t\t</div>\n\t";
     }
     // line 33
     echo "\n\t";
     // line 34
     $this->displayParentBlock("sidebar", $context, $blocks);
     echo "\n";
 }
 public function getHelpDocument($path = '')
 {
     $segments = craft()->request->segments;
     $segment = end($segments);
     $section = craft()->userManual_settings->getChannelSetting();
     $criteria = craft()->elements->getCriteria(ElementType::Entry);
     $criteria->section = $section;
     $criteria->slug = $segment;
     $entry = $criteria->find();
     // if the app has not been set up at all, redirect to the settings page
     if ($section == '') {
         craft()->request->redirect(UrlHelper::getCpUrl('settings/plugins/usermanual/'));
     } else {
         if (!$entry) {
             $firstCriteria = craft()->elements->getCriteria(ElementType::Entry);
             $firstCriteria->section = $section;
             $firstCriteria->limit = 1;
             $firstEntry = $firstCriteria->find();
             echo $firstEntry[0]['body'];
         } else {
             echo $entry[0]['body'];
         }
     }
 }
 /**
  * Get the url for the given page.
  *
  * @param int $page
  *
  * @return string
  */
 public function getUrl($page)
 {
     $params = craft()->request->getQuery();
     // This one belongs to Craft.
     unset($params['p']);
     $params[$this->pageParam] = $page;
     return UrlHelper::getUrl(craft()->request->getPath(), $params);
 }
 /**
  * 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;
 }
 /**
  * Returns the link to the Order's PDF file for download.
  * @param string $option
  * @return string
  */
 public function getPdfUrl($option = '')
 {
     return UrlHelper::getActionUrl('market/download/pdf?number=' . $this->number . "&option=" . $option);
 }
 /**
  * Returns the element's CP edit URL.
  *
  * @return string|false
  */
 public function getCpEditUrl()
 {
     return UrlHelper::getCpUrl('market/customers/' . $this->id);
 }
 /**
  * Get the url for the given page.
  *
  * @param int $page
  *
  * @return string
  */
 public function getUrl($page)
 {
     return UrlHelper::getUrl(craft()->request->getPath(), [$this->pageParam => $page]);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 2
     $context["title"] = \Craft\Craft::t("Sections");
     // line 4
     $context["crumbs"] = array(0 => array("label" => \Craft\Craft::t("Settings"), "url" => \Craft\UrlHelper::getUrl("settings")));
     // line 8
     $context["docsUrl"] = "http://buildwithcraft.com/docs/sections-and-entries#sections";
     // line 11
     ob_start();
     // line 12
     echo "\t<div id=\"nosections\"";
     if ($this->getContext($context, "sections")) {
         echo " class=\"hidden\"";
     }
     echo ">\n\t\t<p>";
     // line 13
     echo twig_escape_filter($this->env, \Craft\Craft::t("No sections exist yet."), "html", null, true);
     echo "</p>\n\t</div>\n\n\t";
     // line 16
     if (twig_length_filter($this->env, $this->getContext($context, "sections"))) {
         // line 17
         echo "\t\t<table id=\"sections\" class=\"data fullwidth collapsible\">\n\t\t\t<thead>\n\t\t\t\t<th scope=\"col\">";
         // line 19
         echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 20
         echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 21
         echo twig_escape_filter($this->env, \Craft\Craft::t("Type"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 22
         echo twig_escape_filter($this->env, \Craft\Craft::t("URL Format"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 23
         echo twig_escape_filter($this->env, \Craft\Craft::t("Entry Types"), "html", null, true);
         echo "</th>\n\t\t\t\t<td class=\"thin\"></td>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t";
         // line 27
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getContext($context, "sections"));
         foreach ($context['_seq'] as $context["_key"] => $context["section"]) {
             // line 28
             echo "\t\t\t\t\t<tr data-id=\"";
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "id"), "html", null, true);
             echo "\" data-name=\"";
             echo twig_escape_filter($this->env, \Craft\Craft::t($this->getAttribute($this->getContext($context, "section"), "name")), "html", null, true);
             echo "\">\n\t\t\t\t\t\t<th scope=\"row\" data-title=\"";
             // line 29
             echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
             echo "\"><a href=\"";
             echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/sections/" . $this->getAttribute($this->getContext($context, "section"), "id")), "html", null, true);
             echo "\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t($this->getAttribute($this->getContext($context, "section"), "name")), "html", null, true);
             echo "</a></th>\n\t\t\t\t\t\t<td data-title=\"";
             // line 30
             echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
             echo "\"><code>";
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "handle"), "html", null, true);
             echo "</code></td>\n\t\t\t\t\t\t<td data-title=\"";
             // line 31
             echo twig_escape_filter($this->env, \Craft\Craft::t("Type"), "html", null, true);
             echo "\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t(twig_title_string_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "type"))), "html", null, true);
             echo "</td>\n\t\t\t\t\t\t<td data-title=\"";
             // line 32
             echo twig_escape_filter($this->env, \Craft\Craft::t("URL Format"), "html", null, true);
             echo "\" dir=\"ltr\">";
             // line 33
             if ($this->getAttribute($this->getContext($context, "section"), "isHomepage", array(), "method")) {
                 // line 34
                 echo "<div data-icon=\"home\" title=\"";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Homepage"), "html", null, true);
                 echo "\"></div>";
             } else {
                 // line 36
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "getUrlFormat", array(), "method"), "html", null, true);
             }
             // line 38
             echo "</td>\n\t\t\t\t\t\t<td data-title=\"";
             // line 39
             echo twig_escape_filter($this->env, \Craft\Craft::t("Entry Types"), "html", null, true);
             echo "\">\n\t\t\t\t\t\t\t";
             // line 40
             if ($this->getAttribute($this->getContext($context, "section"), "type") == "single" && twig_length_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method")) == 1) {
                 // line 41
                 echo "\t\t\t\t\t\t\t\t";
                 $context["entryType"] = $this->getAttribute($this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method"), 0, array(), "array");
                 // line 42
                 echo "\t\t\t\t\t\t\t\t<a href=\"";
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "getCpEditUrl", array(), "method"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Edit entry type"), "html", null, true);
                 echo "</a>\n\t\t\t\t\t\t\t";
             } else {
                 // line 44
                 echo "\t\t\t\t\t\t\t\t<a href=\"";
                 echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/sections/" . $this->getAttribute($this->getContext($context, "section"), "id") . "/entrytypes"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Edit entry types ({count})", array("count" => twig_length_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method")))), "html", null, true);
                 echo "</a>\n\t\t\t\t\t\t\t\t<a class=\"menubtn\" title=\"";
                 // line 45
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Entry Types"), "html", null, true);
                 echo "\"></a>\n\t\t\t\t\t\t\t\t<div class=\"menu\">\n\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t";
                 // line 48
                 $context['_parent'] = (array) $context;
                 $context['_seq'] = twig_ensure_traversable($this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method"));
                 foreach ($context['_seq'] as $context["_key"] => $context["entryType"]) {
                     // line 49
                     echo "\t\t\t\t\t\t\t\t\t\t\t<li><a href=\"";
                     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "getCpEditUrl", array(), "method"), "html", null, true);
                     echo "\">";
                     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "name"), "html", null, true);
                     echo "</a></li>\n\t\t\t\t\t\t\t\t\t\t";
                 }
                 $_parent = $context['_parent'];
                 unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entryType'], $context['_parent'], $context['loop']);
                 $context = array_intersect_key($context, $_parent) + $_parent;
                 // line 51
                 echo "\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
             }
             // line 54
             echo "\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"thin\"><a class=\"delete icon\" title=\"";
             // line 55
             echo twig_escape_filter($this->env, \Craft\Craft::t("Delete"), "html", null, true);
             echo "\" role=\"button\"></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['section'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 58
         echo "\t\t\t</tbody>\n\t\t</table>\n\t";
     }
     // line 61
     echo "\n\t<div id=\"newsectioncontainer\" class=\"buttons";
     // line 62
     if ($this->getContext($context, "CraftEdition") == $this->getContext($context, "CraftPersonal") && twig_length_filter($this->env, $this->getContext($context, "sections")) >= $this->getContext($context, "maxSections")) {
         echo " hidden";
     }
     echo "\">\n\t\t<a href=\"";
     // line 63
     echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/sections/new"), "html", null, true);
     echo "\" class=\"btn submit add icon\">";
     echo twig_escape_filter($this->env, \Craft\Craft::t("New Section"), "html", null, true);
     echo "</a>\n\t</div>\n";
     $context["content"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 68
     ob_start();
     // line 69
     echo "\tvar adminTable = new Craft.AdminTable({\n\t\ttableSelector: '#sections',\n\t\tnoObjectsSelector: '#nosections',\n\t\tnewObjectBtnSelector: '#newsectioncontainer',\n\t\tdeleteAction: 'sections/deleteSection',\n\t\tconfirmDeleteMessage: '";
     // line 74
     echo twig_escape_filter($this->env, \Craft\Craft::t("Are you sure you want to delete “{name}” and all its entries?"), "html", null, true);
     echo "',\n\t\t";
     // line 75
     if ($this->getContext($context, "CraftEdition") == $this->getContext($context, "CraftPersonal")) {
         echo "maxObjects: ";
         echo twig_escape_filter($this->env, $this->getContext($context, "maxSections"), "html", null, true);
         echo ",";
     }
     // line 76
     echo "\t\tonDeleteObject: function()\n\t\t{\n\t\t\t// Hide the Entries tab if that was the last one\n\t\t\tif (adminTable.totalObjects == 0)\n\t\t\t{\n\t\t\t\t\$('#nav-entries').remove();\n\t\t\t}\n\t\t}\n\t});\n";
     $context["js"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 86
     \Craft\craft()->templates->includeJs($this->getContext($context, "js"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
 }
Пример #15
0
 /**
  * Get Icon URL
  *
  * @return string
  */
 public function getIconUrl()
 {
     return UrlHelper::getResourceUrl('oauth/providers/vimeo.svg');
 }
Пример #16
0
 /**
  * Get Icon URL
  *
  * @return string
  */
 public function getIconUrl()
 {
     return UrlHelper::getResourceUrl('linkedin/svg/linkedin.svg');
 }
 public function getGlobals($forTemplate = "", $locale)
 {
     if ($this->renderedMetaVars) {
         return $this->renderedMetaVars;
     }
     if (!$locale) {
         $locale = craft()->language;
     }
     /* -- Load in our globals */
     $meta = $this->getMeta($forTemplate);
     $siteMeta = $this->getSiteMeta($locale);
     $identity = $this->getIdentity($locale);
     $social = $this->getSocial($locale);
     $creator = $this->getCreator($locale);
     /* -- Get a full qualified URL for the current request */
     $requestUrl = UrlHelper::stripQueryString(craft()->request->url);
     $meta['canonicalUrl'] = $this->getFullyQualifiedUrl($requestUrl);
     /* -- Merge the meta with the global meta */
     $globalMeta['seoTitle'] = $siteMeta['siteSeoTitle'];
     $globalMeta['seoDescription'] = $siteMeta['siteSeoDescription'];
     $globalMeta['seoKeywords'] = $siteMeta['siteSeoKeywords'];
     $globalMeta['seoImage'] = $this->getFullyQualifiedUrl($siteMeta['siteSeoImage']);
     $globalMeta['twitterCardType'] = $siteMeta['siteTwitterCardType'];
     $globalMeta['openGraphType'] = $siteMeta['siteOpenGraphType'];
     $globalMeta['robots'] = $siteMeta['siteRobots'];
     $meta = array_merge($globalMeta, $meta);
     /* -- Merge with the entry meta, if any */
     if ($this->entryMeta) {
         $meta = array_merge($meta, $this->entryMeta);
     }
     /* -- Add the helper vars */
     $helper = array();
     $this->addSocialHelpers($helper, $social, $identity);
     $this->addIdentityHelpers($helper, $identity);
     $this->addCreatorHelpers($helper, $creator);
     $this->setSocialForMeta($meta, $siteMeta, $social, $helper, $identity, $locale);
     /* -- Get rid of variables we don't want to expose */
     unset($siteMeta['siteSeoImageId']);
     unset($siteMeta['siteTwitterCardType']);
     unset($siteMeta['siteOpenGraphType']);
     unset($siteMeta['siteRobotsTxt']);
     unset($meta['twitterCardType']);
     unset($meta['openGraphType']);
     /* -- Set some useful runtime variables, too */
     $runtimeVars = array('seomaticTemplatePath' => '');
     /* -- Return everything is an array of arrays */
     $result = array('seomaticMeta' => $meta, 'seomaticHelper' => $helper, 'seomaticSiteMeta' => $siteMeta, 'seomaticSocial' => $social, 'seomaticIdentity' => $identity, 'seomaticCreator' => $creator);
     /* -- Swap in our JSON-LD objects */
     $result['seomaticIdentity'] = $this->getIdentityJSONLD($result['seomaticIdentity'], $helper, $locale);
     $result['seomaticCreator'] = $this->getCreatorJSONLD($result['seomaticCreator'], $helper, $locale);
     if ($this->entryMeta && isset($this->entrySeoCommerceVariants) && !empty($this->entrySeoCommerceVariants)) {
         $result['seomaticProduct'] = $this->getProductJSONLD($result, $locale);
     }
     /* -- Return our global variables */
     $result = array_merge($result, $runtimeVars);
     return $result;
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 2
     $context["title"] = \Craft\Craft::t("Fields");
     // line 4
     $context["docsUrl"] = "http://buildwithcraft.com/docs/fields";
     // line 6
     \Craft\craft()->templates->includeJsResource("js/fields.js");
     // line 8
     \Craft\craft()->templates->includeTranslations("What do you want to name your group?", "Could not create the group:", "Could not create the group:", "Are you sure you want to delete this group and all its fields?", "Could not delete the group.", "Group renamed.");
     // line 17
     $context["crumbs"] = array(0 => array("label" => \Craft\Craft::t("Settings"), "url" => \Craft\UrlHelper::getUrl("settings")));
     // line 22
     $context["groups"] = $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "fields"), "getAllGroups", array(0 => "id"), "method");
     // line 24
     if (array_key_exists("groupId", $context)) {
         // line 25
         if (!$this->getAttribute($this->getContext($context, "groups", true), $this->getContext($context, "groupId"), array(), "array", true, true)) {
             // line 26
             throw new \Craft\HttpException(404);
         }
         // line 29
         $context["fields"] = $this->getAttribute($this->getAttribute($this->getContext($context, "groups"), $this->getContext($context, "groupId"), array(), "array"), "getFields", array(), "method");
     } else {
         // line 31
         $context["fields"] = $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "fields"), "getAllFields", array(), "method");
     }
     // line 35
     ob_start();
     // line 36
     echo "\n\t<nav>\n\t\t<ul id=\"groups\">\n\t\t\t<li><a href=\"";
     // line 39
     echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/fields"), "html", null, true);
     echo "\"";
     if (!array_key_exists("groupId", $context)) {
         echo " class=\"sel\"";
     }
     echo ">";
     echo twig_escape_filter($this->env, \Craft\Craft::t("All Fields"), "html", null, true);
     echo "</a></li>\n\t\t\t";
     // line 40
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable($this->getContext($context, "groups"));
     foreach ($context['_seq'] as $context["_key"] => $context["group"]) {
         // line 41
         echo "\t\t\t\t<li><a href=\"";
         echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/fields/" . $this->getAttribute($this->getContext($context, "group"), "id")), "html", null, true);
         echo "\"";
         if (array_key_exists("groupId", $context) && $this->getAttribute($this->getContext($context, "group"), "id") == $this->getContext($context, "groupId")) {
             echo " class=\"sel\"";
         }
         echo " data-id=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "group"), "id"), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "group"), "name"), "html", null, true);
         echo "</a></li>\n\t\t\t";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['group'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 43
     echo "\t\t</ul>\n\t</nav>\n\n\t<div class=\"buttons\">\n\t\t<div id=\"newgroupbtn\" class=\"btn add icon\">";
     // line 47
     echo twig_escape_filter($this->env, \Craft\Craft::t("New Group"), "html", null, true);
     echo "</div>\n\n\t\t";
     // line 49
     if (array_key_exists("groupId", $context)) {
         // line 50
         echo "\t\t\t<div id=\"groupsettingsbtn\" class=\"btn settings icon menubtn\" title=\"";
         echo "Settings";
         echo "\"></div>\n\t\t\t<div class=\"menu\">\n\t\t\t\t<ul>\n\t\t\t\t\t<li><a data-action=\"rename\" role=\"button\">";
         // line 53
         echo twig_escape_filter($this->env, \Craft\Craft::t("Rename selected group"), "html", null, true);
         echo "</a></li>\n\t\t\t\t\t<li><a data-action=\"delete\" role=\"button\">";
         // line 54
         echo twig_escape_filter($this->env, \Craft\Craft::t("Delete selected group"), "html", null, true);
         echo "</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t";
     }
     // line 58
     echo "\t</div>\n";
     $context["sidebar"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 62
     ob_start();
     // line 63
     echo "\n\t<p id=\"nofields\"";
     // line 64
     if ($this->getContext($context, "fields")) {
         echo " class=\"hidden\"";
     }
     echo ">\n\t\t";
     // line 65
     if (array_key_exists("groupId", $context)) {
         // line 66
         echo "\t\t\t";
         echo twig_escape_filter($this->env, \Craft\Craft::t("This group doesn’t have any fields yet."), "html", null, true);
         echo "\n\t\t";
     } else {
         // line 68
         echo "\t\t\t";
         echo twig_escape_filter($this->env, \Craft\Craft::t("No fields exist yet."), "html", null, true);
         echo "\n\t\t";
     }
     // line 70
     echo "\t</p>\n\n\t";
     // line 72
     if ($this->getContext($context, "fields")) {
         // line 73
         echo "\t\t<table id=\"fields\" class=\"data fullwidth collapsible\">\n\t\t\t<thead>\n\t\t\t\t<th scope=\"col\">";
         // line 75
         echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 76
         echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
         echo "</th>\n\t\t\t\t<th scope=\"col\">";
         // line 77
         echo twig_escape_filter($this->env, \Craft\Craft::t("Type"), "html", null, true);
         echo "</th>\n\t\t\t\t";
         // line 78
         if (!array_key_exists("groupId", $context)) {
             echo "<th scope=\"col\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t("Group"), "html", null, true);
             echo "</th>";
         }
         // line 79
         echo "\t\t\t\t<td class=\"thin\"></td>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t";
         // line 82
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getContext($context, "fields"));
         foreach ($context['_seq'] as $context["_key"] => $context["field"]) {
             // line 83
             echo "\t\t\t\t\t<tr data-id=\"";
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "field"), "id"), "html", null, true);
             echo "\" data-name=\"";
             echo twig_escape_filter($this->env, \Craft\Craft::t($this->getAttribute($this->getContext($context, "field"), "name")), "html", null, true);
             echo "\">\n\t\t\t\t\t\t<th scope=\"row\" data-title=\"";
             // line 84
             echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
             echo "\"><a href=\"";
             echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/fields/edit/" . $this->getAttribute($this->getContext($context, "field"), "id")), "html", null, true);
             echo "\">";
             echo twig_escape_filter($this->env, \Craft\Craft::t($this->getAttribute($this->getContext($context, "field"), "name")), "html", null, true);
             echo "</a>";
             // line 85
             if ($this->getAttribute($this->getContext($context, "field"), "required")) {
                 echo " <span class=\"required\"></span>";
             }
             // line 86
             echo "</th>\n\t\t\t\t\t\t<td data-title=\"";
             // line 87
             echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
             echo "\"><code>";
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "field"), "handle"), "html", null, true);
             echo "</code></td>\n\t\t\t\t\t\t<td data-title=\"";
             // line 88
             echo twig_escape_filter($this->env, \Craft\Craft::t("Type"), "html", null, true);
             echo "\">\n\t\t\t\t\t\t\t";
             // line 89
             $context["fieldType"] = $this->getAttribute($this->getContext($context, "field"), "getFieldType", array(), "method");
             // line 90
             echo "\t\t\t\t\t\t\t";
             if ($this->getContext($context, "fieldType")) {
                 // line 91
                 echo "\t\t\t\t\t\t\t\t";
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "fieldType"), "name"), "html", null, true);
                 echo "\n\t\t\t\t\t\t\t";
             } else {
                 // line 93
                 echo "\t\t\t\t\t\t\t\t<span class=\"error\">";
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "field"), "type"), "html", null, true);
                 echo "</span>\n\t\t\t\t\t\t\t";
             }
             // line 95
             echo "\t\t\t\t\t\t</td>\n\t\t\t\t\t\t";
             // line 96
             if (!array_key_exists("groupId", $context)) {
                 echo "<td data-title=\"";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Group"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "field"), "group"), "name"), "html", null, true);
                 echo "</td>";
             }
             // line 97
             echo "\t\t\t\t\t\t<td class=\"thin\"><a class=\"delete icon\" title=\"";
             echo twig_escape_filter($this->env, \Craft\Craft::t("Delete"), "html", null, true);
             echo "\" role=\"button\"></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['field'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 100
         echo "\t\t\t</tbody>\n\t\t</table>\n\t";
     }
     // line 103
     echo "\n\t";
     // line 104
     if ($this->getContext($context, "groups")) {
         // line 105
         echo "\t\t<div class=\"buttons\">\n\t\t\t";
         // line 106
         $context["newFieldUrl"] = \Craft\UrlHelper::getUrl("settings/fields/new", array_key_exists("groupId", $context) ? array("groupId" => $this->getContext($context, "groupId")) : null);
         // line 107
         echo "\t\t\t<a href=\"";
         echo twig_escape_filter($this->env, $this->getContext($context, "newFieldUrl"), "html", null, true);
         echo "\" class=\"submit btn add icon\">";
         echo twig_escape_filter($this->env, \Craft\Craft::t("New Field"), "html", null, true);
         echo "</a>\n\t\t</div>\n\t";
     }
     // line 110
     echo "\n";
     $context["content"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 114
     $context["js"] = '' === ($tmp = "\tnew Craft.AdminTable({\n\t\ttableSelector: '#fields',\n\t\tnoObjectsSelector: '#nofields',\n\t\tdeleteAction: 'fields/deleteField'\n\t});\n") ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 121
     \Craft\craft()->templates->includeJs($this->getContext($context, "js"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
 }
 public function getCpEditUrl()
 {
     return UrlHelper::getCpUrl('market/settings/taxzones/' . $this->id);
 }
Пример #20
0
 /**
  * Returns the redirect URI
  *
  * @return array|string
  */
 public function getRedirectUri()
 {
     // Force `addTrailingSlashesToUrls` to `false` while we generate the redirectUri
     $addTrailingSlashesToUrls = \Craft\craft()->config->get('addTrailingSlashesToUrls');
     \Craft\craft()->config->set('addTrailingSlashesToUrls', false);
     $redirectUri = \Craft\UrlHelper::getActionUrl('oauth/connect');
     // Set `addTrailingSlashesToUrls` back to its original value
     \Craft\craft()->config->set('addTrailingSlashesToUrls', $addTrailingSlashesToUrls);
     // We don't want the CP trigger showing in the action URL.
     $redirectUri = str_replace(\Craft\craft()->config->get('cpTrigger') . '/', '', $redirectUri);
     OauthPlugin::log('Redirect URI: ' . $redirectUri, LogLevel::Info);
     return $redirectUri;
 }
 public function getCpEditUrl()
 {
     return UrlHelper::getCpUrl('market/settings/orderstatuses/' . $this->id);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     if (\Craft\craft()->getEdition() < $this->getContext($context, "CraftClient")) {
         throw new \Craft\HttpException(404);
     }
     // line 2
     echo "\n";
     // line 3
     $context["drafts"] = $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "entryRevisions"), "getEditableDraftsByEntryId", array(0 => $this->getAttribute($this->getContext($context, "entry"), "id"), 1 => $this->getAttribute($this->getContext($context, "entry"), "locale")), "method");
     // line 4
     $context["versions"] = $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "entryRevisions"), "getVersionsByEntryId", array(0 => $this->getAttribute($this->getContext($context, "entry"), "id"), 1 => $this->getAttribute($this->getContext($context, "entry"), "locale")), "method");
     // line 5
     $context["baseUrl"] = "entries/" . $this->getAttribute($this->getAttribute($this->getContext($context, "entry"), "getSection", array(), "method"), "handle") . "/" . $this->getAttribute($this->getContext($context, "entry"), "id") . "/";
     // line 6
     echo "\n<div class=\"btn menubtn\">";
     // line 7
     echo twig_escape_filter($this->env, $this->getContext($context, "revisionLabel"), "html", null, true);
     echo "</div>\n\n<div class=\"menu padded\">\n\t<ul>\n\t\t<li><a";
     // line 11
     if ($this->getAttribute($this->getContext($context, "entry"), "classHandle") == "Entry") {
         echo " class=\"sel\"";
     }
     echo " href=\"";
     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
     echo "\">";
     echo twig_escape_filter($this->env, \Craft\Craft::t("Current"), "html", null, true);
     echo "</a></li>\n\t</ul>\n\n\t";
     // line 14
     if ($this->getContext($context, "drafts")) {
         // line 15
         echo "\t\t<hr>\n\t\t<ul>\n\t\t\t";
         // line 17
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getContext($context, "drafts"));
         foreach ($context['_seq'] as $context["_key"] => $context["draft"]) {
             // line 18
             echo "\t\t\t\t<li><a";
             if ($this->getAttribute($this->getContext($context, "entry"), "classHandle") == "EntryDraft" && $this->getAttribute($this->getContext($context, "draft"), "draftId") == $this->getContext($context, "draftId")) {
                 echo " class=\"sel\"";
             }
             echo " href=\"";
             echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl($this->getContext($context, "baseUrl") . "drafts/" . $this->getAttribute($this->getContext($context, "draft"), "draftId")), "html", null, true);
             echo "\">\n\t\t\t\t\t";
             // line 19
             echo twig_escape_filter($this->env, \Craft\Craft::t("Draft {id}", array("id" => $this->getAttribute($this->getContext($context, "draft"), "draftId"))), "html", null, true);
             echo "\n\t\t\t\t\t<span class=\"light\">";
             // line 20
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "draft"), "creator"), "html", null, true);
             echo "</span>\n\t\t\t\t</a></li>\n\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['draft'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 23
         echo "\t\t</ul>\n\t";
     }
     // line 25
     echo "\n\t";
     // line 26
     if ($this->getContext($context, "versions")) {
         // line 27
         echo "\t\t<hr>\n\t\t<ul>\n\t\t\t";
         // line 29
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getContext($context, "versions"));
         foreach ($context['_seq'] as $context["_key"] => $context["version"]) {
             // line 30
             echo "\t\t\t\t<li><a";
             if ($this->getAttribute($this->getContext($context, "entry"), "classHandle") == "EntryVersion" && $this->getAttribute($this->getContext($context, "version"), "versionId") == $this->getContext($context, "versionId")) {
                 echo " class=\"sel\"";
             }
             echo " href=\"";
             echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl($this->getContext($context, "baseUrl") . "versions/" . $this->getAttribute($this->getContext($context, "version"), "versionId")), "html", null, true);
             echo "\">\n\t\t\t\t\t";
             // line 31
             echo twig_escape_filter($this->env, \Craft\Craft::t("Version {id}", array("id" => $this->getAttribute($this->getContext($context, "version"), "versionId"))), "html", null, true);
             echo "\n\t\t\t\t\t<span class=\"light\">";
             // line 32
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "version"), "creator"), "html", null, true);
             echo "</span>\n\t\t\t\t</a></li>\n\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['version'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 35
         echo "\t\t</ul>\n\t";
     }
     // line 37
     echo "</div>\n";
 }
Пример #23
0
 /**
  * Connect
  */
 public function connect($variables)
 {
     if (!craft()->httpSession->get('oauth.response')) {
         // we don't have any response yet, get ready to connect
         // clean session
         $this->_sessionClean();
         // get provider
         $provider = craft()->oauth->getProvider($variables['provider']);
         // referer
         if (!empty($variables['referer'])) {
             $referer = $variables['referer'];
         } else {
             $referer = craft()->request->getUrl();
         }
         craft()->httpSession->add('oauth.referer', $referer);
         // scope
         if (!empty($variables['scope'])) {
             $scope = $variables['scope'];
         } else {
             $scope = [];
         }
         craft()->httpSession->add('oauth.scope', $scope);
         // authorizationOptions
         if (!empty($variables['authorizationOptions'])) {
             $authorizationOptions = $variables['authorizationOptions'];
         } else {
             $authorizationOptions = [];
             // $authorizationOptions = $provider->getauthorizationOptions();
         }
         craft()->httpSession->add('oauth.authorizationOptions', $authorizationOptions);
         // redirect url
         $redirectUrl = UrlHelper::getActionUrl('oauth/connect/', array('provider' => $variables['provider']));
         OauthPlugin::log('Redirect to OAuth Connect' . "\r\n" . 'Redirect to: ' . $redirectUrl . "\r\n" . 'Session Data: ' . print_r(['oauth.referer' => $referer, 'oauth.scope' => $scope, 'oauth.authorizationOptions' => $authorizationOptions], true) . "\r\n", LogLevel::Info);
         // redirect
         craft()->request->redirect($redirectUrl);
     } else {
         // populate token object from response
         $response = craft()->httpSession->get('oauth.response');
         craft()->httpSession->remove('oauth.response');
         OauthPlugin::log('OAuth Connect - Retrieve token from response' . "\r\n" . 'Session Data: ' . print_r(['oauth.response' => $response], true) . "\r\n", LogLevel::Info);
         if ($response['token']) {
             // response token to token model
             $token = new Oauth_TokenModel();
             $provider = $this->getProvider($variables['provider']);
             if ($provider) {
                 switch ($provider->getOauthVersion()) {
                     case 1:
                         if (!empty($response['token']['identifier'])) {
                             $token->accessToken = $response['token']['identifier'];
                         }
                         if (!empty($response['token']['secret'])) {
                             $token->secret = $response['token']['secret'];
                         }
                         break;
                     case 2:
                         if (!empty($response['token']['accessToken'])) {
                             $token->accessToken = $response['token']['accessToken'];
                         }
                         if (!empty($response['token']['endOfLife'])) {
                             $token->endOfLife = $response['token']['endOfLife'];
                         }
                         if (!empty($response['token']['refreshToken'])) {
                             $token->refreshToken = $response['token']['refreshToken'];
                         }
                         break;
                 }
             }
             $token->providerHandle = $variables['provider'];
             $token->pluginHandle = $variables['plugin'];
             OauthPlugin::log('OAuth Connect - Token' . "\r\n" . print_r(["Token: \r\n" . print_r($token->getAttributes(), true)], true), LogLevel::Info);
             $response['token'] = $token;
         }
         $this->_sessionClean();
         return $response;
     }
 }
Пример #24
0
 public function getFullyQualifiedUrl($url)
 {
     $result = $url;
     if (!isset($result) || $result == "") {
         return $result;
     }
     $srcUrlParts = parse_url($result);
     if (UrlHelper::isAbsoluteUrl($url) || UrlHelper::isProtocolRelativeUrl($url)) {
         /* -- The URL is already a fully qualfied URL, do nothing */
     } else {
         $siteUrlOverride = craft()->config->get("siteUrlOverride", "seomatic");
         if ($siteUrlOverride) {
             $siteUrl = $siteUrlOverride;
         } else {
             $siteUrl = craft()->getSiteUrl();
         }
         $urlParts = parse_url($siteUrl);
         $port = "";
         if (isset($urlParts['port'])) {
             $port = ":" . $urlParts['port'];
         }
         if (isset($urlParts['scheme']) && isset($urlParts['host'])) {
             $siteUrl = $urlParts['scheme'] . "://" . $urlParts['host'] . $port . "/";
         } else {
             $siteUrl = "/";
         }
         if ($siteUrl[strlen($siteUrl) - 1] == '/' && $result[0] == '/') {
             $siteUrl = rtrim($siteUrl, '/');
         }
         $result = $siteUrl . $result;
     }
     return $result;
 }
Пример #25
0
 /**
  * Get Icon URL
  *
  * @return string
  */
 public function getIconUrl()
 {
     return UrlHelper::getResourceUrl('github/icon.svg');
 }
 public function block_main($context, array $blocks = array())
 {
     // line 14
     echo "\t<form id=\"entry-form\" method=\"post\" accept-charset=\"UTF-8\" data-saveshortcut=\"1\" data-saveshortcut-redirect=\"";
     echo twig_escape_filter($this->env, $this->getContext($context, "continueEditingUrl"), "html", null, true);
     echo "\">\n\t\t<input type=\"hidden\" name=\"sectionId\" value=\"";
     // line 15
     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "id"), "html", null, true);
     echo "\">\n\t\t";
     // line 16
     if ($this->getAttribute($this->getContext($context, "entry"), "id")) {
         echo "<input type=\"hidden\" name=\"entryId\" value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "id"), "html", null, true);
         echo "\">";
     }
     // line 17
     echo "\t\t";
     if ($this->getAttribute($this->getContext($context, "craft"), "isLocalized", array(), "method")) {
         echo "<input type=\"hidden\" name=\"locale\" value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "locale"), "html", null, true);
         echo "\">";
     }
     // line 18
     echo "\n\t\t<div class=\"grid first\">\n\t\t\t<div class=\"item\" data-position=\"left\" data-min-colspan=\"2\" data-max-colspan=\"3\">\n\t\t\t\t<div id=\"fields\" class=\"pane\">\n\t\t\t\t\t";
     // line 22
     $this->env->loadTemplate("_includes/tabs")->display($context);
     // line 23
     echo "\t\t\t\t\t";
     $this->env->loadTemplate("entries/_fields")->display($context);
     // line 24
     echo "\t\t\t\t</div>\n\t\t\t</div><!--/item-->\n\n\t\t\t<div class=\"item\" data-position=\"right\" data-colspan=\"1\">\n\n\t\t\t\t";
     // line 29
     if ($this->getContext($context, "showPreviewBtn")) {
         // line 30
         echo "\t\t\t\t\t<div id=\"livepreview-btn\" class=\"btn big\" data-icon=\"view\">\n\t\t\t\t\t\t";
         // line 31
         echo twig_escape_filter($this->env, \Craft\Craft::t("Live Preview"), "html", null, true);
         echo "\n\t\t\t\t\t\t<div id=\"livepreview-spinner\" class=\"spinner hidden\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t";
     }
     // line 35
     echo "\n\t\t\t\t";
     // line 36
     if ($this->getAttribute($this->getContext($context, "craft"), "isLocalized", array(), "method") && twig_length_filter($this->env, $this->getAttribute($this->getContext($context, "section"), "getLocales", array(), "method")) > 1) {
         // line 37
         echo "\t\t\t\t\t<ul id=\"locales\" class=\"pane\">\n\t\t\t\t\t\t";
         // line 38
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getContext($context, "localeIds"));
         foreach ($context['_seq'] as $context["_key"] => $context["localeId"]) {
             // line 39
             echo "\t\t\t\t\t\t\t";
             $context["localeName"] = $this->getAttribute($this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "i18n"), "getLocaleById", array(0 => $this->getContext($context, "localeId")), "method"), "name");
             // line 40
             echo "\t\t\t\t\t\t\t<li";
             if ($this->getContext($context, "localeId") == $this->getAttribute($this->getContext($context, "entry"), "locale")) {
                 echo " class=\"sel\"";
             }
             echo ">";
             // line 41
             if ($this->getContext($context, "localeId") == $this->getAttribute($this->getContext($context, "entry"), "locale")) {
                 // line 42
                 echo twig_escape_filter($this->env, $this->getContext($context, "localeName"), "html", null, true);
                 echo "\n\t\t\t\t\t\t\t\t\t";
                 // line 43
                 echo $context["forms"]->getlightswitch(array("name" => "localeEnabled", "on" => $this->getAttribute($this->getContext($context, "entry"), "localeEnabled")));
             } else {
                 // line 48
                 echo "<a href=\"";
                 echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("entries/" . $this->getContext($context, "sectionHandle") . "/" . $this->getAttribute($this->getAttribute($this->getContext($context, "craft"), "request"), "getSegment", array(0 => 3), "method")) . "/" . $this->getContext($context, "localeId"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, $this->getContext($context, "localeName"), "html", null, true);
                 echo "</a>\n\t\t\t\t\t\t\t\t\t<div class=\"status ";
                 // line 49
                 echo twig_in_filter($this->getContext($context, "localeId"), $this->getContext($context, "enabledLocales")) ? "enabled" : "disabled";
                 echo "\"></div>";
             }
             // line 51
             echo "</li>\n\t\t\t\t\t\t";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['localeId'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 53
         echo "\t\t\t\t\t</ul>\n\t\t\t\t";
     }
     // line 55
     echo "\n\t\t\t\t";
     // line 56
     if ($this->getAttribute($this->getContext($context, "section"), "type") != "single") {
         // line 57
         echo "\t\t\t\t\t<div id=\"settings\" class=\"pane\">\n\n\t\t\t\t\t\t";
         // line 59
         if ($this->getContext($context, "showEntryTypes")) {
             // line 60
             echo "\t\t\t\t\t\t\t";
             echo $context["forms"]->getselectField(array("label" => \Craft\Craft::t("Entry Type"), "id" => "entryType", "name" => "typeId", "value" => $this->getAttribute($this->getContext($context, "entryType"), "id"), "options" => $this->getContext($context, "entryTypeOptions")));
             // line 66
             echo "\n\t\t\t\t\t\t";
         }
         // line 68
         echo "\n\t\t\t\t\t\t";
         // line 69
         echo $context["forms"]->gettextField(array("label" => \Craft\Craft::t("Slug"), "id" => "slug", "name" => "slug", "value" => $this->getAttribute($this->getContext($context, "entry"), "slug"), "errors" => twig_array_merge($this->getAttribute($this->getContext($context, "entry"), "getErrors", array(0 => "slug"), "method"), $this->getAttribute($this->getContext($context, "entry"), "getErrors", array(0 => "uri"), "method")), "required" => true));
         // line 76
         echo "\n\n\t\t\t\t\t\t";
         // line 78
         if ($this->getAttribute($this->getContext($context, "section"), "type") == "structure" && twig_length_filter($this->env, $this->getContext($context, "parentOptions")) > 1) {
             // line 79
             echo "\t\t\t\t\t\t\t";
             echo $context["forms"]->getselectField(array("label" => \Craft\Craft::t("Parent Entry"), "id" => "parentId", "name" => "parentId", "options" => $this->getContext($context, "parentOptions"), "value" => $this->getContext($context, "parentId")));
             // line 85
             echo "\n\t\t\t\t\t\t";
         }
         // line 87
         echo "\n\t\t\t\t\t\t";
         // line 88
         if ($this->getContext($context, "CraftEdition") >= $this->getContext($context, "CraftClient")) {
             // line 89
             echo "\t\t\t\t\t\t\t";
             echo $context["forms"]->getselectField(array("label" => \Craft\Craft::t("Author"), "id" => "author", "name" => "author", "options" => $this->getContext($context, "authorOptions"), "value" => $this->getAttribute($this->getContext($context, "entry"), "authorId")));
             // line 95
             echo "\n\t\t\t\t\t\t";
         }
         // line 97
         echo "\n\t\t\t\t\t\t";
         // line 98
         echo $context["forms"]->getdateTimeField(array("label" => \Craft\Craft::t("Post Date"), "id" => "postDate", "name" => "postDate", "value" => $this->getAttribute($this->getContext($context, "entry"), "postDate") ? $this->getAttribute($this->getContext($context, "entry"), "postDate") : null, "errors" => $this->getAttribute($this->getContext($context, "entry"), "getErrors", array(0 => "postDate"), "method")));
         // line 104
         echo "\n\n\t\t\t\t\t\t";
         // line 106
         echo $context["forms"]->getdateTimeField(array("label" => \Craft\Craft::t("Expiration Date"), "id" => "expiryDate", "name" => "expiryDate", "value" => $this->getAttribute($this->getContext($context, "entry"), "expiryDate") ? $this->getAttribute($this->getContext($context, "entry"), "expiryDate") : null, "errors" => $this->getAttribute($this->getContext($context, "entry"), "getErrors", array(0 => "expiryDate"), "method")));
         // line 112
         echo "\n\n\t\t\t\t\t\t";
         // line 114
         if ($this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "publishEntries" . $this->getContext($context, "permissionSuffix")), "method")) {
             // line 115
             echo "\t\t\t\t\t\t\t";
             echo $context["forms"]->getlightswitchField(array("label" => \Craft\Craft::t("Status"), "name" => "enabled", "on" => $this->getAttribute($this->getContext($context, "entry"), "enabled")));
             // line 119
             echo "\n\t\t\t\t\t\t";
         }
         // line 121
         echo "\t\t\t\t\t</div><!--/pane-->\n\n\t\t\t\t\t";
         // line 123
         if ($this->getContext($context, "canDeleteEntry")) {
             // line 124
             echo "\t\t\t\t\t\t<div class=\"pane\">\n\t\t\t\t\t\t\t<input type=\"button\" class=\"btn small formsubmit\" value=\"";
             // line 125
             echo twig_escape_filter($this->env, \Craft\Craft::t("Delete"), "html", null, true);
             echo "\" data-action=\"entries/deleteEntry\"\n\t\t\t\t\t\t\t\tdata-confirm=\"";
             // line 126
             echo twig_escape_filter($this->env, \Craft\Craft::t("Are you sure you want to delete this entry?"), "html", null, true);
             echo "\"\n\t\t\t\t\t\t\t\tdata-redirect=\"entries\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t";
         }
         // line 130
         echo "\t\t\t\t";
     }
     // line 131
     echo "\t\t\t</div><!--/item-->\n\n\t\t\t";
     // line 133
     if ($this->getAttribute($this->getContext($context, "entry"), "classHandle") != "EntryVersion") {
         // line 134
         echo "\t\t\t\t<div class=\"item\" data-position=\"left\" data-colspan=\"1\">\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t";
         // line 136
         if ($this->getAttribute($this->getContext($context, "entry"), "id") && $this->getAttribute($this->getContext($context, "entry"), "classHandle") == "EntryDraft") {
             // line 137
             echo "\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"entryRevisions/saveDraft\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"redirect\" value=\"";
             // line 139
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
             echo "/drafts/";
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "draftId"), "html", null, true);
             echo "\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"draftId\" value=\"";
             // line 140
             echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "draftId"), "html", null, true);
             echo "\">\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn submit first\" value=\"";
             // line 141
             echo twig_escape_filter($this->env, \Craft\Craft::t("Save draft"), "html", null, true);
             echo "\">\n\n\t\t\t\t\t\t\t";
             // line 143
             if ($this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "publishEntries" . $this->getContext($context, "permissionSuffix")), "method") && ($this->getAttribute($this->getContext($context, "entry"), "creatorId") == $this->getAttribute($this->getContext($context, "currentUser"), "id") || $this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "publishPeerEntryDrafts" . $this->getContext($context, "permissionSuffix")), "method"))) {
                 // line 144
                 echo "\t\t\t\t\t\t\t\t<input type=\"button\" class=\"btn formsubmit\" value=\"";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Publish draft"), "html", null, true);
                 echo "\" data-action=\"entryRevisions/publishDraft\" data-redirect=\"";
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
                 echo "\">\n\t\t\t\t\t\t\t";
             }
             // line 146
             echo "\n\t\t\t\t\t\t\t";
             // line 147
             if ($this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "publishEntries" . $this->getContext($context, "permissionSuffix")), "method") && ($this->getAttribute($this->getContext($context, "entry"), "creatorId") == $this->getAttribute($this->getContext($context, "currentUser"), "id") || $this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "deletePeerEntryDrafts" . $this->getContext($context, "permissionSuffix")), "method"))) {
                 // line 148
                 echo "\t\t\t\t\t\t\t\t<input type=\"button\" class=\"btn formsubmit\" value=\"";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Delete draft"), "html", null, true);
                 echo "\" data-action=\"entryRevisions/deleteDraft\"\n\t\t\t\t\t\t\t\t   data-confirm=\"";
                 // line 149
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Are you sure you want to delete this draft?"), "html", null, true);
                 echo "\"\n\t\t\t\t\t\t\t\t   data-redirect=\"";
                 // line 150
                 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
                 echo "\"/>\n\t\t\t\t\t\t\t";
             }
             // line 152
             echo "\n\t\t\t\t\t\t";
         } else {
             // line 154
             echo "\n\t\t\t\t\t\t\t";
             // line 155
             if (!$this->getAttribute($this->getContext($context, "entry"), "id") || !$this->getAttribute($this->getContext($context, "entry"), "enabled") || $this->getAttribute($this->getContext($context, "currentUser"), "can", array(0 => "publishEntries" . $this->getContext($context, "permissionSuffix")), "method")) {
                 // line 156
                 echo "\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"entries/saveEntry\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"redirect\" value=\"entries/";
                 // line 157
                 echo twig_escape_filter($this->env, $this->getContext($context, "sectionHandle"), "html", null, true);
                 echo "\">\n\n\t\t\t\t\t\t\t\t<div class=\"btngroup submit first\">\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn submit\" value=\"";
                 // line 160
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Save"), "html", null, true);
                 echo "\">\n\n\t\t\t\t\t\t\t\t\t<div class=\"btn submit menubtn\"></div>\n\t\t\t\t\t\t\t\t\t<div class=\"menu\">\n\t\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t\t<li><a class=\"formsubmit\" data-redirect=\"";
                 // line 165
                 echo twig_escape_filter($this->env, $this->getContext($context, "continueEditingUrl"), "html", null, true);
                 echo "\">";
                 echo twig_escape_filter($this->env, \Craft\Craft::t("Save and continue editing"), "html", null, true);
                 echo "</a></li>\n\n\t\t\t\t\t\t\t\t\t\t\t";
                 // line 167
                 $context["nextEntryParams"] = array();
                 // line 168
                 echo "\t\t\t\t\t\t\t\t\t\t\t";
                 if ($this->getContext($context, "showEntryTypes")) {
                     // line 169
                     echo "\t\t\t\t\t\t\t\t\t\t\t\t";
                     $context["nextEntryParams"] = twig_array_merge($this->getContext($context, "nextEntryParams"), array(0 => "typeId={type.id}"));
                     // line 170
                     echo "\t\t\t\t\t\t\t\t\t\t\t";
                 }
                 // line 171
                 echo "\t\t\t\t\t\t\t\t\t\t\t";
                 if ($this->getAttribute($this->getContext($context, "section"), "type") == "structure" && twig_length_filter($this->env, $this->getContext($context, "parentOptions")) > 1) {
                     // line 172
                     echo "\t\t\t\t\t\t\t\t\t\t\t\t";
                     $context["nextEntryParams"] = twig_array_merge($this->getContext($context, "nextEntryParams"), array(0 => "parentId={parent.id}"));
                     // line 173
                     echo "\t\t\t\t\t\t\t\t\t\t\t";
                 }
                 // line 174
                 echo "\n\t\t\t\t\t\t\t\t\t\t\t";
                 // line 175
                 if ($this->getAttribute($this->getContext($context, "section"), "type") != "single") {
                     // line 176
                     echo "\t\t\t\t\t\t\t\t\t\t\t\t<li><a class=\"formsubmit\" data-redirect=\"entries/";
                     echo twig_escape_filter($this->env, $this->getContext($context, "sectionHandle"), "html", null, true);
                     echo "/new";
                     if ($this->getContext($context, "nextEntryParams")) {
                         echo "?";
                         echo twig_escape_filter($this->env, twig_join_filter($this->getContext($context, "nextEntryParams"), "&"), "html", null, true);
                     }
                     echo "\">";
                     echo twig_escape_filter($this->env, \Craft\Craft::t("Save and add another"), "html", null, true);
                     echo "</a></li>\n\t\t\t\t\t\t\t\t\t\t\t";
                 }
                 // line 178
                 echo "\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t";
                 // line 182
                 if ($this->getAttribute($this->getContext($context, "entry"), "id") && $this->getContext($context, "CraftEdition") >= $this->getContext($context, "CraftClient")) {
                     // line 183
                     echo "\t\t\t\t\t\t\t\t\t<input type=\"button\" class=\"btn formsubmit\" value=\"";
                     echo twig_escape_filter($this->env, \Craft\Craft::t("Save as a draft"), "html", null, true);
                     echo "\" data-action=\"entryRevisions/saveDraft\" data-redirect=\"";
                     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
                     echo "/drafts/{draftId}\">\n\t\t\t\t\t\t\t\t";
                 }
                 // line 185
                 echo "\t\t\t\t\t\t\t";
             } else {
                 // line 186
                 echo "\t\t\t\t\t\t\t\t";
                 if ($this->getContext($context, "CraftEdition") >= $this->getContext($context, "CraftClient")) {
                     // line 187
                     echo "\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"entryRevisions/saveDraft\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"redirect\" value=\"";
                     // line 188
                     echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entry"), "cpEditUrl"), "html", null, true);
                     echo "/drafts/{draftId}\">\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn submit first\" value=\"";
                     // line 189
                     echo twig_escape_filter($this->env, \Craft\Craft::t("Save as a draft"), "html", null, true);
                     echo "\">\n\t\t\t\t\t\t\t\t";
                 }
                 // line 191
                 echo "\t\t\t\t\t\t\t";
             }
             // line 192
             echo "\t\t\t\t\t\t";
         }
         // line 193
         echo "\t\t\t\t\t</div>\n\t\t\t\t</div><!--/item-->\n\t\t\t";
     }
     // line 196
     echo "\t\t</div><!--/grid-->\n\t</form>\n";
 }
Пример #27
0
 /**
  * Method that triggers any pending tasks immediately.
  */
 private function _triggerTasksNow()
 {
     $url = UrlHelper::getActionUrl('tasks/runPendingTasks');
     if (function_exists('curl_init')) {
         $ch = curl_init($url);
         $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => false, CURLOPT_NOSIGNAL => true);
         if (defined('CURLOPT_TIMEOUT_MS')) {
             $options[CURLOPT_TIMEOUT_MS] = 500;
         } else {
             $options[CURLOPT_TIMEOUT] = 1;
         }
         curl_setopt_array($ch, $options);
         curl_exec($ch);
         $curlErrorNo = curl_errno($ch);
         $curlError = curl_error($ch);
         $httpStatus = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
         curl_close($ch);
         if ($curlErrorNo !== 0) {
             ImagerPlugin::log("Request for running tasks immediately failed with error number {$curlErrorNo} and error message: {$curlError}", LogLevel::Error);
         }
         if ($httpStatus !== 200) {
             ImagerPlugin::log("Request for running tasks immediately failed with http status {$httpStatus}", LogLevel::Error);
         }
     }
 }
 public function getCpEditUrl()
 {
     return UrlHelper::getCpUrl('market/products/' . $this->product->type->handle . '/' . $this->product->id . '/variants/' . $this->id);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 3
     $context["entryTypes"] = $this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method");
     // line 4
     $context["multiple"] = twig_length_filter($this->env, $this->getContext($context, "entryTypes")) > 1;
     // line 6
     ob_start();
     // line 7
     echo "\t<table id=\"entrytypes\" class=\"data fullwidth collapsible\">\n\t\t<thead>\n\t\t\t<th scope=\"col\">";
     // line 9
     echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
     echo "</th>\n\t\t\t<th scope=\"col\">";
     // line 10
     echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
     echo "</th>\n\t\t\t";
     // line 11
     if ($this->getContext($context, "multiple")) {
         // line 12
         echo "\t\t\t\t<td class=\"thin\"></td>\n\t\t\t\t<td class=\"thin\"></td>\n\t\t\t";
     }
     // line 15
     echo "\t\t</thead>\n\t\t<tbody>\n\t\t\t";
     // line 17
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable($this->getAttribute($this->getContext($context, "section"), "getEntryTypes", array(), "method"));
     foreach ($context['_seq'] as $context["_key"] => $context["entryType"]) {
         // line 18
         echo "\t\t\t\t<tr data-id=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "id"), "html", null, true);
         echo "\" data-name=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "name"), "html", null, true);
         echo "\">\n\t\t\t\t\t<th scope=\"row\" data-title=\"";
         // line 19
         echo twig_escape_filter($this->env, \Craft\Craft::t("Name"), "html", null, true);
         echo "\"><a href=\"";
         echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/sections/" . $this->getAttribute($this->getContext($context, "section"), "id") . "/entrytypes/" . $this->getAttribute($this->getContext($context, "entryType"), "id")), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "name"), "html", null, true);
         echo "</a></th>\n\t\t\t\t\t<td data-title=\"";
         // line 20
         echo twig_escape_filter($this->env, \Craft\Craft::t("Handle"), "html", null, true);
         echo "\"><code>";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entryType"), "handle"), "html", null, true);
         echo "</code></td>\n\t\t\t\t\t";
         // line 21
         if ($this->getContext($context, "multiple")) {
             // line 22
             echo "\t\t\t\t\t\t<td class=\"thin\"><a class=\"move icon\" title=\"";
             echo twig_escape_filter($this->env, \Craft\Craft::t("Reorder"), "html", null, true);
             echo "\" role=\"button\"></a></td>\n\t\t\t\t\t\t<td class=\"thin\"><a class=\"delete icon\" title=\"";
             // line 23
             echo twig_escape_filter($this->env, \Craft\Craft::t("Delete"), "html", null, true);
             echo "\" role=\"button\"></a></td>\n\t\t\t\t\t";
         }
         // line 25
         echo "\t\t\t\t</tr>\n\t\t\t";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entryType'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 27
     echo "\t\t</tbody>\n\t</table>\n\n\t";
     // line 30
     if ($this->getAttribute($this->getContext($context, "section"), "type") != "single") {
         // line 31
         echo "\t\t<div class=\"buttons\">\n\t\t\t<a href=\"";
         // line 32
         echo twig_escape_filter($this->env, \Craft\UrlHelper::getUrl("settings/sections/" . $this->getAttribute($this->getContext($context, "section"), "id") . "/entrytypes/new"), "html", null, true);
         echo "\" class=\"btn submit add icon\">";
         echo twig_escape_filter($this->env, \Craft\Craft::t("New Entry Type"), "html", null, true);
         echo "</a>\n\t\t</div>\n\t";
     }
     $context["content"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 38
     if ($this->getAttribute($this->getContext($context, "section"), "type") != "single") {
         // line 39
         ob_start();
         // line 40
         echo "\t\tnew Craft.AdminTable({\n\t\t\ttableSelector: '#entrytypes',\n\t\t\tdeleteAction: 'sections/deleteEntryType',\n\t\t\tminObjects: 1,\n\t\t\tsortable: true,\n\t\t\treorderAction: 'sections/reorderEntryTypes',\n\t\t\tconfirmDeleteMessage: '";
         // line 46
         echo twig_escape_filter($this->env, \Craft\Craft::t("Are you sure you want to delete “{name}” and all entries that use it?"), "html", null, true);
         echo "',\n\t\t});\n\t";
         $context["js"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
         // line 49
         \Craft\craft()->templates->includeJs($this->getContext($context, "js"));
     }
     $this->parent->display($context, array_merge($this->blocks, $blocks));
 }
Пример #30
0
 public function actionEditMeta(array $variables = array())
 {
     if (isset($variables['locale'])) {
         $locale = $variables['locale'];
     } else {
         $locale = craft()->language;
     }
     $siteMeta = craft()->seomatic->getSiteMeta($locale);
     $titleLength = craft()->config->get("maxTitleLength", "seomatic");
     if ($siteMeta['siteSeoTitlePlacement'] == "none") {
         $variables['titleLength'] = $titleLength;
     } else {
         $variables['titleLength'] = $titleLength - strlen(" | ") - strlen($siteMeta['siteSeoName']);
     }
     if (empty($variables['meta'])) {
         if (!empty($variables['metaId'])) {
             $variables['meta'] = craft()->seomatic->getMetaById($variables['metaId'], $locale);
             /* -- If we have a metaId but nothing is returned for that locale, make a new element/record using that elementId */
             if (!$variables['meta']) {
                 /*
                 $variables['meta'] = new Seomatic_MetaModel();
                 $variables['meta']['locale'] = $locale;
                 $variables['meta']['elementId'] = $variables['metaId'];
                 */
                 throw new HttpException(404);
             }
         } else {
             $variables['meta'] = new Seomatic_MetaModel();
             $variables['meta']['locale'] = $locale;
         }
     }
     // Whether any assets sources exist
     $sources = craft()->assets->findFolders();
     $variables['assetsSourceExists'] = count($sources);
     $variables['transformsList'] = craft()->seomatic->getTransformsList();
     // URL to create a new assets source
     $variables['newAssetsSourceUrl'] = UrlHelper::getUrl('settings/assets/sources/new');
     // Set asset ID
     $variables['seoImageId'] = $variables['meta']->seoImageId;
     // Set asset elements
     if ($variables['seoImageId']) {
         if (is_array($variables['seoImageId'])) {
             $variables['seoImageId'] = $variables['seoImageId'][0];
         }
         $asset = craft()->elements->getElementById($variables['seoImageId']);
         $variables['elements'] = array($asset);
     } else {
         $variables['elements'] = array();
     }
     // Set asset ID
     $variables['seoTwitterImageId'] = $variables['meta']->seoTwitterImageId;
     // Set asset elements
     if ($variables['seoTwitterImageId']) {
         if (is_array($variables['seoTwitterImageId'])) {
             $variables['seoTwitterImageId'] = $variables['seoTwitterImageId'][0];
         }
         $asset = craft()->elements->getElementById($variables['seoTwitterImageId']);
         $variables['elementsTwitter'] = array($asset);
     } else {
         $variables['elementsTwitter'] = array();
     }
     // Set asset ID
     $variables['seoFacebookImageId'] = $variables['meta']->seoFacebookImageId;
     // Set asset elements
     if ($variables['seoFacebookImageId']) {
         if (is_array($variables['seoFacebookImageId'])) {
             $variables['seoFacebookImageId'] = $variables['seoFacebookImageId'][0];
         }
         $asset = craft()->elements->getElementById($variables['seoFacebookImageId']);
         $variables['elementsFacebook'] = array($asset);
     } else {
         $variables['elementsFacebook'] = array();
     }
     // Set element type
     $variables['elementType'] = craft()->elements->getElementType(ElementType::Asset);
     // Tabs
     $variables['tabs'] = array();
     if (!$variables['meta']->id) {
         $variables['title'] = Craft::t('Untitled Meta');
     } else {
         $variables['title'] = $variables['meta']->title;
     }
     // Breadcrumbs
     $variables['crumbs'] = array(array('label' => Craft::t('SEO Template Meta'), 'url' => UrlHelper::getUrl('seomatic/meta')));
     // Set the "Continue Editing" URL
     $variables['continueEditingUrl'] = 'seomatic/meta/{id}/{locale}';
     // Render the template!
     $this->renderTemplate('seomatic/meta/_edit', $variables);
 }