function ecs_newpatient_module_content_filter($content)
    {
        $page = get_field('option_newpatient_page', 'option');
        if (is_page($page->ID)) {
            ob_start();
            if (get_field('option_vacation_notice', 'option')) {
                ?>
					
				<div class="info">
					
					<?php 
                the_field('option_vacation_notice_text', 'option');
                ?>

				</div>

				<?php 
            }
            gravity_form_enqueue_scripts(3, true);
            gravity_form(3, false, false, false, '', true, 1);
            return ob_get_clean();
        } else {
            return $content;
        }
    }
function constantcontact_submit()
{
    $form_email = $_REQUEST['constantcontact_email'];
    if ($form_email) {
        $cc_user = get_field('constant_contact_username', 'option');
        $cc_pass = get_field('constant_contact_password', 'option');
        $cc_group = get_field('constant_contact_group_name', 'option');
        if (empty($cc_user) || empty($cc_pass) || empty($cc_group)) {
            $message = 'Plugin Settings incomplete';
        } else {
            if (empty($form_email)) {
                $message = 'Email address is required.';
            } else {
                $cc_url = 'https://api.constantcontact.com/0.1/API_AddSiteVisitor.jsp?' . 'loginName=' . rawurlencode($cc_user) . '&loginPassword='******'&ea=' . rawurlencode($form_email) . '&ic=' . rawurlencode($cc_group);
                $response = wp_remote_get($cc_url);
                if (is_wp_error($response)) {
                    $message = 'Could not connect to Constant Contact';
                } else {
                    $rsp = explode("\n", $response['body']);
                    if (intval($rsp[0])) {
                        $message = !empty($rsp[1]) ? $rsp[1] : (intval($rsp[0]) == 400 ? __('Constant Contact username/password not accepted') : __('Constant Contact error'));
                    } else {
                        $message = get_field('constant_contact_success_message', 'option');
                        $message = $message ? $message : "Thank you, you've been added to the list!";
                        $message_type = 'success';
                    }
                }
            }
        }
        if ($message) {
            $tabby_cc_param = array('message' => $message, 'message_type' => $message_type ? $message_type : 'error');
            wp_localize_script('jquery', 'tabby_cc_param', $tabby_cc_param);
        }
    }
}
 public function get_Relationships_by_Tag($tag, $_method, $_route, $_path, $_headers)
 {
     if (empty($tag) || !is_string($tag)) {
         return new WP_Error('json_options_invalid_tag', __("Invalid options tag"), ['status' => 404]);
     }
     $site = $_headers['REMOTE'];
     $tags = explode(',', $tag);
     if ($tags) {
         $tags_query['relation'] = 'OR';
         foreach ($tags as $tag) {
             $tags_query[] = array('key' => 'related_tags', 'value' => $tag, 'compare' => 'LIKE');
         }
     }
     $args = array('post_type' => 'relationship', 'meta_query' => array('relation' => 'AND', array('key' => 'site_address', 'value' => $site), $tags_query));
     $relationships = new WP_Query($args);
     if ($relationships->have_posts()) {
         // Get the Target Categories
         $targets = [];
         while ($relationships->have_posts()) {
             $relationships->the_post();
             $targets[] = get_field('target_category');
         }
         $targets = dedupe($targets);
         $related_categories = implode(', ', $targets);
         // Find Matching Relationships
         $args = array('post_type' => 'relationship', 'tax_query' => array(array('taxonomy' => 'related_categories', 'terms' => $related_categories)));
         $relationships = new WP_Query($args);
         // Build Relationships JSON Reponse
         include 'related-json-response.php';
     }
     wp_reset_query();
     return $sites;
 }
Пример #4
0
 function rd_after_container()
 {
     $post_sidebar = '';
     if (is_product()) {
         if (get_field('product_sidebar')) {
             $post_sidebar = get_field('product_sidebar');
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_product_sidebar_position');
         }
     } elseif (is_shop()) {
         $pageID = get_option('woocommerce_shop_page_id');
         if (get_field('page_sidebar', $pageID)) {
             $post_sidebar = get_field('page_sidebar', $pageID);
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
         }
     } elseif (is_product_category() || is_product_tag()) {
         $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
     } else {
         $post_sidebar = 'sidebar_none';
     }
     echo '</div>';
     if ($post_sidebar != 'sidebar_none') {
         echo '<div class="sidebar grid_3">';
         if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('woo-sidebar')) {
         }
         echo '</div>';
     }
     echo '</div></div></div>';
 }
Пример #5
0
function setup_read_touch_easy_seo_caps()
{
    $roles = touch_easy_seo_touch_get_lower_roles();
    $allowed_roles = get_field('allowed_roles_for_touch_seo', 'options');
    // Do not allow rights modification of administrator and current role
    if (isset($roles["administrator"])) {
        unset($roles["administrator"]);
    }
    // ALWAYS ALLOW ADMINISTRATORS TO VIEW THE PLUGIN
    $adminRole = get_role("administrator");
    if (current_user_can("administrator") && !current_user_can("read_touch-easy-seo")) {
        $adminRole->add_cap("read_touch-easy-seo");
    }
    if (current_user_can("administrator") && !current_user_can("read_touch-easy-seo-settings")) {
        $adminRole->add_cap("read_touch-easy-seo-settings");
    }
    foreach ($roles as $role_name => $role_info) {
        $role = get_role($role_name);
        if ($allowed_roles != '' && in_array($role_name, $allowed_roles) && !$role->has_cap("read_touch-easy-seo")) {
            $role->add_cap("read_touch-easy-seo");
        } elseif ($allowed_roles != '' && $role->has_cap("read_touch-easy-seo") && !in_array($role_name, $allowed_roles)) {
            $role->remove_cap("read_touch-easy-seo");
        } elseif ($allowed_roles == '' && $role->has_cap("read_touch-easy-seo")) {
            $role->remove_cap("read_touch-easy-seo");
        }
    }
}
Пример #6
0
 function display_add_field($recordid = 0)
 {
     if ($recordid) {
         $content = get_field('data_content', 'content', 'fieldid', $this->field->id, 'recordid', $recordid);
         $content = explode('##', $content);
     } else {
         $content = array();
     }
     $str = '<div title="' . s($this->field->description) . '">';
     $str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
     foreach (explode("\n", $this->field->param1) as $option) {
         $option = trim($option);
         $str .= '<option value="' . s($option) . '"';
         if (array_search($option, $content) !== false) {
             // Selected by user.
             $str .= ' selected >';
         } else {
             $str .= '>';
         }
         $str .= $option . '</option>';
     }
     $str .= '</select>';
     $str .= '</div>';
     return $str;
 }
 public static function get_widget_meta($widget_id, $meta_key)
 {
     if (!self::exists() || !$meta_key || !$widget_id) {
         return;
     }
     return get_field($meta_key, 'widget_' . $widget_id);
 }
function insert_fb_in_head()
{
    global $post;
    if (!is_single()) {
        echo '<meta property="fb:app_id" content="964610463630306">';
        echo '<meta property="og:title" content="SMS Brandname"/>';
        echo '<meta property="og:type" content="website">';
        echo '<meta property="og:url" content="' . home_url() . '"/>';
        echo '<meta property="og:site_name" content="SMS Brandname"/>';
        echo '<meta property="og:description" content="Cam kết giá dịch vụ, Tính năng hữu ích, Khác biệt và tươi mới, Tốc độ và niềm tin, Hổ trợ tuyệt vời">';
        echo "";
        return;
    }
    //
    $current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    echo '<meta property="fb:app_id" content="964610463630306">';
    echo '<meta property="og:title" content="' . get_the_title() . '"/>';
    echo '<meta property="og:type" content="website">';
    echo '<meta property="og:url" content="' . $current_url . '"/>';
    echo '<meta property="og:site_name" content="SMS Brandname"/>';
    echo '<meta property="og:description" content="Cam kết giá dịch vụ, Tính năng hữu ích, Khác biệt và tươi mới, Tốc độ và niềm tin, Hổ trợ tuyệt vời">';
    echo "";
    if (is_single()) {
        $image = get_field('image');
        echo '<meta property="og:image" content="' . $image['sizes']['large'] . '"/>';
    } else {
        $default_image = "http://sms.viet-digital.com/wp-content/uploads/2016/03/logo-top.png";
        echo '<meta property="og:image" content="' . $default_image . '"/>';
    }
    echo "";
}
Пример #9
0
/**
 * Get ACF data
 *
 * @param $value
 * @param $data
 *
 * @return string
 */
function vc_gitem_template_attribute_acf($value, $data)
{
    $label = '';
    /**
     * @var null|Wp_Post $post ;
     * @var string $data ;
     */
    extract(array_merge(array('post' => null, 'data' => ''), $data));
    if (strstr($data, 'field_from_group_')) {
        $group_id = preg_replace('/(^field_from_group_|_labeled$)/', '', $data);
        $fields = function_exists('acf_get_fields') ? acf_get_fields($group_id) : apply_filters('acf/field_group/get_fields', array(), $group_id);
        $field = is_array($fields) && isset($fields[0]) ? $fields[0] : false;
        if (is_array($field) && isset($field['key'])) {
            $data = $field['key'] . (strstr($data, '_labeled') ? str_replace($data, '', '_labeled') : '');
        }
    }
    if (preg_match('/_labeled$/', $data)) {
        $data = preg_replace('/_labeled$/', '', $data);
        $field = apply_filters('acf/load_field', array(), $data);
        $label = is_array($field) ? '<span class="vc_gite-acf-label">' . $field['label'] . ':</span> ' : '';
    }
    if (get_field($data)) {
        $value = apply_filters('vc_gitem_template_attribute_acf_value', get_field($data, $post->ID));
    }
    return strlen($value) > 0 ? $label . $value : '';
}
	function get_all_feature_meta($posts) {
		$meta_fetch_list = array (
			"feature_name",
			"feature_usage",
			"feature_action_cost",
			"flavor_text",
			"feature_requirement",
			"feature_text",
			"trigger",
			"atk_block"
			);

		$abilities = array();

		$i = 0;

		foreach ($posts as $post) {
			$abilities[$i]["title"] = $post->post_title;
			$abilities[$i]["id"] = $post->ID;
			$abilities[$i]["data"] = array();

			foreach ($meta_fetch_list as $field) {
				$abilities[$i]['data'][$field] = get_field($field, $post->ID);
			}

			$i++;
		}

		return $abilities;
	}
Пример #11
0
function andclose($PID, $order_id)
{
    // NEED TO ADD ORDER ARCHIVE FILTER
    $archive = get_field('order_archive', $PID);
    __update_post_meta($PID, 'order_archive', $value = '');
    __update_post_meta($PID, 'order_count', $value = $archive);
}
 function __construct()
 {
     $this->sitemap_url = get_field('catfish_website_url', 'option') . "sitemap-index.xml";
     $this->sitemap_xml = file_get_contents($this->sitemap_url);
     $this->service = new \Sabre\Xml\Service();
     $this->do_mapping();
 }
function aps_scholarship_article_month()
{
    $state = get_field('scholarship_article_journal_publication_month');
    if ($state) {
        echo $state . ' ';
    }
}
Пример #14
0
/**
 * Returns html for an ACF image
 *
 * ### Usage:
 * ```php
 * $image = pp_get_acf_image($image, $size, $classes);
 * if ( $image ) {
 *	echo $image;
 * }
 * ```
 *
 * @package pp
 * @subpackage boilerplate-theme
 *
 * @param array|string  $image 			Image array as returned by ACF, or field name as a string
 * @param string $size 					Image size
 * @param string $classes 				Classes to be added
 * @link http://www.advancedcustomfields.com/resources/image/
 * @return string 						HTML output
 *
 */
function pp_get_acf_image($image, $size = 'thumbnail', $classes = '')
{
    // Bail early if there's no image
    if (!is_array($image)) {
        // Maybe it's a string with a field name?
        $field = get_field($image);
        if ($field) {
            $image = $field;
        } else {
            return false;
        }
    }
    $img = '<img src="' . $image['sizes'][$size] . '"';
    // Alt
    if (!empty($image['alt'])) {
        $img .= ' alt="' . $image['alt'] . '"';
    }
    // Title
    if (!empty($image['title'])) {
        $img .= ' title="' . $image['title'] . '"';
    }
    // Classes
    if ($classes) {
        $img .= ' class="' . $classes . '"';
    }
    // width/height
    $img .= ' width="' . $image['sizes'][$size . '-width'] . '"';
    $img .= ' height="' . $image['sizes'][$size . '-height'] . '" />';
    return $img;
}
Пример #15
0
function testimonialssingle($att)
{
    //echo '<pre>';
    $posts = get_post($att['id']);
    //print_r($posts);
    return '<div class="testmlist"><p><i class="fa-left-quote"></i><span>' . $posts->post_content . '</span><i class="fa-right-quote"></i></p> <div class="test-details">' . get_the_post_thumbnail($posts->ID) . '</div><div class="test-name"><strong>' . $posts->post_title . '</strong> ' . get_field('position', $posts->ID) . '</div></div>';
}
Пример #16
0
 public function csvImport($post_id)
 {
     if (!isset($_POST['post_type']) || $_POST['post_type'] != $this->moduleSlug) {
         return;
     }
     if (get_field('mod_table_data_type', $post_id) != 'csv') {
         return;
     }
     ini_set('auto_detect_line_endings', true);
     $file = get_field('mod_table_csv_file', $post_id);
     $file = fopen($file['url'], 'r');
     $data = array();
     if (!$file) {
         wp_die(__('There was an error opening the selected .csv-file.'));
     }
     while (!feof($file)) {
         $row = fgetcsv($file, 0, ';');
         if (count($row) === 0) {
             continue;
         }
         foreach ($row as &$value) {
             $value = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
         }
         array_push($data, $row);
     }
     fclose($file);
     $data = array_filter($data);
     $data = json_encode($data);
     update_post_meta($post_id, 'mod_table', $data);
     update_post_meta($post_id, '_mod_table', 'field_5666a2ae23643');
 }
function attforblock_add_instance($attforblock)
{
    /// Given an object containing all the necessary data,
    /// (defined by the form in mod.html) this function
    /// will create a new instance and return the id number
    /// of the new instance.
    $attforblock->timemodified = time();
    if ($att = get_record('attforblock', 'course', $attforblock->course)) {
        $modnum = get_field('modules', 'id', 'name', 'attforblock');
        if (!get_record('course_modules', 'course', $attforblock->course, 'module', $modnum)) {
            delete_records('attforblock', 'course', $attforblock->course);
            $attforblock->id = insert_record('attforblock', $attforblock);
        } else {
            return false;
        }
    } else {
        $attforblock->id = insert_record('attforblock', $attforblock);
    }
    //Copy statuses for new instance from defaults
    if (!get_records('attendance_statuses', 'courseid', $attforblock->course)) {
        $statuses = get_records('attendance_statuses', 'courseid', 0, 'id');
        foreach ($statuses as $stat) {
            $rec = $stat;
            $rec->courseid = $attforblock->course;
            insert_record('attendance_statuses', $rec);
        }
    }
    //    attforblock_grade_item_update($attforblock);
    //	attforblock_update_grades($attforblock);
    return $attforblock->id;
}
Пример #18
0
 public static function instance_config_form($group, $instance = null)
 {
     if (isset($instance)) {
         $autosubscribe = get_field('interaction_forum_instance_config', 'value', 'field', 'autosubscribe', 'forum', $instance->get('id'));
         $weight = get_field('interaction_forum_instance_config', 'value', 'field', 'weight', 'forum', $instance->get('id'));
         $moderators = get_column_sql('SELECT fm.user FROM {interaction_forum_moderator} fm
             JOIN {usr} u ON (fm.user = u.id AND u.deleted = 0)
             WHERE fm.forum = ?', array($instance->get('id')));
     }
     if ($instance === null) {
         $exclude = '';
     } else {
         $exclude = 'AND i.id != ' . db_quote($instance->get('id'));
     }
     $existing = get_records_sql_array('
         SELECT i.id, i.title, c.value AS weight
         FROM {interaction_instance} i
         INNER JOIN {interaction_forum_instance_config} c ON (i.id = c.forum AND c.field = \'weight\')
         WHERE i.group = ?
         AND i.deleted != 1
         ' . $exclude . '
         ORDER BY c.value', array($group->id));
     if ($existing) {
         foreach ($existing as &$item) {
             $item = (array) $item;
         }
     } else {
         $existing = array();
     }
     return array('fieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('settings'), 'elements' => array('autosubscribe' => array('type' => 'select', 'title' => get_string('autosubscribeusers', 'interaction.forum'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'description' => get_string('autosubscribeusersdescription', 'interaction.forum'), 'defaultvalue' => isset($autosubscribe) ? $autosubscribe : false, 'rules' => array('required' => true), 'help' => true), 'weight' => array('type' => 'weight', 'title' => get_string('Order', 'interaction.forum'), 'description' => get_string('orderdescription', 'interaction.forum'), 'defaultvalue' => isset($weight) ? $weight : count($existing), 'rules' => array('required' => true), 'existing' => $existing, 'ignore' => count($existing) == 0), 'moderator' => array('type' => 'userlist', 'title' => get_string('Moderators', 'interaction.forum'), 'description' => get_string('moderatorsdescription', 'interaction.forum'), 'defaultvalue' => isset($moderators) ? $moderators : null, 'group' => $group->id, 'includeadmins' => false, 'filter' => false, 'lefttitle' => get_string('potentialmoderators', 'interaction.forum'), 'righttitle' => get_string('currentmoderators', 'interaction.forum')))));
 }
Пример #19
0
function most_viewed()
{
    ob_start();
    $posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'paper', 'range' => 'all_time'));
    global $post;
    if (count($posts) > 0) {
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
		<li><a href="<?php 
            the_permalink();
            ?>
">
			<?php 
            if (get_field('short_title')) {
                the_field('short_title');
            } else {
                the_title();
            }
            ?>
		</a></li>
		<?php 
        }
    }
    wp_reset_query();
    $contents = ob_get_contents();
    ob_end_clean();
    return $contents;
}
Пример #20
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $type = isset($configdata['displaytype']) ? $configdata['displaytype'] : 'texticon';
     $showicon = $type == 'icononly' || $type == 'texticon' ? true : false;
     $showtext = $type == 'textonly' || $type == 'texticon' ? true : false;
     $owner = $instance->get('view_obj')->get('owner');
     // Whether to include email button
     if (isset($configdata['displayemail']) && $configdata['displayemail']) {
         $email = get_field('artefact_internal_profile_email', 'email', 'principal', 1, 'owner', $owner);
     } else {
         $email = false;
     }
     if (!isset($configdata['artefactids']) || empty($configdata['artefactids'])) {
         // When we first come into this block, it will have
         // no social profiles configured yet.
         $configdata['artefactids'] = array(0);
     }
     // Include selected social profiles
     $sql = 'SELECT title, description, note FROM {artefact}
         WHERE id IN (' . join(',', $configdata['artefactids']) . ')
             AND owner = ? AND artefacttype = ?
         ORDER BY description ASC';
     if (!($data = get_records_sql_array($sql, array($owner, 'socialprofile')))) {
         $data = array();
     }
     safe_require('artefact', 'internal');
     $data = ArtefactTypeSocialprofile::get_profile_icons($data);
     $smarty = smarty_core();
     $smarty->assign('showicon', $showicon);
     $smarty->assign('showtext', $showtext);
     $smarty->assign('profiles', $data);
     $smarty->assign('email', $email);
     return $smarty->fetch('blocktype:socialprofile:content.tpl');
 }
Пример #21
0
 /**
  * Removes the post type "post/page" from admin
  * @return NULL
  */
 public function removePostPostType()
 {
     global $wp_post_types;
     if (isset($wp_post_types['post'])) {
         if (function_exists('get_field') && get_field('disable_default_blog_post_type')) {
             add_action('admin_menu', function () {
                 remove_menu_page('edit.php');
             });
             add_action('wp_before_admin_bar_render', function () {
                 global $wp_admin_bar;
                 $wp_admin_bar->remove_menu('new-post');
             });
         }
     }
     if (isset($wp_post_types['page'])) {
         if (function_exists('get_field') && get_field('disable_default_page_post_type')) {
             add_action('admin_menu', function () {
                 remove_menu_page('edit.php?post_type=page');
             });
             add_action('wp_before_admin_bar_render', function () {
                 global $wp_admin_bar;
                 $wp_admin_bar->remove_menu('new-page');
             });
         }
     }
     return null;
 }
Пример #22
0
    function section_template()
    {
        $images = get_field('fotos_page_gallery', get_the_ID());
        if (!$images) {
            echo setup_section_notify($this);
        } else {
            ?>
<div id="default-gallery-deck" class="gallslider"><ul class="unstyled slides"><?php 
            foreach ($images as $image) {
                $getlink = $image['description'];
                $getimg = $image['sizes']['thumbnail'];
                $getlgimg = $image['sizes']['large'];
                $getalt = $image['alt'];
                $getcap = $image['caption'];
                printf('<li><img src="%s" alt="%s" /></li>', $getlgimg, $getalt);
            }
            ?>
</ul></div><?php 
            if ($this->opt('fw_defgallery_dothumbs')) {
                ?>
<div id="default-gallery-thumbs" class="gallslider"><ul class="unstyled slides"><?php 
                foreach ($images as $image) {
                    $getlink = $image['description'];
                    $getimg = $image['sizes']['thumbnail'];
                    $getlgimg = $image['sizes']['large'];
                    $getalt = $image['alt'];
                    $getcap = $image['caption'];
                    printf('<li><img src="%s" alt="%s" /></li>', $getimg, $getalt);
                }
                ?>
</ul></div>
			<?php 
            }
        }
    }
Пример #23
0
 public function get($type = "", $id = "", $size = "", $attr = array())
 {
     if (is_array($id) && $id["id"]) {
         $id = $id["id"];
     }
     if (!$id) {
         $id = get_post_thumbnail_id(get_the_ID());
     }
     if (!$id) {
         $id = get_field('image', get_the_ID());
         $id = $id["id"];
     }
     if (!$id) {
         $id = get_field('placeholder', 'options');
     }
     if (!$id) {
         return;
     }
     if ($type == "html") {
         return wp_get_attachment_image($id, $size);
     } else {
         if ($type == "url") {
             return reset(wp_get_attachment_image_src($id, $size));
         } else {
             if ($type == "") {
                 return wp_get_attachment_metadata($id);
             } else {
                 $res = wp_get_attachment_metadata($id);
                 return $res[$type];
             }
         }
     }
 }
Пример #24
0
function acf_repeater_population($form)
{
    GFCommon::log_debug("acf_repeater_population() function called for form {$form['id']}");
    // filters are applied only to form ID 4.  Change to your form ID
    foreach ($form['fields'] as &$field) {
        // if the field is not a radio button type or it does not have the CSS Class Name required, continue
        if ('radio' != $field->type || false === strpos($field->cssClass, 'dates_from_acf')) {
            continue;
        }
        // start with an empty choices array
        $field->choices = array();
        // need the ID of the current post
        global $post;
        GFCommon::log_debug("global post =>" . print_r($post, true));
        $rows = get_field('coursedates');
        if ($rows) {
            GFCommon::log_debug("get_field() for coursedates: \$rows => " . print_r($rows, 1));
            foreach ($rows as $row) {
                $city = $row['city'];
                $text = date_i18n('l j. F Y', strtotime($row['startdate'])) . " - " . $city;
                $field->choices[] = array('text' => $text, 'value' => $row['startdate'] . " - " . $city);
            }
        } else {
            $field->choices[] = array('text' => 'Ingen ledige datoer', 'value' => 'Ingen ledige datoer');
        }
        break;
    }
    // always return the form
    return $form;
}
 public function index($category_slug, $post_slug)
 {
     $post = get_page_by_path($post_slug, OBJECT, 'post');
     $post = new TimberPost($post->ID);
     $canonical_url = $post->catfish_importer_url;
     return $this->client->getSubmissionStatus(get_field('instant_articles_status_id', $post));
 }
 protected function resolveFileName(array $name, array $includePath)
 {
     global $THEME;
     if (!isset(self::$_filePaths[$name[0]][$name[1]])) {
         $artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $name[0]);
         $template_path = $name[1];
         $basedir = get_config('docroot');
         if ($artefactplugin) {
             $basedir .= 'artefact/' . $artefactplugin . '/blocktype/' . $name[0] . '/theme/';
         } else {
             $basedir .= 'blocktype/' . $name[0] . '/theme/';
         }
         foreach ($THEME->inheritance as $theme) {
             $filename = $basedir . $theme . '/' . $template_path;
             if (is_readable($filename)) {
                 array_unshift($includePath, $basedir . $theme . '/');
                 return self::$_filePaths[$name[0]][$name[1]] = array($template_path, $includePath);
             }
         }
         self::$_filePaths[$name[0]][$name[1]] = false;
     }
     if (!self::$_filePaths[$name[0]][$name[1]]) {
         throw new MaharaException('Blocktype template could not be found : ' . implode(':', $name));
     }
     return self::$_filePaths[$name[0]][$name[1]];
 }
Пример #27
0
 public function get_places($category, $items_per_page = 5, $limit = -1)
 {
     //Declare
     $items = array();
     $posts = get_posts(array('post_type' => 'hbgkioskpoi', 'posts_per_page' => -1, 'category' => $category, 'orderby' => 'post_title', 'order' => 'ASC'));
     foreach ($posts as $post) {
         //Get distance
         $full_distance = HelsingborgKiosk\Locations\HelsingborgKioskLocation::distance_kiosk(get_post_meta($post->ID, 'poi-latitude', true), get_post_meta($post->ID, 'poi-longitude', true));
         //Filter out further than 10 km
         if ($full_distance >= 10) {
             unset($items[$post->ID]);
         } else {
             //Get more data if valid
             $items[$post->ID] = array('post_image' => get_post_meta($post->ID, 'poi-image', true), 'post_title' => $post->post_title, 'post_link' => get_permalink($post->ID), 'post_distance' => number_format($full_distance, 1), 'full_distance' => $full_distance);
         }
     }
     //Sort array
     usort($items, function ($a, $b) {
         return $a["full_distance"] < $b["full_distance"] ? -1 : 1;
     });
     $max_distance_category = get_field('poi-category-max-distance', 'category_' . $category);
     if ($max_distance_category > -1) {
         $items = array_filter($items, function ($post) use($max_distance_category) {
             return $post["post_distance"] <= $max_distance_category;
         });
     }
     //Return chunked
     return array_chunk($items, $items_per_page);
 }
Пример #28
0
function get_sliderobjects_array($slider)
{
    $category = get_field("categoria", $slider);
    $category_list = "";
    $return = array();
    $index = 0;
    for ($i = 0; $i < sizeof($category); $i++) {
        $category_list .= strlen($category_list) > 0 ? "," : "";
        $category_list .= $category[$i];
    }
    $option = get_field("opciones", $slider);
    //print_array($option);
    //print_array($category);
    // WP_Query arguments
    $args = array('post_type' => 'objeto', 'post_status' => 'publish', 'cat' => $category_list, 'order' => 'DESC', 'orderby' => 'date');
    // The Query
    $category_posts = new WP_Query($args);
    if ($category_posts->have_posts()) {
        while ($category_posts->have_posts()) {
            $category_posts->the_post();
            $return[$index] = get_the_ID();
            $index++;
        }
    }
    return $return;
}
Пример #29
0
 function display_add_field($recordid = 0)
 {
     global $CFG;
     $content = array();
     if ($recordid) {
         $content = get_field('data_content', 'content', 'fieldid', $this->field->id, 'recordid', $recordid);
         $content = explode('##', $content);
     }
     $str = '<div title="' . s($this->field->description) . '">';
     $str .= '<fieldset><legend><span class="accesshide">' . $this->field->name . '</span></legend>';
     $i = 0;
     foreach (explode("\n", $this->field->param1) as $checkbox) {
         $checkbox = trim($checkbox);
         if ($checkbox === '') {
             continue;
             // skip empty lines
         }
         $str .= '<input type="checkbox" id="field_' . $this->field->id . '_' . $i . '" name="field_' . $this->field->id . '[]" ';
         $str .= 'value="' . s($checkbox) . '" ';
         if (array_search($checkbox, $content) !== false) {
             $str .= 'checked />';
         } else {
             $str .= '/>';
         }
         $str .= '<label for="field_' . $this->field->id . '_' . $i . '">' . $checkbox . '</label><br />';
         $i++;
     }
     $str .= '</fieldset>';
     $str .= '</div>';
     return $str;
 }
Пример #30
0
/**
 *
 */
function ac_remove_wpautop()
{
    $ac_remove_autop = get_field('ac_remove_auto_p', get_the_id());
    if ($ac_remove_autop != false) {
        remove_filter('the_content', 'wpautop');
    }
}