当前位置: 首页>>代码示例>>PHP>>正文


PHP osc_plugins_path函数代码示例

本文整理汇总了PHP中osc_plugins_path函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_plugins_path函数的具体用法?PHP osc_plugins_path怎么用?PHP osc_plugins_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osc_plugins_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mdh_emailmagick_bump_me

/**
 * Makes this plugin the first to be loaded.
 * - Bumps this plugin at the top of the active_plugins stack.
 */
function mdh_emailmagick_bump_me()
{
    if (OC_ADMIN) {
        // @legacy : ALWAYS remove this if active.
        if (osc_plugin_is_enabled("madhouse_utils/index.php")) {
            Plugins::deactivate("madhouse_utils/index.php");
        }
        // Sanitize & get the {PLUGIN_NAME}/index.php.
        $path = str_replace(osc_plugins_path(), '', osc_plugin_path(__FILE__));
        if (osc_plugin_is_installed($path)) {
            // Get the active plugins.
            $plugins_list = unserialize(osc_active_plugins());
            if (!is_array($plugins_list)) {
                return false;
            }
            // Remove $path from the active plugins list
            foreach ($plugins_list as $k => $v) {
                if ($v == $path) {
                    unset($plugins_list[$k]);
                }
            }
            // Re-add the $path at the beginning of the active plugins.
            array_unshift($plugins_list, $path);
            // Serialize the new active_plugins list.
            osc_set_preference('active_plugins', serialize($plugins_list));
            if (Params::getParam("page") === "plugins" && Params::getParam("action") === "enable" && Params::getParam("plugin") === $path) {
                //osc_redirect_to(osc_admin_base_url(true) . "?page=plugins");
            } else {
                osc_redirect_to(osc_admin_base_url(true) . "?" . http_build_query(Params::getParamsAsArray("get")));
            }
        }
    }
}
开发者ID:bomvendador,项目名称:soroka_r,代码行数:37,代码来源:index.php

示例2: google_analytics_footer

/**
 * This function is called every time the page footer is being rendered
 */
function google_analytics_footer()
{
    if (osc_google_analytics_id() != '') {
        $id = osc_google_analytics_id();
        require osc_plugins_path() . 'google_analytics/footer.php';
    }
}
开发者ID:acharei,项目名称:OSClass,代码行数:10,代码来源:index.php

示例3: osc_render_file

 /**
  * Render the specified file
  *
  * @param string $file must be a relative path, from PLUGINS_PATH
  */
 function osc_render_file($file = '') {
     if($file=='') {
         $file = __get('file');
     }
     // Clean $file to prevent hacking of some type
     osc_sanitize_url($file);
     $file = str_replace("../", "", str_replace("..\\", "", str_replace("://", "", preg_replace("|http([s]*)|", "", $file))));
     include osc_plugins_path().$file;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:14,代码来源:hTheme.php

示例4: define_constant

 public function define_constant()
 {
     // Define constants
     define('DLN_CLF_VERSION', '1.0.0');
     define('DLN_CLF', 'dln-classified');
     define('DLN_CLF_PLUGIN_DIR', osc_plugins_path() . DLN_CLF . '/');
     //define( 'FB_APP_ID', get_option( 'dln_fb_app_id' ) ? get_option( 'dln_fb_app_id' ) : '251847918233636' );
     //define( 'FB_SECRET', get_option( 'dln_fb_secret' ) ? get_option( 'dln_fb_secret' ) : '31f3e2be38cd9a9e6e0a399c40ef18cd' );
 }
开发者ID:httvncoder,项目名称:151722441,代码行数:9,代码来源:index.php

示例5: doModel

 function doModel()
 {
     $id = Params::getParam('id');
     $page = false;
     if (is_numeric($id)) {
         $page = $this->pageManager->findByPrimaryKey($id);
     } else {
         $page = $this->pageManager->findByInternalName(Params::getParam('slug'));
     }
     // page not found
     if ($page == false) {
         $this->do404();
         return;
     }
     // this page shouldn't be shown (i.e.: e-mail templates)
     if ($page['b_indelible'] == 1) {
         $this->do404();
         return;
     }
     $kwords = array('{WEB_URL}', '{WEB_TITLE}');
     $rwords = array(osc_base_url(), osc_page_title());
     foreach ($page['locale'] as $k => $v) {
         $page['locale'][$k]['s_title'] = str_ireplace($kwords, $rwords, osc_apply_filter('email_description', $v['s_title']));
         $page['locale'][$k]['s_text'] = str_ireplace($kwords, $rwords, osc_apply_filter('email_description', $v['s_text']));
     }
     // export $page content to View
     $this->_exportVariableToView('page', $page);
     if (Params::getParam('lang') != '') {
         Session::newInstance()->_set('userLocale', Params::getParam('lang'));
     }
     $meta = json_decode($page['s_meta'], true);
     // load the right template file
     if (file_exists(osc_themes_path() . osc_theme() . '/page-' . $page['s_internal_name'] . '.php')) {
         $this->doView('page-' . $page['s_internal_name'] . '.php');
     } else {
         if (isset($meta['template']) && file_exists(osc_themes_path() . osc_theme() . '/' . $meta['template'])) {
             $this->doView($meta['template']);
         } else {
             if (isset($meta['template']) && file_exists(osc_plugins_path() . '/' . $meta['template'])) {
                 osc_run_hook('before_html');
                 require osc_plugins_path() . '/' . $meta['template'];
                 Session::newInstance()->_clearVariables();
                 osc_run_hook('after_html');
             } else {
                 $this->doView('page.php');
             }
         }
     }
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:49,代码来源:page.php

示例6: doModel

 function doModel()
 {
     $file = Params::getParam('file');
     // valid file?
     if (stripos($file, '../') !== false) {
         $this->do404();
         return;
     }
     // check if the file exists
     if (!file_exists(osc_plugins_path() . $file)) {
         $this->do404();
         return;
     }
     $this->_exportVariableToView('file', $file);
     $this->doView('custom.php');
 }
开发者ID:semul,项目名称:Osclass,代码行数:16,代码来源:custom.php

示例7: doModel

        function doModel()
        {
            $user_menu = false;
            if(Params::existParam('route')) {
                $routes = Rewrite::newInstance()->getRoutes();
                $rid = Params::getParam('route');
                $file = '../';
                if(isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                    $file = $routes[$rid]['file'];
                    $user_menu = $routes[$rid]['user_menu'];
                }
            } else {
                // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                // This will be REMOVED in 3.4
                $file = Params::getParam('file');
            }

            // valid file?
            if( strpos($file, '../') !== false || strpos($file, '..\\') !==false || stripos($file, '/admin/') !== false ) { //If the file is inside an "admin" folder, it should NOT be opened in frontend
                $this->do404();
                return;
            }

            // check if the file exists
            if( !file_exists(osc_plugins_path() . $file) ) {
                $this->do404();
                return;
            }

            osc_run_hook('custom_controller');

            $this->_exportVariableToView('file', $file);
            if($user_menu) {
                if(osc_is_web_user_logged_in()) {
                    Params::setParam('in_user_menu', true);
                    $this->doView('user-custom.php');
                } else {
                    $this->redirectTo(osc_user_login_url());
                }
            } else {
                $this->doView('custom.php');
            }
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:43,代码来源:custom.php

示例8: __construct

 function __construct($install = false)
 {
     if (!$install) {
         // get user/admin locale
         if (OC_ADMIN) {
             $locale = osc_current_admin_locale();
         } else {
             $locale = osc_current_user_locale();
         }
         // load core
         $core_file = osc_translations_path() . $locale . '/core.mo';
         $this->_load($core_file, 'core');
         // load messages
         $messages_file = osc_themes_path() . osc_theme() . '/languages/' . $locale . '/messages.mo';
         if (!file_exists($messages_file)) {
             $messages_file = osc_translations_path() . $locale . '/messages.mo';
         }
         $this->_load($messages_file, 'messages');
         // load theme
         $domain = osc_theme();
         $theme_file = osc_themes_path() . $domain . '/languages/' . $locale . '/theme.mo';
         if (!file_exists($theme_file)) {
             if (!file_exists(osc_themes_path() . $domain)) {
                 $domain = 'modern';
             }
             $theme_file = osc_translations_path() . $locale . '/theme.mo';
         }
         $this->_load($theme_file, $domain);
         // load plugins
         $aPlugins = Plugins::listInstalled();
         foreach ($aPlugins as $plugin) {
             $domain = preg_replace('|/.*|', '', $plugin);
             $plugin_file = osc_plugins_path() . $domain . '/languages/' . $locale . '/messages.mo';
             if (file_exists($plugin_file)) {
                 $this->_load($plugin_file, $domain);
             }
         }
     } else {
         $core_file = osc_translations_path() . osc_current_admin_locale() . '/core.mo';
         $this->_load($core_file, 'core');
     }
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:42,代码来源:Translation.php

示例9: doModel


//.........这里部分代码省略.........
                     $categoryManager->updateExpiration($subc['pk_i_id'], $fields['i_expiration_days']);
                 }
             }
             if ($error == 0) {
                 $msg = __("Category updated correctly");
             } else {
                 if ($error == 1) {
                     if ($has_one_title == 1) {
                         $error = 4;
                         $msg = __('Category updated correctly, but some titles are empty');
                     } else {
                         $msg = __('Sorry, including at least a title is mandatory');
                     }
                 } else {
                     if ($error == 2) {
                         $msg = __('An error occurred while updating');
                     }
                 }
             }
             echo json_encode(array('error' => $error, 'msg' => $msg, 'text' => $aFieldsDescription[$l]['s_name']));
             break;
         case 'custom':
             // Execute via AJAX custom file
             $ajaxFile = Params::getParam("ajaxfile");
             if ($ajaxFile == '') {
                 echo json_encode(array('error' => 'no action defined'));
                 break;
             }
             // valid file?
             if (stripos($ajaxFile, '../') !== false) {
                 echo json_encode(array('error' => 'no valid ajaxFile'));
                 break;
             }
             if (!file_exists(osc_plugins_path() . $ajaxFile)) {
                 echo json_encode(array('error' => "ajaxFile doesn't exist"));
                 break;
             }
             require_once osc_plugins_path() . $ajaxFile;
             break;
         case 'test_mail':
             $title = sprintf(__('Test email, %s'), osc_page_title());
             $body = __("Test email") . "<br><br>" . osc_page_title();
             $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
             $array = array();
             if (osc_sendMail($emailParams)) {
                 $array = array('status' => '1', 'html' => __('Email sent successfully'));
             } else {
                 $array = array('status' => '0', 'html' => __('An error occurred while sending email'));
             }
             echo json_encode($array);
             break;
         case 'test_mail_template':
             // replace por valores por defecto
             $email = Params::getParam("email");
             $title = Params::getParam("title");
             $body = urldecode(Params::getParam("body"));
             $emailParams = array('subject' => $title, 'to' => $email, 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
             $array = array();
             if (osc_sendMail($emailParams)) {
                 $array = array('status' => '1', 'html' => __('Email sent successfully'));
             } else {
                 $array = array('status' => '0', 'html' => __('An error occurred while sending email'));
             }
             echo json_encode($array);
             break;
         case 'order_pages':
开发者ID:jmcclenon,项目名称:Osclass,代码行数:67,代码来源:ajax.php

示例10: _e

    _e('Cannot install new plugin');
    ?>
</p>
            </div>
            <p class="text">
                <?php 
    _e('The plugin folder is not writable on your server so you cannot upload plugins from the administration panel. Please make the folder writable and try again.');
    ?>
            </p>
            <p class="text">
                <?php 
    _e('To make the directory writable under UNIX execute this command from the shell:');
    ?>
            </p>
            <pre>chmod a+w <?php 
    echo osc_plugins_path();
    ?>
</pre>
        <?php 
}
?>
        </div>
    </div>

    <div id="market_installer" class="has-form-actions hide">
        <form action="" method="post">
            <input type="hidden" name="market_code" id="market_code" value="" />
            <div class="osc-modal-content-market">
                <img src="" id="market_thumb" class="float-left"/>
                <table class="table" cellpadding="0" cellspacing="0">
                    <tbody>
开发者ID:oanav,项目名称:closetshare,代码行数:31,代码来源:add.php

示例11: addHook

 static function addHook($hook, $function, $priority = 5)
 {
     $hook = preg_replace('|/+|', '/', str_replace('\\', '/', $hook));
     $plugin_path = str_replace('\\', '/', osc_plugins_path());
     $hook = str_replace($plugin_path, '', $hook);
     $found_plugin = false;
     if (isset(self::$hooks[$hook])) {
         for ($_priority = 0; $_priority <= 10; $_priority++) {
             if (isset(self::$hooks[$hook][$_priority])) {
                 foreach (self::$hooks[$hook][$_priority] as $fxName) {
                     if ($fxName == $function) {
                         $found_plugin = true;
                         break;
                     }
                 }
             }
         }
     }
     if (!$found_plugin) {
         self::$hooks[$hook][$priority][] = $function;
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:22,代码来源:plugins.php

示例12: doModel


//.........这里部分代码省略.........
             // Check if the secret passphrase match with the item
             if ($userId == null && $aItem['fk_i_user_id'] == null && $secret != $aItem['s_secret']) {
                 $json['success'] = false;
                 $json['msg'] = _m('The item doesn\'t belong to you');
                 echo json_encode($json);
                 return false;
             }
             // Does id & code combination exist?
             $result = ItemResource::newInstance()->existResource($id, $code);
             if ($result > 0) {
                 // Delete: file, db table entry
                 osc_deleteResource($id);
                 ItemResource::newInstance()->delete(array('pk_i_id' => $id, 'fk_i_item_id' => $item, 's_name' => $code));
                 $json['msg'] = _m('The selected photo has been successfully deleted');
                 $json['success'] = 'true';
             } else {
                 $json['msg'] = _m("The selected photo couldn't be deleted");
                 $json['success'] = 'false';
             }
             echo json_encode($json);
             return true;
             break;
         case 'alerts':
             // Allow to register to an alert given (not sure it's used on admin)
             $alert = Params::getParam("alert");
             $email = Params::getParam("email");
             $userid = Params::getParam("userid");
             if ($alert != '' && $email != '') {
                 if (preg_match("/^[_a-z0-9-+]+(\\.[_a-z0-9-+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/", $email)) {
                     $secret = osc_genRandomPassword();
                     if (Alerts::newInstance()->createAlert($userid, $email, $alert, $secret)) {
                         if ((int) $userid > 0) {
                             $user = User::newInstance()->findByPrimaryKey($userid);
                             if ($user['b_active'] == 1 && $user['b_enabled'] == 1) {
                                 Alerts::newInstance()->activate($email, $secret);
                                 echo '1';
                                 return true;
                             } else {
                                 echo '-1';
                                 return false;
                             }
                         } else {
                             osc_run_hook('hook_email_alert_validation', $alert, $email, $secret);
                         }
                         echo "1";
                     } else {
                         echo "0";
                     }
                     return true;
                 } else {
                     echo '-1';
                     return false;
                 }
             }
             echo '0';
             return false;
             break;
         case 'runhook':
             //Run hooks
             $hook = Params::getParam("hook");
             switch ($hook) {
                 case 'item_form':
                     $catId = Params::getParam("catId");
                     if ($catId != '') {
                         osc_run_hook("item_form", $catId);
                     } else {
                         osc_run_hook("item_form");
                     }
                     break;
                 case 'item_edit':
                     $catId = Params::getParam("catId");
                     $itemId = Params::getParam("itemId");
                     osc_run_hook("item_edit", $catId, $itemId);
                     break;
                 default:
                     if ($hook == '') {
                         return false;
                     } else {
                         osc_run_hook($hook);
                     }
                     break;
             }
             break;
         case 'custom':
             // Execute via AJAX custom file
             $ajaxfile = Params::getParam("ajaxfile");
             if ($ajaxfile != '') {
                 require_once osc_plugins_path() . $ajaxfile;
             } else {
                 echo json_encode(array('error' => __('no action defined')));
             }
             break;
         default:
             echo json_encode(array('error' => __('no action defined')));
             break;
     }
     // clear all keep variables into session
     Session::newInstance()->_dropKeepForm();
     Session::newInstance()->_clearVariables();
 }
开发者ID:acharei,项目名称:OSClass,代码行数:101,代码来源:ajax.php

示例13: doModel

 function doModel()
 {
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             break;
         case 'regions':
             //Return regions given a countryId
             $regions = Region::newInstance()->getByCountry(Params::getParam("countryId"));
             echo json_encode($regions);
             break;
         case 'cities':
             //Returns cities given a regionId
             $cities = City::newInstance()->getByRegion(Params::getParam("regionId"));
             echo json_encode($cities);
             break;
         case 'location':
             // This is the autocomplete AJAX
             $cities = City::newInstance()->ajax(Params::getParam("term"));
             echo json_encode($cities);
             break;
         case 'alerts':
             // Allow to register to an alert given (not sure it's used on admin)
             $alert = Params::getParam("alert");
             $email = Params::getParam("email");
             $userid = Params::getParam("userid");
             if ($alert != '' && $email != '') {
                 if (preg_match("/^[_a-z0-9-+]+(\\.[_a-z0-9-+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/", $email)) {
                     Alerts::newInstance()->createAlert($userid, $email, $alert);
                     echo "1";
                 } else {
                     echo '0';
                 }
                 return true;
             }
             echo '0';
             return false;
             break;
         case 'runhook':
             //Run hooks
             $hook = Params::getParam("hook");
             switch ($hook) {
                 case 'item_form':
                     $catId = Params::getParam("catId");
                     if ($catId != '') {
                         osc_run_hook("item_form", $catId);
                     } else {
                         osc_run_hook("item_form");
                     }
                     break;
                 case 'item_edit':
                     $catId = Params::getParam("catId");
                     $itemId = Params::getParam("itemId");
                     osc_run_hook("item_edit", $catId, $itemId);
                     break;
                 default:
                     if ($hook == '') {
                         return false;
                     } else {
                         osc_run_hook($hook);
                     }
                     break;
             }
             break;
         case 'custom':
             // Execute via AJAX custom file
             $ajaxfile = Params::getParam("ajaxfile");
             if ($ajaxfile != '') {
                 require_once osc_plugins_path() . $ajaxfile;
             } else {
                 echo json_encode(array('error' => __('no action defined')));
             }
             break;
         default:
             echo json_encode(array('error' => __('no action defined')));
             break;
     }
 }
开发者ID:hashemgamal,项目名称:OSClass,代码行数:78,代码来源:ajax.php

示例14: osc_add_flash_ok_message

                        $conn->osc_dbExec($qry);
                        $item_count++;
                    }
                    osc_add_flash_ok_message($item_count . ' Cover Photo(s) Denied  ', 'admin');
                    header('Location:' . osc_admin_render_plugin_url($file));
                }
                break;
            case 'delete':
                $user_ids = Params::getParam('chk');
                $count = count($user_ids);
                if ($count > 0) {
                    $item_count = 0;
                    foreach ($user_ids as $user_id) {
                        $conn = getConnection();
                        $qry = 'DELETE FROM  ' . DB_TABLE_PREFIX . 't_cover_photo  WHERE user_id = ' . $user_id;
                        $img_path = osc_plugins_path() . 'cover_photo/images/profile' . $user_id . get_image_extension($user_id);
                        unlink($img_path);
                        $conn->osc_dbExec($qry);
                        $item_count++;
                    }
                    osc_add_flash_ok_message($item_count . ' Cover Photo(s) Deleted  ', 'admin');
                    header('Location:' . osc_admin_render_plugin_url($file));
                }
                break;
        }
        break;
}
if (Params::getParam('start') == '') {
    $start = 0;
} else {
    $start = Params::getParam('start');
开发者ID:uwwclass,项目名称:cover_photo,代码行数:31,代码来源:manage_user_cover_photos.php

示例15: osc_plugin_path

/**
 * Fix the problem of symbolics links in the path of the file
 *
 * @param string $file The filename of plugin.
 * @return string The fixed path of a plugin.
 */
function osc_plugin_path($file)
{
    // Sanitize windows paths and duplicated slashes
    $file = preg_replace('|/+|', '/', str_replace('\\', '/', $file));
    $plugin_path = preg_replace('|/+|', '/', str_replace('\\', '/', osc_plugins_path()));
    $file = $plugin_path . preg_replace('#^.*oc-content\\/plugins\\/#', '', $file);
    return $file;
}
开发者ID:ricktaylord,项目名称:OSClass,代码行数:14,代码来源:utils.php


注:本文中的osc_plugins_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。