Example #1
0
function mandrill_emailer_phpmailer_init($phpmailer)
{
    $phpmailer->isSMTP();
    $phpmailer->SMTPAuth = true;
    $phpmailer->SMTPSecure = "tls";
    $phpmailer->Host = "smtp.mandrillapp.com";
    $phpmailer->Port = "587";
    // Credentials for SMTP authentication
    $phpmailer->Username = papi_get_option("mandrill_emailer_username");
    $phpmailer->Password = papi_get_option("mandrill_emailer_api_key");
    // From email and name
    $from_name = papi_get_option("mandrill_emailer_from_name");
    if (!isset($from_name)) {
        $from_name = 'WordPress';
    }
    $from_email = papi_get_option("mandrill_emailer_from_email");
    if (!isset($from_email)) {
        // Get the site domain and get rid of www.
        $sitename = strtolower($_SERVER['SERVER_NAME']);
        if ('www.' == substr($sitename, 0, 4)) {
            $sitename = substr($sitename, 4);
        }
        $from_email = 'wordpress@' . $sitename;
    }
    $phpmailer->From = $from_email;
    $phpmailer->FromName = $from_name;
}
Example #2
0
/**
 * Echo the value for property on a option page.
 *
 * @param string $slug
 * @param mixed  $default
 */
function the_papi_option($slug = null, $default = null)
{
    $value = papi_get_option($slug, $default);
    if (is_array($value)) {
        $value = implode(', ', $value);
    }
    echo $value;
}
Example #3
0
/**
 * Echo the value for property on a option page.
 *
 * @param string $slug
 * @param mixed  $default
 */
function the_papi_option($slug = null, $default = null)
{
    $value = papi_get_option($slug, $default);
    if (is_array($value)) {
        $value = implode(', ', $value);
    }
    if (is_object($value)) {
        $value = papi_convert_to_string($value);
    }
    echo esc_html($value);
}
 /**
  * Get setting value for a property.
  *
  * @param  string $key
  * @param  string $value
  *
  * @return mixed
  */
 public function get_setting($key, $value)
 {
     $property = null;
     foreach ((array) $this->entries as $entry) {
         if ($property = $entry->get_property($key)) {
             break;
         }
     }
     if (is_null($property)) {
         return $value;
     }
     $value = papi_get_option($key);
     return $property->rest_prepare_value($value);
 }
 /**
  * Get value.
  *
  * @return mixed
  */
 public function get_value()
 {
     $value = $this->get_option('value');
     if (papi_is_empty($value)) {
         $slug = $this->get_slug(true);
         if ($this->is_option_page()) {
             $value = papi_get_option($slug);
         } else {
             $value = papi_get_field($this->get_post_id(), $slug);
         }
         $post_status = get_post_status($this->get_post_id());
         if (papi_is_empty($value) && ($post_status === false || $post_status === 'auto-draft')) {
             $value = $this->get_option('default');
         }
     }
     return $this->prepare_value($value);
 }
Example #6
0
<?php

add_action('init', 'LobbyKit\\Intra\\PostTypes::register');
add_action('wp_enqueue_scripts', 'LobbyKit\\Intra\\Assets::enqueueScripts');
add_filter('pre_http_request', 'LobbyKit\\Intra\\Setup::wp_api_block_request', 10, 3);
add_action('init', 'LobbyKit\\Intra\\Setup::register_menues');
add_filter('nav_menu_css_class', 'LobbyKit\\Intra\\Setup::special_nav_class', 10, 2);
add_action('after_setup_theme', 'LobbyKit\\Intra\\Setup::theme_setup');
add_filter('papi/settings/directories', function ($directories) {
    $directories[] = dirname(__FILE__) . '/page-types';
    return $directories;
});
add_filter('gatekeeper/messages/new', function () {
    return papi_get_option('message_new_account');
});
 /**
  * Get property value.
  *
  * @param  Papi_Core_Conditional_Rule $rule
  *
  * @return mixed
  */
 private function get_value(Papi_Core_Conditional_Rule $rule)
 {
     if (papi_doing_ajax()) {
         $source = $rule->get_source();
         $post_id = papi_get_post_id();
         $page_type = papi_get_page_type_by_post_id($post_id);
         if (!papi_is_empty($source) && $page_type instanceof Papi_Page_Type !== false) {
             if (papi_is_property($page_type->get_property($rule->slug))) {
                 return $this->get_deep_value($rule->slug, $source);
             }
         }
     }
     if (!papi_is_empty($rule->get_source())) {
         return $this->get_deep_value($rule->slug, $rule->get_source());
     }
     $slug = $rule->get_field_slug();
     if (papi_is_option_page()) {
         $value = papi_get_option($slug);
     } else {
         $value = papi_get_field($slug);
     }
     return $this->get_deep_value($slug, $value);
 }