本文整理汇总了PHP中KT::arrayIssetAndNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP KT::arrayIssetAndNotEmpty方法的具体用法?PHP KT::arrayIssetAndNotEmpty怎么用?PHP KT::arrayIssetAndNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KT
的用法示例。
在下文中一共展示了KT::arrayIssetAndNotEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kt_zzz_load_more_posts_callback
function kt_zzz_load_more_posts_callback()
{
if (KT::arrayIssetAndNotEmpty($_REQUEST)) {
$presenter = new KT_ZZZ_Posts_Presenter();
die($presenter->getPostsOutput());
}
die(false);
}
示例2: __construct
function __construct($taxonomy = null, $args = null)
{
if (KT::arrayIssetAndNotEmpty($args)) {
$this->setArgs($args);
}
if (KT::issetAndNotEmpty($taxonomy)) {
$this->setTaxonomy($taxonomy);
}
}
示例3: getList
/**
* Na základě odřádkování (tzn. po řádcích) rozdělí zadaný text a vrátí jako HTML seznam zadaného tagu
*
* @author Martin Hlaváč
* @link http://www.ktstudio.cz
*
* @param string $format @see sprintf()
* @return string (HTML)
*/
public function getList($format = "%s", $unsafe = false)
{
$lines = $this->getLinesArray($unsafe);
if (!KT::arrayIssetAndNotEmpty($lines)) {
return;
}
$output = "";
foreach ($lines as $line) {
$output .= sprintf($format, $line);
}
return $output;
}
示例4: initPosts
private function initPosts()
{
$args = array("post_type" => KT_WP_POST_KEY, "post_status" => "publish", "posts_per_page" => self::DEFAULT_COUNT, "orderby" => "date", "order" => KT_Repository::ORDER_DESC, "cat" => KT_ZZZ::getThemeModel()->getCategoryNewsId());
$query = new WP_Query();
$posts = $query->query($args);
if (KT::arrayIssetAndNotEmpty($posts)) {
$this->posts = $posts;
$this->postsCount = count($posts);
} else {
$this->posts = array();
$this->postsCount = 0;
}
}
示例5: kt_edit_sorting_crud_list_callback
/**
* Funkce obslouží ajax dotaz, který má provést uložení pořadí itemů po Sortable
*
* @author Tomáš Kocifaj
* @link http://www.ktstudio.cz
*/
function kt_edit_sorting_crud_list_callback()
{
$itemCollection = $_REQUEST["data"];
$className = $_REQUEST["class_name"];
if (KT::arrayIssetAndNotEmpty($itemCollection)) {
foreach ($itemCollection as $index => $itemId) {
$crudClassObject = new $className($itemId);
if ($crudClassObject->isInDatabase()) {
$crudClassObject->setMenuOrder($index)->saveRow();
}
}
}
}
示例6: initPosts
private function initPosts()
{
$args = array("post_type" => KT_ZZZ_SLIDER_KEY, "post_status" => "publish", "posts_per_page" => self::DEFAULT_COUNT, "orderby" => "menu_order title", "order" => KT_Repository::ORDER_ASC);
$query = new WP_Query();
$posts = $query->query($args);
if (KT::arrayIssetAndNotEmpty($posts)) {
$this->posts = $posts;
$this->postsCount = count($posts);
} else {
$this->posts = array();
$this->postsCount = 0;
}
}
示例7: 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>";
}
}
示例8: theItemsLoops
/**
* Výpis postů podle zadané query v zadané loopě
*
* @param WP_Query $query
* @param string $loopName
* @param mixed int|null $count
* @param mixed int|null $offset
*/
protected function theItemsLoops(array $items, $loopName, $count = null, $offset = null)
{
if (KT::arrayIssetAndNotEmpty($items)) {
$index = 0;
if (KT::tryGetInt($offset) > 0) {
$items = array_slice($items, $offset);
}
if (KT::tryGetInt($count) > 0) {
$items = array_slice($items, 0, $count);
}
foreach ($items as $item) {
global $post;
$post = $item;
include locate_template("loops/loop-{$loopName}.php");
$index++;
}
wp_reset_postdata();
}
}
示例9: saveFieldset
/**
* Uloží fieldset
* VOLÁ SE V HOOCE
*
* @author Jan Pokorný
* @param int $user_id
*/
public function saveFieldset($user_id)
{
if (get_current_user_id() != $user_id && !current_user_can('edit_users')) {
return;
}
$fieldset = $this->getFieldset();
$form = new KT_form();
$form->addFieldSetByObject($fieldset);
$form->validate();
if ($form->hasError()) {
// TODO has error
}
if ($fieldset->getSerializeSave()) {
$fieldsetData = $form->getSavableFieldsetGroupValue($fieldset);
if (KT::arrayIssetAndNotEmpty($fieldsetData)) {
update_user_meta($user_id, $fieldset->getName(), $fieldsetData);
} else {
delete_user_meta($user_id, $fieldset->getName());
}
} else {
foreach ($fieldset->getFields() as $field) {
$fieldValue = $form->getSavableFieldValue($field);
if ($field && $fieldValue !== "") {
update_user_meta($user_id, $field->getName(), $fieldValue);
} else {
delete_user_meta($user_id, $field->getName());
}
}
}
}
示例10: 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);
}
示例11: getThumbnailImagePermalink
/**
* Vrátí URL pro odkaz na obrázek (thumb)
* Defaultní velikost - Large
*
* @return string (URL)
*/
public function getThumbnailImagePermalink($size = KT_WP_IMAGE_SIZE_LARGE)
{
if (KT::issetAndNotEmpty($this->thumbnailImagePermalink)) {
return $this->thumbnailImagePermalink;
}
$src = wp_get_attachment_image_src($this->getModel()->getThumbnailId(), $size);
if (KT::arrayIssetAndNotEmpty($src)) {
return $this->thumbnailImagePermalink = $src[0];
}
return $this->thumbnailImagePermalink = null;
}
示例12: theItemsLoops
/**
* Výpis postů podle zadané query v zadané loopě
*
* @author Martin Hlaváč
* @link http://www.ktstudio.cz
*
* @param array $items
* @param string $loopName
* @param mixed int|null $count
* @param mixed int|null $offset
* @param array $clearfixes pole clearfixů k printu podle klíče (modulo)
*/
public static function theItemsLoops(array $items, $loopName, $count = null, $offset = null, array $clearfixes = null)
{
if (KT::arrayIssetAndNotEmpty($items)) {
$isClearfixes = KT::arrayIssetAndNotEmpty($clearfixes);
self::$currentItemsLoopIndex = 0;
if (KT::tryGetInt($offset) > 0) {
$items = array_slice($items, $offset);
}
if (KT::tryGetInt($count) > 0) {
$items = array_slice($items, 0, $count);
}
foreach ($items as $item) {
global $post;
$post = $item;
include locate_template("loops/loop-{$loopName}.php");
self::$currentItemsLoopIndex++;
if ($isClearfixes) {
self::theClearfixes($clearfixes, self::$currentItemsLoopIndex);
}
}
self::$currentItemsLoopIndex = null;
wp_reset_postdata();
}
}
示例13: getTermsSlugs
/**
* Vrátí pole ve tvaru term ID => slug pro zadanou taxonomii a podle parametrů
*
* @author Martin Hlaváč
* @link http://www.ktstudio.cz
*
* @param string $taxonomy
* @param array $args // wp_get_object_terms
*
* @return array
*/
public function getTermsSlugs($taxonomy, array $args = array())
{
$terms = $this->getTerms($taxonomy, $args);
$termsNames = array();
if (KT::arrayIssetAndNotEmpty($terms)) {
foreach ($terms as $term) {
$termsNames[$term->term_id] = $term->slug;
}
}
return $termsNames;
}
示例14: initialize
/**
* Provede inicializaci a načtení všech obrázků dle zadaného Post objektu a nastavení
*
* @author Tomáš Kocifaj
* @link http://www.ktstudio.cz
*
* @return \KT_WP_Post_Gallery
*/
protected function initialize()
{
$queryArgs = array("post_type" => KT_WP_ATTACHMENT_KEY, "post_status" => "inherit", "posts_per_page" => $this->getNumberFiles(), "post_mime_type" => "image", "orderby" => $this->getOrderby(), "order" => $this->getOrder());
$customImageIds = $this->getCustomImageIds();
$isCustomImageIds = KT::arrayIssetAndNotEmpty($customImageIds);
if ($this->getExcludeThumbnail()) {
$thumbnailId = get_post_thumbnail_id($this->getPost()->ID);
$queryArgs["post__not_in"] = array($thumbnailId);
if ($isCustomImageIds) {
$customImageIds = KT::arrayRemoveByValue($customImageIds, $thumbnailId);
}
}
if ($isCustomImageIds) {
$queryArgs["post__in"] = $customImageIds;
} else {
$queryArgs["post_parent"] = $this->getPost()->ID;
}
$images = new WP_Query($queryArgs);
$this->setFiles($images->posts);
return $this;
}
示例15: addNewColumnsToValue
/**
* Přiřadí novou sadu sloupců do kolekce stávajících dat.
* Nepřepíše původní, provede merge dat. Přepíše hodnoty stejných sloupců
* které jsou již v kolekci přiřazeny
*
* @author Tomáš Kocifaj
* @link http://www.ktstudio.cz
*
* @param array $columns
*/
public function addNewColumnsToValue(array $columns)
{
if (!KT::arrayIssetAndNotEmpty($columns)) {
return $this;
}
foreach ($columns as $columnName => $columnValue) {
$this->addNewColumnValue($columnName, $columnValue);
}
return $this;
}