예제 #1
0
 public function api($api_function = false, $params = false)
 {
     if (isset($_REQUEST['api_key']) and user_id() == 0) {
         api_login($_REQUEST['api_key']);
     }
     if (!defined('MW_API_CALL')) {
         define('MW_API_CALL', true);
     }
     $set_constants = true;
     $mod_class_api = false;
     $mod_class_api_called = false;
     $mod_class_api_class_exist = false;
     $caller_commander = false;
     if ($api_function == false) {
         $api_function_full = $this->app->url_manager->string();
         $api_function_full = $this->app->format->replace_once('api_html', '', $api_function_full);
         $api_function_full = $this->app->format->replace_once('api/api', 'api', $api_function_full);
         $api_function_full = $this->app->format->replace_once('api', '', $api_function_full);
         $api_function_full = trim($api_function_full, '/');
         //$api_function_full = substr($api_function_full, 4);
     } else {
         $api_function_full = $api_function;
     }
     if (isset($api_function_full) and $api_function_full != '') {
         if (ltrim($api_function_full, '/') == 'module') {
             $set_constants = false;
         }
     }
     if ($set_constants == true) {
         $this->app->content_manager->define_constants();
     }
     if (defined('TEMPLATE_DIR')) {
         $load_template_functions = TEMPLATE_DIR . 'functions.php';
         if (is_file($load_template_functions)) {
             include_once $load_template_functions;
         }
     }
     //$api_function_full = str_ireplace('api/', '', $api_function_full);
     $api_function_full = str_replace('..', '', $api_function_full);
     $api_function_full = str_replace('\\', '/', $api_function_full);
     $api_function_full = str_replace('//', '/', $api_function_full);
     $api_function_full = $this->app->database_manager->escape_string($api_function_full);
     if (is_string($api_function_full)) {
         $mod_api_class = explode('/', $api_function_full);
     } else {
         $mod_api_class = $api_function_full;
     }
     $try_class_func = array_pop($mod_api_class);
     // $try_class_func2 = array_pop($mod_api_class);
     $mod_api_class_copy = $mod_api_class;
     $try_class_func2 = array_pop($mod_api_class_copy);
     $mod_api_class2 = implode(DS, $mod_api_class_copy);
     $mod_api_class = implode(DS, $mod_api_class);
     $mod_api_class_clean = ltrim($mod_api_class, '/');
     $mod_api_class_clean = ltrim($mod_api_class_clean, '\\');
     $mod_api_class_clean_uc1 = ucfirst($mod_api_class_clean);
     $mod_api_class1 = normalize_path(modules_path() . $mod_api_class, false) . '.php';
     $mod_api_class_native = normalize_path(mw_includes_path() . $mod_api_class, false) . '.php';
     $mod_api_class_native_system = normalize_path(dirname(MW_PATH) . DS . $mod_api_class, false) . '.php';
     $mod_api_class_native_global_ns = normalize_path(mw_includes_path() . 'classes' . DS . $mod_api_class2, false) . '.php';
     $mod_api_class1_uc1 = normalize_path(modules_path() . $mod_api_class_clean_uc1, false) . '.php';
     $mod_api_class_native_uc1 = normalize_path(mw_includes_path() . $mod_api_class_clean_uc1, false) . '.php';
     $mod_api_class_native_global_ns_uc1 = normalize_path(mw_includes_path() . 'classes' . DS . $mod_api_class_clean_uc1, false) . '.php';
     $mod_api_class2 = normalize_path(modules_path() . DS . $mod_api_class_clean . DS . $mod_api_class_clean, false) . '.php';
     $mod_api_class2_uc1 = normalize_path(modules_path() . DS . $mod_api_class_clean . DS . $mod_api_class_clean, false) . '.php';
     $try_class = '\\' . str_replace('/', '\\', $mod_api_class);
     if (class_exists($try_class, false)) {
         $caller_commander = 'class_is_already_here';
         $mod_class_api_class_exist = true;
     } else {
         if (is_file($mod_api_class1)) {
             $mod_class_api = true;
             include_once $mod_api_class1;
         } elseif (is_file($mod_api_class_native_system)) {
             $mod_class_api = true;
             include_once $mod_api_class_native_system;
         } elseif (is_file($mod_api_class1_uc1)) {
             $mod_class_api = true;
             include_once $mod_api_class1_uc1;
         } elseif (is_file($mod_api_class_native_global_ns_uc1)) {
             $try_class = str_replace('/', '\\', $mod_api_class2);
             $mod_class_api = true;
             include_once $mod_api_class_native_global_ns_uc1;
         } elseif (is_file($mod_api_class_native_global_ns)) {
             $try_class = str_replace('/', '\\', $mod_api_class2);
             $mod_class_api = true;
             include_once $mod_api_class_native_global_ns;
         } elseif (is_file($mod_api_class_native_uc1)) {
             $mod_class_api = true;
             include_once $mod_api_class_native_uc1;
         } elseif (is_file($mod_api_class_native)) {
             $mod_class_api = true;
             include_once $mod_api_class_native;
         } elseif (is_file($mod_api_class2)) {
             $mod_class_api = true;
             include_once $mod_api_class2;
         } elseif (is_file($mod_api_class2_uc1)) {
             $mod_class_api = true;
             include_once $mod_api_class2_uc1;
         }
     }
     $api_exposed = '';
     // user functions
     $api_exposed .= 'user_login user_logout social_login_process';
     // content functions
     $api_exposed .= 'set_language ';
     $api_exposed .= api_expose(true);
     if (is_logged()) {
         $api_exposed .= api_expose_user(true);
     }
     if (is_admin()) {
         $api_exposed .= api_expose_admin(true);
     }
     $api_exposed = explode(' ', $api_exposed);
     $api_exposed = array_unique($api_exposed);
     $api_exposed = array_trim($api_exposed);
     $hooks = api_bind(true);
     if (is_logged()) {
         $hooks_admin = api_bind_user(true);
         if (is_array($hooks_admin)) {
             $hooks = array_merge($hooks, $hooks_admin);
         }
     }
     if (is_admin()) {
         $hooks_admin = api_bind_admin(true);
         if (is_array($hooks_admin)) {
             $hooks = array_merge($hooks, $hooks_admin);
         }
     }
     if ($api_function == false) {
         $api_function = $this->app->url_manager->segment(1);
     }
     if (!defined('MW_API_RAW')) {
         if ($mod_class_api != false) {
             $url_segs = $this->app->url_manager->segment(-1);
         }
     } else {
         if (is_array($api_function)) {
             $url_segs = $api_function;
         } else {
             $url_segs = explode('/', $api_function);
         }
     }
     if (!defined('MW_API_FUNCTION_CALL')) {
         define('MW_API_FUNCTION_CALL', $api_function);
     }
     switch ($caller_commander) {
         case 'class_is_already_here':
             if ($params != false) {
                 $data = $params;
             } elseif (!$_POST and !$_REQUEST) {
                 $data = $this->app->url_manager->params(true);
                 if (empty($data)) {
                     $data = $this->app->url_manager->segment(2);
                 }
             } else {
                 //$data = $_REQUEST;
                 $data = array_merge($_GET, $_POST);
             }
             static $loaded_classes = array();
             //$try_class_n = src_
             if (isset($loaded_classes[$try_class]) == false) {
                 $res = new $try_class($data);
                 $loaded_classes[$try_class] = $res;
             } else {
                 $res = $loaded_classes[$try_class];
                 //
             }
             if (method_exists($res, $try_class_func) or method_exists($res, $try_class_func2)) {
                 if (method_exists($res, $try_class_func2)) {
                     $try_class_func = $try_class_func2;
                 }
                 $res = $res->{$try_class_func}($data);
                 if (defined('MW_API_RAW')) {
                     $mod_class_api_called = true;
                 }
                 return $this->_api_responce($res);
             }
             break;
         default:
             $res = false;
             if (isset($hooks[$api_function_full])) {
                 $data = array_merge($_GET, $_POST);
                 $call = $hooks[$api_function_full];
                 if (!empty($call)) {
                     foreach ($call as $call_item) {
                         $res = call_user_func($call_item, $data);
                     }
                 }
                 if ($res != false) {
                     return $this->_api_responce($res);
                 }
             }
             if ($mod_class_api == true and $mod_api_class != false) {
                 $mod_api_class = str_replace('..', '', $mod_api_class);
                 $try_class = str_replace('/', '\\', $mod_api_class);
                 $try_class_full = str_replace('/', '\\', $api_function_full);
                 $try_class_full2 = str_replace('\\', '/', $api_function_full);
                 $mod_api_class_test = explode('/', $try_class_full2);
                 $try_class_func_test = array_pop($mod_api_class_test);
                 $mod_api_class_test_full = implode('/', $mod_api_class_test);
                 $mod_api_err = false;
                 if (!defined('MW_API_RAW')) {
                     if (!in_array($try_class_full, $api_exposed) and !in_array($try_class_full2, $api_exposed) and !in_array($mod_api_class_test_full, $api_exposed)) {
                         $mod_api_err = true;
                         foreach ($api_exposed as $api_exposed_value) {
                             if ($mod_api_err == true) {
                                 if ($api_exposed_value == $try_class_full) {
                                     $mod_api_err = false;
                                 } elseif (strtolower('\\' . $api_exposed_value) == strtolower($try_class_full)) {
                                     $mod_api_err = false;
                                 } elseif ($api_exposed_value == $try_class_full2) {
                                     $mod_api_err = false;
                                 } else {
                                     $convert_slashes = str_replace('\\', '/', $try_class_full);
                                     if ($convert_slashes == $api_exposed_value) {
                                         $mod_api_err = false;
                                     }
                                 }
                             }
                         }
                     } else {
                         $mod_api_err = false;
                     }
                 }
                 if ($mod_class_api and $mod_api_err == false) {
                     if (!class_exists($try_class, false)) {
                         $remove = $url_segs;
                         $last_seg = array_pop($remove);
                         $last_prev_seg = array_pop($remove);
                         $last_prev_seg2 = array_pop($remove);
                         if (class_exists($last_prev_seg, false)) {
                             $try_class = $last_prev_seg;
                         } elseif (class_exists($last_prev_seg2, false)) {
                             $try_class = $last_prev_seg2;
                         }
                     }
                     if (!class_exists($try_class, false)) {
                         $try_class_mw = ltrim($try_class, '/');
                         $try_class_mw = ltrim($try_class_mw, '\\');
                         $try_class = $try_class_mw;
                     }
                     if (class_exists($try_class, false)) {
                         if ($params != false) {
                             $data = $params;
                         } elseif (!$_POST and !$_REQUEST) {
                             $data = $this->app->url_manager->params(true);
                             if (empty($data)) {
                                 $data = $this->app->url_manager->segment(2);
                             }
                         } else {
                             $data = array_merge($_GET, $_POST);
                         }
                         $res = new $try_class($data);
                         if (method_exists($res, $try_class_func) or method_exists($res, $try_class_func2)) {
                             if (method_exists($res, $try_class_func2)) {
                                 $try_class_func = $try_class_func2;
                             }
                             $res = $res->{$try_class_func}($data);
                             $mod_class_api_called = true;
                             return $this->_api_responce($res);
                         }
                     } else {
                         mw_error('The api class ' . $try_class . '  does not exist');
                     }
                 }
             }
             break;
     }
     if ($api_function) {
     } else {
         $api_function = 'index';
     }
     if ($api_function == 'module' and $mod_class_api_called == false) {
         $this->module();
     } else {
         $err = false;
         if (!in_array($api_function, $api_exposed)) {
             $err = true;
         }
         if ($err == true) {
             foreach ($api_exposed as $api_exposed_item) {
                 if ($api_exposed_item == $api_function) {
                     $err = false;
                 }
             }
         }
         if (isset($api_function_full)) {
             foreach ($api_exposed as $api_exposed_item) {
                 if (is_string($api_exposed_item) and is_string($api_function_full)) {
                     $api_function_full = str_replace('\\', '/', $api_function_full);
                     $api_function_full = ltrim($api_function_full, '/');
                     if (strtolower($api_exposed_item) == strtolower($api_function_full)) {
                         $err = false;
                     }
                 }
             }
         }
         if ($err == false) {
             if ($mod_class_api_called == false) {
                 if (!$_POST and !$_REQUEST) {
                     //  $data = $this->app->url_manager->segment(2);
                     $data = $this->app->url_manager->params(true);
                     if (empty($data)) {
                         $data = $this->app->url_manager->segment(2);
                     }
                 } else {
                     //$data = $_REQUEST;
                     $data = array_merge($_GET, $_POST);
                 }
                 $api_function_full_2 = explode('/', $api_function_full);
                 unset($api_function_full_2[count($api_function_full_2) - 1]);
                 $api_function_full_2 = implode('/', $api_function_full_2);
                 if (function_exists($api_function)) {
                     $res = $api_function($data);
                 } elseif (class_exists($api_function, false)) {
                     //
                     $segs = $this->app->url_manager->segment();
                     $mmethod = array_pop($segs);
                     $class = new $api_function($this->app);
                     if (method_exists($class, $mmethod)) {
                         $res = $class->{$mmethod}($data);
                     }
                 } else {
                     $api_function_full_2 = str_replace(array('..', '/'), array('', '\\'), $api_function_full_2);
                     $api_function_full_2 = __NAMESPACE__ . '\\' . $api_function_full_2;
                     if (class_exists($api_function_full_2, false)) {
                         //
                         $segs = $this->app->url_manager->segment();
                         $mmethod = array_pop($segs);
                         $class = new $api_function_full_2($this->app);
                         if (method_exists($class, $mmethod)) {
                             $res = $class->{$mmethod}($data);
                         }
                     } elseif (isset($api_function_full)) {
                         $api_function_full = str_replace('\\', '/', $api_function_full);
                         $api_function_full1 = explode('/', $api_function_full);
                         $mmethod = array_pop($api_function_full1);
                         $mclass = array_pop($api_function_full1);
                         if (class_exists($mclass, false)) {
                             $class = new $mclass($this->app);
                             if (method_exists($class, $mmethod)) {
                                 $res = $class->{$mmethod}($data);
                             }
                         }
                     }
                 }
             }
             if (isset($res) and isset($hooks[$api_function]) and is_array($hooks[$api_function]) and !empty($hooks[$api_function])) {
                 foreach ($hooks[$api_function] as $hook_key => $hook_value) {
                     if ($hook_value != false and $hook_value != null) {
                         $hook_value($res);
                     }
                 }
             } else {
                 //error('The api function ' . $api_function . ' does not exist', __FILE__, __LINE__);
             }
             // print $api_function;
         } else {
             $api_function = mw()->format->clean_html($api_function);
             $api_function = mw()->format->clean_xss($api_function);
             mw_error('The api function ' . $api_function . ' is not defined in the allowed functions list');
         }
         if (isset($res)) {
             return $this->_api_responce($res);
         }
         return;
     }
 }
예제 #2
0
    }
    if ($load_file != false) {
        return file_get_contents($load_file);
    }
}
api_expose_admin('system_log_reset');
function system_log_reset($data = false)
{
    return mw()->log_manager->reset();
}
api_expose_admin('delete_log_entry');
function delete_log_entry($data)
{
    return mw()->log_manager->delete_entry($data);
}
api_expose('captcha');
/**
 * Returns PNG Image
 */
function captcha($params = false)
{
    return mw()->captcha->render($params);
}
///**
// * Returns captcha URL
// */
//function captcha_url($params=false)
//{
//	return Microweber\Utils\Captcha::url($params);
//}
function mw_error($e, $f = false, $l = false)
예제 #3
0
api_expose('checkout');
api_expose('checkout_ipn');
api_expose('currency_format');
api_expose('empty_cart');
api_expose('payment_options');
api_expose('remove_cart_item');
api_expose('update_cart');
api_expose('update_cart_item_qty');
api_expose_admin('get_cart');
api_expose_admin('get_orders');
api_expose_admin('get_order_by_id');
api_expose_admin('checkout_confirm_email_test');
api_expose_admin('delete_client');
api_expose_admin('delete_order');
api_expose_admin('update_order');
api_bind_admin('shop/update_order', function ($data) {
    return mw()->shop_manager->update_order($data);
});
// media
api_expose('delete_media_file');
api_expose('upload_progress_check');
api_expose('upload');
api_expose('reorder_media');
api_expose('delete_media');
api_expose('save_media');
api_expose('pixum_img');
api_expose('thumbnail_img');
api_expose('create_media_dir');
api_expose('media/upload');
api_expose('media/delete_media_file');
<?php

namespace shop\shipping\gateways\country;

api_bind('shop/shipping/gateways/country/shipping_to_country/test', 'shop/shipping/gateways/country/shipping_to_country/test2');
// print('shop/shipping/gateways/country/shipping_to_country/test'. 'shop/shipping/gateways/country/shipping_to_country/test2');
api_expose_admin('shop/shipping/gateways/country/shipping_to_country/save');
api_expose('shop/shipping/gateways/country/shipping_to_country/set');
api_expose('shop/shipping/gateways/country/shipping_to_country/get');
api_expose_admin('shop/shipping/gateways/country/shipping_to_country/delete');
api_expose_admin('shop/shipping/gateways/country/shipping_to_country/reorder');
class shipping_to_country
{
    // singleton instance
    public $table;
    public $app;
    // private constructor function
    // to prevent external instantiation
    function __construct($app = false)
    {
        $this->table = 'cart_shipping';
        if (!is_object($this->app)) {
            if (is_object($app)) {
                $this->app = $app;
            } else {
                $this->app = mw();
            }
        }
    }
    function get_cost()
    {
예제 #5
0
 * Send your language translation to Microweber.
 *
 * @internal its used via ajax in the admin panel under Settings->Language
 */
function send_lang_form_to_microweber($data)
{
    if (is_admin() == true) {
        $lang = current_lang();
        $send = array();
        $send['function_name'] = __FUNCTION__;
        $send['language'] = $lang;
        $send['data'] = $data;
        return mw_send_anonymous_server_data($send);
    }
}
api_expose('save_language_file_content');
/**
 * Saves your custom language translation.
 *
 * @internal its used via ajax in the admin panel under Settings->Language
 */
function save_language_file_content($data)
{
    if (isset($_POST) and !empty($_POST)) {
        $data = $_POST;
    }
    if (is_admin() == true) {
        if (isset($data['unicode_temp_remove'])) {
            unset($data['unicode_temp_remove']);
        }
        $lang = current_lang();
예제 #6
0
}
api_expose_admin('save_picture');
function save_picture($data)
{
    return mw()->media_manager->save($data);
}
api_expose('pixum_img');
function pixum_img()
{
    return mw()->media_manager->pixum_img();
}
function pixum($width, $height)
{
    return mw()->media_manager->pixum($width, $height);
}
api_expose('thumbnail_img');
function thumbnail_img($params)
{
    return mw()->media_manager->thumbnail_img($params);
}
if (!function_exists('thumbnail')) {
    function thumbnail($src, $width = 200, $height = 200)
    {
        return mw()->media_manager->thumbnail($src, $width, $height);
    }
}
api_expose_admin('get_media');
function get_media($params)
{
    return mw()->media_manager->get($params);
}
예제 #7
0
api_expose('user_send_forgot_password');
function user_send_forgot_password($params)
{
    return mw()->user_manager->send_forgot_password($params);
}
api_expose_admin('user_make_logged');
function user_make_logged($params)
{
    return mw()->user_manager->make_logged($params);
}
api_expose('user_login');
function user_login($params)
{
    return mw()->user_manager->login($params);
}
api_expose('is_logged');
function is_logged()
{
    $is = mw()->user_manager->is_logged();
    if (defined("MW_API_CALL")) {
        mw()->event_manager->trigger('mw.user.is_logged');
    }
    return $is;
}
function user_id()
{
    return mw()->user_manager->id();
}
function has_access($function_name)
{
    return mw()->user_manager->has_access($function_name);
예제 #8
0
<?php

event_bind('site_header', 'append_global_styles_site_header');
function append_global_styles_site_header($params)
{
    //print '';
    $template_name = $params;
    $template_name = str_replace('..', '', $template_name);
    $url = api_link('user_styles_css/?template_name=' . $template_name);
    $src = '<link rel="stylesheet" id="mw-user-stylesheet" href="' . $url . '" type="text/css" media="all">' . "\n";
    template_head($src);
}
api_expose('user_styles_css');
function user_styles_css($params)
{
    if (!is_array($params)) {
        $template_name = $params;
    } else {
        extract($params);
    }
    if (!isset($template_name)) {
        exit;
    }
    $template_name = str_replace('..', '', $template_name);
    if (defined('TEMPLATE_NAME') == false) {
        define('TEMPLATE_NAME', $template_name);
    }
    $custom_fn = TEMPLATES_DIR . $template_name;
    // d( $custom_fn);
    if (is_dir($custom_fn)) {
        $custom_fn = $custom_fn . DS . 'global_styles.php';
예제 #9
0
 * @return array
 */
function get_user($id = false)
{
    return mw()->user_manager->get($id);
}
api_expose_admin('users/register_email_send_test', function () {
    mw()->option_manager->override('users', 'register_email_enabled', true);
    return mw()->user_manager->register_email_send();
});
api_expose('users/register_email_send', function () {
    return mw()->user_manager->register_email_send();
});
api_expose('users/verify_email_link', function ($params) {
    if (isset($params['key'])) {
        try {
            $decoded = mw()->format->decrypt($params['key']);
            if ($decoded) {
                $decoded = intval($decoded);
                $adminUser = \User::findOrFail($decoded);
                $adminUser->is_verified = 1;
                $adminUser->save();
                mw()->cache_manager->delete('users/global');
                mw()->cache_manager->delete('users/' . $decoded);
                return mw()->url_manager->redirect(site_url());
            }
        } catch (Exception $e) {
            echo 'Exception: ', $e->getMessage(), "\n";
        }
    }
});
예제 #10
0
<?php

api_expose('save_quote');
function save_quote($data)
{
    if (!is_admin()) {
        return;
    }
    $table = "ez_quotes";
    return db_save($table, $data);
}
function get_quotes($params = array())
{
    if (is_string($params)) {
        $params = parse_params($params);
    }
    $params['table'] = "ez_quotes";
    return db_get($params);
}
api_expose('delete_quote');
function delete_quote($params)
{
    if (!is_admin()) {
        return;
    }
    if (isset($params['id'])) {
        $table = "ez_quotes";
        $id = $params['id'];
        return db_delete($table, $id);
    }
}
예제 #11
0
            foreach ($get_comm as $get_com) {
                $upd = array();
                $upd['is_new'] = 0;
                $upd['id'] = $get_com['id'];
                $upd['rel_type'] = 'content';
                $upd['rel_id'] = mw()->database_manager->escape_string($data['content_id']);
                mw()->database_manager->save($table, $upd);
            }
        }
        return $get_comm;
    }
}
/**
 * post_comment
 */
api_expose('post_comment');
function post_comment($data)
{
    $adm = is_admin();
    $table = MODULE_DB_COMMENTS;
    mw_var('FORCE_SAVE', $table);
    if (isset($data['id'])) {
        if ($adm == false) {
            error('Error: Only admin can edit comments!');
        }
    }
    if (defined("MW_API_CALL")) {
        if (!$adm) {
            $validate_token = mw()->user_manager->csrf_validate($data);
            if ($validate_token == false) {
                return array('error' => 'Invalid token!');
예제 #12
0
api_expose_admin('delete_client');
api_expose_admin('delete_order');
api_expose_admin('update_order');
api_expose_admin('shop/update_order', function ($data) {
    return mw()->shop_manager->update_order($data);
});
api_expose_admin('shop/save_tax_item', function ($data) {
    return mw()->tax_manager->save($data);
});
api_expose_admin('shop/delete_tax_item', function ($data) {
    return mw()->tax_manager->delete_by_id($data);
});
api_expose_admin('shop/export_orders', function ($data) {
    return mw()->order_manager->export_orders($data);
});
// media
api_expose('delete_media_file');
api_expose('upload_progress_check');
api_expose('upload');
api_expose('reorder_media');
api_expose('delete_media');
api_expose('save_media');
api_expose('pixum_img');
api_expose('thumbnail_img');
api_expose('create_media_dir');
api_expose('media/upload');
api_expose('media/delete_media_file');
// queue
api_expose('queue_dispatch', function () {
    mw()->event_manager->trigger('mw.queue.dispatch');
});
예제 #13
0
  <module type="site_stats/admin" />';
    //print '<microweber module="site_stats" view="admin" />';
}
event_bind('frontend', function ($params = false) {
    return stats_append_image($params);
});
function stats_append_image($layout = false)
{
    if (defined('MW_API_CALL')) {
        return true;
    }
    if (defined('MW_FRONTEND') and !isset($_REQUEST['isolate_content_field'])) {
        stats_insert();
    }
}
api_expose('stats_image');
function stats_image()
{
    stats_insert();
    // $f = dirname(__FILE__);
    //    $f = $f . DS . '1px.png';
    //    $name = $f;
    //    $fp = fopen($name, 'rb');
    //
    //    // send the right headers
    //    header("Content-Type: image/png");
    //    header("Content-Length: " . filesize($name));
    //
    //    // dump the picture and stop the script
    //    fpassthru($fp);
    //    exit;
예제 #14
0
 *            your data, anything that can be serialized
 * @param string $cache_id
 *            id of the cache, you must define it because you will use it later to
 *            retrieve the cached content.
 * @param string $cache_group
 *            (default is 'global') - this is the subfolder in the cache dir.
 *
 * @param bool $expiration_in_seconds
 * @return boolean
 * @package Cache
 */
function cache_save($data_to_cache, $cache_id, $cache_group = 'global', $expiration = false)
{
    return mw()->cache_manager->save($data_to_cache, $cache_id, $cache_group, $expiration);
}
api_expose('clearcache');
/**
 * Clears all cache data
 * @example
 * <code>
 * //delete all cache
 *  clearcache();
 * </code>
 * @return boolean
 * @package Cache
 */
function clearcache()
{
    return mw()->cache_manager->clear();
}
/**