当前位置: 首页>>代码示例>>PHP>>正文


PHP KT::arrayTryGetValue方法代码示例

本文整理汇总了PHP中KT::arrayTryGetValue方法的典型用法代码示例。如果您正苦于以下问题:PHP KT::arrayTryGetValue方法的具体用法?PHP KT::arrayTryGetValue怎么用?PHP KT::arrayTryGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KT的用法示例。


在下文中一共展示了KT::arrayTryGetValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: kt_cron_schedules_metabox_callback

function kt_cron_schedules_metabox_callback()
{
    $schedules = wp_get_schedules();
    if (KT::arrayIssetAndNotEmpty($schedules)) {
        echo "<ol>";
        foreach ($schedules as $key => $values) {
            if (KT::arrayIssetAndNotEmpty($values)) {
                $interval = KT::arrayTryGetValue($values, "interval");
                $display = KT::arrayTryGetValue($values, "display");
                echo "<li><b>{$key}</b> (<i>{$display}</i>) - {$interval} [s]</li>";
            }
        }
        echo "</ol>";
    }
}
开发者ID:ktstudio,项目名称:wp-framework,代码行数:15,代码来源:kt_wp_cron_metabox.admin.inc.php

示例2: getCookieStatementHtml

 /**
  * Vrátí obsah proužku s potvrzením cookie (v patičce)
  * NENÍ POTŘEBA VOLAT VEŘEJNĚ
  *
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  */
 public static function getCookieStatementHtml()
 {
     $cookueStatementKey = KT::arrayTryGetValue($_COOKIE, self::COOKIE_STATEMENT_KEY);
     if (KT::notIssetOrEmpty($cookueStatementKey)) {
         $text = __("Tyto stránky využívají Cookies. Používáním těchto stránek vyjadřujete souhlas s používáním Cookies.", "KT_CORE_DOMAIN");
         $moreInfoTitle = __("Zjistit více", "KT_CORE_DOMAIN");
         $moreInfoUrl = apply_filters("kt_cookie_statement_more_info_url_filter", "https://www.google.com/policies/technologies/cookies/");
         $confirmTitle = __("OK, rozumím", "KT_CORE_DOMAIN");
         $html = "<span id=\"ktCookieStatementText\">{$text}</span>";
         $html .= "<span id=\"ktCookieStatementMoreInfo\"><a href=\"{$moreInfoUrl}\" title=\"{$moreInfoTitle}\" target=\"_blank\">{$moreInfoTitle}</a></span>";
         $html .= "<span id=\"ktCookieStatementConfirm\">{$confirmTitle}</span>";
         $content = apply_filters("kt_cookie_statement_content_filter", $html);
         $output = "<div id=\"ktCookieStatement\">{$content}</div>";
         $output .= "<noscript><style scoped>#ktCookieStatement { display:none; }</style></noscript>";
         return $output;
     }
     return null;
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:25,代码来源:kt_wp_configurator.inc.php

示例3: theColumn

 private function theColumn($postId, $args)
 {
     $columnType = $args[self::TYPE_PARAM_KEY];
     switch ($columnType) {
         case self::THUMBNAIL_TYPE_KEY:
             if (has_post_thumbnail($postId)) {
                 the_post_thumbnail($args[self::SIZE_PARAM_KEY]);
             } else {
                 echo KT_EMPTY_SYMBOL;
             }
             break;
         case self::POST_PROPERTY_TYPE_KEY:
             $post = get_post($postId);
             if (KT::issetAndNotEmpty($post)) {
                 $property = $args[self::PROPERTY_PARAM_KEY];
                 $value = $post->{$property};
                 $filterFunction = KT::arrayTryGetValue($args, self::FILTER_FUNCTION);
                 if (KT::issetAndNotEmpty($filterFunction)) {
                     $value = apply_filters("{$filterFunction}", $value);
                 }
                 echo $value;
             } else {
                 echo KT_EMPTY_SYMBOL;
             }
             break;
         case self::POST_META_TYPE_KEY:
             $postMeta = get_post_meta($postId, $args[self::METAKEY_PARAM_KEY], true);
             if (isset($postMeta)) {
                 $value = $postMeta;
                 $filterFunction = KT::arrayTryGetValue($args, self::FILTER_FUNCTION);
                 if (KT::issetAndNotEmpty($filterFunction)) {
                     $value = apply_filters($filterFunction, $value);
                 }
                 echo $value;
             } else {
                 echo KT_EMPTY_SYMBOL;
             }
             break;
         case self::TAXONOMY_TYPE_KEY:
             $postType = get_post_type($postId);
             $terms = get_the_terms($postId, $args[self::TAXONOMY_PARAM_KEY]);
             if (!empty($terms)) {
                 foreach ($terms as $term) {
                     $href = "edit.php?post_type={$postType}&{$args[self::TAXONOMY_PARAM_KEY]}={$term->slug}";
                     $name = esc_html(sanitize_term_field("name", $term->name, $term->term_id, $args[self::TAXONOMY_PARAM_KEY], "edit"));
                     $post_terms[] = '<a href="' . $href . '">' . $name . '</a>';
                 }
                 echo join(", ", $post_terms);
             } else {
                 echo KT_EMPTY_SYMBOL;
             }
             break;
         default:
             throw new KT_Not_Supported_Exception(sprintf(__("Typ sloupce: %s", "KT_CORE_DOMAIN"), $columnType));
     }
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:56,代码来源:kt_admin_columns.inc.php

示例4: getPasword

 protected function getPasword(array $values)
 {
     $form = $this->getForm();
     $password = KT::arrayTryGetValue($values, KT_User_Profile_Config::PASSWORD);
     if (KT::issetAndNotEmpty($password)) {
         $fieldset = $form->getFieldSetByName(KT_User_Profile_Config::USER_PROFILE_FIELDSET);
         $passwordConfirm = KT::arrayTryGetValue($values, KT_User_Profile_Config::PASSWORD_CONFIRM);
         if (KT::issetAndNotEmpty($passwordConfirm)) {
             if ($password === $passwordConfirm) {
                 // OK
                 return $password;
             } else {
                 // hesla se nerovnají
                 $passwordConfirmField = $fieldset->getFieldByName(KT_User_Profile_Config::PASSWORD_CONFIRM);
                 $passwordConfirmField->setErrorMsg("Heslo a jeho potvrzení musejí být stejné.");
                 $form->setError(true);
             }
         } else {
             // heslo je zadané, ale potvrzení ne
             $passwordField = $fieldset->getFieldByName(KT_User_Profile_Config::PASSWORD);
             $passwordField->setErrorMsg("Pro změnu hesla musí být zadané heslo i jeho potvrzení.");
             $form->setError(true);
         }
     }
     return null;
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:26,代码来源:kt_user_profile_base_presenter.inc.php

示例5: initCurrentSidebar

 /** @return KT_ZZZ_Sidebar_Presenter */
 private function initCurrentSidebar()
 {
     global $wp_registered_sidebars;
     $sidebarKey = KT_ZZZ_SIDEBAR_DEFAULT;
     if (KT::arrayIssetAndNotEmpty($wp_registered_sidebars)) {
         foreach ($wp_registered_sidebars as $key => $values) {
             if ($key === $sidebarKey) {
                 $this->setCurrentSidebarName(KT::arrayTryGetValue($values, "name"));
                 break;
             }
         }
     }
     return $this->setCurrentSidebarKey($sidebarKey);
 }
开发者ID:ktstudio,项目名称:WPFW-Skeleton,代码行数:15,代码来源:kt_zzz_sidebar_presenter.inc.php

示例6: getAutoVersion

 /**
  * @return string
  */
 public function getAutoVersion()
 {
     if (KT::issetAndNotEmpty($this->autoVersion)) {
         return $this->autoVersion;
     }
     $autoVersionExpiration = $this->getAutoVersionExpiration();
     $isAutoVersionExpiration = $autoVersionExpiration > 0;
     if ($isAutoVersionExpiration) {
         $cachedAutoVersionKey = self::VERSION_CACHE_PREFIX . $this->getId();
         $cachedAutoVersion = KT::arrayTryGetValue($_COOKIE, $cachedAutoVersionKey);
         if (KT::issetAndNotEmpty($cachedAutoVersion)) {
             return $this->autoVersion = $cachedAutoVersion;
         }
     }
     $source = $this->getSource();
     if (KT::issetAndNotEmpty($source)) {
         $sourceHeaders = get_headers($source, 1);
         if (KT::arrayIssetAndNotEmpty($sourceHeaders)) {
             if (stristr($sourceHeaders[0], "200")) {
                 $lastModified = KT::arrayTryGetValue($sourceHeaders, "Last-Modified");
                 if (KT::issetAndNotEmpty($lastModified)) {
                     $lastModifiedDateTime = new \DateTime($lastModified);
                     $autoVersion = $lastModifiedDateTime->getTimestamp();
                     if ($isAutoVersionExpiration) {
                         setcookie($cachedAutoVersionKey, "{$autoVersion}", time() + $autoVersionExpiration, "/");
                     }
                     return $this->autoVersion = $autoVersion;
                 }
             }
         }
     }
     return null;
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:36,代码来源:kt_wp_asset_definition_base.inc.php

示例7: processMail

 /**
  * Zpracování údajů z POSTu (bez spam validace) a případné zodeslání mailu
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  * 
  * @param array $values
  * @return boolean
  */
 protected function processMail(array $values)
 {
     if (count($values) > 0) {
         $firstName = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::FIRST_NAME));
         $lastName = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::LAST_NAME));
         $name = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::NAME));
         $email = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::EMAIL));
         $phone = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::PHONE));
         $message = htmlspecialchars(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::MESSAGE));
         $fullName = $name ?: "{$firstName} {$lastName}";
         if (KT::issetAndNotEmpty($fullName) && KT::issetAndNotEmpty($email) && KT::issetAndNotEmpty($phone) && KT::issetAndNotEmpty($message) && is_email($email)) {
             $ktWpInfo = new KT_WP_Info();
             $requestUrl = KT::getRequestUrl();
             $requestLink = "<a href=\"{$requestUrl}\">{$requestUrl}</a>";
             $content = sprintf(__("Jméno: %s", "KT_CORE_DOMAIN"), $fullName) . "<br>";
             $content .= sprintf(__("E-mail: %s", "KT_CORE_DOMAIN"), $email) . "<br>";
             $content .= sprintf(__("Telefon: %s", "KT_CORE_DOMAIN"), $phone) . "<br><br>";
             $content .= __("Zpráva:", "KT_CORE_DOMAIN") . "<br><br>{$message}<br><br>";
             $content .= sprintf(__("Provedeno z URL adresy: %s", "KT_CORE_DOMAIN"), $requestLink) . "<br><br>---<br>";
             $content .= sprintf($this->getEmailSignature(), $ktWpInfo->getUrl());
             $contactFormEmail = apply_filters("kt_contact_form_email_filter", $this->getFormEmail());
             $mailer = new KT_Mailer($contactFormEmail, $ktWpInfo->getName(), sprintf($this->getEmailTitle(), $ktWpInfo->getName()));
             $mailer->setReplyToEmail($email);
             $mailer->setContent($content);
             return $sendResult = $mailer->send();
         }
     }
     return false;
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:38,代码来源:kt_contact_form_base_presenter.inc.php

示例8: renderCookieStatement

 /**
  * Provede povolení, resp. inicializaci proužku s potvrzením cookie (v patičce)
  * NENÍ POTŘEBA VOLAT VEŘEJNĚ
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  */
 public function renderCookieStatement()
 {
     $cookueStatementKey = KT::arrayTryGetValue($_COOKIE, self::COOKIE_STATEMENT_KEY);
     if (KT::notIssetOrEmpty($cookueStatementKey)) {
         $text = __("Tyto stránky využívají Cookies. Používáním těchto stránek vyjadřujete souhlas s používáním Cookies.", KT_DOMAIN);
         $moreInfoTitle = __("Zjistit více", KT_DOMAIN);
         $moreInfoUrl = apply_filters("kt_cookie_statement_more_info_url_filter", "https://www.google.com/policies/technologies/cookies/");
         $confirmTitle = __("OK, rozumím", KT_DOMAIN);
         $content = "<span id=\"ktCookieStatementText\">{$text}</span>";
         $content .= "<span id=\"ktCookieStatementMoreInfo\"><a href=\"{$moreInfoUrl}\" title=\"{$moreInfoTitle}\" target=\"_blank\">{$moreInfoTitle}</a></span>";
         $content .= "<span id=\"ktCookieStatementConfirm\">{$confirmTitle}</span>";
         echo "<!-- ktcookiestatement W3TC_DYNAMIC_SECURITY -->";
         echo "<div id=\"ktCookieStatement\">";
         echo apply_filters("kt_cookie_statement_content_filter", $content);
         echo "</div>";
         echo "<noscript><style scoped>#ktCookieStatement { display:none; }</style></noscript>";
         echo "<!-- /ktcookiestatement W3TC_DYNAMIC_SECURITY -->";
     }
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:26,代码来源:kt_wp_configurator.inc.php

示例9: initParams

 private function initParams()
 {
     $this->setOffset(KT::arrayTryGetValue($_REQUEST, "kt_offset"));
     $queriedObject = get_queried_object();
     if (KT::issetAndNotEmpty($queriedObject)) {
         if (property_exists($queriedObject, "term_id")) {
             $this->setCategoryId($queriedObject->term_id);
         }
     } else {
         $this->setCategoryId(KT::arrayTryGetValue($_REQUEST, "kt_category_id"));
     }
 }
开发者ID:ktstudio,项目名称:WPFW-Skeleton,代码行数:12,代码来源:kt_zzz_posts_presenter.inc.php

示例10: screenUpdatingRedirect

 /**
  * Prověří, zda je daná stránka otevřena a jsou na ní odeslány data pomocí POST metody
  * pokud ano, zavede příslušnou akci a provede redirect
  * 
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  * 
  * @param string $screenName
  */
 protected function screenUpdatingRedirect($screenName)
 {
     if (array_key_exists("kt-admin-screen-action", $_POST) && array_key_exists("page", $_GET)) {
         $pageSlug = $_GET["page"];
         if ($pageSlug == $this->getSlug()) {
             $saveResult = array(self::SAVE_RESULT_KEY => true, self::REDIRECT_ALLOWED => true);
             $saveResult = apply_filters("kt-custom-metabox-save-{$screenName}", $saveResult);
             if (KT::arrayTryGetValue($saveResult, self::REDIRECT_ALLOWED) == false) {
                 return;
             }
             if (KT::arrayTryGetValue($saveResult, self::SAVE_RESULT_KEY) !== true) {
                 add_action("admin_notices", array($this, "adminNoticesError"));
                 return;
             }
             $urlParams = array("page" => $_GET["page"], self::UPDATED_GET_KEY => true);
             if (array_key_exists("crud", $saveResult)) {
                 $crudInstance = $saveResult["crud"];
                 $urlParams[$crudInstance::ID_COLUMN] = $crudInstance->getId();
                 $urlParams["action"] = "update";
             }
             $adminPermlink = get_admin_url(null, "admin.php");
             $redirectLink = add_query_arg($urlParams, $adminPermlink);
             wp_redirect($redirectLink);
             exit;
         }
     }
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:36,代码来源:kt_custom_metaboxes_base.inc.php

示例11: doRemoveHeads

 /**
  * Provede odstraní všech zadaných head hodnot
  * Pozn.: netřeba volat veřejně - provede se automaticky v rámci @see \KT_WP_Configurator
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  * 
  * @return \KT_WP_Head_Remover_Configurator
  */
 public function doRemoveHeads()
 {
     foreach ($this->getHeadRemoverData() as $head => $args) {
         if (KT::arrayIssetAndNotEmpty($args)) {
             $priority = KT::arrayTryGetValue($args, "priority");
             if (KT::tryGetInt($priority)) {
                 $params = KT::arrayTryGetValue($args, "params");
                 if (KT::tryGetInt($priority)) {
                     remove_action("wp_head", "{$head}", $priority, $params);
                 } else {
                     remove_action("wp_head", "{$head}", $priority);
                 }
             }
         } else {
             remove_action("wp_head", "{$head}");
         }
     }
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:27,代码来源:kt_wp_head_remover_configurator.inc.php

示例12: processMail

 /**
  * Zpracování údajů z POSTu (bez spam validace) a případné zodeslání mailu
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  * 
  * @param array $values
  * @return boolean
  */
 protected function processMail(array $values)
 {
     if (count($values) > 0) {
         $firstName = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::FIRST_NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $lastName = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::LAST_NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $name = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::NAME), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $email = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::EMAIL), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $phone = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::PHONE), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $message = filter_var(KT::arrayTryGetValue($values, KT_Contact_Form_Base_Config::MESSAGE), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
         $fullName = $name ?: "{$firstName} {$lastName}";
         if (KT::issetAndNotEmpty($fullName) && KT::issetAndNotEmpty($email) && KT::issetAndNotEmpty($phone) && KT::issetAndNotEmpty($message) && is_email($email)) {
             $ktWpInfo = new KT_WP_Info();
             $content = sprintf(__("Jméno: %s", KT_DOMAIN), $fullName) . "<br />";
             $content .= sprintf(__("E-mail: %s", KT_DOMAIN), $email) . "<br />";
             $content .= sprintf(__("Telefon: %s", KT_DOMAIN), $phone) . "<br /><br />";
             $content .= sprintf(__("Zpráva:", KT_DOMAIN), $message) . "<br /><br />";
             $content .= $message;
             $content .= "<br /><br />---<br />";
             $content .= sprintf(__("Tento e-mail byl vygenerován pomocí kontaktního formuláře na webu: %s", KT_DOMAIN), $ktWpInfo->getUrl());
             $contactFormEmail = apply_filters("kt_contact_form_email_filter", $this->getFormEmail());
             $mailer = new KT_Mailer($contactFormEmail, $ktWpInfo->getName(), sprintf(__("%s - kontakt", KT_DOMAIN), $ktWpInfo->getName()));
             $mailer->setSenderEmail($email);
             $mailer->setSenderName($fullName);
             $mailer->setContent($content);
             return $sendResult = $mailer->send();
         }
     }
     return false;
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:38,代码来源:kt_contact_form_base_presenter.inc.php

示例13: getCleanValue

 /**
  * Vrátí přímo čistou hodnotu bez zpracování - sanitizace
  *
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  *
  * @return string
  */
 public function getCleanValue()
 {
     if (isset($this->cleanValue)) {
         return $this->cleanValue;
     }
     $name = $this->getName();
     $postPrefix = $this->getPostPrefix();
     if (KT::issetAndNotEmpty($postPrefix)) {
         $postValues = filter_input(INPUT_POST, $postPrefix, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
         if (KT::arrayIssetAndNotEmpty($postValues)) {
             $postPrefixValue = KT::arrayTryGetValue($postValues, $name);
             if (isset($postPrefixValue)) {
                 return $this->cleanValue = $postPrefixValue;
             }
         }
         $getValues = filter_input(INPUT_GET, $postPrefix, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
         if (KT::arrayIssetAndNotEmpty($getValues)) {
             $getPrefixValue = KT::arrayTryGetValue($getValues, $name);
             if (isset($getPrefixValue)) {
                 return $this->cleanValue = $getPrefixValue;
             }
         }
     }
     $postValue = KT::arrayTryGetValue($_POST, $name);
     if (isset($postValue)) {
         return $this->cleanValue = $postValue;
     }
     $getValue = KT::arrayTryGetValue($_GET, $name);
     if (isset($getValue)) {
         return $this->cleanValue = $getValue;
     }
     $defaultValue = $this->getDefaultValue();
     if (isset($defaultValue)) {
         return $this->cleanValue = $defaultValue;
     }
     return $this->cleanValue = "";
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:45,代码来源:kt_field.inc.php


注:本文中的KT::arrayTryGetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。