コード例 #1
0
 public function fire()
 {
     $input = array('option_key' => $this->argument('option_key'), 'option_value' => $this->argument('option_value'), 'option_group' => $this->argument('option_group'));
     $this->info('Setting option...');
     $result = mw()->option_manager->save($input);
     $this->info($result);
 }
コード例 #2
0
ファイル: Parser.php プロジェクト: hyrmedia/microweber
 function __construct($app = null)
 {
     if (!is_object($app)) {
         $this->app = mw();
     } else {
         $this->app = $app;
     }
 }
コード例 #3
0
ファイル: custom_fields.php プロジェクト: Git-Host/microweber
function get_custom_fields($table, $id = 0, $return_full = false, $field_for = false, $debug = false, $field_type = false, $for_session = false)
{
    if (isset($table) and intval($table) > 0) {
        $id = intval(intval($table));
        $table = 'content';
    }
    return mw()->fields_manager->get($table, $id, $return_full, $field_for, $debug, $field_type, $for_session);
}
コード例 #4
0
 public function run()
 {
     Cache::flush();
     $this->createSchema();
     $this->seed();
     Cache::flush();
     mw()->modules->install();
 }
コード例 #5
0
ファイル: functions.php プロジェクト: hyrmedia/microweber
function mw_print_admin_menu_settings_btn()
{
    $active = mw()->url_manager->param('view');
    $cls = '';
    if ($active == 'settings') {
        $cls = ' class="active" ';
    }
    print '<li' . $cls . '><a href="' . admin_url() . 'view:settings" title="' . _e("Settings", true) . '"><i class="ico inavsettings"></i><span>' . _e("Settings", true) . '</span></a></li>';
}
コード例 #6
0
 public function __construct($app = null)
 {
     if (is_object($app)) {
         $this->app = $app;
     } else {
         $this->app = mw();
     }
     $this->set_table_names();
 }
コード例 #7
0
 private function hasNoAdmin()
 {
     if (!$this->checkServiceConfig()) {
         $this->registerMwClient();
     }
     if (mw()->url_manager->param('mw_install_create_user')) {
         $this->execCreateAdmin();
     }
 }
コード例 #8
0
 function __construct($app = null)
 {
     $this->set_table_names();
     if (is_object($app)) {
         $this->app = $app;
     } else {
         $this->app = mw();
     }
     $this->socialite = new SocialiteManager($this->app);
 }
コード例 #9
0
ファイル: Model.php プロジェクト: hyrmedia/microweber
 public function __construct($app)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $this->app->database_manager->build_table($this->table, $this->fields);
 }
コード例 #10
0
ファイル: Template.php プロジェクト: kamilmiesiac/microweber
 function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $this->adapter_current = $this->adapter_default = new MicroweberTemplate($app);
 }
コード例 #11
0
ファイル: CacheManager.php プロジェクト: hyrmedia/microweber
 function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $this->adapter = new LaravelCache($app);
 }
コード例 #12
0
 public function testSave()
 {
     mw()->database_manager->extended_save_set_permission(true);
     $has_permission = mw()->database_manager->extended_save_has_permission();
     $params = array('title' => 'My post with data fields', 'content_type' => 'post', 'data_hi_there' => 'hello world', 'is_active' => 1);
     //saving
     $id = save_content($params);
     $data_fields = content_data($id);
     $this->assertEquals(intval($id) > 0, true);
     $this->assertEquals($data_fields['hi_there'], "hello world");
     $this->assertEquals(true, $has_permission);
 }
コード例 #13
0
 public function testSaveDataFields()
 {
     mw()->database_manager->extended_save_set_permission(true);
     $val = 'hello there custom 1-' . rand();
     $val2 = 'hello there custom 2-' . rand();
     $params = array('title' => 'My post with data attributes 1', 'content_type' => 'post', 'data_fields_something_custom' => $val, 'data_fields_something_else_custom' => $val2, 'is_active' => 1);
     $id = save_content($params);
     $attributes = content_data($id);
     $this->assertEquals(intval($id) > 0, true);
     $this->assertEquals($attributes['something_custom'], $val);
     $this->assertEquals($attributes['something_else_custom'], $val2);
 }
コード例 #14
0
 function delete($data)
 {
     $adm = is_admin();
     if ($adm == false) {
         error('Error: not logged in as admin.' . __FILE__ . __LINE__);
     }
     if (isset($data['id'])) {
         $c_id = intval($data['id']);
         mw()->database_manager->delete_by_id($this->table, $c_id);
         //d($c_id);
     }
 }
コード例 #15
0
ファイル: Http.php プロジェクト: hyrmedia/microweber
 function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     if (!is_object($this->adapter)) {
         $this->adapter = new Adapters\Http\Guzzle($app);
     }
 }
コード例 #16
0
 function __construct($app = null)
 {
     if (is_object($app)) {
         $this->app = $app;
     } else {
         $this->app = mw();
     }
     $tables['cart'] = 'cart';
     $tables['cart_orders'] = 'cart_orders';
     $tables['cart_shipping'] = 'cart_shipping';
     $tables['cart_taxes'] = 'cart_taxes';
     $this->tables = $tables;
 }
コード例 #17
0
 function __construct($app = null)
 {
     if (defined("INI_SYSTEM_CHECK_DISABLED") == false) {
         define("INI_SYSTEM_CHECK_DISABLED", ini_get('disable_functions'));
     }
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
 }
コード例 #18
0
ファイル: Edit.php プロジェクト: newaltcoin/microweber
 function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $this->views_dir = dirname(__DIR__) . DS . 'views' . DS;
     $this->provider = $this->app->content_manager;
     $this->category_provider = $this->app->category_manager;
     $is_admin = $this->app->user_manager->admin_access();
 }
コード例 #19
0
ファイル: functions.php プロジェクト: microweber/microweber
function make_white_label()
{
    $settings = get_white_label_config();
    if (isset($settings['logo_admin']) and trim($settings['logo_admin']) != '') {
        $logo_admin = $settings['logo_admin'];
        mw()->ui->admin_logo = $logo_admin;
    }
    if (isset($settings['logo_live_edit']) and trim($settings['logo_live_edit']) != '') {
        $logo_live_edit = $settings['logo_live_edit'];
        mw()->ui->logo_live_edit = $logo_live_edit;
    }
    if (isset($settings['logo_login']) and trim($settings['logo_login']) != '') {
        $logo_login = $settings['logo_login'];
        mw()->ui->admin_logo_login = $logo_login;
    }
    if (isset($settings['admin_logo_login_link']) and trim($settings['admin_logo_login_link']) != '') {
        $logo_login = $settings['admin_logo_login_link'];
        mw()->ui->admin_logo_login_link = $logo_login;
    }
    if (isset($settings['powered_by']) and $settings['powered_by'] != false) {
        $powered_by = $settings['powered_by'];
        mw()->ui->powered_by = $powered_by;
    }
    if (isset($settings['powered_by_link']) and $settings['powered_by_link'] != false) {
        $powered_by_link = $settings['powered_by_link'];
        mw()->ui->powered_by_link = $powered_by_link;
    }
    if (isset($settings['brand_name']) and $settings['brand_name'] != false) {
        $brand_name = $settings['brand_name'];
        mw()->ui->brand_name = $brand_name;
    }
    if (isset($settings['enable_service_links'])) {
        mw()->ui->enable_service_links = $settings['enable_service_links'];
    }
    if (isset($settings['disable_marketplace'])) {
        mw()->ui->disable_marketplace = $settings['disable_marketplace'];
    }
    if (isset($settings['disable_powered_by_link']) and intval($settings['disable_powered_by_link']) != 0) {
        mw()->ui->disable_powered_by_link = true;
    }
    if (isset($settings['marketplace_provider_id']) and trim($settings['marketplace_provider_id']) != false) {
        mw()->ui->marketplace_provider_id = trim($settings['marketplace_provider_id']);
    }
    if (isset($settings['marketplace_access_code']) and trim($settings['marketplace_access_code']) != false) {
        mw()->ui->marketplace_access_code = trim($settings['marketplace_access_code']);
    }
    if (isset($settings['custom_support_url']) and trim($settings['custom_support_url']) != '') {
        mw()->ui->custom_support_url = $settings['custom_support_url'];
    }
}
コード例 #20
0
ファイル: Database.php プロジェクト: newaltcoin/microweber
 function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $get_default_limit_from_options = $this->app->option_manager->get_items_per_page();
     if ($get_default_limit_from_options != false) {
         $this->default_limit = intval($get_default_limit_from_options);
     }
 }
コード例 #21
0
ファイル: Worker.php プロジェクト: hyrmedia/microweber
 public function run()
 {
     $removed = 0;
     $value = mw()->cache_manager->get('create_batch', $this->cache_group);
     if (isset($value['total']) and $value['total'] > 0) {
         if (isset($value['remaining']) and $value['remaining'] > 0) {
             $batch = mw()->media_manager->get_all('limit=30000');
             if ($batch) {
                 foreach ($batch as $k => $v) {
                     if (isset($v['id']) and isset($v['filename']) and $v['filename'] != false) {
                         $process = false;
                         if (stristr($v['filename'], '{SITE_URL}')) {
                             $process = true;
                         } else {
                             if (stristr($v['filename'], site_url())) {
                                 $process = true;
                             }
                         }
                         if ($process) {
                             $v['filename'] = str_ireplace('{SITE_URL}', '', $v['filename']);
                             $v['filename'] = str_ireplace(site_url(), '', $v['filename']);
                             $is_file = false;
                             $file1 = normalize_path(public_path() . DS . $v['filename'], false);
                             $file2 = normalize_path(base_path() . DS . $v['filename'], false);
                             $file3 = normalize_path(media_base_path() . DS . $v['filename'], false);
                             $file4 = normalize_path(userfiles_path() . DS . $v['filename'], false);
                             if (is_file($file1)) {
                                 $is_file = true;
                             } elseif (is_file($file2)) {
                                 $is_file = true;
                             } elseif (is_file($file3)) {
                                 $is_file = true;
                             } elseif (is_file($file4)) {
                                 $is_file = true;
                             }
                             if ($is_file == false) {
                                 mw()->media_manager->delete($v['id']);
                                 $removed++;
                             }
                         }
                     }
                 }
             }
         }
     }
     mw()->cache_manager->delete($this->cache_group);
     $resp = array('success' => "Removed " . $removed . ' items');
     return $resp;
 }
コード例 #22
0
ファイル: functions.php プロジェクト: newaltcoin/microweber
function mw_print_admin_dashboard_orders_btn()
{
    if (get_option('shop_disabled', 'website') == 'y') {
        return;
    }
    $admin_dashboard_btn = array();
    $admin_dashboard_btn['view'] = 'shop/action:orders';
    $admin_dashboard_btn['icon_class'] = 'mw-icon-shop';
    $notif_html = '';
    $notif_count = get_orders('count=1&order_status=[null]&is_completed=y');
    if ($notif_count > 0) {
        $notif_html = '<sup class="mw-notification-count">' . $notif_count . '</sup>';
    }
    $admin_dashboard_btn['text'] = _e("View Orders", true) . $notif_html;
    mw()->ui->module('admin.dashboard.menu', $admin_dashboard_btn);
}
コード例 #23
0
ファイル: LogTest.php プロジェクト: hyrmedia/microweber
 public function testDelete()
 {
     $data = array();
     $data['field'] = 'log_test';
     $get = mw()->log_manager->get($data);
     $deleted = array();
     foreach ($get as $item) {
         $deleted[] = $item['id'];
         $del = mw()->log_manager->delete_entry($item);
         $this->assertEquals($del, $item['id']);
     }
     $data = array();
     $data['ids'] = $deleted;
     $get = mw()->log_manager->get($data);
     $this->assertEquals(false, $get);
 }
コード例 #24
0
ファイル: FormsManager.php プロジェクト: Git-Host/microweber
 function __construct($app = null)
 {
     if (is_object($app)) {
         $this->app = $app;
     } else {
         $this->app = mw();
     }
     if (!defined("MW_DB_TABLE_COUNTRIES")) {
         define('MW_DB_TABLE_COUNTRIES', 'countries');
     }
     if (!defined("MW_DB_TABLE_FORMS_LISTS")) {
         define('MW_DB_TABLE_FORMS_LISTS', 'forms_lists');
     }
     if (!defined("MW_DB_TABLE_FORMS_DATA")) {
         define('MW_DB_TABLE_FORMS_DATA', 'forms_data');
     }
 }
コード例 #25
0
 public function get_styles()
 {
     $config = mw()->template->get_config();
     if (isset($config['styles'])) {
         $styles = $config['styles'];
         if (is_array($styles) and !empty($styles)) {
             foreach ($styles as $k => $style) {
                 if (isset($style['name']) and isset($style['tag'])) {
                     $style['tag_string'] = '';
                     if (isset($style['tag'])) {
                         if (is_array($style['tag'])) {
                             $style['tag_string'] = implode(',', $style['tag']);
                         } elseif (is_string($style['tag'])) {
                             $style['tag_string'] = $style['tag'];
                         }
                     }
                     $style['class_string'] = '';
                     if (isset($style['class'])) {
                         if (is_array($style['class'])) {
                             $style['class_string'] = implode(',', $style['class']);
                         } elseif (is_string($style['class'])) {
                             $style['class_string'] = $style['class'];
                         }
                     }
                     $style['except_string'] = '';
                     if (isset($style['except'])) {
                         if (is_array($style['except'])) {
                             $style['except_string'] = implode(',', $style['except']);
                         } elseif (is_string($style['except'])) {
                             $style['except_string'] = $style['except'];
                         }
                     }
                 }
                 $styles[$k] = $style;
             }
         }
         return $styles;
     }
     return false;
 }
コード例 #26
0
ファイル: functions.php プロジェクト: biggtfish/microweber
function make_white_label()
{
    $settings = get_white_label_config();
    if (isset($settings['logo_admin']) and trim($settings['logo_admin']) != '') {
        $logo_admin = $settings['logo_admin'];
        mw()->ui->admin_logo = $logo_admin;
    }
    if (isset($settings['logo_live_edit']) and trim($settings['logo_live_edit']) != '') {
        $logo_live_edit = $settings['logo_live_edit'];
        mw()->ui->logo_live_edit = $logo_live_edit;
    }
    if (isset($settings['logo_login']) and trim($settings['logo_login']) != '') {
        $logo_login = $settings['logo_login'];
        mw()->ui->admin_logo_login = $logo_login;
    }
    if (isset($settings['admin_logo_login_link']) and trim($settings['admin_logo_login_link']) != '') {
        $logo_login = $settings['admin_logo_login_link'];
        mw()->ui->admin_logo_login_link = $logo_login;
    }
    if (isset($settings['powered_by']) and $settings['powered_by'] != false) {
        $powered_by = $settings['powered_by'];
        mw()->ui->powered_by = $powered_by;
    }
    if (isset($settings['powered_by_link']) and $settings['powered_by_link'] != false) {
        $powered_by_link = $settings['powered_by_link'];
        mw()->ui->powered_by_link = $powered_by_link;
    }
    if (isset($settings['brand_name']) and $settings['brand_name'] != false) {
        $brand_name = $settings['brand_name'];
        mw()->ui->brand_name = $brand_name;
    }
    if (isset($settings['enable_service_links'])) {
        mw()->ui->enable_service_links = $settings['enable_service_links'];
    }
    if (isset($settings['disable_marketplace'])) {
        mw()->ui->disable_marketplace = $settings['disable_marketplace'];
    }
}
コード例 #27
0
ファイル: Worker.php プロジェクト: microweber/microweber
 public function run()
 {
     $all = DB::table('media')->where('rel_type', 'content')->whereNotIn('rel_id', function ($query) {
         $query->select('id')->from('content');
     })->get();
     if (!empty($all)) {
         foreach ($all as $item) {
             mw()->media_manager->delete($item->id);
         }
     }
     $all = DB::table('custom_fields')->where('rel_type', 'content')->whereNotIn('rel_id', function ($query) {
         $query->select('id')->from('content');
     })->get();
     if (!empty($all)) {
         foreach ($all as $item) {
             mw()->fields_manager->delete($item->id);
         }
     }
     DB::table('custom_fields_values')->whereNotIn('custom_field_id', function ($query) {
         $query->select('id')->from('custom_fields');
     })->delete();
     DB::table('categories_items')->where('rel_type', 'content')->whereNotIn('rel_id', function ($query) {
         $query->select('id')->from('content');
     })->delete();
     DB::table('categories_items')->whereNotIn('parent_id', function ($query) {
         $query->select('id')->from('categories');
     })->toSql();
     $all = DB::table('content_data')->where('rel_type', 'content')->whereNotIn('rel_id', function ($query) {
         $query->select('id')->from('content');
     })->get();
     if (!empty($all)) {
         foreach ($all as $item) {
             mw()->data_fields_manager->delete($item->id);
         }
     }
     return array('success' => 'Cleanup completed');
 }
コード例 #28
0
 public function __construct($app = null)
 {
     if (!is_object($this->app)) {
         if (is_object($app)) {
             $this->app = $app;
         } else {
             $this->app = mw();
         }
     }
     $prefix = $this->app->config->get('database.connections.mysql.prefix');
     $this->tables = $this->app->content_manager->tables;
     if (!isset($this->tables['categories'])) {
         $this->tables['categories'] = 'categories';
     }
     if (!isset($this->tables['categories_items'])) {
         $this->tables['categories_items'] = 'categories_items';
     }
     if (!defined('MW_DB_TABLE_TAXONOMY')) {
         define('MW_DB_TABLE_TAXONOMY', $this->tables['categories']);
     }
     if (!defined('MW_DB_TABLE_TAXONOMY_ITEMS')) {
         define('MW_DB_TABLE_TAXONOMY_ITEMS', $this->tables['categories_items']);
     }
 }
コード例 #29
0
 public function edit_field_draft($data)
 {
     only_admin_access();
     $page = false;
     if (isset($_SERVER["HTTP_REFERER"])) {
         $url = $_SERVER["HTTP_REFERER"];
         $url = explode('?', $url);
         $url = $url[0];
         if (trim($url) == '' or trim($url) == $this->app->url_manager->site()) {
             //$page = $this->get_by_url($url);
             $page = $this->homepage();
             // var_dump($page);
         } else {
             $page = $this->get_by_url($url);
         }
     } else {
         $url = $this->app->url_manager->string();
     }
     $this->define_constants($page);
     $table_drafts = $this->tables['content_fields_drafts'];
     $data = parse_params($data);
     if (isset($data['id']) and $data['id'] == 'latest_content_edit') {
         if (isset($page['id'])) {
             $page_data = $this->get_by_id($page['id']);
             $results = array();
             if (isset($page_data['title'])) {
                 $arr = array('rel_type' => 'content', 'field' => 'title', 'value' => $page_data['title']);
                 $results[] = $arr;
                 if (isset($page_data['content_type'])) {
                     $arr = array('rel_type' => $page_data['content_type'], 'field' => 'title', 'value' => $page_data['title']);
                     $results[] = $arr;
                 }
                 if (isset($page_data['subtype'])) {
                     $arr = array('rel_type' => $page_data['subtype'], 'field' => 'title', 'value' => $page_data['title']);
                     $results[] = $arr;
                 }
             }
             if (isset($page_data['content']) and $page_data['content'] != '') {
                 $arr = array('rel_type' => 'content', 'field' => 'content', 'value' => $page_data['content']);
                 $results[] = $arr;
                 if (isset($page_data['content_type'])) {
                     $arr = array('rel_type' => $page_data['content_type'], 'field' => 'content', 'value' => $page_data['content']);
                     $results[] = $arr;
                 }
                 if (isset($page_data['subtype'])) {
                     $arr = array('rel_type' => $page_data['subtype'], 'field' => 'content', 'value' => $page_data['content']);
                     $results[] = $arr;
                 }
             }
             //$results[]
         }
     } else {
         $data['is_draft'] = 1;
         $data['full'] = 1;
         $data['all'] = 1;
         $results = $this->edit_field($data);
     }
     $ret = array();
     if ($results == false) {
         return;
     }
     $i = 0;
     foreach ($results as $item) {
         if (isset($item['value'])) {
             $field_content = htmlspecialchars_decode($item['value']);
             $field_content = $this->_decode_entities($field_content);
             $item['value'] = mw()->parser->process($field_content, $options = false);
         }
         $ret[$i] = $item;
         $i++;
     }
     return $ret;
 }
コード例 #30
0
ファイル: Backup.php プロジェクト: microweber/microweber
 public function get_bakup_location()
 {
     if (defined('MW_API_CALL')) {
         if (defined('MW_CRON_EXEC')) {
         } elseif (!is_admin()) {
             return 'must be admin';
         }
     }
     $loc = $this->backups_folder;
     if ($loc != false) {
         return $loc;
     }
     $here = userfiles_path() . 'backup' . DS;
     if (!is_dir($here)) {
         mkdir_recursive($here);
         $hta = $here . '.htaccess';
         if (!is_file($hta)) {
             touch($hta);
             file_put_contents($hta, 'Deny from all');
         }
     }
     $here = userfiles_path() . 'backup' . DS . get_table_prefix() . DS;
     $here2 = mw()->option_manager->get('backup_location', 'admin/backup');
     if ($here2 != false and is_string($here2) and trim($here2) != 'default' and trim($here2) != '') {
         $here2 = normalize_path($here2, true);
         if (!is_dir($here2)) {
             mkdir_recursive($here2);
         }
         if (is_dir($here2)) {
             $here = $here2;
         }
     }
     if (!is_dir($here)) {
         mkdir_recursive($here);
     }
     $loc = $here;
     $this->backups_folder = $loc;
     return $here;
 }